@dexterai/connect 0.26.4 → 0.29.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 +185 -192
- package/dist/chunk-EMCGL64H.js +59 -0
- package/dist/{chunk-TLCQSAE5.js → chunk-T62F36N2.js} +2 -2
- package/dist/chunk-XKOVUW5P.js +1872 -0
- package/dist/connectionContract-QGRidIHM.d.ts +470 -0
- package/dist/index.d.ts +434 -10
- package/dist/index.js +816 -39
- package/dist/react.d.ts +69 -191
- package/dist/react.js +551 -490
- package/dist/server.d.ts +2 -1
- package/dist/server.js +80 -5
- package/dist/worldid.d.ts +2 -4
- package/dist/worldid.js +1 -1
- package/package.json +3 -2
- package/dist/chunk-H3NXC4S5.js +0 -1136
- package/dist/signals-dIHYwlPh.d.ts +0 -383
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { C as ConnectVault, R as RecoverWalletConfig, a as RecoverOutcome, b as
|
|
2
|
-
export {
|
|
1
|
+
import { C as ConnectVault, R as RecoverWalletConfig, a as RecoverOutcome, W as WalletIdentityProof, A as ActiveWalletBindingIdentity, b as WalletBindingCandidate, c as WalletAccountRelationSnapshot, B as BindingFetch, d as WalletAccountBindingClient, e as CeremonyPhase } from './connectionContract-QGRidIHM.js';
|
|
2
|
+
export { f as AccountBindingCandidate, g as AccountSessionClearer, h as AccountSessionInstaller, i as AgentDelegationMode, j as BindingResolutionResult, k as CeremonyOperation, l as ConnectDexterIdentityConfig, m as ConnectError, n as CreateWalletConfig, o as CreateWalletResult, D as DexterConnectConfig, p as DexterConnectionCapability, q as DexterConnectionIntent, r as DexterConnectionPermissions, s as DexterControlModel, t as DexterControlPrimaryAction, u as DexterControlStage, v as DisconnectDexterIdentityConfig, H as HostedSignRequestPayload, w as HostedSignResult, x as HostedSignVaultIdentity, P as PasskeyLoginTokens, y as RecoverVault, z as RelationCandidates, E as RelationCheckReason, F as RelationRuntime, G as ResolveWalletAccountBindingInput, I as ResolvedWalletAccountRelation, S as SESSION_TTL_30D, J as ServerRelationVerificationRequest, K as ServerRelationVerificationResult, L as ServerRelationVerifier, M as SignInResult, N as SpendPolicy, O as WALLET_ACCOUNT_BINDING_PATH, Q as WalletAccountBindingClientConfig, T as WalletAccountRelation, U as WalletAccountRelationController, V as WalletAccountRelationControllerOptions, X as accountBindingCandidate, Y as authoredPolicy, Z as connectDexterIdentity, _ as createDexterControlModel, $ as createWallet, a0 as createWalletAccountBindingClient, a1 as disconnectDexterIdentity, a2 as usdToAtomic, a3 as walletBindingCandidate } from './connectionContract-QGRidIHM.js';
|
|
3
3
|
import { PasskeySignerWithPublicKey } from '@dexterai/vault/signers';
|
|
4
|
+
import { PublicKeyCredentialRequestOptionsJSON, AuthenticationResponseJSON } from '@simplewebauthn/browser';
|
|
4
5
|
|
|
5
6
|
/** What `issueChallenge` returns to the SDK signer. */
|
|
6
7
|
interface AnonChallengeResult {
|
|
@@ -61,7 +62,7 @@ interface CreatePasskeySignerOptions {
|
|
|
61
62
|
* `vault.publicKey` is base64 (33-byte SEC1 compressed P-256); `vault.userHandle`
|
|
62
63
|
* is base64url (server-minted). Both are decoded to the Uint8Arrays the SDK wants.
|
|
63
64
|
*
|
|
64
|
-
* @param vault the
|
|
65
|
+
* @param vault the Wallet returned by a verified Dexter ceremony
|
|
65
66
|
* @param apiBase compatibility-only; omitted or exactly https://api.dexter.cash
|
|
66
67
|
* @param opts.__assertion test-only injected assertion (skips real WebAuthn)
|
|
67
68
|
*/
|
|
@@ -69,14 +70,169 @@ declare function createPasskeySigner(vault: ConnectVault, apiBase?: string, opts
|
|
|
69
70
|
|
|
70
71
|
declare function recoverWallet(config?: RecoverWalletConfig): Promise<RecoverOutcome>;
|
|
71
72
|
|
|
73
|
+
/** One localStorage entry per Wallet keeps inactive Wallet proofs independent. */
|
|
74
|
+
declare const WALLET_PROOF_SESSION_STORAGE_PREFIX: "dexter:wallet-identity-proof-session:";
|
|
75
|
+
declare const walletProofSessionBrand: unique symbol;
|
|
76
|
+
/**
|
|
77
|
+
* Public metadata for a locally retained Wallet proof. The signed proof is held
|
|
78
|
+
* out of enumerable properties, JSON, events, and roster state.
|
|
79
|
+
*/
|
|
80
|
+
interface WalletProofSession {
|
|
81
|
+
readonly kind: 'dexter_wallet_proof_session';
|
|
82
|
+
readonly handle: string;
|
|
83
|
+
/** Epoch seconds, matching the Dexter API ceremony response. */
|
|
84
|
+
readonly expiresAt: number;
|
|
85
|
+
readonly [walletProofSessionBrand]: true;
|
|
86
|
+
}
|
|
87
|
+
type WalletProofSessionOperation = 'saved' | 'cleared' | 'expired' | 'corrupted' | 'external';
|
|
88
|
+
/** Subscription events carry metadata only. */
|
|
89
|
+
interface WalletProofSessionEvent {
|
|
90
|
+
readonly operation: WalletProofSessionOperation;
|
|
91
|
+
/** Null means another tab cleared all localStorage. */
|
|
92
|
+
readonly handle: string | null;
|
|
93
|
+
readonly session: WalletProofSession | null;
|
|
94
|
+
}
|
|
95
|
+
type WalletProofLifecycleEvent = {
|
|
96
|
+
readonly type: 'wallet_removed_from_device';
|
|
97
|
+
readonly handle: string;
|
|
98
|
+
} | {
|
|
99
|
+
readonly type: 'browser_disconnected';
|
|
100
|
+
readonly handle: string;
|
|
101
|
+
} | {
|
|
102
|
+
readonly type: 'account_signed_out';
|
|
103
|
+
};
|
|
104
|
+
interface WalletProofSessionStorage {
|
|
105
|
+
getItem(key: string): string | null;
|
|
106
|
+
setItem(key: string, value: string): void;
|
|
107
|
+
removeItem(key: string): void;
|
|
108
|
+
}
|
|
109
|
+
interface WalletProofStorageEvent {
|
|
110
|
+
readonly key: string | null;
|
|
111
|
+
readonly newValue: string | null;
|
|
112
|
+
readonly storageArea?: WalletProofSessionStorage | null;
|
|
113
|
+
}
|
|
114
|
+
interface WalletProofStorageEventSource {
|
|
115
|
+
addEventListener(type: 'storage', listener: (event: WalletProofStorageEvent) => void): void;
|
|
116
|
+
removeEventListener(type: 'storage', listener: (event: WalletProofStorageEvent) => void): void;
|
|
117
|
+
}
|
|
118
|
+
interface WalletProofSessionStoreOptions {
|
|
119
|
+
/** Omit for browser localStorage. Pass null in non-browser adapters. */
|
|
120
|
+
readonly storage?: WalletProofSessionStorage | null;
|
|
121
|
+
/** Omit for the browser window. Pass null to disable cross-tab events. */
|
|
122
|
+
readonly eventSource?: WalletProofStorageEventSource | null;
|
|
123
|
+
/** Injectable clock returning epoch seconds. */
|
|
124
|
+
readonly nowEpochSeconds?: () => number;
|
|
125
|
+
}
|
|
126
|
+
interface WalletProofSessionStore {
|
|
127
|
+
/** Persist the proof returned as `walletIdentityProof` by a ceremony. */
|
|
128
|
+
save(handle: string, walletIdentityProof: WalletIdentityProof): WalletProofSession | null;
|
|
129
|
+
/** Load unexpired metadata for one Wallet. */
|
|
130
|
+
load(handle: string): WalletProofSession | null;
|
|
131
|
+
/** Build an opaque API candidate without returning the proof string. */
|
|
132
|
+
bindingCandidate(handle: string, activeWallet: ActiveWalletBindingIdentity): WalletBindingCandidate | null;
|
|
133
|
+
/** Clear one Wallet's retained proof. */
|
|
134
|
+
clear(handle: string): boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Apply explicit lifecycle meaning. Only device removal clears a proof;
|
|
137
|
+
* browser disconnect and account sign-out are separate state changes.
|
|
138
|
+
*/
|
|
139
|
+
handleLifecycle(event: WalletProofLifecycleEvent): boolean;
|
|
140
|
+
/** Subscribe to local and cross-tab proof metadata changes. */
|
|
141
|
+
subscribe(listener: (event: WalletProofSessionEvent) => void): () => void;
|
|
142
|
+
dispose(): void;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Create the framework-neutral Wallet proof-session adapter. The default uses
|
|
146
|
+
* browser localStorage and listens for cross-tab changes. It remains inert on
|
|
147
|
+
* the server and in storage-restricted browsers.
|
|
148
|
+
*/
|
|
149
|
+
declare function createWalletProofSessionStore(options?: WalletProofSessionStoreOptions): WalletProofSessionStore;
|
|
150
|
+
/** Shared browser store used by Connect ceremonies and Wallet lifecycle verbs. */
|
|
151
|
+
declare const walletProofSessionStore: WalletProofSessionStore;
|
|
152
|
+
|
|
153
|
+
interface DexterIdentityCoordinatorOptions {
|
|
154
|
+
/** Compatibility option; only the canonical Dexter API origin is accepted. */
|
|
155
|
+
readonly apiBase?: string;
|
|
156
|
+
/** Injectable for tests and hosts with a custom fetch adapter. */
|
|
157
|
+
readonly fetch?: BindingFetch;
|
|
158
|
+
/** Injectable browser proof store. The shared Connect store is the default. */
|
|
159
|
+
readonly proofSessionStore?: WalletProofSessionStore;
|
|
160
|
+
/** Injectable binding client for non-browser runtimes and tests. */
|
|
161
|
+
readonly bindingClient?: WalletAccountBindingClient;
|
|
162
|
+
}
|
|
163
|
+
interface DexterIdentityCoordinator {
|
|
164
|
+
getSnapshot(): WalletAccountRelationSnapshot;
|
|
165
|
+
subscribe(listener: (snapshot: WalletAccountRelationSnapshot) => void): () => void;
|
|
166
|
+
/** Restore the active Wallet and current account session as one relationship. */
|
|
167
|
+
restore(accountAccessToken: string | null): Promise<WalletAccountRelationSnapshot>;
|
|
168
|
+
/** Update only the account session. Account sign-out keeps the Wallet session. */
|
|
169
|
+
setAccountSession(accountAccessToken: string | null): Promise<WalletAccountRelationSnapshot>;
|
|
170
|
+
/** Lock account-owned data while the host restores its account session. */
|
|
171
|
+
setAccountLoading(): void;
|
|
172
|
+
/** Admit only the exact account token returned by the verified transition. */
|
|
173
|
+
allowAccountSession(accountAccessToken: string): void;
|
|
174
|
+
retry(): Promise<WalletAccountRelationSnapshot>;
|
|
175
|
+
dispose(): void;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Own the browser's Wallet/account relationship as one package-level session.
|
|
179
|
+
* Consumers supply the current account access token; Connect owns Wallet
|
|
180
|
+
* changes, retained Wallet proof loading, server verification, and stale-check
|
|
181
|
+
* cancellation.
|
|
182
|
+
*/
|
|
183
|
+
declare function createDexterIdentityCoordinator(options?: DexterIdentityCoordinatorOptions): DexterIdentityCoordinator;
|
|
184
|
+
|
|
72
185
|
/**
|
|
73
186
|
* Human-readable label for a ceremony phase — the live "connecting step" copy.
|
|
74
|
-
*
|
|
75
|
-
* flows) show identical wording. Consumers surfacing createWallet's `onPhase`
|
|
76
|
-
* should use this instead of hand-rolling their own strings (Rule #7).
|
|
187
|
+
* One source of truth for sign-in and Wallet-creation progress labels.
|
|
77
188
|
*/
|
|
78
189
|
declare function ceremonyPhaseLabel(phase: CeremonyPhase): string;
|
|
79
190
|
|
|
191
|
+
interface PasskeySignalSupport {
|
|
192
|
+
/** signalCurrentUserDetails — rename a passkey post-creation. */
|
|
193
|
+
rename: boolean;
|
|
194
|
+
/** signalUnknownCredential — remove one stale passkey from the manager. */
|
|
195
|
+
prune: boolean;
|
|
196
|
+
/** signalAllAcceptedCredentials — reconcile the full valid set. */
|
|
197
|
+
syncAccepted: boolean;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* What the CURRENT browser supports, by direct feature-detection. Instant, no
|
|
201
|
+
* network, no UA sniffing — tells you exactly what will light up on THIS device
|
|
202
|
+
* (e.g. call once on Branch's iPhone to learn its Safari's status).
|
|
203
|
+
*/
|
|
204
|
+
declare function passkeySignalSupport(): PasskeySignalSupport;
|
|
205
|
+
/**
|
|
206
|
+
* Rename a passkey in the OS keychain AFTER creation. `userId` is the base64url
|
|
207
|
+
* user handle; `rpId` defaults to the current host. Returns true if the signal
|
|
208
|
+
* fired, false if unsupported/failed (caller treats false as "left as-is").
|
|
209
|
+
*/
|
|
210
|
+
declare function renamePasskey(args: {
|
|
211
|
+
userId: string;
|
|
212
|
+
name: string;
|
|
213
|
+
displayName?: string;
|
|
214
|
+
rpId?: string;
|
|
215
|
+
}): Promise<boolean>;
|
|
216
|
+
/**
|
|
217
|
+
* Tell the OS manager a credential is gone so it removes that passkey from the
|
|
218
|
+
* user's list — the welded-old-wallet auto-cleanup. `credentialId` is base64url.
|
|
219
|
+
* Returns true if fired, false if unsupported/failed.
|
|
220
|
+
*/
|
|
221
|
+
declare function prunePasskey(args: {
|
|
222
|
+
credentialId: string;
|
|
223
|
+
rpId?: string;
|
|
224
|
+
}): Promise<boolean>;
|
|
225
|
+
/**
|
|
226
|
+
* Declare the FULL set of still-valid credential IDs for a user; the manager
|
|
227
|
+
* prunes anything not listed. Use after sign-in or eject to reconcile in one
|
|
228
|
+
* shot (pass `[]` to clear all of a user's passkeys). Returns true if fired.
|
|
229
|
+
*/
|
|
230
|
+
declare function syncAcceptedPasskeys(args: {
|
|
231
|
+
userId: string;
|
|
232
|
+
acceptedCredentialIds: string[];
|
|
233
|
+
rpId?: string;
|
|
234
|
+
}): Promise<boolean>;
|
|
235
|
+
|
|
80
236
|
/** The automatic role-2 agent-spend rail. */
|
|
81
237
|
interface AutomaticAgentSpend {
|
|
82
238
|
/** true = agent-spend is ON (not revoked). Derived from revokedAt === null. */
|
|
@@ -159,11 +315,11 @@ declare function assembleAgentSpendStatus(status: RawAgentSpendStatus, sessions?
|
|
|
159
315
|
/**
|
|
160
316
|
* The minimal identity the off/on switch needs: WHO is active + the wallet
|
|
161
317
|
* handle the anon router keys on. Structurally satisfied by connect's
|
|
162
|
-
*
|
|
318
|
+
* The canonical connection identity can be passed through directly.
|
|
163
319
|
*/
|
|
164
320
|
interface AgentSpendIdentity {
|
|
165
|
-
/**
|
|
166
|
-
kind:
|
|
321
|
+
/** Agent controls require an active Wallet and reject account-only/conflict states. */
|
|
322
|
+
kind: 'wallet_only' | 'bound';
|
|
167
323
|
/** The passkey-vault user handle the anon router addresses, or null. */
|
|
168
324
|
userHandle: string | null;
|
|
169
325
|
}
|
|
@@ -215,4 +371,272 @@ interface EnableAgentSpendResult {
|
|
|
215
371
|
*/
|
|
216
372
|
declare function enableAgentSpend(id: AgentSpendIdentity, vaultPda: string, apiOrigin: string, credentialId?: string | null, signer?: AgentSpendOperationSigner): Promise<EnableAgentSpendResult>;
|
|
217
373
|
|
|
218
|
-
|
|
374
|
+
declare const AGENT_AUTHORITY_NAMESPACE: "dexter-governed-agent-surface-selection/v2";
|
|
375
|
+
declare const AGENT_AUTHORITY_STATUS_NAMESPACE: "dexter-governed-agent-surface-authority/v2";
|
|
376
|
+
declare const X402_PROTOCOL_ID: "x402";
|
|
377
|
+
declare const X402_PROTOCOL_VERSION: 2;
|
|
378
|
+
declare const X402_ALLOWED_SCHEMES: readonly ["exact", "tab"];
|
|
379
|
+
declare const X402_ASSET: "usdc";
|
|
380
|
+
declare const X402_COUNTERPARTY_SCOPE: "any-valid-x402-seller";
|
|
381
|
+
declare const MAX_AUTHORITY_AMOUNT_ATOMIC: "18446744073709551615";
|
|
382
|
+
type AgentAuthorityTarget = Readonly<{
|
|
383
|
+
kind: 'oauth-code';
|
|
384
|
+
requestId: string;
|
|
385
|
+
}> | Readonly<{
|
|
386
|
+
kind: 'device-code';
|
|
387
|
+
userCode: string;
|
|
388
|
+
}>;
|
|
389
|
+
type AgentAuthorityApprovalMode = 'never' | 'always' | 'amount_or_risk';
|
|
390
|
+
interface AgentAuthorityRuleBase {
|
|
391
|
+
assetId: string;
|
|
392
|
+
maxAmountAtomic: string;
|
|
393
|
+
maxDailyAmountAtomic: string;
|
|
394
|
+
maxAggregateAmountAtomic: string;
|
|
395
|
+
approvalMode: AgentAuthorityApprovalMode;
|
|
396
|
+
approvalThresholdAtomic: string | null;
|
|
397
|
+
approvalEscalationReasons: readonly string[];
|
|
398
|
+
blockedEscalationReasons: readonly string[];
|
|
399
|
+
}
|
|
400
|
+
interface X402PaymentAuthorityRule extends AgentAuthorityRuleBase {
|
|
401
|
+
assetId: typeof X402_ASSET;
|
|
402
|
+
action: 'pay';
|
|
403
|
+
protocolId: typeof X402_PROTOCOL_ID;
|
|
404
|
+
protocolVersion: typeof X402_PROTOCOL_VERSION;
|
|
405
|
+
allowedSchemes: typeof X402_ALLOWED_SCHEMES;
|
|
406
|
+
counterpartyScope: typeof X402_COUNTERPARTY_SCOPE;
|
|
407
|
+
}
|
|
408
|
+
interface TradeAuthorityRule extends AgentAuthorityRuleBase {
|
|
409
|
+
action: 'buy' | 'sell';
|
|
410
|
+
maxSlippageBps: number;
|
|
411
|
+
maxPriceImpactBps: number;
|
|
412
|
+
}
|
|
413
|
+
type AgentAuthorityRule = X402PaymentAuthorityRule | TradeAuthorityRule;
|
|
414
|
+
interface AgentAuthorityBootstrapRequest {
|
|
415
|
+
expectedVaultPda: string;
|
|
416
|
+
target: AgentAuthorityTarget;
|
|
417
|
+
agentLabel: string | null;
|
|
418
|
+
grantExpiresAt: string;
|
|
419
|
+
rules: readonly AgentAuthorityRule[];
|
|
420
|
+
}
|
|
421
|
+
type StagedAgentAuthorityRule = AgentAuthorityRule & Readonly<{
|
|
422
|
+
id: string;
|
|
423
|
+
}>;
|
|
424
|
+
interface AgentAuthorityAuthorization {
|
|
425
|
+
namespace: typeof AGENT_AUTHORITY_NAMESPACE;
|
|
426
|
+
status: 'owner_authorization_required';
|
|
427
|
+
selectionId: string;
|
|
428
|
+
operationId: string;
|
|
429
|
+
ownerVaultPda: string;
|
|
430
|
+
target: AgentAuthorityTarget;
|
|
431
|
+
agentId: string;
|
|
432
|
+
grantId: string;
|
|
433
|
+
validFrom: string;
|
|
434
|
+
grantExpiresAt: string;
|
|
435
|
+
rules: readonly StagedAgentAuthorityRule[];
|
|
436
|
+
rulesDigest: string;
|
|
437
|
+
authorizationId: string;
|
|
438
|
+
authorizationExpiresAt: string;
|
|
439
|
+
authorizationOptions: PublicKeyCredentialRequestOptionsJSON;
|
|
440
|
+
selectionDigest: string;
|
|
441
|
+
request: AgentAuthorityBootstrapRequest;
|
|
442
|
+
}
|
|
443
|
+
interface AgentAuthorityStagedReceipt {
|
|
444
|
+
namespace: typeof AGENT_AUTHORITY_NAMESPACE;
|
|
445
|
+
status: 'owner_authorized';
|
|
446
|
+
selectionId: string;
|
|
447
|
+
operationId: string;
|
|
448
|
+
ownerVaultPda: string;
|
|
449
|
+
target: AgentAuthorityTarget;
|
|
450
|
+
agentId: string;
|
|
451
|
+
grantId: string;
|
|
452
|
+
validFrom: string;
|
|
453
|
+
grantExpiresAt: string;
|
|
454
|
+
rules: readonly StagedAgentAuthorityRule[];
|
|
455
|
+
rulesDigest: string;
|
|
456
|
+
authorizationId: string;
|
|
457
|
+
selectionDigest: string;
|
|
458
|
+
}
|
|
459
|
+
interface AgentAuthorityCapacity {
|
|
460
|
+
maximumPerCallAmountAtomic: string;
|
|
461
|
+
remainingPerCallAmountAtomic: string;
|
|
462
|
+
maximumDailyAmountAtomic: string;
|
|
463
|
+
usedDailyAmountAtomic: string;
|
|
464
|
+
remainingDailyAmountAtomic: string;
|
|
465
|
+
maximumAggregateAmountAtomic: string;
|
|
466
|
+
usedAggregateAmountAtomic: string;
|
|
467
|
+
remainingAggregateAmountAtomic: string;
|
|
468
|
+
evaluatedAt: string;
|
|
469
|
+
snapshotDigest: string;
|
|
470
|
+
}
|
|
471
|
+
type AgentAuthorityActiveRole = Readonly<{
|
|
472
|
+
status: 'active';
|
|
473
|
+
roleId: number;
|
|
474
|
+
authoritySigner: string;
|
|
475
|
+
sessionExpirySlot: number;
|
|
476
|
+
currentSlot: number;
|
|
477
|
+
resolutionDigest: string;
|
|
478
|
+
}> | Readonly<{
|
|
479
|
+
status: 'not-applicable' | 'unavailable';
|
|
480
|
+
reason: string;
|
|
481
|
+
}>;
|
|
482
|
+
interface AgentAuthorityStatus {
|
|
483
|
+
namespace: typeof AGENT_AUTHORITY_STATUS_NAMESPACE;
|
|
484
|
+
mode: 'view_only' | 'bounded_payment_authority' | 'unavailable';
|
|
485
|
+
active: boolean;
|
|
486
|
+
inactiveReason: string | null;
|
|
487
|
+
logicalGrantActive: boolean;
|
|
488
|
+
principal: Readonly<{
|
|
489
|
+
actor: 'owner' | 'agent';
|
|
490
|
+
vaultPda: string;
|
|
491
|
+
walletAddress: string;
|
|
492
|
+
agentId: string | null;
|
|
493
|
+
}> | null;
|
|
494
|
+
source: 'mcp-link-token' | null;
|
|
495
|
+
grantId: string | null;
|
|
496
|
+
grantRevision: number | null;
|
|
497
|
+
expiresAt: string | null;
|
|
498
|
+
scopes: Readonly<{
|
|
499
|
+
network: 'solana-mainnet';
|
|
500
|
+
assetId: typeof X402_ASSET;
|
|
501
|
+
action: 'pay';
|
|
502
|
+
protocolId: typeof X402_PROTOCOL_ID;
|
|
503
|
+
protocolVersion: typeof X402_PROTOCOL_VERSION;
|
|
504
|
+
allowedSchemes: typeof X402_ALLOWED_SCHEMES;
|
|
505
|
+
counterpartyScope: typeof X402_COUNTERPARTY_SCOPE;
|
|
506
|
+
}> | null;
|
|
507
|
+
capacity: AgentAuthorityCapacity | null;
|
|
508
|
+
revoked: boolean | null;
|
|
509
|
+
activeRole: AgentAuthorityActiveRole;
|
|
510
|
+
fallback: false;
|
|
511
|
+
}
|
|
512
|
+
type X402LimitDraft = Readonly<{
|
|
513
|
+
perPaymentUsd: string;
|
|
514
|
+
dailyUsd: string;
|
|
515
|
+
aggregateUsd: string;
|
|
516
|
+
expiresInDays: string;
|
|
517
|
+
}>;
|
|
518
|
+
type X402Limits = Readonly<{
|
|
519
|
+
perPaymentAtomic: string;
|
|
520
|
+
dailyAtomic: string;
|
|
521
|
+
aggregateAtomic: string;
|
|
522
|
+
expiresAt: string;
|
|
523
|
+
}>;
|
|
524
|
+
type X402LimitValidation = Readonly<{
|
|
525
|
+
ok: true;
|
|
526
|
+
limits: X402Limits;
|
|
527
|
+
}> | Readonly<{
|
|
528
|
+
ok: false;
|
|
529
|
+
field: keyof X402LimitDraft;
|
|
530
|
+
message: string;
|
|
531
|
+
}>;
|
|
532
|
+
type BoundedX402Draft = X402LimitDraft;
|
|
533
|
+
type BoundedX402Limits = X402Limits;
|
|
534
|
+
type BoundedX402Validation = X402LimitValidation;
|
|
535
|
+
type BoundedX402Rule = X402PaymentAuthorityRule;
|
|
536
|
+
type BoundedX402BootstrapRequest = AgentAuthorityBootstrapRequest & Readonly<{
|
|
537
|
+
target: Readonly<{
|
|
538
|
+
kind: 'oauth-code';
|
|
539
|
+
requestId: string;
|
|
540
|
+
}>;
|
|
541
|
+
agentLabel: string;
|
|
542
|
+
rules: readonly [X402PaymentAuthorityRule];
|
|
543
|
+
}>;
|
|
544
|
+
interface BoundedX402Authorization {
|
|
545
|
+
selectionId: string;
|
|
546
|
+
operationId: string;
|
|
547
|
+
ownerVaultPda: string;
|
|
548
|
+
authorizationId: string;
|
|
549
|
+
authorizationOptions: PublicKeyCredentialRequestOptionsJSON;
|
|
550
|
+
agentId: string;
|
|
551
|
+
grantId: string;
|
|
552
|
+
validFrom: string;
|
|
553
|
+
rulesDigest: string;
|
|
554
|
+
selectionDigest: string;
|
|
555
|
+
request: BoundedX402BootstrapRequest;
|
|
556
|
+
}
|
|
557
|
+
interface BoundedX402StagedReceipt {
|
|
558
|
+
namespace: typeof AGENT_AUTHORITY_NAMESPACE;
|
|
559
|
+
status: 'owner_authorized';
|
|
560
|
+
selectionId: string;
|
|
561
|
+
operationId: string;
|
|
562
|
+
ownerVaultPda: string;
|
|
563
|
+
target: Readonly<{
|
|
564
|
+
kind: 'oauth-code';
|
|
565
|
+
requestId: string;
|
|
566
|
+
}>;
|
|
567
|
+
agentId: string;
|
|
568
|
+
grantId: string;
|
|
569
|
+
validFrom: string;
|
|
570
|
+
grantExpiresAt: string;
|
|
571
|
+
rules: readonly [StagedAgentAuthorityRule];
|
|
572
|
+
rulesDigest: string;
|
|
573
|
+
authorizationId: string;
|
|
574
|
+
selectionDigest: string;
|
|
575
|
+
}
|
|
576
|
+
declare class AgentAuthorityError extends Error {
|
|
577
|
+
readonly code: 'invalid_input' | 'owner_required' | 'request_refused' | 'invalid_response';
|
|
578
|
+
readonly status: number | null;
|
|
579
|
+
readonly serverCode: string | null;
|
|
580
|
+
constructor(code: 'invalid_input' | 'owner_required' | 'request_refused' | 'invalid_response', message: string, status?: number | null, serverCode?: string | null);
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
declare function noCustomX402Limits(nowUnixMs?: number): X402Limits;
|
|
584
|
+
/** Parse owner-authored x402 limits without floating point. */
|
|
585
|
+
declare function validateBoundedX402Draft(draft: X402LimitDraft, nowUnixMs?: number): X402LimitValidation;
|
|
586
|
+
declare function buildX402PaymentRule(limits: Pick<X402Limits, 'perPaymentAtomic' | 'dailyAtomic' | 'aggregateAtomic'>, approval?: Readonly<{
|
|
587
|
+
mode?: AgentAuthorityApprovalMode;
|
|
588
|
+
thresholdAtomic?: string | null;
|
|
589
|
+
escalationReasons?: readonly string[];
|
|
590
|
+
blockedReasons?: readonly string[];
|
|
591
|
+
}>): X402PaymentAuthorityRule;
|
|
592
|
+
declare function buildAgentAuthorityRequest(input: {
|
|
593
|
+
target: AgentAuthorityTarget;
|
|
594
|
+
expectedVaultPda: string;
|
|
595
|
+
agentLabel?: string | null;
|
|
596
|
+
grantExpiresAt: string;
|
|
597
|
+
rules: readonly AgentAuthorityRule[];
|
|
598
|
+
}): AgentAuthorityBootstrapRequest;
|
|
599
|
+
declare function buildBoundedX402BootstrapRequest(input: {
|
|
600
|
+
requestId: string;
|
|
601
|
+
expectedVaultPda: string;
|
|
602
|
+
agentLabel: string;
|
|
603
|
+
limits: X402Limits;
|
|
604
|
+
}): BoundedX402BootstrapRequest;
|
|
605
|
+
declare function beginAgentAuthority(input: {
|
|
606
|
+
ownerAccessToken: string;
|
|
607
|
+
operationId: string;
|
|
608
|
+
request: AgentAuthorityBootstrapRequest;
|
|
609
|
+
apiBase?: string;
|
|
610
|
+
fetchImpl?: typeof fetch;
|
|
611
|
+
}): Promise<AgentAuthorityAuthorization>;
|
|
612
|
+
declare function stageAgentAuthority(input: {
|
|
613
|
+
ownerAccessToken: string;
|
|
614
|
+
authorization: AgentAuthorityAuthorization;
|
|
615
|
+
credential: AuthenticationResponseJSON;
|
|
616
|
+
apiBase?: string;
|
|
617
|
+
fetchImpl?: typeof fetch;
|
|
618
|
+
}): Promise<AgentAuthorityStagedReceipt>;
|
|
619
|
+
declare function beginBoundedX402Authority(input: {
|
|
620
|
+
accessToken: string;
|
|
621
|
+
operationId: string;
|
|
622
|
+
request: BoundedX402BootstrapRequest;
|
|
623
|
+
apiBase?: string;
|
|
624
|
+
fetchImpl?: typeof fetch;
|
|
625
|
+
}): Promise<BoundedX402Authorization>;
|
|
626
|
+
declare function stageBoundedX402Authority(input: {
|
|
627
|
+
accessToken: string;
|
|
628
|
+
authorization: BoundedX402Authorization;
|
|
629
|
+
credential: AuthenticationResponseJSON;
|
|
630
|
+
apiBase?: string;
|
|
631
|
+
fetchImpl?: typeof fetch;
|
|
632
|
+
}): Promise<BoundedX402StagedReceipt>;
|
|
633
|
+
declare function exactAgentAuthorityApprovalRedirect(value: unknown, expectedGrantId: string): string;
|
|
634
|
+
declare function exactBoundedX402ApprovalRedirect(value: unknown, expectedGrantId: string): string;
|
|
635
|
+
/** Read the current grant, capacity, and live role behind an OpenDexter bearer. */
|
|
636
|
+
declare function readAgentAuthority(input: {
|
|
637
|
+
accessToken: string;
|
|
638
|
+
apiBase?: string;
|
|
639
|
+
fetchImpl?: typeof fetch;
|
|
640
|
+
}): Promise<AgentAuthorityStatus>;
|
|
641
|
+
|
|
642
|
+
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 };
|