@dexterai/connect 0.33.0 → 0.35.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 +3 -1
- package/dist/{accountIdentity-DQ_C-WAi.d.ts → accountIdentity-BHazSkuz.d.ts} +1 -8
- package/dist/{chunk-SLI2QCWN.js → chunk-5B3IO3JU.js} +22 -1
- package/dist/{chunk-Q7HTBUJF.js → chunk-SGWYN67U.js} +679 -935
- package/dist/{chunk-3SBEND6T.js → chunk-ZVUFVXUG.js} +1 -1
- package/dist/{connectionContract-BA03zq2D.d.ts → connectionContract-CSZiddpS.d.ts} +1 -1
- package/dist/hosted.d.ts +1 -1
- package/dist/hosted.js +5 -12
- package/dist/index.d.ts +61 -7
- package/dist/index.js +63 -16
- package/dist/react.d.ts +18 -4
- package/dist/react.js +86 -11
- package/package.json +13 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as PasskeyLoginTokens, I as PasskeyLoginConfig, a as CeremonyPhase, S as SignInResult } from './accountIdentity-
|
|
1
|
+
import { P as PasskeyLoginTokens, I as PasskeyLoginConfig, a as CeremonyPhase, S as SignInResult } from './accountIdentity-BHazSkuz.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Framework-neutral Wallet/account relationship controller.
|
package/dist/hosted.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SignInResult, C as CreateWalletResult, a as CeremonyPhase, W as WalletStoreMode, b as SpendPolicy, A as AccountIdentityResult, R as RecoverOutcome } from './accountIdentity-
|
|
1
|
+
import { S as SignInResult, C as CreateWalletResult, a as CeremonyPhase, W as WalletStoreMode, b as SpendPolicy, A as AccountIdentityResult, R as RecoverOutcome } from './accountIdentity-BHazSkuz.js';
|
|
2
2
|
import { AuthenticationResponseJSON } from '@simplewebauthn/browser';
|
|
3
3
|
|
|
4
4
|
type ContinueResult = ({
|
package/dist/hosted.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
recoverWallet,
|
|
3
3
|
runHostedMissingVaultRecoveryProof
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ZVUFVXUG.js";
|
|
5
5
|
import {
|
|
6
6
|
ConnectError,
|
|
7
7
|
DEXTER_API_BASE,
|
|
8
|
+
DEXTER_WALLET_CLOSED_CODE,
|
|
9
|
+
DEXTER_WALLET_CLOSED_MESSAGE,
|
|
8
10
|
continueWithDexter,
|
|
9
|
-
createWallet,
|
|
10
11
|
enrollAccountIdentity,
|
|
11
12
|
passkeyLogin,
|
|
12
13
|
resolveAgentDelegationMode,
|
|
13
14
|
resolveWalletStoreMode,
|
|
14
15
|
signInAccountIdentity
|
|
15
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-SGWYN67U.js";
|
|
16
17
|
import "./chunk-EMCGL64H.js";
|
|
17
18
|
|
|
18
19
|
// src/hosted.ts
|
|
@@ -62,15 +63,7 @@ async function runHostedCeremony(request) {
|
|
|
62
63
|
request.onPhase
|
|
63
64
|
);
|
|
64
65
|
case "create":
|
|
65
|
-
|
|
66
|
-
apiBase: DEXTER_API_BASE,
|
|
67
|
-
transport: "inline",
|
|
68
|
-
...persistence,
|
|
69
|
-
...request.name !== void 0 ? { name: request.name } : {},
|
|
70
|
-
...request.spendPolicy !== void 0 ? { spendPolicy: request.spendPolicy } : {},
|
|
71
|
-
...request.agentDelegation !== void 0 ? { agentDelegation: request.agentDelegation } : {},
|
|
72
|
-
...request.onPhase !== void 0 ? { onPhase: request.onPhase } : {}
|
|
73
|
-
});
|
|
66
|
+
throw new ConnectError(DEXTER_WALLET_CLOSED_CODE, DEXTER_WALLET_CLOSED_MESSAGE);
|
|
74
67
|
case "recover":
|
|
75
68
|
return await recoverWallet({
|
|
76
69
|
apiBase: DEXTER_API_BASE,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { M as MissingVaultRecoveryConfig, c as MissingVaultRecoveryResult, d as ConnectVault, e as RecoverWalletConfig, R as RecoverOutcome, A as AccountIdentityResult, f as ConnectError, g as WalletIdentityProof, a as CeremonyPhase } from './accountIdentity-
|
|
2
|
-
export { h as ACCOUNT_IDENTITY_API_PATH, i as AccountAccessResult, j as AccountIdentityCredential, k as AccountIdentitySession, l as AccountRefusalRequest, m as AgentDelegationMode, n as CeremonyOperation, o as CreateWalletConfig, C as CreateWalletResult, D as DexterConnectConfig, E as EnrollAccountIdentityConfig, H as HostedSignRequestPayload, p as HostedSignResult, q as HostedSignVaultIdentity, r as MissingVaultRecoveryAccount, s as MissingVaultRecoveryVault, P as PasskeyLoginTokens, t as RecoverVault, u as SESSION_TTL_30D, v as SignInAccountIdentityConfig, S as SignInResult, b as SpendPolicy, w as authoredPolicy, x as createWallet, y as enrollAccountAccess, z as enrollAccountIdentity, B as signInAccountAccess, F as signInAccountIdentity, G as usdToAtomic } from './accountIdentity-
|
|
1
|
+
import { M as MissingVaultRecoveryConfig, c as MissingVaultRecoveryResult, d as ConnectVault, e as RecoverWalletConfig, R as RecoverOutcome, A as AccountIdentityResult, f as ConnectError, g as WalletIdentityProof, a as CeremonyPhase } from './accountIdentity-BHazSkuz.js';
|
|
2
|
+
export { h as ACCOUNT_IDENTITY_API_PATH, i as AccountAccessResult, j as AccountIdentityCredential, k as AccountIdentitySession, l as AccountRefusalRequest, m as AgentDelegationMode, n as CeremonyOperation, o as CreateWalletConfig, C as CreateWalletResult, D as DexterConnectConfig, E as EnrollAccountIdentityConfig, H as HostedSignRequestPayload, p as HostedSignResult, q as HostedSignVaultIdentity, r as MissingVaultRecoveryAccount, s as MissingVaultRecoveryVault, P as PasskeyLoginTokens, t as RecoverVault, u as SESSION_TTL_30D, v as SignInAccountIdentityConfig, S as SignInResult, b as SpendPolicy, w as authoredPolicy, x as createWallet, y as enrollAccountAccess, z as enrollAccountIdentity, B as signInAccountAccess, F as signInAccountIdentity, G as usdToAtomic } from './accountIdentity-BHazSkuz.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-
|
|
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-
|
|
4
|
+
import { A as ActiveWalletBindingIdentity, W as WalletBindingCandidate, a as WalletAccountRelationSnapshot, B as BindingFetch, b as WalletAccountBindingClient } from './connectionContract-CSZiddpS.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-CSZiddpS.js';
|
|
6
6
|
import { PublicKeyCredentialRequestOptionsJSON, AuthenticationResponseJSON } from '@simplewebauthn/browser';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -86,7 +86,11 @@ declare const ACCOUNT_API_PATH = "/api/account/v1";
|
|
|
86
86
|
interface DexterAccount {
|
|
87
87
|
readonly principal: string;
|
|
88
88
|
readonly wallet: string | null;
|
|
89
|
-
|
|
89
|
+
/**
|
|
90
|
+
* `held`: the Account's address is real and takes money now; it opens on the
|
|
91
|
+
* chain by itself on the first money or the first action. Show it as `ready`.
|
|
92
|
+
*/
|
|
93
|
+
readonly status: 'ready' | 'held' | 'setting-up';
|
|
90
94
|
readonly nextStep: string | null;
|
|
91
95
|
}
|
|
92
96
|
/** The passkey the session is bound to, as its owner would recognise it. */
|
|
@@ -177,7 +181,7 @@ interface AccountOperationConfig {
|
|
|
177
181
|
readonly signal?: AbortSignal;
|
|
178
182
|
}
|
|
179
183
|
interface AccountFlowResult {
|
|
180
|
-
/**
|
|
184
|
+
/** Signatures of the transactions the flow sent, in order. A held setup step sends none. */
|
|
181
185
|
readonly signatures: readonly string[];
|
|
182
186
|
}
|
|
183
187
|
/**
|
|
@@ -808,4 +812,54 @@ declare function readAgentAuthority(input: {
|
|
|
808
812
|
fetchImpl?: typeof fetch;
|
|
809
813
|
}): Promise<AgentAuthorityStatus>;
|
|
810
814
|
|
|
811
|
-
|
|
815
|
+
/** The request that opened this review, so the result can return to the same app request. */
|
|
816
|
+
interface AccountConnectionRequest {
|
|
817
|
+
/** The requesting app as shown to the owner, e.g. "ChatGPT" or "Claude". */
|
|
818
|
+
app: string;
|
|
819
|
+
origin: string;
|
|
820
|
+
returnUrl?: string;
|
|
821
|
+
state?: string;
|
|
822
|
+
}
|
|
823
|
+
/** The principal being acted for (a person or a company). Context only: it grants nothing. */
|
|
824
|
+
interface AccountPrincipalContext {
|
|
825
|
+
kind: 'person' | 'company';
|
|
826
|
+
address: string;
|
|
827
|
+
name?: string;
|
|
828
|
+
}
|
|
829
|
+
interface SignAccountChallengeConfig {
|
|
830
|
+
/** The exact bytes to sign. Passed to WebAuthn unchanged (base64url-encoded as the challenge). */
|
|
831
|
+
challenge: Uint8Array;
|
|
832
|
+
/** Relying-party id. Passed through when given; never defaulted here. */
|
|
833
|
+
rpId?: string;
|
|
834
|
+
/** Restrict the ceremony to these credential ids (base64url). */
|
|
835
|
+
allowCredentialIds?: readonly string[];
|
|
836
|
+
/** Milliseconds before the browser abandons the ceremony. */
|
|
837
|
+
timeoutMs?: number;
|
|
838
|
+
connectionRequest?: AccountConnectionRequest;
|
|
839
|
+
principal?: AccountPrincipalContext;
|
|
840
|
+
}
|
|
841
|
+
/** Every field base64url, as WebAuthn returned it. `signature` is the authenticator's DER signature. */
|
|
842
|
+
interface AccountChallengeAssertion {
|
|
843
|
+
credentialId: string;
|
|
844
|
+
authenticatorData: string;
|
|
845
|
+
clientDataJSON: string;
|
|
846
|
+
signature: string;
|
|
847
|
+
userHandle: string | null;
|
|
848
|
+
}
|
|
849
|
+
type SignAccountChallengeResult = {
|
|
850
|
+
status: 'signed';
|
|
851
|
+
assertion: AccountChallengeAssertion;
|
|
852
|
+
connectionRequest?: AccountConnectionRequest;
|
|
853
|
+
principal?: AccountPrincipalContext;
|
|
854
|
+
} | {
|
|
855
|
+
status: 'cancelled';
|
|
856
|
+
connectionRequest?: AccountConnectionRequest;
|
|
857
|
+
} | {
|
|
858
|
+
status: 'refused';
|
|
859
|
+
reason: 'webauthn_unavailable' | 'invalid_challenge' | 'credential_not_allowed' | 'webauthn_failed';
|
|
860
|
+
detail?: string;
|
|
861
|
+
connectionRequest?: AccountConnectionRequest;
|
|
862
|
+
};
|
|
863
|
+
declare function signAccountChallenge(config: SignAccountChallengeConfig): Promise<SignAccountChallengeResult>;
|
|
864
|
+
|
|
865
|
+
export { ACCOUNT_API_PATH, AGENT_AUTHORITY_NAMESPACE, AGENT_AUTHORITY_STATUS_NAMESPACE, type AccountBalances, type AccountChallengeAssertion, type AccountConnectionRequest, type AccountFlowResult, AccountIdentityResult, type AccountOperationConfig, type AccountOperationDetails, type AccountOperationState, type AccountOperationStatus, AccountOperationUnsettledError, type AccountOverview, type AccountPasskey, type AccountPrincipalContext, type AccountSendRequest, type AccountStepPhase, type AccountStepView, type AccountTokenBalance, type AccountUnsettled, 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, ConnectError, ConnectVault, type CreatePasskeySignerOptions, type DexterAccount, type DexterIdentityCoordinator, type DexterIdentityCoordinatorOptions, type EnableAgentSpendResult, MAX_AUTHORITY_AMOUNT_ATOMIC, MissingVaultRecoveryConfig, MissingVaultRecoveryResult, type PasskeySignalSupport, type RawAgentSpendSession, type RawAgentSpendStatus, RecoverOutcome, RecoverWalletConfig, type RevokeAgentSpendResult, type SignAccountChallengeConfig, type SignAccountChallengeResult, 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, formatAccountAmount, getAccount, getAccountBalances, getAccountOperation, getAccountOverview, noCustomX402Limits, openAccount, parseAccountAmount, passkeySignalSupport, prunePasskey, readAgentAuthority, recoverMissingVaultForAccount, recoverWallet, renamePasskey, revokeAgentSpend, sendFromAccount, signAccountChallenge, stageAgentAuthority, stageBoundedX402Authority, syncAcceptedPasskeys, validateBoundedX402Draft, walletProofSessionStore };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
+
SESSION_TTL_30D,
|
|
2
3
|
WalletAccountRelationController,
|
|
4
|
+
authoredPolicy,
|
|
3
5
|
ceremonyPhaseLabel,
|
|
4
6
|
connectDexterIdentity,
|
|
5
7
|
createDexterControlModel,
|
|
@@ -8,22 +10,21 @@ import {
|
|
|
8
10
|
passkeySignalSupport,
|
|
9
11
|
prunePasskey,
|
|
10
12
|
renamePasskey,
|
|
11
|
-
syncAcceptedPasskeys
|
|
12
|
-
|
|
13
|
+
syncAcceptedPasskeys,
|
|
14
|
+
usdToAtomic
|
|
15
|
+
} from "./chunk-5B3IO3JU.js";
|
|
13
16
|
import {
|
|
14
17
|
recoverMissingVaultForAccount,
|
|
15
18
|
recoverWallet
|
|
16
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-ZVUFVXUG.js";
|
|
17
20
|
import {
|
|
18
21
|
ACCOUNT_IDENTITY_API_PATH,
|
|
19
22
|
ConnectError,
|
|
20
23
|
DEXTER_API_BASE,
|
|
21
24
|
DEXTER_RP_ID,
|
|
22
|
-
SESSION_TTL_30D,
|
|
23
25
|
WALLET_ACCOUNT_BINDING_PATH,
|
|
24
26
|
WALLET_PROOF_SESSION_STORAGE_PREFIX,
|
|
25
27
|
accountBindingCandidate,
|
|
26
|
-
authoredPolicy,
|
|
27
28
|
bytesEqual,
|
|
28
29
|
createWallet,
|
|
29
30
|
createWalletAccountBindingClient,
|
|
@@ -38,10 +39,9 @@ import {
|
|
|
38
39
|
shouldUsePopup,
|
|
39
40
|
signInAccountAccess,
|
|
40
41
|
signInAccountIdentity,
|
|
41
|
-
usdToAtomic,
|
|
42
42
|
walletBindingCandidate,
|
|
43
43
|
walletProofSessionStore
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-SGWYN67U.js";
|
|
45
45
|
import {
|
|
46
46
|
base64ToBytes,
|
|
47
47
|
base64urlToBytes,
|
|
@@ -291,7 +291,7 @@ function accountFrom(value) {
|
|
|
291
291
|
if (!record(value) || !("account" in value)) malformed();
|
|
292
292
|
const account = value.account;
|
|
293
293
|
if (account === null) return null;
|
|
294
|
-
if (!record(account) || !address(account.principal) || account.wallet !== null && account.wallet !== void 0 && !address(account.wallet) || account.status !== "ready" && account.status !== "setting-up" || account.nextStep !== null && account.nextStep !== void 0 && !text(account.nextStep, 80)) malformed();
|
|
294
|
+
if (!record(account) || !address(account.principal) || account.wallet !== null && account.wallet !== void 0 && !address(account.wallet) || account.status !== "ready" && account.status !== "held" && account.status !== "setting-up" || account.nextStep !== null && account.nextStep !== void 0 && !text(account.nextStep, 80)) malformed();
|
|
295
295
|
return Object.freeze({
|
|
296
296
|
principal: account.principal,
|
|
297
297
|
wallet: account.wallet ?? null,
|
|
@@ -371,10 +371,12 @@ async function complete(config, flow, body) {
|
|
|
371
371
|
return call(config.identity, "POST", `/${flow}/complete`, body, true);
|
|
372
372
|
}
|
|
373
373
|
}
|
|
374
|
-
function confirmedFrom(value) {
|
|
375
|
-
if (!record(value) || value.status !== "confirmed"
|
|
374
|
+
function confirmedFrom(value, flow) {
|
|
375
|
+
if (!record(value) || value.status !== "confirmed") malformed();
|
|
376
|
+
const held = flow === "setup" && (value.signature === null || value.signature === void 0);
|
|
377
|
+
if (!held && !text(value.signature)) malformed();
|
|
376
378
|
if (value.next !== null && value.next !== void 0 && !text(value.next, 80)) malformed();
|
|
377
|
-
return { signature: value.signature, next: value.next ?? null };
|
|
379
|
+
return { signature: held ? null : value.signature, next: value.next ?? null };
|
|
378
380
|
}
|
|
379
381
|
async function settle(config, flow, step, operationId, cause) {
|
|
380
382
|
let state;
|
|
@@ -383,7 +385,7 @@ async function settle(config, flow, step, operationId, cause) {
|
|
|
383
385
|
} catch {
|
|
384
386
|
throw new AccountOperationUnsettledError(operationId, flow, step);
|
|
385
387
|
}
|
|
386
|
-
if (state.status === "confirmed" && state.signature) return { signature: state.signature, next: state.next };
|
|
388
|
+
if (state.status === "confirmed" && (state.signature || flow === "setup")) return { signature: state.signature, next: state.next };
|
|
387
389
|
if (state.status === "failed" || state.status === "prepared" || state.status === "expired") {
|
|
388
390
|
throw cause instanceof ConnectError && cause.code !== "account_operation_uncertain" ? cause : new ConnectError("account_operation_failed");
|
|
389
391
|
}
|
|
@@ -440,11 +442,11 @@ async function runFlow(config, flow, body, check) {
|
|
|
440
442
|
signature: credential.response.signature,
|
|
441
443
|
userHandle: credential.response.userHandle ?? null
|
|
442
444
|
}
|
|
443
|
-
}));
|
|
445
|
+
}), flow);
|
|
444
446
|
} catch (cause) {
|
|
445
447
|
result = await settle(config, flow, prepared.step, prepared.operationId, cause);
|
|
446
448
|
}
|
|
447
|
-
signatures.push(result.signature);
|
|
449
|
+
if (result.signature) signatures.push(result.signature);
|
|
448
450
|
config.onStep?.({ ...view, phase: "confirmed", signature: result.signature });
|
|
449
451
|
const next = result.next;
|
|
450
452
|
if (next === null) return Object.freeze({ signatures: Object.freeze(signatures) });
|
|
@@ -482,7 +484,7 @@ async function getAccountOperation(config) {
|
|
|
482
484
|
if (!text(config.operationId) || !/^[A-Za-z0-9_-]+$/.test(config.operationId)) throw new ConnectError("invalid_account_operation");
|
|
483
485
|
const value = await call(config.identity, "GET", `/operations/${config.operationId}`, void 0, false, config.signal);
|
|
484
486
|
const statuses = ["prepared", "sending", "confirmed", "failed", "expired"];
|
|
485
|
-
if (!record(value) || value.operationId !== config.operationId || value.flow !== "setup" && value.flow !== "send" || !text(value.step, 80) || typeof value.status !== "string" || !statuses.includes(value.status) || value.signature !== null && value.signature !== void 0 && !text(value.signature) || value.next !== null && value.next !== void 0 && !text(value.next, 80) || value.status === "confirmed" && !text(value.signature)) malformed();
|
|
487
|
+
if (!record(value) || value.operationId !== config.operationId || value.flow !== "setup" && value.flow !== "send" || !text(value.step, 80) || typeof value.status !== "string" || !statuses.includes(value.status) || value.signature !== null && value.signature !== void 0 && !text(value.signature) || value.next !== null && value.next !== void 0 && !text(value.next, 80) || value.status === "confirmed" && value.flow === "send" && !text(value.signature)) malformed();
|
|
486
488
|
return Object.freeze({
|
|
487
489
|
operationId: value.operationId,
|
|
488
490
|
flow: value.flow,
|
|
@@ -514,7 +516,7 @@ async function getAccountBalances(config) {
|
|
|
514
516
|
}
|
|
515
517
|
async function openAccount(config) {
|
|
516
518
|
const existing = await getAccount(config);
|
|
517
|
-
if (existing?.status === "ready") return existing;
|
|
519
|
+
if (existing?.status === "ready" || existing?.status === "held") return existing;
|
|
518
520
|
config.onStep?.({
|
|
519
521
|
step: existing?.nextStep ?? "create-account",
|
|
520
522
|
summary: "",
|
|
@@ -1277,6 +1279,50 @@ async function readAgentAuthority(input) {
|
|
|
1277
1279
|
}
|
|
1278
1280
|
return payload;
|
|
1279
1281
|
}
|
|
1282
|
+
|
|
1283
|
+
// src/accountChallenge.ts
|
|
1284
|
+
import { browserSupportsWebAuthn as browserSupportsWebAuthn2, startAuthentication as startAuthentication2 } from "@simplewebauthn/browser";
|
|
1285
|
+
var MAX_CHALLENGE_BYTES = 1024;
|
|
1286
|
+
async function signAccountChallenge(config) {
|
|
1287
|
+
const { connectionRequest, principal } = config;
|
|
1288
|
+
const refused = (reason, detail) => ({ status: "refused", reason, ...detail ? { detail } : {}, ...connectionRequest ? { connectionRequest } : {} });
|
|
1289
|
+
if (!(config.challenge instanceof Uint8Array) || config.challenge.length < 16 || config.challenge.length > MAX_CHALLENGE_BYTES) {
|
|
1290
|
+
return refused("invalid_challenge", "challenge must be 16 to 1024 bytes");
|
|
1291
|
+
}
|
|
1292
|
+
if (!browserSupportsWebAuthn2()) return refused("webauthn_unavailable");
|
|
1293
|
+
const allow = config.allowCredentialIds?.filter((id) => typeof id === "string" && id.length > 0) ?? [];
|
|
1294
|
+
let credential;
|
|
1295
|
+
try {
|
|
1296
|
+
credential = await startAuthentication2({
|
|
1297
|
+
optionsJSON: {
|
|
1298
|
+
challenge: bytesToBase64url(config.challenge),
|
|
1299
|
+
...config.rpId ? { rpId: config.rpId } : {},
|
|
1300
|
+
...allow.length ? { allowCredentials: allow.map((id) => ({ id, type: "public-key" })) } : {},
|
|
1301
|
+
userVerification: "required",
|
|
1302
|
+
...config.timeoutMs ? { timeout: config.timeoutMs } : {}
|
|
1303
|
+
}
|
|
1304
|
+
});
|
|
1305
|
+
} catch (cause) {
|
|
1306
|
+
const name = cause instanceof Error ? cause.name : "";
|
|
1307
|
+
if (name === "NotAllowedError" || name === "AbortError") {
|
|
1308
|
+
return { status: "cancelled", ...connectionRequest ? { connectionRequest } : {} };
|
|
1309
|
+
}
|
|
1310
|
+
return refused("webauthn_failed", cause instanceof Error ? cause.message : String(cause));
|
|
1311
|
+
}
|
|
1312
|
+
if (allow.length && !allow.includes(credential.id)) return refused("credential_not_allowed");
|
|
1313
|
+
return {
|
|
1314
|
+
status: "signed",
|
|
1315
|
+
assertion: {
|
|
1316
|
+
credentialId: credential.id,
|
|
1317
|
+
authenticatorData: credential.response.authenticatorData,
|
|
1318
|
+
clientDataJSON: credential.response.clientDataJSON,
|
|
1319
|
+
signature: credential.response.signature,
|
|
1320
|
+
userHandle: credential.response.userHandle ?? null
|
|
1321
|
+
},
|
|
1322
|
+
...connectionRequest ? { connectionRequest } : {},
|
|
1323
|
+
...principal ? { principal } : {}
|
|
1324
|
+
};
|
|
1325
|
+
}
|
|
1280
1326
|
export {
|
|
1281
1327
|
ACCOUNT_API_PATH,
|
|
1282
1328
|
ACCOUNT_IDENTITY_API_PATH,
|
|
@@ -1338,6 +1384,7 @@ export {
|
|
|
1338
1384
|
renamePasskey,
|
|
1339
1385
|
revokeAgentSpend,
|
|
1340
1386
|
sendFromAccount,
|
|
1387
|
+
signAccountChallenge,
|
|
1341
1388
|
signInAccountAccess,
|
|
1342
1389
|
signInAccountIdentity,
|
|
1343
1390
|
stageAgentAuthority,
|
package/dist/react.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { f as ConnectError, S as SignInResult, I as PasskeyLoginConfig, A as AccountIdentityResult, C as CreateWalletResult, m as AgentDelegationMode } from './accountIdentity-
|
|
2
|
-
export { d as ConnectVault, R as RecoverOutcome, t as RecoverVault, g as WalletIdentityProof } from './accountIdentity-
|
|
3
|
-
import { i as DexterControlModel, a as WalletAccountRelationSnapshot, g as DexterConnectionIntent, e as AccountSessionInstaller, d as AccountSessionClearer, B as BindingFetch } from './connectionContract-
|
|
4
|
-
export { D as DexterConnectionCapability, h as DexterConnectionPermissions, j as DexterControlPrimaryAction, k as DexterControlStage } from './connectionContract-
|
|
1
|
+
import { f as ConnectError, S as SignInResult, I as PasskeyLoginConfig, A as AccountIdentityResult, C as CreateWalletResult, m as AgentDelegationMode } from './accountIdentity-BHazSkuz.js';
|
|
2
|
+
export { d as ConnectVault, R as RecoverOutcome, t as RecoverVault, g as WalletIdentityProof } from './accountIdentity-BHazSkuz.js';
|
|
3
|
+
import { i as DexterControlModel, a as WalletAccountRelationSnapshot, g as DexterConnectionIntent, e as AccountSessionInstaller, d as AccountSessionClearer, B as BindingFetch } from './connectionContract-CSZiddpS.js';
|
|
4
|
+
export { D as DexterConnectionCapability, h as DexterConnectionPermissions, j as DexterControlPrimaryAction, k as DexterControlStage } from './connectionContract-CSZiddpS.js';
|
|
5
5
|
import * as react from 'react';
|
|
6
6
|
import { ButtonHTMLAttributes, ReactNode, ReactElement, ComponentType, AnchorHTMLAttributes } from 'react';
|
|
7
7
|
|
|
@@ -140,6 +140,20 @@ interface CreateWalletPanelProps {
|
|
|
140
140
|
terminology?: 'wallet' | 'account';
|
|
141
141
|
/** Hide when the containing panel already carries Dexter's mark. */
|
|
142
142
|
withMark?: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Account wording only: fired with the new Account when the host has no
|
|
145
|
+
* credential handler. Dexter Wallet is now Dexter Account, so account wording always
|
|
146
|
+
* enrolls an Account; without either handler the panel says where it works.
|
|
147
|
+
*/
|
|
148
|
+
onAccountCreated?: (result: AccountIdentityResult) => void;
|
|
149
|
+
/** An equal-weight second choice shown beside the create button (e.g. Sign in). */
|
|
150
|
+
secondaryAction?: {
|
|
151
|
+
label: string;
|
|
152
|
+
onClick: () => void;
|
|
153
|
+
disabled?: boolean;
|
|
154
|
+
};
|
|
155
|
+
/** Replaces the passkey hint under the buttons. */
|
|
156
|
+
passkeyHintText?: string;
|
|
143
157
|
}
|
|
144
158
|
/** The turnkey consent-at-birth create panel. */
|
|
145
159
|
declare function CreateWalletPanel(props: CreateWalletPanelProps): ReactElement;
|
package/dist/react.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
authoredPolicy,
|
|
2
3
|
ceremonyPhaseLabel,
|
|
3
4
|
connectDexterIdentity,
|
|
4
5
|
createDexterControlModel,
|
|
@@ -7,10 +8,9 @@ import {
|
|
|
7
8
|
passkeySignalSupport,
|
|
8
9
|
prunePasskey,
|
|
9
10
|
renamePasskey
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-5B3IO3JU.js";
|
|
11
12
|
import {
|
|
12
13
|
ConnectError,
|
|
13
|
-
authoredPolicy,
|
|
14
14
|
createWallet,
|
|
15
15
|
disconnectActiveWallet,
|
|
16
16
|
ejectActiveWallet,
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
subscribe,
|
|
27
27
|
switchWallet,
|
|
28
28
|
walletProofSessionStore
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-SGWYN67U.js";
|
|
30
30
|
import {
|
|
31
31
|
DexterButton,
|
|
32
32
|
DexterMark,
|
|
@@ -716,6 +716,8 @@ function CreateWalletPanel(props) {
|
|
|
716
716
|
} = props;
|
|
717
717
|
const account = terminology === "account";
|
|
718
718
|
const credentialOnly = !!props.onCredentialCreated;
|
|
719
|
+
const { secondaryAction } = props;
|
|
720
|
+
const [accountReady, setAccountReady] = useState5(false);
|
|
719
721
|
useEffect5(ensureConsentStyles, []);
|
|
720
722
|
useEffect5(ensureDexterButtonStyles, []);
|
|
721
723
|
const nameInputId = useId2();
|
|
@@ -732,7 +734,7 @@ function CreateWalletPanel(props) {
|
|
|
732
734
|
}, [transport]);
|
|
733
735
|
const hosted = resolvedTransport === "popup";
|
|
734
736
|
const ownerOnly = credentialOnly || agentDelegation === "deferred";
|
|
735
|
-
const passkeyHint = account && ownerOnly && resolvedTransport === "inline";
|
|
737
|
+
const passkeyHint = Boolean(secondaryAction) || account && ownerOnly && resolvedTransport === "inline";
|
|
736
738
|
const policy = resolvedTransport === "inline" && !ownerOnly ? authoredPolicy(value ?? "") : null;
|
|
737
739
|
const canContinue = hosted || ownerOnly || Boolean(policy);
|
|
738
740
|
const statusText = running ? phase ? ceremonyPhaseLabel(phase) : "Starting your passkey\u2026" : resolvedTransport === "unknown" ? account ? "Preparing account setup..." : "Preparing wallet setup\u2026" : hosted ? account ? "Account setup continues in Dexter." : "Wallet setup continues in Dexter Wallet." : ownerOnly ? "" : policy ? "Ready to create." : "Choose an agent allowance.";
|
|
@@ -743,9 +745,11 @@ function CreateWalletPanel(props) {
|
|
|
743
745
|
setRunning(true);
|
|
744
746
|
setPhase(null);
|
|
745
747
|
try {
|
|
746
|
-
if (props.onCredentialCreated) {
|
|
748
|
+
if (props.onCredentialCreated || account) {
|
|
747
749
|
const result2 = await enrollAccountIdentity({ name: hosted ? void 0 : name.trim() || void 0, apiBase, transport, onPhase: setPhase });
|
|
748
|
-
props.onCredentialCreated(result2);
|
|
750
|
+
if (props.onCredentialCreated) props.onCredentialCreated(result2);
|
|
751
|
+
else if (props.onAccountCreated) props.onAccountCreated(result2);
|
|
752
|
+
else setAccountReady(true);
|
|
749
753
|
return;
|
|
750
754
|
}
|
|
751
755
|
const result = await createWallet({
|
|
@@ -793,7 +797,33 @@ function CreateWalletPanel(props) {
|
|
|
793
797
|
] }) : null : null,
|
|
794
798
|
error && /* @__PURE__ */ jsx2("div", { className: "dx-cwp__err", role: "alert", "aria-live": "assertive", children: error.message || error.code }),
|
|
795
799
|
statusText && /* @__PURE__ */ jsx2("p", { className: "dx-cwp__status", role: "status", "aria-live": "polite", children: statusText }),
|
|
796
|
-
/* @__PURE__ */ jsx2(
|
|
800
|
+
accountReady ? /* @__PURE__ */ jsx2("p", { className: "dx-cwp__status", role: "status", "aria-live": "polite", children: "Your Dexter Account is ready. It works at dexter.cash; this app can't use it yet." }) : secondaryAction ? /* @__PURE__ */ jsxs2("div", { className: "dx-cwp__choices", children: [
|
|
801
|
+
/* @__PURE__ */ jsx2(
|
|
802
|
+
"button",
|
|
803
|
+
{
|
|
804
|
+
type: "button",
|
|
805
|
+
className: "dx-cwp__secondary",
|
|
806
|
+
"aria-describedby": `${nameInputId}-hint`,
|
|
807
|
+
disabled: running || secondaryAction.disabled,
|
|
808
|
+
onClick: secondaryAction.onClick,
|
|
809
|
+
children: secondaryAction.label
|
|
810
|
+
}
|
|
811
|
+
),
|
|
812
|
+
/* @__PURE__ */ jsx2(
|
|
813
|
+
DexterButton,
|
|
814
|
+
{
|
|
815
|
+
block: true,
|
|
816
|
+
withMark,
|
|
817
|
+
className: "dx-cwp__cta",
|
|
818
|
+
"aria-describedby": passkeyHint ? `${nameInputId}-hint` : void 0,
|
|
819
|
+
loading: running,
|
|
820
|
+
loadingLabel: phase ? ceremonyPhaseLabel(phase) : "Creating\u2026",
|
|
821
|
+
disabled: !canContinue || resolvedTransport === "unknown",
|
|
822
|
+
onClick: handleCreate,
|
|
823
|
+
children: error ? "Retry" : account ? "Create my account" : "Create your Dexter Wallet"
|
|
824
|
+
}
|
|
825
|
+
)
|
|
826
|
+
] }) : /* @__PURE__ */ jsx2(
|
|
797
827
|
DexterButton,
|
|
798
828
|
{
|
|
799
829
|
block: true,
|
|
@@ -807,11 +837,11 @@ function CreateWalletPanel(props) {
|
|
|
807
837
|
children: error ? "Retry" : hosted ? account ? "Continue to Dexter" : "Continue to Dexter Wallet" : account ? ownerOnly ? "Create my account" : "Create account" : "Create your Dexter Wallet"
|
|
808
838
|
}
|
|
809
839
|
),
|
|
810
|
-
passkeyHint && /* @__PURE__ */ jsx2("p", { className: "dx-cwp__hint", id: `${nameInputId}-hint`, children: "Your device will ask for a passkey." }),
|
|
840
|
+
passkeyHint && !accountReady && /* @__PURE__ */ jsx2("p", { className: "dx-cwp__hint", id: `${nameInputId}-hint`, children: props.passkeyHintText ?? "Your device will ask for a passkey." }),
|
|
811
841
|
showName === "on-request" && resolvedTransport === "inline" && /* @__PURE__ */ jsxs2("details", { className: "dx-cwp__naming", children: [
|
|
812
842
|
/* @__PURE__ */ jsxs2("summary", { children: [
|
|
813
843
|
"Name this ",
|
|
814
|
-
credentialOnly
|
|
844
|
+
credentialOnly || account ? "passkey" : "wallet"
|
|
815
845
|
] }),
|
|
816
846
|
nameField
|
|
817
847
|
] })
|
|
@@ -972,6 +1002,43 @@ var ACCOUNT_CONTROL_CSS = `.dx-account-control,.dx-account-panel,.dx-account-pan
|
|
|
972
1002
|
letter-spacing: -.01em;
|
|
973
1003
|
}
|
|
974
1004
|
.dx-account-creation .dx-cwp__cta:hover:enabled { filter: brightness(1.045); }
|
|
1005
|
+
.dx-account-creation .dx-cwp__choices {
|
|
1006
|
+
display: grid;
|
|
1007
|
+
grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
|
|
1008
|
+
gap: 10px;
|
|
1009
|
+
width: 100%;
|
|
1010
|
+
}
|
|
1011
|
+
.dx-account-creation .dx-cwp__choices .dx-cwp__cta { width: 100%; min-width: 0; }
|
|
1012
|
+
.dx-account-creation .dx-cwp__secondary {
|
|
1013
|
+
box-sizing: border-box;
|
|
1014
|
+
width: 100%;
|
|
1015
|
+
min-width: 0;
|
|
1016
|
+
min-height: 48px;
|
|
1017
|
+
margin: 0;
|
|
1018
|
+
padding: 12px 22px;
|
|
1019
|
+
border: 1px solid #2b1b12;
|
|
1020
|
+
border-radius: 2px;
|
|
1021
|
+
background: #2b1b12;
|
|
1022
|
+
box-shadow: inset 0 1px 0 #ffffff1f, 0 1px 0 #2b1b1226;
|
|
1023
|
+
color: #fff8f1;
|
|
1024
|
+
font: inherit;
|
|
1025
|
+
font-size: 16px;
|
|
1026
|
+
font-weight: 700;
|
|
1027
|
+
line-height: 1.25;
|
|
1028
|
+
letter-spacing: -.01em;
|
|
1029
|
+
text-align: center;
|
|
1030
|
+
cursor: pointer;
|
|
1031
|
+
transition: background-color 140ms;
|
|
1032
|
+
}
|
|
1033
|
+
.dx-account-creation .dx-cwp__secondary:hover:enabled { background: #3d2a1f; }
|
|
1034
|
+
.dx-account-creation .dx-cwp__secondary:active:enabled,
|
|
1035
|
+
.dx-account-creation .dx-cwp__cta:active:enabled { transform: translateY(1px); }
|
|
1036
|
+
.dx-account-creation .dx-cwp__choices + .dx-cwp__hint { margin-top: 8px; text-align: center; }
|
|
1037
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1038
|
+
.dx-account-creation .dx-cwp__secondary { transition: none; }
|
|
1039
|
+
.dx-account-creation .dx-cwp__secondary:active:enabled,
|
|
1040
|
+
.dx-account-creation .dx-cwp__cta:active:enabled { transform: none; }
|
|
1041
|
+
}
|
|
975
1042
|
.dx-account-creation .dx-cwp__hint,
|
|
976
1043
|
.dx-account-creation .dx-cwp__status,
|
|
977
1044
|
.dx-account-creation .dx-cwp__hosted {
|
|
@@ -1520,6 +1587,15 @@ function DexterAccountControl({
|
|
|
1520
1587
|
terminology: "account",
|
|
1521
1588
|
showName: "on-request",
|
|
1522
1589
|
withMark: false,
|
|
1590
|
+
secondaryAction: {
|
|
1591
|
+
label: "Sign in",
|
|
1592
|
+
disabled: busy,
|
|
1593
|
+
onClick: () => {
|
|
1594
|
+
setCreateOpen(false);
|
|
1595
|
+
void run(credentialEntry ? "credential" : "connect");
|
|
1596
|
+
}
|
|
1597
|
+
},
|
|
1598
|
+
passkeyHintText: "Either way, your device asks for a passkey.",
|
|
1523
1599
|
onCredentialCreated: credentialEntry ? (result) => {
|
|
1524
1600
|
credentialEntry.accept(result);
|
|
1525
1601
|
setCreateOpen(false);
|
|
@@ -1536,8 +1612,7 @@ function DexterAccountControl({
|
|
|
1536
1612
|
setCreateOpen(false);
|
|
1537
1613
|
}
|
|
1538
1614
|
}
|
|
1539
|
-
)
|
|
1540
|
-
/* @__PURE__ */ jsx6("button", { type: "button", className: "dx-welcome-link", onClick: () => setCreateOpen(false), children: "Sign in instead" })
|
|
1615
|
+
)
|
|
1541
1616
|
] }),
|
|
1542
1617
|
/* @__PURE__ */ jsxs5("footer", { className: "dx-welcome-terms", children: [
|
|
1543
1618
|
"By creating an account, you agree to the",
|
package/package.json
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dexterai/connect",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.0",
|
|
4
4
|
"description": "Connect apps and agents to a self-custodial Dexter Wallet with passkey identity, governed authority, hosted signing, and verifiable sessions.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/Dexter-DAO/dexter-connect.git"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/Dexter-DAO/dexter-connect#readme",
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/Dexter-DAO/dexter-connect/issues"
|
|
12
|
+
},
|
|
5
13
|
"type": "module",
|
|
6
14
|
"packageManager": "npm@10.9.3",
|
|
7
15
|
"exports": {
|
|
@@ -65,5 +73,9 @@
|
|
|
65
73
|
"@simplewebauthn/browser": "^13.3.0",
|
|
66
74
|
"framer-motion": "^12.43.0",
|
|
67
75
|
"jose": "^6.2.3"
|
|
76
|
+
},
|
|
77
|
+
"publishConfig": {
|
|
78
|
+
"access": "public",
|
|
79
|
+
"provenance": true
|
|
68
80
|
}
|
|
69
81
|
}
|