This guide shows you how to sync an existing identity from one device to another using the three-step sync protocol: Device A initiates, Device B responds, and both complete the exchange.Documentation Index
Fetch the complete documentation index at: https://docs.hyperauth.dev/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The sync protocol is a three-message key exchange. Device A (the existing device) generates an ephemeral session and shares a session ID and public key. Device B (the new device) responds with its own public key. Device A completes the handshake, and both sides derive a shared encrypted channel through which the vault is transferred.All three methods require the vault to be unlocked on the device calling them.
Step 1 — Device A initiates
On the device that already has the identity, callsyncInit. This creates a sync session and returns a session ID and a public key to share with Device B.
label is an optional human-readable name for the session. expiresIn is the session lifetime in seconds; pass 0 or omit it to use the server default.
Share init.session_id and init.public_key with Device B via any side channel — QR code, copy-paste, or your application’s own handshake UI.
Step 2 — Device B responds
On the new device, callsyncRespond with the session ID and the public key received from Device A. This returns Device B’s own public key, which must be sent back to Device A.
syncRespond. The vault can be in a fresh, uninitialized state.
Step 3 — Both devices complete
Device A callssyncComplete with the session ID and Device B’s public key. Device B also calls syncComplete with the session ID (Device B’s remote public key argument is optional at this stage).
On Device A:
Full example
Error handling
Each step throws aPluginCallError if the vault operation fails — for example, if the session ID is not found, has expired, or the key exchange is invalid.
syncRespond call returns successfully but the session expires before Device A calls syncComplete, the complete step will fail with a session-not-found error. In that case, restart from syncInit.