@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.
@@ -2,20 +2,134 @@ import {
2
2
  ConnectError,
3
3
  activateRecoveredVault,
4
4
  classifyWebAuthnRejection,
5
+ clearPendingCreation,
5
6
  immediateAuthentication,
6
7
  immediateGetSupported,
8
+ normalizeMissingVaultRecoveryOptions,
7
9
  openCeremonyPopup,
10
+ parseMissingVaultRecoveryChallenge,
11
+ parseMissingVaultRecoveryResult,
8
12
  parseWalletIdentityProof,
9
13
  primeImmediateSupport,
10
14
  readErrorCode,
11
15
  resolveDexterApiBase,
16
+ resolveDexterConnectHost,
12
17
  resolveDexterRpId,
13
18
  resolveWalletStoreMode,
14
- shouldUsePopup
15
- } from "./chunk-CZL7NGVV.js";
19
+ shouldUsePopup,
20
+ validateMissingVaultRecoveryAssertion
21
+ } from "./chunk-4FTJB7FT.js";
22
+
23
+ // src/missingVaultRecovery.ts
24
+ import {
25
+ startAuthentication
26
+ } from "@simplewebauthn/browser";
27
+ var RECOVERY_PATH = "/api/passkey-vault/recover-missing";
28
+ var INDEXTER_RECOVERY_ORIGIN = "https://indexter.cash";
29
+ async function recoverMissingVaultForAccount(config) {
30
+ requireIndexterRecoveryOpener();
31
+ const apiBase = resolveDexterApiBase(config.apiBase);
32
+ const connectHost = resolveDexterConnectHost(config.connectHost);
33
+ const accountAccessToken = requireAccountAccessToken(config.accountAccessToken);
34
+ let expectedRequest;
35
+ const popupResult = await openCeremonyPopup(
36
+ "recover-missing-vault",
37
+ {
38
+ connectHost,
39
+ missingVaultRecoveryRequest: async () => {
40
+ expectedRequest = await fetchRecoveryChallenge(apiBase, accountAccessToken);
41
+ return expectedRequest;
42
+ }
43
+ }
44
+ );
45
+ if (!expectedRequest) {
46
+ throw new ConnectError("missing_vault_recovery_challenge_missing");
47
+ }
48
+ const credential = await validateMissingVaultRecoveryAssertion(
49
+ popupResult,
50
+ expectedRequest.options.challenge
51
+ );
52
+ return completeRecovery(
53
+ apiBase,
54
+ accountAccessToken,
55
+ credential,
56
+ expectedRequest.account
57
+ );
58
+ }
59
+ function requireIndexterRecoveryOpener() {
60
+ if (typeof window === "undefined") {
61
+ throw new ConnectError(
62
+ "not_browser",
63
+ "missing Vault recovery requires the Indexter browser session"
64
+ );
65
+ }
66
+ if (window.location.origin !== INDEXTER_RECOVERY_ORIGIN) {
67
+ throw new ConnectError(
68
+ "untrusted_missing_vault_recovery_opener",
69
+ "missing Vault recovery is restricted to Indexter"
70
+ );
71
+ }
72
+ }
73
+ async function runHostedMissingVaultRecoveryProof(options) {
74
+ const normalized = normalizeMissingVaultRecoveryOptions(options);
75
+ let credential;
76
+ try {
77
+ credential = await startAuthentication({ optionsJSON: normalized });
78
+ } catch (err) {
79
+ throw new ConnectError(
80
+ "webauthn_failed",
81
+ err instanceof Error ? err.message : String(err)
82
+ );
83
+ }
84
+ return validateMissingVaultRecoveryAssertion(credential, normalized.challenge);
85
+ }
86
+ async function fetchRecoveryChallenge(apiBase, accountAccessToken) {
87
+ const res = await fetch(`${apiBase}${RECOVERY_PATH}/challenge`, {
88
+ method: "POST",
89
+ headers: {
90
+ authorization: `Bearer ${accountAccessToken}`,
91
+ "content-type": "application/json"
92
+ },
93
+ body: "{}"
94
+ });
95
+ if (!res.ok) {
96
+ throw new ConnectError(
97
+ await readErrorCode(res),
98
+ `missing Vault recovery challenge ${res.status}`
99
+ );
100
+ }
101
+ return parseMissingVaultRecoveryChallenge(await res.json());
102
+ }
103
+ async function completeRecovery(apiBase, accountAccessToken, credential, expectedAccount) {
104
+ const res = await fetch(`${apiBase}${RECOVERY_PATH}/complete`, {
105
+ method: "POST",
106
+ headers: {
107
+ authorization: `Bearer ${accountAccessToken}`,
108
+ "content-type": "application/json"
109
+ },
110
+ body: JSON.stringify({ credential })
111
+ });
112
+ if (!res.ok) {
113
+ throw new ConnectError(
114
+ await readErrorCode(res),
115
+ `missing Vault recovery completion ${res.status}`
116
+ );
117
+ }
118
+ return parseMissingVaultRecoveryResult(
119
+ await res.json(),
120
+ credential,
121
+ expectedAccount
122
+ );
123
+ }
124
+ function requireAccountAccessToken(value) {
125
+ if (typeof value !== "string" || value.length < 16 || value.length > 16384 || /\s/.test(value)) {
126
+ throw new ConnectError("missing_account_session");
127
+ }
128
+ return value;
129
+ }
16
130
 
17
131
  // src/recover.ts
18
- import { startAuthentication, browserSupportsWebAuthn } from "@simplewebauthn/browser";
132
+ import { startAuthentication as startAuthentication2, browserSupportsWebAuthn } from "@simplewebauthn/browser";
19
133
  var ANON_SIGN_BASE = "/api/passkey-anon/sign";
