@dexterai/connect 0.25.2 → 0.26.3
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 +52 -6
- package/dist/{chunk-4AJ5BYFW.js → chunk-XQ7RKJMI.js} +280 -42
- package/dist/index.d.ts +31 -18
- package/dist/index.js +190 -31
- package/dist/react.d.ts +13 -9
- package/dist/react.js +56 -8
- package/dist/{signals-C4JSE_4X.d.ts → signals-Dx090EYY.d.ts} +53 -3
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { C as ConnectVault, R as RecoverWalletConfig, a as RecoverOutcome, b as CeremonyPhase, I as IdentityKind } from './signals-
|
|
2
|
-
export { A as ACTIVE_WALLET_STORAGE_KEY, c as
|
|
3
|
-
import {
|
|
1
|
+
import { C as ConnectVault, R as RecoverWalletConfig, a as RecoverOutcome, b as CeremonyPhase, I as IdentityKind } from './signals-Dx090EYY.js';
|
|
2
|
+
export { A as ACTIVE_WALLET_STORAGE_KEY, c as CeremonyOperation, d as ConnectError, e as ContinueResult, f as CreateWalletConfig, g as CreateWalletResult, D as DexterConnectConfig, H as HostedSignRequestPayload, h as HostedSignResult, i as HostedSignVaultIdentity, j as IdentityInput, P as PasskeyLoginConfig, k as PasskeyLoginTokens, l as PasskeySignalSupport, m as RecoverVault, n as ResolvedIdentity, S as SESSION_TTL_30D, o as SignInResult, p as SpendPolicy, q as StoredWallet, W as WalletStoreMode, r as authoredPolicy, s as continueWithDexter, t as createWallet, u as ejectActiveWallet, v as forgetWallet, w as getActiveHandle, x as getCredentialId, y as listWallets, z as passkeyLogin, B as passkeySignalSupport, E as prunePasskey, F as renamePasskey, G as resolveIdentity, J as setActiveHandle, K as subscribeWallet, L as switchWallet, M as syncAcceptedPasskeys, N as usdToAtomic } from './signals-Dx090EYY.js';
|
|
3
|
+
import { PasskeySignerWithPublicKey } from '@dexterai/vault/signers';
|
|
4
4
|
|
|
5
5
|
/** What `issueChallenge` returns to the SDK signer. */
|
|
6
6
|
interface AnonChallengeResult {
|
|
7
|
-
/** Server-issued
|
|
7
|
+
/** Server-issued canonical 200-byte passkey-authorization envelope. */
|
|
8
8
|
challenge: Uint8Array;
|
|
9
9
|
/** Credential id the server resolved from the userHandle (allowCredentials[0]). */
|
|
10
10
|
credentialId: Uint8Array;
|
|
@@ -15,6 +15,7 @@ interface AnonChallengeResult {
|
|
|
15
15
|
interface AnonServerPolicy {
|
|
16
16
|
issueChallenge(args: {
|
|
17
17
|
userHandle: Uint8Array;
|
|
18
|
+
operationMessage: Uint8Array;
|
|
18
19
|
operationHash: Uint8Array;
|
|
19
20
|
}): Promise<AnonChallengeResult>;
|
|
20
21
|
verify(args: {
|
|
@@ -28,10 +29,11 @@ interface AnonServerPolicy {
|
|
|
28
29
|
/**
|
|
29
30
|
* Build the anon ServerPolicy for a given dexter-api base.
|
|
30
31
|
*
|
|
31
|
-
* `issueChallenge` → POST /challenge
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
32
|
+
* `issueChallenge` → POST /challenge
|
|
33
|
+
* { userHandle, operationHash, operationMessage,
|
|
34
|
+
* operation: 'vault_operation' }.
|
|
35
|
+
* The server returns the canonical authorization envelope; the SDK validates
|
|
36
|
+
* its operation/program/vault binding before invoking WebAuthn.
|
|
35
37
|
* `verify` → POST /verify { credential, userHandle }. NOTE: the SDK hands us the
|
|
36
38
|
* COMPACT 64-byte signature; dexter-api's WebAuthn verifier wants DER, so we
|
|
37
39
|
* re-encode compact → DER here (compactSignatureToDer).
|
|
@@ -47,6 +49,12 @@ type AssertionLike = {
|
|
|
47
49
|
authenticatorData: Uint8Array;
|
|
48
50
|
}>;
|
|
49
51
|
};
|
|
52
|
+
interface CreatePasskeySignerOptions {
|
|
53
|
+
/** Compatibility-only hosted page; omitted or exactly Dexter's pinned URL. */
|
|
54
|
+
connectHost?: string;
|
|
55
|
+
/** Test-only injected assertion. Never used by the off-origin hosted path. */
|
|
56
|
+
__assertion?: AssertionLike;
|
|
57
|
+
}
|
|
50
58
|
/**
|
|
51
59
|
* Construct the guest signer from a connected `ConnectVault`.
|
|
52
60
|
*
|
|
@@ -54,12 +62,10 @@ type AssertionLike = {
|
|
|
54
62
|
* is base64url (server-minted). Both are decoded to the Uint8Arrays the SDK wants.
|
|
55
63
|
*
|
|
56
64
|
* @param vault the connected vault from useSignInWithDexter()
|
|
57
|
-
* @param apiBase
|
|
65
|
+
* @param apiBase compatibility-only; omitted or exactly https://api.dexter.cash
|
|
58
66
|
* @param opts.__assertion test-only injected assertion (skips real WebAuthn)
|
|
59
67
|
*/
|
|
60
|
-
declare function createPasskeySigner(vault: ConnectVault, apiBase?: string, opts?:
|
|
61
|
-
__assertion?: AssertionLike;
|
|
62
|
-
}): DexterApiBrowserPasskeySigner;
|
|
68
|
+
declare function createPasskeySigner(vault: ConnectVault, apiBase?: string, opts?: CreatePasskeySignerOptions): PasskeySignerWithPublicKey;
|
|
63
69
|
|
|
64
70
|
declare function recoverWallet(config?: RecoverWalletConfig): Promise<RecoverOutcome>;
|
|
65
71
|
|
|
@@ -168,6 +174,14 @@ declare class AgentSpendError extends Error {
|
|
|
168
174
|
}
|
|
169
175
|
/** Map an AgentSpendError.code to plain, user-facing copy. */
|
|
170
176
|
declare function describeAgentSpendError(code: string): string;
|
|
177
|
+
/** A caller may supply Connect's hosted signer on an arbitrary website. */
|
|
178
|
+
interface AgentSpendOperationSigner {
|
|
179
|
+
signOperation(operationMessage: Uint8Array): Promise<{
|
|
180
|
+
signature: Uint8Array;
|
|
181
|
+
clientDataJSON: Uint8Array;
|
|
182
|
+
authenticatorData: Uint8Array;
|
|
183
|
+
}>;
|
|
184
|
+
}
|
|
171
185
|
interface RevokeAgentSpendResult {
|
|
172
186
|
revoked: boolean;
|
|
173
187
|
}
|
|
@@ -179,12 +193,11 @@ interface RevokeAgentSpendResult {
|
|
|
179
193
|
*
|
|
180
194
|
* @param id WHO is active — must be the passkey-vault (Dexter Wallet).
|
|
181
195
|
* @param vaultPda The vault PDA, base58 string. Becomes the signed message.
|
|
182
|
-
* @param apiOrigin
|
|
183
|
-
* caller owns env; connect reads none.
|
|
196
|
+
* @param apiOrigin Compatibility-only: must be https://api.dexter.cash.
|
|
184
197
|
* @param credentialId The wallet's passkey credential id (base64url), to make
|
|
185
198
|
* the assertion a direct biometric, not an account picker.
|
|
186
199
|
*/
|
|
187
|
-
declare function revokeAgentSpend(id: AgentSpendIdentity, vaultPda: string, apiOrigin: string, credentialId?: string | null): Promise<RevokeAgentSpendResult>;
|
|
200
|
+
declare function revokeAgentSpend(id: AgentSpendIdentity, vaultPda: string, apiOrigin: string, credentialId?: string | null, signer?: AgentSpendOperationSigner): Promise<RevokeAgentSpendResult>;
|
|
188
201
|
interface EnableAgentSpendResult {
|
|
189
202
|
enabled: boolean;
|
|
190
203
|
}
|
|
@@ -197,9 +210,9 @@ interface EnableAgentSpendResult {
|
|
|
197
210
|
*
|
|
198
211
|
* @param id WHO is active — must be the passkey-vault (Dexter Wallet).
|
|
199
212
|
* @param vaultPda The vault PDA, base58 string.
|
|
200
|
-
* @param apiOrigin
|
|
213
|
+
* @param apiOrigin Compatibility-only: must be https://api.dexter.cash.
|
|
201
214
|
* @param credentialId The wallet's passkey credential id (base64url).
|
|
202
215
|
*/
|
|
203
|
-
declare function enableAgentSpend(id: AgentSpendIdentity, vaultPda: string, apiOrigin: string, credentialId?: string | null): Promise<EnableAgentSpendResult>;
|
|
216
|
+
declare function enableAgentSpend(id: AgentSpendIdentity, vaultPda: string, apiOrigin: string, credentialId?: string | null, signer?: AgentSpendOperationSigner): Promise<EnableAgentSpendResult>;
|
|
204
217
|
|
|
205
|
-
export { AgentSpendError, type AgentSpendIdentity, type AgentSpendStatus, type AgentSpendTab, type AnonChallengeResult, type AnonServerPolicy, type AutomaticAgentSpend, CeremonyPhase, ConnectVault, type EnableAgentSpendResult, IdentityKind, type RawAgentSpendSession, type RawAgentSpendStatus, RecoverOutcome, RecoverWalletConfig, type RevokeAgentSpendResult, assembleAgentSpendStatus, ceremonyPhaseLabel, createAnonServerPolicy, createPasskeySigner, describeAgentSpendError, enableAgentSpend, recoverWallet, revokeAgentSpend };
|
|
218
|
+
export { AgentSpendError, type AgentSpendIdentity, type AgentSpendStatus, type AgentSpendTab, type AnonChallengeResult, type AnonServerPolicy, type AutomaticAgentSpend, CeremonyPhase, ConnectVault, type CreatePasskeySignerOptions, type EnableAgentSpendResult, IdentityKind, type RawAgentSpendSession, type RawAgentSpendStatus, RecoverOutcome, RecoverWalletConfig, type RevokeAgentSpendResult, assembleAgentSpendStatus, ceremonyPhaseLabel, createAnonServerPolicy, createPasskeySigner, describeAgentSpendError, enableAgentSpend, recoverWallet, revokeAgentSpend };
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,9 @@ import {
|
|
|
3
3
|
ConnectError,
|
|
4
4
|
SESSION_TTL_30D,
|
|
5
5
|
authoredPolicy,
|
|
6
|
-
|
|
6
|
+
base64urlToBytes,
|
|
7
|
+
bytesEqual,
|
|
8
|
+
bytesToBase64,
|
|
7
9
|
bytesToBase64url,
|
|
8
10
|
ceremonyPhaseLabel,
|
|
9
11
|
continueWithDexter,
|
|
@@ -20,18 +22,21 @@ import {
|
|
|
20
22
|
prunePasskey,
|
|
21
23
|
recoverWallet,
|
|
22
24
|
renamePasskey,
|
|
25
|
+
resolveDexterApiBase,
|
|
26
|
+
resolveDexterRpId,
|
|
23
27
|
resolveIdentity,
|
|
24
28
|
setActiveHandle,
|
|
25
29
|
subscribe,
|
|
26
30
|
switchWallet,
|
|
27
31
|
syncAcceptedPasskeys,
|
|
28
32
|
usdToAtomic
|
|
29
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-XQ7RKJMI.js";
|
|
30
34
|
|
|
31
35
|
// src/agentSpend.ts
|
|
32
36
|
import { PublicKey } from "@solana/web3.js";
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
37
|
+
import { WebAuthnAssertion } from "@dexterai/vault/signers/browser";
|
|
38
|
+
import { validatePasskeyAuthorizationChallenge } from "@dexterai/vault";
|
|
39
|
+
import { enableAgentSpendMessage, revokeAgentSpendV2Message } from "@dexterai/vault/messages";
|
|
35
40
|
import { DEXTER_VAULT_PROGRAM_ID } from "@dexterai/vault/constants";
|
|
36
41
|
function shortCounterparty(a) {
|
|
37
42
|
return a.length > 12 ? `${a.slice(0, 4)}\u2026${a.slice(-4)}` : a;
|
|
@@ -89,6 +94,12 @@ function describeAgentSpendError(code) {
|
|
|
89
94
|
return "The server couldn't complete it \u2014 try again shortly.";
|
|
90
95
|
case "not_guest":
|
|
91
96
|
return "This control is only available on a Dexter Wallet.";
|
|
97
|
+
case "hosted_signer_required":
|
|
98
|
+
return "Open Dexter\u2019s secure approval window to confirm this change.";
|
|
99
|
+
case "challenge_malformed":
|
|
100
|
+
case "challenge_mismatch":
|
|
101
|
+
case "credential_mismatch":
|
|
102
|
+
return "Dexter could not verify exactly what you were asked to approve.";
|
|
92
103
|
default:
|
|
93
104
|
return code;
|
|
94
105
|
}
|
|
@@ -107,46 +118,173 @@ function assertDexterWallet(id) {
|
|
|
107
118
|
throw new AgentSpendError("not_guest", "agent-spend off/on switch is Dexter Wallet only");
|
|
108
119
|
}
|
|
109
120
|
}
|
|
110
|
-
function
|
|
111
|
-
|
|
121
|
+
function assertHostedSignerIfNeeded(signer) {
|
|
122
|
+
if (!signer && (typeof window === "undefined" || window.location.origin !== "https://dexter.cash")) {
|
|
123
|
+
throw new AgentSpendError(
|
|
124
|
+
"hosted_signer_required",
|
|
125
|
+
"agent-spend consent on a third-party website requires Dexter's hosted signer"
|
|
126
|
+
);
|
|
127
|
+
}
|
|
112
128
|
}
|
|
113
|
-
function
|
|
114
|
-
|
|
129
|
+
function signedPayload(result) {
|
|
130
|
+
if (result.signature.length !== 64 || result.clientDataJSON.length === 0 || result.authenticatorData.length < 37) {
|
|
131
|
+
throw new AgentSpendError("verification_failed", "signer returned malformed assertion bytes");
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
clientDataJSON: bytesToBase64(result.clientDataJSON),
|
|
135
|
+
authenticatorData: bytesToBase64(result.authenticatorData),
|
|
136
|
+
signature: bytesToBase64(result.signature)
|
|
137
|
+
};
|
|
115
138
|
}
|
|
116
|
-
async function
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
139
|
+
async function sha256(bytes) {
|
|
140
|
+
if (!globalThis.crypto?.subtle) {
|
|
141
|
+
throw new AgentSpendError("webauthn_unavailable", "Web Crypto is unavailable");
|
|
142
|
+
}
|
|
143
|
+
return new Uint8Array(
|
|
144
|
+
await globalThis.crypto.subtle.digest("SHA-256", new Uint8Array(bytes))
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
async function assertCanonicalOperationInline(messageBytes, userHandle, expectedVault, apiBase, credentialId) {
|
|
148
|
+
if (typeof window === "undefined" || window.location.origin !== "https://dexter.cash") {
|
|
149
|
+
throw new AgentSpendError(
|
|
150
|
+
"hosted_signer_required",
|
|
151
|
+
"agent-spend consent on a third-party website requires Dexter's hosted signer"
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
const operationHash = await sha256(messageBytes);
|
|
155
|
+
const challengeRes = await fetch(`${apiBase}/api/passkey-anon/sign/challenge`, {
|
|
156
|
+
method: "POST",
|
|
157
|
+
headers: { "content-type": "application/json" },
|
|
158
|
+
body: JSON.stringify({
|
|
159
|
+
userHandle,
|
|
160
|
+
operationMessage: bytesToBase64url(messageBytes),
|
|
161
|
+
operationHash: bytesToBase64url(operationHash),
|
|
162
|
+
operation: "vault_operation"
|
|
163
|
+
})
|
|
124
164
|
});
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
165
|
+
if (!challengeRes.ok) throw await agentSpendError(challengeRes);
|
|
166
|
+
const data = await challengeRes.json();
|
|
167
|
+
const options = data.options;
|
|
168
|
+
const serverCredential = options?.allowCredentials?.[0];
|
|
169
|
+
if (!options?.challenge || !serverCredential?.id) {
|
|
170
|
+
throw new AgentSpendError("challenge_malformed", "Dexter returned an incomplete challenge");
|
|
171
|
+
}
|
|
172
|
+
const rpId = resolveDexterRpId(options.rpId);
|
|
173
|
+
if (credentialId && credentialId !== serverCredential.id) {
|
|
174
|
+
throw new AgentSpendError("credential_mismatch", "Dexter returned a different credential");
|
|
175
|
+
}
|
|
176
|
+
const challenge = base64urlToBytes(options.challenge);
|
|
177
|
+
try {
|
|
178
|
+
validatePasskeyAuthorizationChallenge({
|
|
179
|
+
challenge,
|
|
180
|
+
operationHash,
|
|
181
|
+
expectedVault
|
|
182
|
+
});
|
|
183
|
+
} catch {
|
|
184
|
+
throw new AgentSpendError("challenge_mismatch", "Dexter returned an unbound challenge");
|
|
185
|
+
}
|
|
186
|
+
const assertion = await new WebAuthnAssertion({
|
|
187
|
+
credentialId: base64urlToBytes(serverCredential.id),
|
|
188
|
+
rpId,
|
|
189
|
+
allowCredentials: [{
|
|
190
|
+
id: base64urlToBytes(serverCredential.id),
|
|
191
|
+
transports: serverCredential.transports
|
|
192
|
+
}]
|
|
193
|
+
}).assertOver(challenge);
|
|
194
|
+
const credential = {
|
|
195
|
+
id: serverCredential.id,
|
|
196
|
+
rawId: serverCredential.id,
|
|
197
|
+
type: "public-key",
|
|
198
|
+
response: {
|
|
199
|
+
clientDataJSON: bytesToBase64url(assertion.clientDataJSON),
|
|
200
|
+
authenticatorData: bytesToBase64url(assertion.authenticatorData),
|
|
201
|
+
signature: bytesToBase64url(assertion.signatureDer),
|
|
202
|
+
userHandle: null
|
|
203
|
+
},
|
|
204
|
+
clientExtensionResults: {},
|
|
205
|
+
authenticatorAttachment: null
|
|
129
206
|
};
|
|
207
|
+
const verifyRes = await fetch(`${apiBase}/api/passkey-anon/sign/verify`, {
|
|
208
|
+
method: "POST",
|
|
209
|
+
headers: { "content-type": "application/json" },
|
|
210
|
+
body: JSON.stringify({ credential, userHandle })
|
|
211
|
+
});
|
|
212
|
+
if (!verifyRes.ok) throw await agentSpendError(verifyRes);
|
|
213
|
+
const verified = await verifyRes.json();
|
|
214
|
+
if (verified.verified !== true) {
|
|
215
|
+
throw new AgentSpendError("verification_failed", "Dexter did not verify the assertion");
|
|
216
|
+
}
|
|
217
|
+
return signedPayload(assertion);
|
|
130
218
|
}
|
|
131
|
-
async function
|
|
219
|
+
async function authorizeAgentSpendOperation(messageBytes, id, expectedVault, apiBase, credentialId, signer) {
|
|
220
|
+
if (!id.userHandle) throw new AgentSpendError("missing_fields", "wallet handle is required");
|
|
221
|
+
if (signer) return signedPayload(await signer.signOperation(new Uint8Array(messageBytes)));
|
|
222
|
+
return assertCanonicalOperationInline(
|
|
223
|
+
new Uint8Array(messageBytes),
|
|
224
|
+
id.userHandle,
|
|
225
|
+
expectedVault,
|
|
226
|
+
apiBase,
|
|
227
|
+
credentialId
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
async function revokeAgentSpend(id, vaultPda, apiOrigin, credentialId, signer) {
|
|
132
231
|
assertDexterWallet(id);
|
|
133
|
-
const origin =
|
|
134
|
-
|
|
232
|
+
const origin = resolveDexterApiBase(apiOrigin);
|
|
233
|
+
assertHostedSignerIfNeeded(signer);
|
|
234
|
+
if (!id.userHandle) throw new AgentSpendError("missing_fields", "wallet handle is required");
|
|
235
|
+
const challengeRes = await fetch(
|
|
236
|
+
`${origin}/api/passkey-vault-anon/revoke-agent-spend/challenge`,
|
|
237
|
+
{
|
|
238
|
+
method: "POST",
|
|
239
|
+
headers: { "content-type": "application/json" },
|
|
240
|
+
body: JSON.stringify({ userHandle: id.userHandle })
|
|
241
|
+
}
|
|
242
|
+
);
|
|
243
|
+
if (!challengeRes.ok) throw await agentSpendError(challengeRes);
|
|
244
|
+
const challenge = await challengeRes.json();
|
|
245
|
+
if (typeof challenge.nonce !== "string" || !/^(0|[1-9][0-9]*)$/.test(challenge.nonce) || typeof challenge.expiry !== "number" || !Number.isSafeInteger(challenge.expiry) || typeof challenge.operationMessage !== "string") {
|
|
246
|
+
throw new AgentSpendError("challenge_malformed", "Dexter returned an incomplete revoke intent");
|
|
247
|
+
}
|
|
248
|
+
const expectedVault = new PublicKey(vaultPda);
|
|
249
|
+
const message = revokeAgentSpendV2Message({
|
|
135
250
|
programId: DEXTER_VAULT_PROGRAM_ID,
|
|
136
|
-
vaultPda:
|
|
251
|
+
vaultPda: expectedVault,
|
|
252
|
+
nonce: BigInt(challenge.nonce),
|
|
253
|
+
expiry: BigInt(challenge.expiry)
|
|
137
254
|
});
|
|
138
|
-
|
|
255
|
+
let serverMessage;
|
|
256
|
+
try {
|
|
257
|
+
serverMessage = base64urlToBytes(challenge.operationMessage);
|
|
258
|
+
} catch {
|
|
259
|
+
throw new AgentSpendError("challenge_malformed", "Dexter returned invalid revoke bytes");
|
|
260
|
+
}
|
|
261
|
+
if (!bytesEqual(serverMessage, message)) {
|
|
262
|
+
throw new AgentSpendError("challenge_mismatch", "Dexter returned a different revoke operation");
|
|
263
|
+
}
|
|
264
|
+
const signed = await authorizeAgentSpendOperation(
|
|
265
|
+
serverMessage,
|
|
266
|
+
id,
|
|
267
|
+
expectedVault,
|
|
268
|
+
origin,
|
|
269
|
+
credentialId,
|
|
270
|
+
signer
|
|
271
|
+
);
|
|
139
272
|
const res = await fetch(`${origin}/api/passkey-vault-anon/revoke-agent-spend`, {
|
|
140
273
|
method: "POST",
|
|
141
274
|
headers: { "content-type": "application/json" },
|
|
142
|
-
body: JSON.stringify({
|
|
275
|
+
body: JSON.stringify({
|
|
276
|
+
userHandle: id.userHandle,
|
|
277
|
+
nonce: challenge.nonce,
|
|
278
|
+
signedPasskeyPayload: signed
|
|
279
|
+
})
|
|
143
280
|
});
|
|
144
281
|
if (!res.ok) throw await agentSpendError(res);
|
|
145
282
|
return await res.json();
|
|
146
283
|
}
|
|
147
|
-
async function enableAgentSpend(id, vaultPda, apiOrigin, credentialId) {
|
|
284
|
+
async function enableAgentSpend(id, vaultPda, apiOrigin, credentialId, signer) {
|
|
148
285
|
assertDexterWallet(id);
|
|
149
|
-
const origin =
|
|
286
|
+
const origin = resolveDexterApiBase(apiOrigin);
|
|
287
|
+
assertHostedSignerIfNeeded(signer);
|
|
150
288
|
const challengeRes = await fetch(
|
|
151
289
|
`${origin}/api/passkey-vault-anon/enable-agent-spend/challenge`,
|
|
152
290
|
{
|
|
@@ -156,14 +294,35 @@ async function enableAgentSpend(id, vaultPda, apiOrigin, credentialId) {
|
|
|
156
294
|
}
|
|
157
295
|
);
|
|
158
296
|
if (!challengeRes.ok) throw await agentSpendError(challengeRes);
|
|
159
|
-
const
|
|
297
|
+
const challenge = await challengeRes.json();
|
|
298
|
+
if (typeof challenge.nonce !== "string" || typeof challenge.expiry !== "number" || typeof challenge.operationMessage !== "string") {
|
|
299
|
+
throw new AgentSpendError("challenge_malformed", "Dexter returned an incomplete enable intent");
|
|
300
|
+
}
|
|
301
|
+
const { nonce, expiry } = challenge;
|
|
302
|
+
const expectedVault = new PublicKey(vaultPda);
|
|
160
303
|
const message = enableAgentSpendMessage({
|
|
161
304
|
programId: DEXTER_VAULT_PROGRAM_ID,
|
|
162
|
-
vaultPda:
|
|
305
|
+
vaultPda: expectedVault,
|
|
163
306
|
nonce: BigInt(nonce),
|
|
164
307
|
expiry: BigInt(expiry)
|
|
165
308
|
});
|
|
166
|
-
|
|
309
|
+
let serverMessage;
|
|
310
|
+
try {
|
|
311
|
+
serverMessage = base64urlToBytes(challenge.operationMessage);
|
|
312
|
+
} catch {
|
|
313
|
+
throw new AgentSpendError("challenge_malformed", "Dexter returned invalid enable bytes");
|
|
314
|
+
}
|
|
315
|
+
if (!bytesEqual(serverMessage, message)) {
|
|
316
|
+
throw new AgentSpendError("challenge_mismatch", "Dexter returned a different enable operation");
|
|
317
|
+
}
|
|
318
|
+
const signed = await authorizeAgentSpendOperation(
|
|
319
|
+
serverMessage,
|
|
320
|
+
id,
|
|
321
|
+
expectedVault,
|
|
322
|
+
origin,
|
|
323
|
+
credentialId,
|
|
324
|
+
signer
|
|
325
|
+
);
|
|
167
326
|
const verifyRes = await fetch(
|
|
168
327
|
`${origin}/api/passkey-vault-anon/enable-agent-spend/verify`,
|
|
169
328
|
{
|
package/dist/react.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { b as CeremonyPhase,
|
|
3
|
-
export {
|
|
1
|
+
import { PasskeySignerWithPublicKey } from '@dexterai/vault/signers';
|
|
2
|
+
import { b as CeremonyPhase, o as SignInResult, a as RecoverOutcome, e as ContinueResult, k as PasskeyLoginTokens, C as ConnectVault, d as ConnectError, q as StoredWallet, l as PasskeySignalSupport, n as ResolvedIdentity, g as CreateWalletResult } from './signals-Dx090EYY.js';
|
|
3
|
+
export { m as RecoverVault } from './signals-Dx090EYY.js';
|
|
4
4
|
import { ReactElement, ButtonHTMLAttributes, ReactNode } from 'react';
|
|
5
5
|
|
|
6
6
|
type ConnectStatus = 'idle' | 'pending' | 'done' | 'error';
|
|
7
7
|
interface UseSignInWithDexterConfig {
|
|
8
|
-
/**
|
|
8
|
+
/** Compatibility-only: omitted or exactly https://api.dexter.cash. */
|
|
9
9
|
apiBase?: string;
|
|
10
10
|
/** RPC for the connected-chip balance read. Default: Dexter's Helius proxy. */
|
|
11
11
|
rpcUrl?: string;
|
|
@@ -50,7 +50,7 @@ interface UseSignInWithDexter {
|
|
|
50
50
|
credentialId: string | null;
|
|
51
51
|
/** Guest passkey signer for authorizing spends / opening x402 tabs. null until
|
|
52
52
|
* a vault is connected. Drive it via `passkeySigner.signOperation(op)`. */
|
|
53
|
-
passkeySigner:
|
|
53
|
+
passkeySigner: PasskeySignerWithPublicKey | null;
|
|
54
54
|
/** USD available. number once read; null = unknown → chip shows wallet only. */
|
|
55
55
|
usdcBalance: number | null;
|
|
56
56
|
refreshBalance: () => Promise<void>;
|
|
@@ -241,7 +241,7 @@ interface CreateWalletPanelProps {
|
|
|
241
241
|
onCreated?: (result: CreateWalletResult) => void;
|
|
242
242
|
/** Fired with the typed error if the ceremony fails. */
|
|
243
243
|
onError?: (error: ConnectError) => void;
|
|
244
|
-
/**
|
|
244
|
+
/** Compatibility-only: omitted or exactly https://api.dexter.cash. */
|
|
245
245
|
apiBase?: string;
|
|
246
246
|
/** Where the WebAuthn ceremony runs. Default 'auto' (createWallet's default). */
|
|
247
247
|
transport?: 'auto' | 'popup' | 'inline';
|
|
@@ -253,13 +253,15 @@ interface CreateWalletPanelProps {
|
|
|
253
253
|
/** The turnkey consent-at-birth create panel. */
|
|
254
254
|
declare function CreateWalletPanel(props: CreateWalletPanelProps): ReactElement;
|
|
255
255
|
|
|
256
|
-
type InstallApp = 'cursor' | 'vscode' | 'hermes' | 'claude-code';
|
|
256
|
+
type InstallApp = 'claude' | 'chatgpt' | 'cursor' | 'vscode' | 'hermes' | 'claude-code';
|
|
257
257
|
interface AppInstallButtonsProps {
|
|
258
258
|
/** MCP endpoint to install. Default: OpenDexter. */
|
|
259
259
|
mcpUrl?: string;
|
|
260
|
+
/** Human-facing connector name. Default: OpenDexter. */
|
|
261
|
+
displayName?: string;
|
|
260
262
|
/** Server name written into the app's config. Default: opendexter. */
|
|
261
263
|
serverName?: string;
|
|
262
|
-
/** Which app buttons to render, in order. Default:
|
|
264
|
+
/** Which app buttons to render, in order. Default: the four desktop clients. */
|
|
263
265
|
apps?: InstallApp[];
|
|
264
266
|
/** Stack full-width instead of a wrapping row. */
|
|
265
267
|
block?: boolean;
|
|
@@ -267,6 +269,8 @@ interface AppInstallButtonsProps {
|
|
|
267
269
|
/** Observability hook: fired on every action a user takes. */
|
|
268
270
|
onAction?: (app: InstallApp, action: 'deeplink' | 'copied') => void;
|
|
269
271
|
}
|
|
272
|
+
declare function claudeWebConnectorUrl(displayName: string, mcpUrl: string): string;
|
|
273
|
+
declare function chatgptPluginsUrl(): string;
|
|
270
274
|
declare function cursorInstallUrl(name: string, mcpUrl: string): string;
|
|
271
275
|
declare function vscodeInstallUrl(name: string, mcpUrl: string): string;
|
|
272
276
|
declare function hermesInstallCommand(name: string, mcpUrl: string): string;
|
|
@@ -274,4 +278,4 @@ declare function hermesOpenUrl(name: string): string;
|
|
|
274
278
|
declare function claudeCodeInstallCommand(name: string, mcpUrl: string): string;
|
|
275
279
|
declare function AppInstallButtons(props: AppInstallButtonsProps): ReactElement;
|
|
276
280
|
|
|
277
|
-
export { AllowanceChips, type AllowanceChipsProps, AppInstallButtons, type AppInstallButtonsProps, type ConnectStatus, CreateWalletPanel, type CreateWalletPanelProps, DexterButton, type DexterButtonProps, DexterMark, DexterWalletChip, type DexterWalletChipProps, DexterWalletMenu, type DexterWalletMenuProps, type InstallApp, RecoverOutcome, SignInWithDexter, type SignInWithDexterProps, type UseDexterWallet, type UseIdentityConfig, type UseSignInWithDexter, type UseSignInWithDexterConfig, claudeCodeInstallCommand, cursorInstallUrl, hermesInstallCommand, hermesOpenUrl, useDexterWallet, useIdentity, useSignInWithDexter, vscodeInstallUrl };
|
|
281
|
+
export { AllowanceChips, type AllowanceChipsProps, AppInstallButtons, type AppInstallButtonsProps, type ConnectStatus, CreateWalletPanel, type CreateWalletPanelProps, DexterButton, type DexterButtonProps, DexterMark, DexterWalletChip, type DexterWalletChipProps, DexterWalletMenu, type DexterWalletMenuProps, type InstallApp, RecoverOutcome, SignInWithDexter, type SignInWithDexterProps, type UseDexterWallet, type UseIdentityConfig, type UseSignInWithDexter, type UseSignInWithDexterConfig, chatgptPluginsUrl, claudeCodeInstallCommand, claudeWebConnectorUrl, cursorInstallUrl, hermesInstallCommand, hermesOpenUrl, useDexterWallet, useIdentity, useSignInWithDexter, vscodeInstallUrl };
|
package/dist/react.js
CHANGED
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
shouldUsePopup,
|
|
20
20
|
subscribe,
|
|
21
21
|
switchWallet
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-XQ7RKJMI.js";
|
|
23
23
|
import {
|
|
24
24
|
DexterButton,
|
|
25
25
|
DexterMark,
|
|
@@ -174,8 +174,10 @@ function useSignInWithDexter(config = {}) {
|
|
|
174
174
|
setStatus("idle");
|
|
175
175
|
}, []);
|
|
176
176
|
const passkeySigner = useMemo(
|
|
177
|
-
() => vault ? createPasskeySigner(vault, apiBase
|
|
178
|
-
|
|
177
|
+
() => vault ? createPasskeySigner(vault, apiBase, {
|
|
178
|
+
...connectHost ? { connectHost } : {}
|
|
179
|
+
}) : null,
|
|
180
|
+
[vault, apiBase, connectHost]
|
|
179
181
|
);
|
|
180
182
|
useEffect(() => {
|
|
181
183
|
void refreshBalance();
|
|
@@ -811,9 +813,22 @@ var CURSOR_MARK = "data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjU
|
|
|
811
813
|
var VSCODE_MARK = "data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPG1hc2sgaWQ9Im1hc2swIiBtYXNrLXR5cGU9ImFscGhhIiBtYXNrVW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4PSIwIiB5PSIwIiB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEwMCI+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNNzAuOTExOSA5OS4zMTcxQzcyLjQ4NjkgOTkuOTMwNyA3NC4yODI4IDk5Ljg5MTQgNzUuODcyNSA5OS4xMjY0TDk2LjQ2MDggODkuMjE5N0M5OC42MjQyIDg4LjE3ODcgMTAwIDg1Ljk4OTIgMTAwIDgzLjU4NzJWMTYuNDEzM0MxMDAgMTQuMDExMyA5OC42MjQzIDExLjgyMTggOTYuNDYwOSAxMC43ODA4TDc1Ljg3MjUgMC44NzM3NTZDNzMuNzg2MiAtMC4xMzAxMjkgNzEuMzQ0NiAwLjExNTc2IDY5LjUxMzUgMS40NDY5NUM2OS4yNTIgMS42Mz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jQgNTEuNFYxMjQ4bC0xNTUuMS04OS40Vjc1NS44Yy0uMS0xODcuMDk5IDE1MS42MDEtMzM4LjkgMzM5LTMzOS4yeiIgZmlsbD0iI2ZmZiIvPgoJPHVzZSB4bGluazpocmVmPSIjYSIgdHJhbnNmb3JtPSJyb3RhdGUoNjAgMTIwMyAxMjAzKSIvPgogIAk8dXNlIHhsaW5rOmhyZWY9IiNhIiB0cmFuc2Zvcm09InJvdGF0ZSgxMjAgMTIwMyAxMjAzKSIvPgoJPHVzZSB4bGluazpocmVmPSIjYSIgdHJhbnNmb3JtPSJyb3RhdGUoMTgwIDEyMDMgMTIwMykiLz4KCTx1c2UgeGxpbms6aHJlZj0iI2EiIHRyYW5zZm9ybT0icm90YXRlKDI0MCAxMjAzIDEyMDMpIi8+Cgk8dXNlIHhsaW5rOmhyZWY9IiNhIiB0cmFuc2Zvcm09InJvdGF0ZSgzMDAgMTIwMyAxMjAzKSIvPgoKPC9zdmc+";
|
|
814
817
|
var DEFAULT_MCP_URL = "https://open.dexter.cash/mcp";
|
|
815
|
-
var
|
|
816
|
-
var
|
|
818
|
+
var DEFAULT_DISPLAY_NAME = "OpenDexter";
|
|
819
|
+
var DEFAULT_SERVER_NAME = "opendexter";
|
|
820
|
+
var DEFAULT_APPS = ["cursor", "vscode", "hermes", "claude-code"];
|
|
821
|
+
function claudeWebConnectorUrl(displayName, mcpUrl) {
|
|
822
|
+
const query = new URLSearchParams({
|
|
823
|
+
modal: "add-custom-connector",
|
|
824
|
+
connectorName: displayName,
|
|
825
|
+
connectorUrl: mcpUrl
|
|
826
|
+
});
|
|
827
|
+
return `https://claude.ai/customize/connectors?${query.toString()}`;
|
|
828
|
+
}
|
|
829
|
+
function chatgptPluginsUrl() {
|
|
830
|
+
return "https://chatgpt.com/plugins";
|
|
831
|
+
}
|
|
817
832
|
function cursorInstallUrl(name, mcpUrl) {
|
|
818
833
|
const config = btoa(JSON.stringify({ url: mcpUrl }));
|
|
819
834
|
return `cursor://anysphere.cursor-deeplink/mcp/install?name=${encodeURIComponent(name)}&config=${encodeURIComponent(config)}`;
|
|
@@ -848,8 +863,9 @@ function appCx(block) {
|
|
|
848
863
|
function AppInstallButtons(props) {
|
|
849
864
|
const {
|
|
850
865
|
mcpUrl = DEFAULT_MCP_URL,
|
|
851
|
-
serverName =
|
|
852
|
-
|
|
866
|
+
serverName = DEFAULT_SERVER_NAME,
|
|
867
|
+
displayName = serverName === DEFAULT_SERVER_NAME ? DEFAULT_DISPLAY_NAME : serverName,
|
|
868
|
+
apps = DEFAULT_APPS,
|
|
853
869
|
block = false,
|
|
854
870
|
className,
|
|
855
871
|
onAction
|
|
@@ -863,6 +879,36 @@ function AppInstallButtons(props) {
|
|
|
863
879
|
const hermesErrorId = `${statusId}-hermes-error`;
|
|
864
880
|
const claudeErrorId = `${statusId}-claude-error`;
|
|
865
881
|
const buttons = {
|
|
882
|
+
claude: /* @__PURE__ */ jsxs6(
|
|
883
|
+
"a",
|
|
884
|
+
{
|
|
885
|
+
className: appCx(block),
|
|
886
|
+
href: claudeWebConnectorUrl(displayName, mcpUrl),
|
|
887
|
+
target: "_blank",
|
|
888
|
+
rel: "noopener noreferrer",
|
|
889
|
+
onClick: () => onAction?.("claude", "deeplink"),
|
|
890
|
+
children: [
|
|
891
|
+
/* @__PURE__ */ jsx6("img", { className: "dx-appbtn__logo", src: CLAUDE_MARK, alt: "", "aria-hidden": true }),
|
|
892
|
+
"Open in Claude"
|
|
893
|
+
]
|
|
894
|
+
},
|
|
895
|
+
"claude"
|
|
896
|
+
),
|
|
897
|
+
chatgpt: /* @__PURE__ */ jsxs6(
|
|
898
|
+
"a",
|
|
899
|
+
{
|
|
900
|
+
className: appCx(block),
|
|
901
|
+
href: chatgptPluginsUrl(),
|
|
902
|
+
target: "_blank",
|
|
903
|
+
rel: "noopener noreferrer",
|
|
904
|
+
onClick: () => onAction?.("chatgpt", "deeplink"),
|
|
905
|
+
children: [
|
|
906
|
+
/* @__PURE__ */ jsx6("img", { className: "dx-appbtn__logo", src: CHATGPT_MARK, alt: "", "aria-hidden": true }),
|
|
907
|
+
"Open ChatGPT plugins"
|
|
908
|
+
]
|
|
909
|
+
},
|
|
910
|
+
"chatgpt"
|
|
911
|
+
),
|
|
866
912
|
cursor: /* @__PURE__ */ jsxs6(
|
|
867
913
|
"a",
|
|
868
914
|
{
|
|
@@ -943,7 +989,7 @@ function AppInstallButtons(props) {
|
|
|
943
989
|
{
|
|
944
990
|
className: ["dx-appinstall", block ? "dx-appinstall--block" : "", className ?? ""].filter(Boolean).join(" "),
|
|
945
991
|
role: "group",
|
|
946
|
-
"aria-label": `Add ${
|
|
992
|
+
"aria-label": `Add ${displayName} to an agent app`,
|
|
947
993
|
children: [
|
|
948
994
|
apps.map((app) => buttons[app] ?? null),
|
|
949
995
|
/* @__PURE__ */ jsx6("span", { className: "dx-appinstall__sr-only", "aria-live": "polite", "aria-atomic": "true", children: [
|
|
@@ -1007,7 +1053,9 @@ export {
|
|
|
1007
1053
|
DexterWalletChip,
|
|
1008
1054
|
DexterWalletMenu,
|
|
1009
1055
|
SignInWithDexter,
|
|
1056
|
+
chatgptPluginsUrl,
|
|
1010
1057
|
claudeCodeInstallCommand,
|
|
1058
|
+
claudeWebConnectorUrl,
|
|
1011
1059
|
cursorInstallUrl,
|
|
1012
1060
|
hermesInstallCommand,
|
|
1013
1061
|
hermesOpenUrl,
|