✳ Lambatoken / Mobile DocsAUTH 0.7.0 · WALLET 0.2.0
Wallet / 12

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.

typescript
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.

typescript
const synced = await sdk.syncWalletWithBackend(localWalletId, label);
// synced.verified, synced.localWalletId, synced.backendWalletId

3. 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.

typescript
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.