20
134
  primeImmediateSupport();
21
135
  async function recoverWallet(config = {}) {
@@ -106,7 +220,7 @@ async function recoverWallet(config = {}) {
106
220
  const useImmediate = Boolean(config.preferImmediate) && await immediateGetSupported();
107
221
  let credential;
108
222
  try {
109
- credential = useImmediate ? await immediateAuthentication(options) : await startAuthentication({ optionsJSON: options });
223
+ credential = useImmediate ? await immediateAuthentication(options) : await startAuthentication2({ optionsJSON: options });
110
224
  } catch (err) {
111
225
  if (classifyWebAuthnRejection(err)) {
112
226
  return { ok: false, reason: useImmediate ? "no_credential" : "cancelled" };
@@ -130,6 +244,9 @@ async function recoverWallet(config = {}) {
130
244
  if (res.status === 404) return { ok: false, reason: "no_credential" };
131
245
  if (!res.ok) return { ok: false, reason: "error", error: new ConnectError(await readErrorCode(res)) };
132
246
  const data = await res.json();
247
+ if (data.verified !== true || data.credentialId !== credential.id || typeof data.userHandle !== "string" || !data.userHandle) {
248
+ throw new ConnectError("recover_verify_malformed");
249
+ }
133
250
  userHandle = data.userHandle;
134
251
  credentialId = data.credentialId;
135
252
  walletIdentityProof = parseWalletIdentityProof(data.walletIdentityProof);
@@ -144,10 +261,23 @@ async function recoverWallet(config = {}) {
144
261
  if (!res.ok) return { ok: false, reason: "error", error: new ConnectError(await readErrorCode(res)) };
145
262
  const data = await res.json();
146
263
  if (!data.hasVault || !data.vault) {
147
- return {
148
- ok: false,
149
- reason: "error",
150
- error: new ConnectError("vault_not_found", "this sign-in key has no wallet attached")
264
+ const initialized = await fetch(`${apiBase}/api/passkey-vault-anon/initialize`, {
265
+ method: "POST",
266
+ headers: {
267
+ "content-type": "application/json",
268
+ authorization: `Bearer ${walletIdentityProof.token}`
269
+ },
270
+ body: JSON.stringify({ userHandle, credentialId })
271
+ });
272
+ if (!initialized.ok) return { ok: false, reason: "error", error: new ConnectError(await readErrorCode(initialized)) };
273
+ const created = await initialized.json();
274
+ if (!created.vaultPda || !created.swigStateAddress) throw new ConnectError("initialize_malformed");
275
+ data.vault = {
276
+ vaultPda: created.vaultPda,
277
+ swigAddress: created.swigStateAddress,
278
+ receiveAddress: created.receiveAddress ?? null,
279
+ walletLabel: created.walletLabel ?? null,
280
+ isActivated: false
151
281
  };
152
282
  }
153
283
  vault = {
@@ -168,6 +298,7 @@ async function recoverWallet(config = {}) {
168
298
  walletIdentityProof
169
299
  );
170
300
  }
301
+ clearPendingCreation(credentialId);
171
302
  return { ok: true, userHandle, credentialId, vault, walletIdentityProof };
172
303
  }
173
304
  function netError(code, err) {
@@ -179,5 +310,7 @@ function netError(code, err) {
179
310
  }
180
311
 
181
312
  export {
313
+ recoverMissingVaultForAccount,
314
+ runHostedMissingVaultRecoveryProof,
182
315
  recoverWallet
183
316
  };
@@ -10,7 +10,7 @@ import {
10
10
  subscribe,
11
11
  walletBindingCandidate,
12
12
  walletProofSessionStore
13
- } from "./chunk-CZL7NGVV.js";
13
+ } from "./chunk-4FTJB7FT.js";
14
14
 
15
15
  // src/relationController.ts
16
16
  function provisionalRelation(walletPresent, accountPresent) {
@@ -1,4 +1,4 @@
1
- import { P as PasskeyLoginTokens, o as PasskeyLoginConfig, a as CeremonyPhase, S as SignInResult } from './enroll-DrgEW0X8.js';
1
+ import { P as PasskeyLoginTokens, r as PasskeyLoginConfig, a as CeremonyPhase, S as SignInResult } from './enroll-BmD1y8KH.js';
2
2
 
3
3
  /**
4
4
  * Framework-neutral Wallet/account relationship controller.
@@ -159,6 +159,17 @@ interface ResolveWalletAccountBindingInput {
159
159
  readonly signal?: AbortSignal;
160
160
  }
161
161
  type BindingFetch = (input: string | URL, init?: RequestInit) => Promise<Response>;
162
+ interface WalletIdentityFetchInput {
163
+ readonly wallet: WalletBindingCandidate;
164
+ readonly activeWallet: ActiveWalletBindingIdentity;
165
+ readonly url: string | URL;
166
+ readonly init?: RequestInit;
167
+ readonly fetch?: BindingFetch;
168
+ }
169
+ /** Send the retained identity proof to Dexter without exposing its token.
170
+ * Identity permits wallet reads; each financial action still requires its
171
+ * own authorization. Redirects cannot forward the proof to another origin. */
172
+ declare function fetchWithWalletIdentity(input: WalletIdentityFetchInput): Promise<Response>;
162
173
  interface WalletAccountBindingClientConfig {
163
174
  /** Compatibility option; only the canonical Dexter API origin is accepted. */
164
175
  readonly apiBase?: string;
@@ -225,4 +236,4 @@ interface DexterControlModel {
225
236
  */
226
237
  declare function createDexterControlModel(intent: DexterConnectionIntent, relation: WalletAccountRelationSnapshot): DexterControlModel;
227
238
 
228
- export { type ActiveWalletBindingIdentity as A, type BindingFetch as B, type ConnectDexterIdentityConfig as C, type DexterConnectionCapability as D, createWalletAccountBindingClient as E, disconnectDexterIdentity as F, walletBindingCandidate as G, type RelationCandidates as R, type ServerRelationVerificationRequest as S, type WalletBindingCandidate as W, type WalletAccountRelationSnapshot as a, type WalletAccountBindingClient as b, type AccountBindingCandidate as c, type AccountSessionClearer as d, type AccountSessionInstaller as e, type BindingResolutionResult as f, type DexterConnectionIntent as g, type DexterConnectionPermissions as h, type DexterControlModel as i, type DexterControlPrimaryAction as j, type DexterControlStage as k, type DisconnectDexterIdentityConfig as l, type RelationCheckReason as m, type RelationRuntime as n, type ResolveWalletAccountBindingInput as o, type ResolvedWalletAccountRelation as p, type ServerRelationVerificationResult as q, type ServerRelationVerifier as r, WALLET_ACCOUNT_BINDING_PATH as s, type WalletAccountBindingClientConfig as t, type WalletAccountRelation as u, WalletAccountRelationController as v, type WalletAccountRelationControllerOptions as w, accountBindingCandidate as x, connectDexterIdentity as y, createDexterControlModel as z };
239
+ export { type ActiveWalletBindingIdentity as A, type BindingFetch as B, type ConnectDexterIdentityConfig as C, type DexterConnectionCapability as D, createDexterControlModel as E, createWalletAccountBindingClient as F, disconnectDexterIdentity as G, fetchWithWalletIdentity as H, walletBindingCandidate as I, type RelationCandidates as R, type ServerRelationVerificationRequest as S, type WalletBindingCandidate as W, type WalletAccountRelationSnapshot as a, type WalletAccountBindingClient as b, type AccountBindingCandidate as c, type AccountSessionClearer as d, type AccountSessionInstaller as e, type BindingResolutionResult as f, type DexterConnectionIntent as g, type DexterConnectionPermissions as h, type DexterControlModel as i, type DexterControlPrimaryAction as j, type DexterControlStage as k, type DisconnectDexterIdentityConfig as l, type RelationCheckReason as m, type RelationRuntime as n, type ResolveWalletAccountBindingInput as o, type ResolvedWalletAccountRelation as p, type ServerRelationVerificationResult as q, type ServerRelationVerifier as r, WALLET_ACCOUNT_BINDING_PATH as s, type WalletAccountBindingClientConfig as t, type WalletAccountRelation as u, WalletAccountRelationController as v, type WalletAccountRelationControllerOptions as w, type WalletIdentityFetchInput as x, accountBindingCandidate as y, connectDexterIdentity as z };
@@ -70,7 +70,7 @@ type WalletStoreMode = 'commit' | 'provisional';
70
70
  */
71
71
  type AgentDelegationMode = 'configure-now' | 'deferred';
72
72
  /** Exact action the hosted Dexter consent window is being asked to perform. */
73
- type CeremonyOperation = 'signin' | 'create' | 'continue' | 'recover' | 'sign';
73
+ type CeremonyOperation = 'signin' | 'create' | 'continue' | 'recover' | 'sign' | 'recover-missing-vault';
74
74
  /** Minimal vault identity transferred to Dexter's hosted signing window. */
75
75
  interface HostedSignVaultIdentity {
76
76
  vaultPda: string;
@@ -94,6 +94,37 @@ interface HostedSignResult {
94
94
  clientDataJSON: Uint8Array;
95
95
  authenticatorData: Uint8Array;
96
96
  }
97
+ /** Durable account identity selected by the authenticated recovery API. */
98
+ interface MissingVaultRecoveryAccount {
99
+ provider: 'x';
100
+ /** Canonical X handle, including the leading @. */
101
+ handle: string;
102
+ }
103
+ /** Vault row attached to the already-authenticated account after recovery. */
104
+ interface MissingVaultRecoveryVault {
105
+ vaultPda: string;
106
+ swigAddress: string;
107
+ receiveAddress: string;
108
+ userHandle: string;
109
+ credentialId: string;
110
+ state: 'initialized';
111
+ }
112
+ /** Result of explicitly repairing an account whose passkey exists without its Vault row. */
113
+ interface MissingVaultRecoveryResult {
114
+ recovered: true;
115
+ alreadyRecovered: boolean;
116
+ relation: 'bound';
117
+ account: MissingVaultRecoveryAccount;
118
+ vault: MissingVaultRecoveryVault;
119
+ }
120
+ interface MissingVaultRecoveryConfig {
121
+ /** Supabase access token for the existing account being repaired. */
122
+ accountAccessToken: string;
123
+ /** Compatibility-only API base; omitted or exactly https://api.dexter.cash. */
124
+ apiBase?: string;
125
+ /** Compatibility-only hosted page; omitted or exactly https://dexter.cash/connect. */
126
+ connectHost?: string;
127
+ }
97
128
  /**
98
129
  * Vault identity on the wallet-only recover leg, as reported by
99
130
  * /api/passkey-vault-anon/status. Narrower than ConnectVault on purpose —
@@ -242,4 +273,4 @@ interface CreateWalletResult {
242
273
  */
243
274
  declare function createWallet(config?: CreateWalletConfig): Promise<CreateWalletResult>;
244
275
 
245
- export { type AgentDelegationMode as A, type CreateWalletResult as C, type DexterConnectConfig as D, type HostedSignRequestPayload as H, type PasskeyLoginTokens as P, type RecoverOutcome as R, type SignInResult as S, type WalletStoreMode as W, type CeremonyPhase as a, type SpendPolicy as b, type ConnectVault as c, type RecoverWalletConfig as d, type WalletIdentityProof as e, type CeremonyOperation as f, ConnectError as g, type CreateWalletConfig as h, type HostedSignResult as i, type HostedSignVaultIdentity as j, type RecoverVault as k, SESSION_TTL_30D as l, authoredPolicy as m, createWallet as n, type PasskeyLoginConfig as o, usdToAtomic as u };
276
+ export { type AgentDelegationMode as A, type CreateWalletResult as C, type DexterConnectConfig as D, type HostedSignRequestPayload as H, type MissingVaultRecoveryConfig as M, type PasskeyLoginTokens as P, type RecoverOutcome as R, type SignInResult as S, type WalletStoreMode as W, type CeremonyPhase as a, type SpendPolicy as b, type MissingVaultRecoveryResult as c, type ConnectVault as d, type RecoverWalletConfig as e, type WalletIdentityProof as f, type CeremonyOperation as g, ConnectError as h, type CreateWalletConfig as i, type HostedSignResult as j, type HostedSignVaultIdentity as k, type MissingVaultRecoveryAccount as l, type MissingVaultRecoveryVault as m, type RecoverVault as n, SESSION_TTL_30D as o, authoredPolicy as p, createWallet as q, type PasskeyLoginConfig as r, usdToAtomic as u };
package/dist/hosted.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { S as SignInResult, C as CreateWalletResult, W as WalletStoreMode, a as CeremonyPhase, b as SpendPolicy, R as RecoverOutcome } from './enroll-DrgEW0X8.js';
1
+ import { S as SignInResult, C as CreateWalletResult, W as WalletStoreMode, a as CeremonyPhase, b as SpendPolicy, R as RecoverOutcome } from './enroll-BmD1y8KH.js';
2
+ import { AuthenticationResponseJSON } from '@simplewebauthn/browser';
2
3
 
3
4
  type ContinueResult = ({
4
5
  kind: 'signin';
@@ -68,5 +69,11 @@ declare function runHostedCeremony(request: HostedSignInCeremony): Promise<SignI
68
69
  declare function runHostedCeremony(request: HostedContinueCeremony): Promise<HostedContinueResult>;
69
70
  declare function runHostedCeremony(request: HostedCreateCeremony): Promise<CreateWalletResult>;
70
71
  declare function runHostedCeremony(request: HostedRecoverCeremony): Promise<RecoverOutcome>;
72
+ /**
73
+ * Run only the account-bound missing-Vault proof supplied by an opener after
74
+ * the exact popup handshake. API/session binding and completion stay in the
75
+ * opener; this page receives no account token.
76
+ */
77
+ declare function runHostedMissingVaultRecoveryProof(options: unknown): Promise<AuthenticationResponseJSON>;
71
78
 
72
- export { DEXTER_HOSTED_CEREMONY_ORIGIN, type HostedCeremonyOperation, type HostedCeremonyRequest, type HostedCeremonyResult, type HostedContinueCeremony, type HostedContinueResult, type HostedCreateCeremony, type HostedRecoverCeremony, type HostedSignInCeremony, runHostedCeremony };
79
+ export { DEXTER_HOSTED_CEREMONY_ORIGIN, type HostedCeremonyOperation, type HostedCeremonyRequest, type HostedCeremonyResult, type HostedContinueCeremony, type HostedContinueResult, type HostedCreateCeremony, type HostedRecoverCeremony, type HostedSignInCeremony, runHostedCeremony, runHostedMissingVaultRecoveryProof };
package/dist/hosted.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import {
2
- recoverWallet
3
- } from "./chunk-LHYU2EZQ.js";
2
+ recoverWallet,
3
+ runHostedMissingVaultRecoveryProof
4
+ } from "./chunk-WHGR5FUY.js";
4
5
  import {
5
6
  ConnectError,
6
7
  DEXTER_API_BASE,
@@ -9,7 +10,7 @@ import {
9
10
  passkeyLogin,
10
11
  resolveAgentDelegationMode,
11
12
  resolveWalletStoreMode
12
- } from "./chunk-CZL7NGVV.js";
13
+ } from "./chunk-4FTJB7FT.js";
13
14
  import "./chunk-EMCGL64H.js";
14
15
 
15
16
  // src/hosted.ts
@@ -63,6 +64,10 @@ async function runHostedCeremony(request) {
63
64
  throw new ConnectError("unsupported_hosted_ceremony");
64
65
  }
65
66
  }
67
+ async function runHostedMissingVaultRecoveryProof2(options) {
68
+ assertHostedCeremonyOrigin();
69
+ return runHostedMissingVaultRecoveryProof(options);
70
+ }
66
71
  function assertHostedDelegationChoice(request) {
67
72
  if (request.operation !== "continue" && request.operation !== "create") return;
68
73
  const agentDelegation = resolveAgentDelegationMode(
@@ -91,5 +96,6 @@ function assertHostedCeremonyOrigin() {
91
96
  }
92
97
  export {
93
98
  DEXTER_HOSTED_CEREMONY_ORIGIN,
94
- runHostedCeremony
99
+ runHostedCeremony,
100
+ runHostedMissingVaultRecoveryProof2 as runHostedMissingVaultRecoveryProof
95
101
  };
package/dist/index.d.ts CHANGED
@@ -1,10 +1,20 @@
1
- import { c as ConnectVault, d as RecoverWalletConfig, R as RecoverOutcome, e as WalletIdentityProof, a as CeremonyPhase } from './enroll-DrgEW0X8.js';
2
- export { A as AgentDelegationMode, f as CeremonyOperation, g as ConnectError, h as CreateWalletConfig, C as CreateWalletResult, D as DexterConnectConfig, H as HostedSignRequestPayload, i as HostedSignResult, j as HostedSignVaultIdentity, P as PasskeyLoginTokens, k as RecoverVault, l as SESSION_TTL_30D, S as SignInResult, b as SpendPolicy, m as authoredPolicy, n as createWallet, u as usdToAtomic } from './enroll-DrgEW0X8.js';
1
+ import { M as MissingVaultRecoveryConfig, c as MissingVaultRecoveryResult, d as ConnectVault, e as RecoverWalletConfig, R as RecoverOutcome, f as WalletIdentityProof, a as CeremonyPhase } from './enroll-BmD1y8KH.js';
2
+ export { A as AgentDelegationMode, g as CeremonyOperation, h as ConnectError, i as CreateWalletConfig, C as CreateWalletResult, D as DexterConnectConfig, H as HostedSignRequestPayload, j as HostedSignResult, k as HostedSignVaultIdentity, l as MissingVaultRecoveryAccount, m as MissingVaultRecoveryVault, P as PasskeyLoginTokens, n as RecoverVault, o as SESSION_TTL_30D, S as SignInResult, b as SpendPolicy, p as authoredPolicy, q as createWallet, u as usdToAtomic } from './enroll-BmD1y8KH.js';
3
3
  import { PasskeySignerWithPublicKey } from '@dexterai/vault/signers';
4
- import { A as ActiveWalletBindingIdentity, W as WalletBindingCandidate, a as WalletAccountRelationSnapshot, B as BindingFetch, b as WalletAccountBindingClient } from './connectionContract-CR478cfF.js';
5
- export { c as AccountBindingCandidate, d as AccountSessionClearer, e as AccountSessionInstaller, f as BindingResolutionResult, C as ConnectDexterIdentityConfig, D as DexterConnectionCapability, g as DexterConnectionIntent, h as DexterConnectionPermissions, i as DexterControlModel, j as DexterControlPrimaryAction, k as DexterControlStage, l as DisconnectDexterIdentityConfig, R as RelationCandidates, m as RelationCheckReason, n as RelationRuntime, o as ResolveWalletAccountBindingInput, p as ResolvedWalletAccountRelation, S as ServerRelationVerificationRequest, q as ServerRelationVerificationResult, r as ServerRelationVerifier, s as WALLET_ACCOUNT_BINDING_PATH, t as WalletAccountBindingClientConfig, u as WalletAccountRelation, v as WalletAccountRelationController, w as WalletAccountRelationControllerOptions, x as accountBindingCandidate, y as connectDexterIdentity, z as createDexterControlModel, E as createWalletAccountBindingClient, F as disconnectDexterIdentity, G as walletBindingCandidate } from './connectionContract-CR478cfF.js';
4
+ import { A as ActiveWalletBindingIdentity, W as WalletBindingCandidate, a as WalletAccountRelationSnapshot, B as BindingFetch, b as WalletAccountBindingClient } from './connectionContract-BzV_pjOI.js';
5
+ export { c as AccountBindingCandidate, d as AccountSessionClearer, e as AccountSessionInstaller, f as BindingResolutionResult, C as ConnectDexterIdentityConfig, D as DexterConnectionCapability, g as DexterConnectionIntent, h as DexterConnectionPermissions, i as DexterControlModel, j as DexterControlPrimaryAction, k as DexterControlStage, l as DisconnectDexterIdentityConfig, R as RelationCandidates, m as RelationCheckReason, n as RelationRuntime, o as ResolveWalletAccountBindingInput, p as ResolvedWalletAccountRelation, S as ServerRelationVerificationRequest, q as ServerRelationVerificationResult, r as ServerRelationVerifier, s as WALLET_ACCOUNT_BINDING_PATH, t as WalletAccountBindingClientConfig, u as WalletAccountRelation, v as WalletAccountRelationController, w as WalletAccountRelationControllerOptions, x as WalletIdentityFetchInput, y as accountBindingCandidate, z as connectDexterIdentity, E as createDexterControlModel, F as createWalletAccountBindingClient, G as disconnectDexterIdentity, H as fetchWithWalletIdentity, I as walletBindingCandidate } from './connectionContract-BzV_pjOI.js';
6
6
  import { PublicKeyCredentialRequestOptionsJSON, AuthenticationResponseJSON } from '@simplewebauthn/browser';
7
7
 
8
+ /**
9
+ * Repair one confirmed split state: a Dexter passkey exists, but its Vault row
10
+ * is missing from the already-authenticated account. This never signs in,
11
+ * creates an account, or changes the browser's active Wallet.
12
+ *
13
+ * Call directly from a user click. The trusted popup opens synchronously; the
14
+ * account-authenticated challenge fetch begins only after it exists.
15
+ */
16
+ declare function recoverMissingVaultForAccount(config: MissingVaultRecoveryConfig): Promise<MissingVaultRecoveryResult>;
17
+
8
18
  /** What `issueChallenge` returns to the SDK signer. */
9
19
  interface AnonChallengeResult {
10
20
  /** Server-issued canonical 200-byte passkey-authorization envelope. */
@@ -641,4 +651,4 @@ declare function readAgentAuthority(input: {
641
651
  fetchImpl?: typeof fetch;
642
652
  }): Promise<AgentAuthorityStatus>;
643
653
 
644
- export { AGENT_AUTHORITY_NAMESPACE, AGENT_AUTHORITY_STATUS_NAMESPACE, type AgentAuthorityActiveRole, type AgentAuthorityApprovalMode, type AgentAuthorityAuthorization, type AgentAuthorityBootstrapRequest, type AgentAuthorityCapacity, AgentAuthorityError, type AgentAuthorityRule, type AgentAuthorityRuleBase, type AgentAuthorityStagedReceipt, type AgentAuthorityStatus, type AgentAuthorityTarget, AgentSpendError, type AgentSpendIdentity, type AgentSpendStatus, type AgentSpendTab, type AnonChallengeResult, type AnonServerPolicy, type AutomaticAgentSpend, BindingFetch, AgentAuthorityError as BoundedX402AuthorityError, type BoundedX402Authorization, type BoundedX402BootstrapRequest, type BoundedX402Draft, type BoundedX402Limits, type BoundedX402Rule, type BoundedX402StagedReceipt, type BoundedX402Validation, CeremonyPhase, ConnectVault, type CreatePasskeySignerOptions, type DexterIdentityCoordinator, type DexterIdentityCoordinatorOptions, type EnableAgentSpendResult, MAX_AUTHORITY_AMOUNT_ATOMIC, type PasskeySignalSupport, type RawAgentSpendSession, type RawAgentSpendStatus, RecoverOutcome, RecoverWalletConfig, type RevokeAgentSpendResult, type StagedAgentAuthorityRule, type TradeAuthorityRule, WALLET_PROOF_SESSION_STORAGE_PREFIX, WalletAccountBindingClient, WalletAccountRelationSnapshot, WalletBindingCandidate, WalletIdentityProof, type WalletProofLifecycleEvent, type WalletProofSession, type WalletProofSessionEvent, type WalletProofSessionOperation, type WalletProofSessionStorage, type WalletProofSessionStore, type WalletProofSessionStoreOptions, type WalletProofStorageEvent, type WalletProofStorageEventSource, type X402LimitDraft, type X402LimitValidation, type X402Limits, type X402PaymentAuthorityRule, X402_ALLOWED_SCHEMES, X402_ASSET, X402_COUNTERPARTY_SCOPE, X402_PROTOCOL_ID, X402_PROTOCOL_VERSION, assembleAgentSpendStatus, beginAgentAuthority, beginBoundedX402Authority, buildAgentAuthorityRequest, buildBoundedX402BootstrapRequest, buildX402PaymentRule, ceremonyPhaseLabel, createAnonServerPolicy, createDexterIdentityCoordinator, createPasskeySigner, createWalletProofSessionStore, describeAgentSpendError, enableAgentSpend, exactAgentAuthorityApprovalRedirect, exactBoundedX402ApprovalRedirect, noCustomX402Limits, passkeySignalSupport, prunePasskey, readAgentAuthority, recoverWallet, renamePasskey, revokeAgentSpend, stageAgentAuthority, stageBoundedX402Authority, syncAcceptedPasskeys, validateBoundedX402Draft, walletProofSessionStore };
654
+ export { AGENT_AUTHORITY_NAMESPACE, AGENT_AUTHORITY_STATUS_NAMESPACE, type AgentAuthorityActiveRole, type AgentAuthorityApprovalMode, type AgentAuthorityAuthorization, type AgentAuthorityBootstrapRequest, type AgentAuthorityCapacity, AgentAuthorityError, type AgentAuthorityRule, type AgentAuthorityRuleBase, type AgentAuthorityStagedReceipt, type AgentAuthorityStatus, type AgentAuthorityTarget, AgentSpendError, type AgentSpendIdentity, type AgentSpendStatus, type AgentSpendTab, type AnonChallengeResult, type AnonServerPolicy, type AutomaticAgentSpend, BindingFetch, AgentAuthorityError as BoundedX402AuthorityError, type BoundedX402Authorization, type BoundedX402BootstrapRequest, type BoundedX402Draft, type BoundedX402Limits, type BoundedX402Rule, type BoundedX402StagedReceipt, type BoundedX402Validation, CeremonyPhase, ConnectVault, type CreatePasskeySignerOptions, type DexterIdentityCoordinator, type DexterIdentityCoordinatorOptions, type EnableAgentSpendResult, MAX_AUTHORITY_AMOUNT_ATOMIC, MissingVaultRecoveryConfig, MissingVaultRecoveryResult, type PasskeySignalSupport, type RawAgentSpendSession, type RawAgentSpendStatus, RecoverOutcome, RecoverWalletConfig, type RevokeAgentSpendResult, type StagedAgentAuthorityRule, type TradeAuthorityRule, WALLET_PROOF_SESSION_STORAGE_PREFIX, WalletAccountBindingClient, WalletAccountRelationSnapshot, WalletBindingCandidate, WalletIdentityProof, type WalletProofLifecycleEvent, type WalletProofSession, type WalletProofSessionEvent, type WalletProofSessionOperation, type WalletProofSessionStorage, type WalletProofSessionStore, type WalletProofSessionStoreOptions, type WalletProofStorageEvent, type WalletProofStorageEventSource, type X402LimitDraft, type X402LimitValidation, type X402Limits, type X402PaymentAuthorityRule, X402_ALLOWED_SCHEMES, X402_ASSET, X402_COUNTERPARTY_SCOPE, X402_PROTOCOL_ID, X402_PROTOCOL_VERSION, assembleAgentSpendStatus, beginAgentAuthority, beginBoundedX402Authority, buildAgentAuthorityRequest, buildBoundedX402BootstrapRequest, buildX402PaymentRule, ceremonyPhaseLabel, createAnonServerPolicy, createDexterIdentityCoordinator, createPasskeySigner, createWalletProofSessionStore, describeAgentSpendError, enableAgentSpend, exactAgentAuthorityApprovalRedirect, exactBoundedX402ApprovalRedirect, noCustomX402Limits, passkeySignalSupport, prunePasskey, readAgentAuthority, recoverMissingVaultForAccount, recoverWallet, renamePasskey, revokeAgentSpend, stageAgentAuthority, stageBoundedX402Authority, syncAcceptedPasskeys, validateBoundedX402Draft, walletProofSessionStore };
package/dist/index.js CHANGED
@@ -9,10 +9,11 @@ import {
9
9
  prunePasskey,
10
10
  renamePasskey,
11
11
  syncAcceptedPasskeys
12
- } from "./chunk-2BTS6DCR.js";
12
+ } from "./chunk-Z6YHGWG3.js";
13
13
  import {
14
+ recoverMissingVaultForAccount,
14
15
  recoverWallet
15
- } from "./chunk-LHYU2EZQ.js";
16
+ } from "./chunk-WHGR5FUY.js";
16
17
  import {
17
18
  ConnectError,
18
19
  SESSION_TTL_30D,
@@ -24,6 +25,7 @@ import {
24
25
  createWallet,
25
26
  createWalletAccountBindingClient,
26
27
  createWalletProofSessionStore,
28
+ fetchWithWalletIdentity,
27
29
  openCeremonyPopup,
28
30
  readErrorCode,
29
31
  resolveDexterApiBase,
@@ -32,7 +34,7 @@ import {
32
34
  usdToAtomic,
33
35
  walletBindingCandidate,
34
36
  walletProofSessionStore
35
- } from "./chunk-CZL7NGVV.js";
37
+ } from "./chunk-4FTJB7FT.js";
36
38
  import {
37
39
  base64ToBytes,
38
40
  base64urlToBytes,
@@ -962,10 +964,12 @@ export {
962
964
  enableAgentSpend,
963
965
  exactAgentAuthorityApprovalRedirect,
964
966
  exactBoundedX402ApprovalRedirect,
967
+ fetchWithWalletIdentity,
965
968
  noCustomX402Limits,
966
969
  passkeySignalSupport,
967
970
  prunePasskey,
968
971
  readAgentAuthority,
972
+ recoverMissingVaultForAccount,
969
973
  recoverWallet,
970
974
  renamePasskey,
971
975
  revokeAgentSpend,
package/dist/react.d.ts CHANGED
@@ -1,8 +1,9 @@
1
- import { g as ConnectError, S as SignInResult, o as PasskeyLoginConfig, C as CreateWalletResult, A as AgentDelegationMode } from './enroll-DrgEW0X8.js';
2
- export { c as ConnectVault, R as RecoverOutcome, k as RecoverVault, e as WalletIdentityProof } from './enroll-DrgEW0X8.js';
3
- import { a as WalletAccountRelationSnapshot, i as DexterControlModel, g as DexterConnectionIntent, e as AccountSessionInstaller, d as AccountSessionClearer, B as BindingFetch } from './connectionContract-CR478cfF.js';
4
- export { D as DexterConnectionCapability, h as DexterConnectionPermissions, j as DexterControlPrimaryAction, k as DexterControlStage } from './connectionContract-CR478cfF.js';
5
- import { ButtonHTMLAttributes, ReactNode, ReactElement } from 'react';
1
+ import { h as ConnectError, S as SignInResult, r as PasskeyLoginConfig, C as CreateWalletResult, A as AgentDelegationMode } from './enroll-BmD1y8KH.js';
2
+ export { d as ConnectVault, R as RecoverOutcome, n as RecoverVault, f as WalletIdentityProof } from './enroll-BmD1y8KH.js';
3
+ import { i as DexterControlModel, a as WalletAccountRelationSnapshot, g as DexterConnectionIntent, e as AccountSessionInstaller, d as AccountSessionClearer, B as BindingFetch } from './connectionContract-BzV_pjOI.js';
4
+ export { D as DexterConnectionCapability, h as DexterConnectionPermissions, j as DexterControlPrimaryAction, k as DexterControlStage } from './connectionContract-BzV_pjOI.js';
5
+ import * as react from 'react';
6
+ import { ButtonHTMLAttributes, ReactNode, ReactElement, ComponentType, AnchorHTMLAttributes } from 'react';
6
7
 
7
8
  /** The Dexter passkey mark carried on the branded button. */
8
9
  declare function DexterMark(): ReactElement;
@@ -129,10 +130,79 @@ interface CreateWalletPanelProps {
129
130
  agentDelegation?: AgentDelegationMode;
130
131
  /** Extra className composed after the brand classes. */
131
132
  className?: string;
133
+ /** Account wording for the shared account control; wallet remains compatible. */
134
+ terminology?: 'wallet' | 'account';
135
+ /** Hide when the containing panel already carries Dexter's mark. */
136
+ withMark?: boolean;
132
137
  }
133
138
  /** The turnkey consent-at-birth create panel. */
134
139
  declare function CreateWalletPanel(props: CreateWalletPanelProps): ReactElement;
135
140
 
141
+ type AccountLinkComponent = ComponentType<AnchorHTMLAttributes<HTMLAnchorElement>>;
142
+ interface AccountDestination {
143
+ href: string;
144
+ label?: string;
145
+ }
146
+ interface AccountNavigation {
147
+ money: AccountDestination | false;
148
+ send: AccountDestination | false;
149
+ receive: AccountDestination | false;
150
+ activity: AccountDestination | false;
151
+ agents: AccountDestination | false;
152
+ profile: AccountDestination | false;
153
+ support: AccountDestination | false;
154
+ settings: AccountDestination | false;
155
+ }
156
+ /** Local app destinations can replace any hosted destination; false hides it. */
157
+ declare const DEFAULT_ACCOUNT_NAVIGATION: Readonly<AccountNavigation>;
158
+ interface AccountMenuItem {
159
+ id: string;
160
+ label: string;
161
+ href: string;
162
+ icon?: ReactNode;
163
+ hint?: string;
164
+ /** The host remains responsible for authorizing its destination. */
165
+ requires: 'account' | 'wallet';
166
+ }
167
+
168
+ interface DexterAccountControlProps {
169
+ /** Reuse the app's canonical useDexterConnection instance. */
170
+ connection: UseDexterConnection;
171
+ open?: boolean;
172
+ onOpenChange?: (open: boolean) => void;
173
+ /** Shown only after the connection verifies account access. */
174
+ profile?: {
175
+ name?: string;
176
+ email?: string;
177
+ };
178
+ navigation?: Partial<AccountNavigation>;
179
+ /** Host-specific links. The connection also gates the required access. */
180
+ items?: readonly AccountMenuItem[];
181
+ LinkComponent?: AccountLinkComponent;
182
+ /** Optional adapter for an existing portfolio reader; presentation stays shared. */
183
+ renderSummary?: (onNavigate: () => void) => ReactNode;
184
+ formatError?: (code?: string) => string;
185
+ className?: string;
186
+ triggerClassName?: string;
187
+ styleNonce?: string;
188
+ }
189
+ /** Branded account entry with canonical connection, balance and settings. */
190
+ declare function DexterAccountControl({ connection: dexter, open: controlledOpen, onOpenChange, profile, navigation, items, LinkComponent, renderSummary, formatError, className, triggerClassName, styleNonce, }: DexterAccountControlProps): react.JSX.Element;
191
+
192
+ interface DexterAccountSummaryProps {
193
+ /** Formatted value from a read bound to the currently selected account. */
194
+ amount: string | null;
195
+ loading: boolean;
196
+ partial?: boolean;
197
+ refresh: () => Promise<void>;
198
+ navigation?: Partial<AccountNavigation>;
199
+ LinkComponent?: AccountLinkComponent;
200
+ onNavigate?: () => void;
201
+ styleNonce?: string;
202
+ }
203
+ /** The same balance and money actions used by DexterAccountControl. */
204
+ declare function DexterAccountSummary({ amount, loading, partial, refresh, navigation, LinkComponent, onNavigate, styleNonce }: DexterAccountSummaryProps): react.JSX.Element;
205
+
136
206
  type InstallApp = 'claude' | 'chatgpt' | 'cursor' | 'vscode' | 'hermes' | 'claude-code';
137
207
  interface AppInstallButtonsProps {
138
208
  /** MCP endpoint to install. Default: OpenDexter. */
@@ -158,4 +228,4 @@ declare function hermesOpenUrl(name: string): string;
158
228
  declare function claudeCodeInstallCommand(name: string, mcpUrl: string): string;
159
229
  declare function AppInstallButtons(props: AppInstallButtonsProps): ReactElement;
160
230
 
161
- export { AllowanceChips, type AllowanceChipsProps, AppInstallButtons, type AppInstallButtonsProps, CreateWalletPanel, type CreateWalletPanelProps, CreateWalletResult, type DexterAccountSession, DexterButton, type DexterButtonProps, DexterConnectionIntent, type DexterConnectionOperation, DexterControlModel, type DexterIdentityView, DexterMark, type DexterWalletView, type InstallApp, REMOVE_DEXTER_FROM_DEVICE_CONFIRMATION, type RemoveDexterFromDeviceConfirmation, type RemoveDexterFromDeviceResult, SignInResult, type UseDexterConnection, type UseDexterConnectionConfig, WalletAccountRelationSnapshot, chatgptPluginsUrl, claudeCodeInstallCommand, claudeWebConnectorUrl, cursorInstallUrl, hermesInstallCommand, hermesOpenUrl, useDexterConnection, vscodeInstallUrl };
231
+ export { type AccountDestination, type AccountLinkComponent, type AccountMenuItem, type AccountNavigation, AllowanceChips, type AllowanceChipsProps, AppInstallButtons, type AppInstallButtonsProps, CreateWalletPanel, type CreateWalletPanelProps, CreateWalletResult, DEFAULT_ACCOUNT_NAVIGATION, DexterAccountControl, type DexterAccountControlProps, type DexterAccountSession, DexterAccountSummary, type DexterAccountSummaryProps, DexterButton, type DexterButtonProps, DexterConnectionIntent, type DexterConnectionOperation, DexterControlModel, type DexterIdentityView, DexterMark, type DexterWalletView, type InstallApp, REMOVE_DEXTER_FROM_DEVICE_CONFIRMATION, type RemoveDexterFromDeviceConfirmation, type RemoveDexterFromDeviceResult, SignInResult, type UseDexterConnection, type UseDexterConnectionConfig, WalletAccountRelationSnapshot, chatgptPluginsUrl, claudeCodeInstallCommand, claudeWebConnectorUrl, cursorInstallUrl, hermesInstallCommand, hermesOpenUrl, useDexterConnection, vscodeInstallUrl };