An easy-to-host PDS on the ATProtocol, MacOS. Grandma-approved.

feat(identity-wallet): add createAccount IPC wrapper to ipc.ts

authored by malpercio.dev and committed by

Tangled 6702cd61 a6758653

+40
+40
apps/identity-wallet/src/lib/ipc.ts
··· 2 2 3 3 export const greet = (name: string): Promise<string> => 4 4 invoke('greet', { name }); 5 + 6 + // ── create_account ────────────────────────────────────────────────────────── 7 + 8 + export interface CreateAccountParams { 9 + claimCode: string; 10 + email: string; 11 + handle: string; 12 + } 13 + 14 + export interface CreateAccountResult { 15 + nextStep: string; 16 + } 17 + 18 + /** 19 + * Error returned by the `create_account` Rust command. 20 + * 21 + * Serialized as `{ code: "EXPIRED_CODE" }` etc. by the Rust backend. 22 + * The `message` field is present only on NETWORK_ERROR and UNKNOWN variants. 23 + */ 24 + export interface CreateAccountError { 25 + code: 26 + | 'EXPIRED_CODE' 27 + | 'REDEEMED_CODE' 28 + | 'EMAIL_TAKEN' 29 + | 'HANDLE_TAKEN' 30 + | 'NETWORK_ERROR' 31 + | 'UNKNOWN'; 32 + message?: string; 33 + } 34 + 35 + /** 36 + * Create a new account via the relay. 37 + * 38 + * On success, tokens are stored in the iOS Keychain by the Rust backend. 39 + * On failure, the Promise rejects with a `CreateAccountError`. 40 + */ 41 + export const createAccount = ( 42 + params: CreateAccountParams 43 + ): Promise<CreateAccountResult> => 44 + invoke('create_account', params);