Create, import and sync wallets
Create or recover local key material, then prove ownership to the backend.
1. Create local wallet
Use the wallet manager for local creation. If the user needs to record the recovery phrase, use createWalletForBackupDisplay instead of calling both methods. The mnemonic is sensitive; display only in the dedicated backup screen.
const created = await sdk.wallet.createWalletForBackupDisplay(label);
// Securely display created.words, then clear the screen state.
const localWalletId = created.walletId;2. Sync and verify ownership
After local creation, sync to the backend. The SDK handles backend registration, challenge signing and verification. Do not repeat local creation when sync fails; retain the existing local ID and reconcile.
const synced = await sdk.syncWalletWithBackend(localWalletId, label);
// synced.verified, synced.localWalletId, synced.backendWalletId3. Import existing wallet
Accept mnemonic or private key from the user on an isolated screen. Use one import method, never send raw key material to a backend. Clear inputs and verify ownership.
const imported = await sdk.wallet.importWalletFromMnemonic(mnemonic, label);
// Alternative: sdk.wallet.importWalletFromPrivateKey(privateKey, label)
await sdk.syncWalletWithBackend(imported.walletId, label);4. Local vs backend creation
sdk.wallet.createWallet creates local keys. sdk.createWallet({label, chain}) is the backend creation operation and must not be confused with generating keys. Prefer the local-create-and-sync workflow for non-custodial wallets. Never claim a backend record alone can sign.