@dexterai/connect 0.29.1 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -28,6 +28,24 @@ fresh passkey ceremony and replaces the active identity only after verification.
28
28
  Agent authority always requires a separate owner grant. Creating or connecting a
29
29
  Wallet grants no agent spending authority.
30
30
 
31
+ ## Interrupted wallet setup
32
+
33
+ `createWallet()` retains the original passkey when setup is interrupted. Calling
34
+ it again resumes that wallet, including after a page reload, and may ask the
35
+ owner to confirm the saved passkey. The pending wallet becomes active after
36
+ initialization succeeds. Its original name and authored allowance stay with it.
37
+
38
+ If enrollment never reached the server and its challenge expires, a fresh
39
+ passkey check can confirm that the saved credential has no server record.
40
+ Connect then clears that pending setup and returns `enrollment_not_saved`.
41
+ The next explicit Create action starts a new wallet. Network errors, generic
42
+ 404 responses, and server failures retain the pending setup for another retry.
43
+
44
+ On another device, `recoverWallet()` can finish an enrolled passkey's missing
45
+ wallet initialization after verifying that passkey. Recovery starts with zero
46
+ agent spending allowance. Full sign-in also restores a missing wallet record
47
+ while preserving the credential's existing account binding.
48
+
31
49
  ## Install
32
50
 
33
51
  ```bash
@@ -46,6 +64,54 @@ npm install @dexterai/connect @dexterai/vault react
46
64
  | `@dexterai/connect/server` | Local verification of Dexter account sessions |
47
65
  | `@dexterai/connect/worldid` | Optional World ID proof-of-personhood control |
48
66
 
67
+ ## Account panel
68
+
69
+ `DexterAccountControl` provides Dexter's account menu: balance, Send and Receive,
70
+ activity, connected apps, account switching, and connection settings. It uses the
71
+ same `useDexterConnection` instance as the app. The panel includes its brand marks,
72
+ styles, and motion; it inherits the host font and respects reduced motion.
73
+
74
+ ```tsx
75
+ import { DexterAccountControl, type UseDexterConnection } from '@dexterai/connect/react';
76
+
77
+ export function AccountEntry({ connection }: { connection: UseDexterConnection }) {
78
+ return <DexterAccountControl connection={connection} />;
79
+ }
80
+ ```
81
+
82
+ The panel reads the selected account's portfolio while open. Partial pricing is
83
+ labeled Priced assets. A failed read displays Balance unavailable; switching
84
+ accounts clears the previous balance immediately. Wallet holdings are bound to
85
+ `receiveAddress`, the asset address. `walletAddress` identifies the Swig control
86
+ account and must not be used to match a portfolio.
87
+
88
+ Destinations open Dexter by default and carry the selected account. Dexter asks
89
+ for that account's passkey if a different account is active there. Set `navigation` to use local app routes,
90
+ or set an entry to `false` to hide it. `items` adds app-specific destinations with
91
+ `requires: 'account'` or `requires: 'wallet'`; only verified access exposes them.
92
+ The destination itself must enforce its own authorization.
93
+
94
+ ```tsx
95
+ <DexterAccountControl
96
+ connection={connection}
97
+ navigation={{
98
+ money: { href: '/money' },
99
+ activity: { href: '/activity' },
100
+ profile: false,
101
+ }}
102
+ items={[{ id: 'seller', label: 'Your servers', href: '/servers', requires: 'account' }]}
103
+ />
104
+ ```
105
+
106
+ `open` and `onOpenChange` optionally coordinate the panel with site navigation.
107
+ `LinkComponent` accepts an app router's anchor adapter. `profile` supplies a name
108
+ and email, shown only after account access is verified. For an existing portfolio
109
+ reader, `renderSummary` can render `DexterAccountSummary` with its bound result,
110
+ avoid a second read, and keep the shared presentation. `--dx-account-font` sets
111
+ the panel font; `styleNonce` supports a site's inline-style policy.
112
+
113
+ Device removal belongs in account management and is absent from this menu.
114
+
49
115
  ## Canonical React integration
50
116
 
51
117
  `useDexterConnection` is the controlled integration for a product header,
@@ -211,6 +277,31 @@ Dexter API while preserving provisional Wallet results for the opener. The root
211
277
  package continues to expose the complete identity transition rather than its
212
278
  private login and browser-roster steps.
213
279
 
280
+ ### Repair a missing Vault record
281
+
282
+ Connect 0.31.0 includes `recoverMissingVaultForAccount`. Update older installations
283
+ to use this recovery helper alongside the account panel.
284
+
285
+ Use this only after the API reports `vault_not_found` for an existing account.
286
+ The account holder must sign in to that same account again before starting the
287
+ repair.
288
+
289
+ ```ts
290
+ import { recoverMissingVaultForAccount } from '@dexterai/connect';
291
+
292
+ const result = await recoverMissingVaultForAccount({
293
+ accountAccessToken: session.access_token,
294
+ });
295
+
296
+ result.account.handle; // the X account confirmed by the API
297
+ result.vault.vaultPda; // the Vault attached to that account
298
+ ```
299
+
300
+ The passkey prompt runs in the pinned `dexter.cash` window. The account token
301
+ stays in the calling app. A successful repair attaches the missing Vault to the
302
+ account already signed in; it does not create an account, mint a new session, or
303
+ change the browser's active Wallet.
304
+
214
305
  ## Server verification
215
306
 
216
307
  ```ts
@@ -278,3 +369,29 @@ The server entry depends only on `jose`.
278
369
  ## License
279
370
 
280
371
  MIT
372
+
373
+ ### Private wallet activity
374
+
375
+ Use the retained proof from the existing passkey ceremony for wallet activity and
376
+ owner-operation status. The proof identifies the wallet; the server still verifies
377
+ an exact operation assertion before any financial action. The request helper keeps
378
+ proof material inside the SDK and only sends it to the canonical Dexter API.
379
+
380
+ ```ts
381
+ import { fetchWithWalletIdentity, walletProofSessionStore } from '@dexterai/connect';
382
+
383
+ const activeWallet = { userHandle, vaultPda };
384
+ const wallet = walletProofSessionStore.bindingCandidate(userHandle, activeWallet);
385
+ if (wallet) {
386
+ const response = await fetchWithWalletIdentity({
387
+ wallet,
388
+ activeWallet,
389
+ url: `/api/passkey-vault-anon/activity/v4?user_handle=${userHandle}`,
390
+ });
391
+ }
392
+ ```
393
+
394
+ Older device records can save `walletIdentityProof` returned after their normal
395
+ verified owner-operation claim using `walletProofSessionStore.save(userHandle,
396
+ walletIdentityProof)`. Preparation and the exact claim do not require a second
397
+ passkey ceremony. A missing or expired proof does not authorize private reads.