Files
holesail-browser/native-host/host/handlers/sync.js
T
Raven Scott 2595a01f65
CI / Build & Test (push) Successful in 4m27s
feat: autopass-based cross-device sync for Holesail Browser
- Native host: add autopass + corestore deps, sync-manager (createInvite, pairWithInvite, push/pull)
- Apply synced state via same flow as backup restore (state.json only, no certs)
- Holesail-manager: setOnStateSaved hook for sync push
- Extension: Sync dashboard page, getSyncStatus/createSyncInvite/pairWithInvite, syncApplied event
- Docs: NATIVE-HOST.md sync commands, SYNC.md
2026-03-15 01:31:51 -04:00

47 lines
1.1 KiB
JavaScript

/**
* Handlers for sync: getSyncStatus, createSyncInvite, pairWithInvite.
* Context: syncManager
*/
function register(deps) {
const { syncManager } = deps;
return [
{
type: 'getSyncStatus',
handle: async (payload, reply) => {
try {
const status = await syncManager.getSyncStatus();
reply({ ok: true, ...status });
} catch (e) {
reply({ ok: false, error: e.message });
}
}
},
{
type: 'createSyncInvite',
handle: async (payload, reply) => {
try {
const result = await syncManager.createSyncInvite();
reply(result);
} catch (e) {
reply({ ok: false, error: e.message });
}
}
},
{
type: 'pairWithInvite',
handle: async (payload, reply) => {
const invite = payload && payload.invite;
try {
const result = await syncManager.pairWithInvite(invite);
reply(result);
} catch (e) {
reply({ ok: false, error: e.message });
}
}
}
];
}
module.exports = { register };