@dexterai/connect 0.25.2 → 0.26.2
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 +24 -6
- package/dist/{chunk-4AJ5BYFW.js → chunk-QP2WXXKP.js} +251 -38
- 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-BIh8JvP-.d.ts} +31 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -41,7 +41,7 @@ npm install @dexterai/connect @dexterai/vault react
|
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
`@solana/web3.js` and `@worldcoin/idkit` are optional peers: the first for
|
|
44
|
-
agent-spend signing, the second only if you use the World ID button.
|
|
44
|
+
passkey and agent-spend signing, the second only if you use the World ID button.
|
|
45
45
|
|
|
46
46
|
## Quick start
|
|
47
47
|
|
|
@@ -67,9 +67,27 @@ the wallet chip: address plus **"$X.XX available."**
|
|
|
67
67
|
|
|
68
68
|
The ceremony is not limited to dexter.cash. On a foreign origin, `passkeyLogin`
|
|
69
69
|
opens a hosted popup on `dexter.cash/connect`, runs the ceremony there, and
|
|
70
|
-
posts the result back to your page
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
posts the result back to your page. A browser-stamped hello/ack binds the exact
|
|
71
|
+
popup window, hosted origin, caller origin, request nonce, and requested
|
|
72
|
+
operation; the caller-origin may be any HTTPS website and is not allowlisted.
|
|
73
|
+
The default `transport: 'auto'` picks the right mode; `'popup'` and `'inline'`
|
|
74
|
+
force it.
|
|
75
|
+
|
|
76
|
+
The connected `passkeySigner.signOperation(rawOperation)` follows the same
|
|
77
|
+
cross-origin rule. On an unrelated website it opens the pinned Dexter consent
|
|
78
|
+
window and sends the raw operation plus the selected vault identity only after
|
|
79
|
+
the exact hello/ack handshake. Those bytes are structured-cloned in a
|
|
80
|
+
`sign-request`; they are never put in the URL. The Dexter window displays the
|
|
81
|
+
requesting origin and operation-specific consent before returning the
|
|
82
|
+
on-chain-ready assertion bytes.
|
|
83
|
+
|
|
84
|
+
WebAuthn challenge and verification calls are pinned to
|
|
85
|
+
`https://api.dexter.cash`. The legacy `apiBase` option remains source-compatible
|
|
86
|
+
only for that exact value (an optional trailing slash is normalized); any other
|
|
87
|
+
server fails before a popup, fetch, or authenticator call. `apiBase` is never
|
|
88
|
+
placed in the hosted popup URL. The legacy `connectHost` option is likewise
|
|
89
|
+
compatibility-only and may name only `https://dexter.cash/connect`; this pins
|
|
90
|
+
the credential-handling window without restricting the embedding website.
|
|
73
91
|
|
|
74
92
|
```ts
|
|
75
93
|
import { passkeyLogin } from '@dexterai/connect';
|
|
@@ -209,8 +227,8 @@ React: `<SignInWithDexter mode="recover" preferImmediate onRecovered={…} />`
|
|
|
209
227
|
| Peer | Required | Why |
|
|
210
228
|
|---|---|---|
|
|
211
229
|
| `react` >=18 | yes | the `/react` and `/worldid` surfaces |
|
|
212
|
-
| `@dexterai/vault`
|
|
213
|
-
| `@solana/web3.js` | optional | agent-spend signing paths |
|
|
230
|
+
| `@dexterai/vault` ^0.43 | yes | hardened signer envelope validation + agent-spend message builders |
|
|
231
|
+
| `@solana/web3.js` | optional | passkey and agent-spend signing paths |
|
|
214
232
|
| `@worldcoin/idkit` | optional | only for `/worldid` |
|
|
215
233
|
|
|
216
234
|
The `/server` entry has none of these peers; it depends only on `jose`.
|
|
@@ -145,8 +145,40 @@ function authoredPolicy(usdInput) {
|
|
|
145
145
|
// src/enroll.ts
|
|
146
146
|
import { startRegistration } from "@simplewebauthn/browser";
|
|
147
147
|
|
|
148
|
+
// src/trust.ts
|
|
149
|
+
var DEXTER_API_BASE = "https://api.dexter.cash";
|
|
150
|
+
var DEXTER_CONNECT_HOST = "https://dexter.cash/connect";
|
|
151
|
+
var DEXTER_RP_ID = "dexter.cash";
|
|
152
|
+
function resolveDexterApiBase(apiBase) {
|
|
153
|
+
if (apiBase === void 0 || typeof apiBase === "string" && apiBase.replace(/\/+$/, "") === DEXTER_API_BASE) {
|
|
154
|
+
return DEXTER_API_BASE;
|
|
155
|
+
}
|
|
156
|
+
throw new ConnectError(
|
|
157
|
+
"untrusted_api_base",
|
|
158
|
+
`Dexter WebAuthn is pinned to ${DEXTER_API_BASE}`
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
function resolveDexterConnectHost(connectHost) {
|
|
162
|
+
if (connectHost === void 0 || typeof connectHost === "string" && connectHost.replace(/\/+$/, "") === DEXTER_CONNECT_HOST) {
|
|
163
|
+
return DEXTER_CONNECT_HOST;
|
|
164
|
+
}
|
|
165
|
+
throw new ConnectError(
|
|
166
|
+
"untrusted_connect_host",
|
|
167
|
+
`Dexter WebAuthn ceremonies are pinned to ${DEXTER_CONNECT_HOST}`
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
function resolveDexterRpId(rpId) {
|
|
171
|
+
if (rpId === void 0 || rpId === DEXTER_RP_ID) return DEXTER_RP_ID;
|
|
172
|
+
throw new ConnectError("untrusted_rp_id", `Dexter WebAuthn is pinned to ${DEXTER_RP_ID}`);
|
|
173
|
+
}
|
|
174
|
+
function bytesEqual(a, b) {
|
|
175
|
+
if (a.byteLength !== b.byteLength) return false;
|
|
176
|
+
let difference = 0;
|
|
177
|
+
for (let i = 0; i < a.byteLength; i += 1) difference |= a[i] ^ b[i];
|
|
178
|
+
return difference === 0;
|
|
179
|
+
}
|
|
180
|
+
|
|
148
181
|
// src/popup.ts
|
|
149
|
-
var DEFAULT_CONNECT_HOST = "https://dexter.cash/connect";
|
|
150
182
|
var POPUP_TIMEOUT_MS = 12e4;
|
|
151
183
|
var CANONICAL_ORIGIN = "https://dexter.cash";
|
|
152
184
|
function shouldUsePopup(transport) {
|
|
@@ -159,13 +191,13 @@ function openCeremonyPopup(op, config = {}) {
|
|
|
159
191
|
if (typeof window === "undefined") {
|
|
160
192
|
return Promise.reject(new ConnectError("not_browser", "popup ceremony requires a browser"));
|
|
161
193
|
}
|
|
162
|
-
const host = (config.connectHost
|
|
194
|
+
const host = resolveDexterConnectHost(config.connectHost);
|
|
163
195
|
const hostOrigin = new URL(host).origin;
|
|
164
196
|
const openerOrigin = window.location.origin;
|
|
165
197
|
const requestId = makeNonce();
|
|
198
|
+
const signRequest = snapshotSignRequest(op, config.signRequest);
|
|
166
199
|
const params = new URLSearchParams({ v: "1", op, requestId, origin: openerOrigin });
|
|
167
200
|
if (config.name) params.set("name", config.name);
|
|
168
|
-
if (config.apiBase) params.set("apiBase", config.apiBase);
|
|
169
201
|
if (config.preferImmediate) params.set("preferImmediate", "1");
|
|
170
202
|
const url = `${host}?${params.toString()}`;
|
|
171
203
|
return new Promise((resolve, reject) => {
|
|
@@ -177,10 +209,46 @@ function openCeremonyPopup(op, config = {}) {
|
|
|
177
209
|
return;
|
|
178
210
|
}
|
|
179
211
|
let settled = false;
|
|
212
|
+
let handshakeComplete = false;
|
|
180
213
|
const onMessage = (event) => {
|
|
181
214
|
if (event.origin !== hostOrigin) return;
|
|
215
|
+
if (event.source !== popup) return;
|
|
182
216
|
const data = event.data;
|
|
183
|
-
if (!data || data.
|
|
217
|
+
if (!data || data.v !== 1 || data.requestId !== requestId || data.op !== op) return;
|
|
218
|
+
if (data.type === "dexter-connect:hello") {
|
|
219
|
+
if (handshakeComplete) return;
|
|
220
|
+
const ack = {
|
|
221
|
+
v: 1,
|
|
222
|
+
type: "dexter-connect:hello-ack",
|
|
223
|
+
requestId,
|
|
224
|
+
op
|
|
225
|
+
};
|
|
226
|
+
try {
|
|
227
|
+
popup.postMessage(ack, event.origin);
|
|
228
|
+
if (signRequest) {
|
|
229
|
+
const request = {
|
|
230
|
+
v: 1,
|
|
231
|
+
type: "dexter-connect:sign-request",
|
|
232
|
+
requestId,
|
|
233
|
+
op: "sign",
|
|
234
|
+
payload: signRequest
|
|
235
|
+
};
|
|
236
|
+
popup.postMessage(request, event.origin);
|
|
237
|
+
}
|
|
238
|
+
handshakeComplete = true;
|
|
239
|
+
} catch (err) {
|
|
240
|
+
finish(
|
|
241
|
+
() => reject(
|
|
242
|
+
new ConnectError(
|
|
243
|
+
"popup_handshake_failed",
|
|
244
|
+
err instanceof Error ? err.message : String(err)
|
|
245
|
+
)
|
|
246
|
+
)
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
if (data.type !== "dexter-connect:result" || !handshakeComplete) return;
|
|
184
252
|
if (data.ok) finish(() => resolve(data.result));
|
|
185
253
|
else
|
|
186
254
|
finish(
|
|
@@ -209,6 +277,47 @@ function openCeremonyPopup(op, config = {}) {
|
|
|
209
277
|
window.addEventListener("message", onMessage);
|
|
210
278
|
});
|
|
211
279
|
}
|
|
280
|
+
function snapshotSignRequest(op, request) {
|
|
281
|
+
if (op !== "sign") {
|
|
282
|
+
if (request !== void 0) {
|
|
283
|
+
throw new ConnectError("unexpected_sign_request", "sign payload requires op=sign");
|
|
284
|
+
}
|
|
285
|
+
return void 0;
|
|
286
|
+
}
|
|
287
|
+
if (!request || !(request.operationMessage instanceof Uint8Array) || request.operationMessage.length === 0 || request.operationMessage.length > 4096) {
|
|
288
|
+
throw new ConnectError("missing_sign_request", "hosted signing requires raw operation bytes");
|
|
289
|
+
}
|
|
290
|
+
if (isAccountProofOperation(request.operationMessage)) {
|
|
291
|
+
throw new ConnectError(
|
|
292
|
+
"unsupported_operation",
|
|
293
|
+
"account-claim proofs cannot be requested by a third-party website"
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
const vault = request.vault;
|
|
297
|
+
if (!vault || !vault.vaultPda || !vault.publicKey || !vault.userHandle || !vault.credentialId) {
|
|
298
|
+
throw new ConnectError("invalid_sign_identity", "hosted signing requires a complete vault identity");
|
|
299
|
+
}
|
|
300
|
+
return {
|
|
301
|
+
// Snapshot before opening the window so caller mutation cannot change what
|
|
302
|
+
// the user sees/signs after the ceremony begins.
|
|
303
|
+
operationMessage: new Uint8Array(request.operationMessage),
|
|
304
|
+
vault: {
|
|
305
|
+
vaultPda: vault.vaultPda,
|
|
306
|
+
publicKey: vault.publicKey,
|
|
307
|
+
userHandle: vault.userHandle,
|
|
308
|
+
credentialId: vault.credentialId,
|
|
309
|
+
...vault.walletLabel !== void 0 ? { walletLabel: vault.walletLabel } : {}
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
function isAccountProofOperation(operation) {
|
|
314
|
+
const prefix = new TextEncoder().encode("siwx_login");
|
|
315
|
+
if (operation.length !== prefix.length + 32) return false;
|
|
316
|
+
for (let i = 0; i < prefix.length; i += 1) {
|
|
317
|
+
if (operation[i] !== prefix[i]) return false;
|
|
318
|
+
}
|
|
319
|
+
return true;
|
|
320
|
+
}
|
|
212
321
|
function popupFeatures() {
|
|
213
322
|
const w = 420;
|
|
214
323
|
const h = 660;
|
|
@@ -242,15 +351,14 @@ async function readErrorCode(res) {
|
|
|
242
351
|
}
|
|
243
352
|
|
|
244
353
|
// src/enroll.ts
|
|
245
|
-
var DEFAULT_API_BASE = "https://api.dexter.cash";
|
|
246
|
-
var DEFAULT_RP_ID = "dexter.cash";
|
|
247
354
|
var DEFAULT_WALLET_NAME = "Dexter Wallet";
|
|
248
355
|
async function createWallet(config = {}) {
|
|
356
|
+
const apiBase = resolveDexterApiBase(config.apiBase);
|
|
357
|
+
resolveDexterRpId(config.rpId);
|
|
249
358
|
if (shouldUsePopup(config.transport)) {
|
|
250
359
|
const result = await openCeremonyPopup("create", {
|
|
251
360
|
connectHost: config.connectHost,
|
|
252
|
-
name: config.name
|
|
253
|
-
apiBase: config.apiBase
|
|
361
|
+
name: config.name
|
|
254
362
|
});
|
|
255
363
|
setActiveHandle(result.handle, result.label ?? config.name, result.credentialId);
|
|
256
364
|
return result;
|
|
@@ -258,15 +366,13 @@ async function createWallet(config = {}) {
|
|
|
258
366
|
if (typeof navigator === "undefined" || !navigator.credentials) {
|
|
259
367
|
throw new ConnectError("webauthn_unsupported", "WebAuthn unavailable in this environment");
|
|
260
368
|
}
|
|
261
|
-
const apiBase = (config.apiBase ?? DEFAULT_API_BASE).replace(/\/$/, "");
|
|
262
|
-
const rpId = config.rpId ?? DEFAULT_RP_ID;
|
|
263
369
|
const name = config.name && config.name.trim() || DEFAULT_WALLET_NAME;
|
|
264
370
|
config.onPhase?.("challenge");
|
|
265
371
|
const options = await fetchEnrollChallenge(apiBase);
|
|
266
372
|
config.onPhase?.("passkey");
|
|
267
373
|
const optionsJSON = {
|
|
268
374
|
...options,
|
|
269
|
-
rp: { ...options.rp, id:
|
|
375
|
+
rp: { ...options.rp, id: DEXTER_RP_ID, name: "Dexter" },
|
|
270
376
|
user: { ...options.user, name, displayName: name }
|
|
271
377
|
};
|
|
272
378
|
let regResponse;
|
|
@@ -316,6 +422,7 @@ async function fetchEnrollChallenge(apiBase) {
|
|
|
316
422
|
if (!data?.options?.challenge) {
|
|
317
423
|
throw new ConnectError("enroll_challenge_malformed", "no creation options in response");
|
|
318
424
|
}
|
|
425
|
+
resolveDexterRpId(data.options.rp?.id);
|
|
319
426
|
return data.options;
|
|
320
427
|
}
|
|
321
428
|
async function submitEnrollComplete(apiBase, response) {
|
|
@@ -366,10 +473,6 @@ function bytesToBase64(bytes) {
|
|
|
366
473
|
function bytesToBase64url(bytes) {
|
|
367
474
|
return bytesToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
368
475
|
}
|
|
369
|
-
function base64urlToBase64(s) {
|
|
370
|
-
const t = s.replace(/-/g, "+").replace(/_/g, "/");
|
|
371
|
-
return t + "=".repeat((4 - t.length % 4) % 4);
|
|
372
|
-
}
|
|
373
476
|
function compactSignatureToDer(compact) {
|
|
374
477
|
if (compact.length !== 64) {
|
|
375
478
|
throw new Error(`expected 64-byte compact signature, got ${compact.length}`);
|
|
@@ -463,14 +566,13 @@ function classifyWebAuthnRejection(err) {
|
|
|
463
566
|
}
|
|
464
567
|
|
|
465
568
|
// src/relay.ts
|
|
466
|
-
var DEFAULT_API_BASE2 = "https://api.dexter.cash";
|
|
467
569
|
var ANON_SIGN_BASE = "/api/passkey-anon/sign";
|
|
468
570
|
primeImmediateSupport();
|
|
469
571
|
async function passkeyLogin(config = {}, onPhase) {
|
|
572
|
+
const apiBase = resolveDexterApiBase(config.apiBase);
|
|
470
573
|
if (shouldUsePopup(config.transport)) {
|
|
471
574
|
const result2 = await openCeremonyPopup("signin", {
|
|
472
|
-
connectHost: config.connectHost
|
|
473
|
-
apiBase: config.apiBase
|
|
575
|
+
connectHost: config.connectHost
|
|
474
576
|
});
|
|
475
577
|
if (result2.vault) {
|
|
476
578
|
setActiveHandle(result2.vault.userHandle, result2.vault.walletLabel ?? void 0, result2.vault.credentialId);
|
|
@@ -480,7 +582,6 @@ async function passkeyLogin(config = {}, onPhase) {
|
|
|
480
582
|
if (!browserSupportsWebAuthn()) {
|
|
481
583
|
throw new ConnectError("webauthn_unsupported", "WebAuthn unavailable in this environment");
|
|
482
584
|
}
|
|
483
|
-
const apiBase = (config.apiBase ?? DEFAULT_API_BASE2).replace(/\/$/, "");
|
|
484
585
|
onPhase?.("challenge");
|
|
485
586
|
const options = await fetchLoginChallenge(apiBase);
|
|
486
587
|
onPhase?.("passkey");
|
|
@@ -498,11 +599,11 @@ async function passkeyLogin(config = {}, onPhase) {
|
|
|
498
599
|
return result;
|
|
499
600
|
}
|
|
500
601
|
async function continueWithDexter(config = {}, onPhase) {
|
|
602
|
+
resolveDexterApiBase(config.apiBase);
|
|
501
603
|
if (shouldUsePopup(config.transport)) {
|
|
502
604
|
const result = await openCeremonyPopup("continue", {
|
|
503
605
|
connectHost: config.connectHost,
|
|
504
|
-
name: config.name
|
|
505
|
-
apiBase: config.apiBase
|
|
606
|
+
name: config.name
|
|
506
607
|
});
|
|
507
608
|
if (result.kind === "create") {
|
|
508
609
|
setActiveHandle(result.handle, result.label ?? config.name, result.credentialId);
|
|
@@ -526,7 +627,7 @@ async function continueWithDexter(config = {}, onPhase) {
|
|
|
526
627
|
return { kind: "needs_choice" };
|
|
527
628
|
}
|
|
528
629
|
async function immediatePasskeyLogin(config, onPhase) {
|
|
529
|
-
const apiBase = (config.apiBase
|
|
630
|
+
const apiBase = resolveDexterApiBase(config.apiBase);
|
|
530
631
|
onPhase?.("challenge");
|
|
531
632
|
const options = await fetchLoginChallenge(apiBase);
|
|
532
633
|
onPhase?.("passkey");
|
|
@@ -563,7 +664,7 @@ async function fetchLoginChallenge(apiBase) {
|
|
|
563
664
|
if (!data?.options?.challenge) {
|
|
564
665
|
throw new ConnectError("login_challenge_malformed", "no challenge in response");
|
|
565
666
|
}
|
|
566
|
-
return data.options;
|
|
667
|
+
return { ...data.options, rpId: resolveDexterRpId(data.options.rpId) };
|
|
567
668
|
}
|
|
568
669
|
async function submitLogin(apiBase, response) {
|
|
569
670
|
const res = await fetch(`${apiBase}${ANON_SIGN_BASE}/passkey-login`, {
|
|
@@ -586,18 +687,19 @@ async function submitLogin(apiBase, response) {
|
|
|
586
687
|
}
|
|
587
688
|
|
|
588
689
|
// src/anon-policy.ts
|
|
589
|
-
var DEFAULT_API_BASE3 = "https://api.dexter.cash";
|
|
590
690
|
var ANON_SIGN_BASE2 = "/api/passkey-anon/sign";
|
|
591
|
-
function createAnonServerPolicy(apiBase
|
|
592
|
-
const base = apiBase
|
|
691
|
+
function createAnonServerPolicy(apiBase) {
|
|
692
|
+
const base = resolveDexterApiBase(apiBase);
|
|
593
693
|
return {
|
|
594
|
-
async issueChallenge({ userHandle, operationHash }) {
|
|
694
|
+
async issueChallenge({ userHandle, operationMessage, operationHash }) {
|
|
595
695
|
const res = await fetch(`${base}${ANON_SIGN_BASE2}/challenge`, {
|
|
596
696
|
method: "POST",
|
|
597
697
|
headers: { "content-type": "application/json" },
|
|
598
698
|
body: JSON.stringify({
|
|
599
699
|
userHandle: bytesToBase64url(userHandle),
|
|
600
|
-
operationHash: bytesToBase64url(operationHash)
|
|
700
|
+
operationHash: bytesToBase64url(operationHash),
|
|
701
|
+
operationMessage: bytesToBase64url(operationMessage),
|
|
702
|
+
operation: "vault_operation"
|
|
601
703
|
})
|
|
602
704
|
});
|
|
603
705
|
if (!res.ok) throw new ConnectError(await readErrorCode(res), `challenge ${res.status}`);
|
|
@@ -606,14 +708,15 @@ function createAnonServerPolicy(apiBase = DEFAULT_API_BASE3) {
|
|
|
606
708
|
if (!options?.challenge) {
|
|
607
709
|
throw new ConnectError("challenge_malformed", "no challenge in response");
|
|
608
710
|
}
|
|
711
|
+
const challenge = base64urlToBytes(options.challenge);
|
|
609
712
|
const cred = options.allowCredentials?.[0];
|
|
610
713
|
if (!cred?.id) {
|
|
611
714
|
throw new ConnectError("no_credential", "no allow-listed credential for this userHandle");
|
|
612
715
|
}
|
|
613
716
|
return {
|
|
614
|
-
challenge
|
|
717
|
+
challenge,
|
|
615
718
|
credentialId: base64urlToBytes(cred.id),
|
|
616
|
-
rpId: options.rpId,
|
|
719
|
+
rpId: resolveDexterRpId(options.rpId),
|
|
617
720
|
transports: cred.transports
|
|
618
721
|
};
|
|
619
722
|
},
|
|
@@ -625,7 +728,7 @@ function createAnonServerPolicy(apiBase = DEFAULT_API_BASE3) {
|
|
|
625
728
|
response: {
|
|
626
729
|
clientDataJSON: bytesToBase64url(clientDataJSON),
|
|
627
730
|
authenticatorData: bytesToBase64url(authenticatorData),
|
|
628
|
-
// SDK
|
|
731
|
+
// The SDK passes the COMPACT sig; dexter-api's verifier wants DER.
|
|
629
732
|
signature: bytesToBase64url(compactSignatureToDer(signature)),
|
|
630
733
|
userHandle: null
|
|
631
734
|
},
|
|
@@ -639,8 +742,8 @@ function createAnonServerPolicy(apiBase = DEFAULT_API_BASE3) {
|
|
|
639
742
|
});
|
|
640
743
|
if (!res.ok) throw new ConnectError(await readErrorCode(res), `verify ${res.status}`);
|
|
641
744
|
const data = await res.json();
|
|
642
|
-
if (data?.verified
|
|
643
|
-
throw new ConnectError("verification_failed", "server
|
|
745
|
+
if (data?.verified !== true) {
|
|
746
|
+
throw new ConnectError("verification_failed", "server did not return verified=true");
|
|
644
747
|
}
|
|
645
748
|
}
|
|
646
749
|
};
|
|
@@ -648,14 +751,106 @@ function createAnonServerPolicy(apiBase = DEFAULT_API_BASE3) {
|
|
|
648
751
|
|
|
649
752
|
// src/signer.ts
|
|
650
753
|
import { DexterApiBrowserPasskeySigner } from "@dexterai/vault/signers/browser";
|
|
754
|
+
import {
|
|
755
|
+
parseStrictCollectedClientData,
|
|
756
|
+
validatePasskeyAuthorizationChallenge
|
|
757
|
+
} from "@dexterai/vault";
|
|
758
|
+
import { PublicKey } from "@solana/web3.js";
|
|
759
|
+
var HostedPopupPasskeySigner = class {
|
|
760
|
+
constructor(vault, expectedVault, connectHost) {
|
|
761
|
+
this.expectedVault = expectedVault;
|
|
762
|
+
this.connectHost = connectHost;
|
|
763
|
+
this.vault = { ...vault };
|
|
764
|
+
this.credentialId = base64urlToBytes(vault.credentialId);
|
|
765
|
+
this.publicKey = base64ToBytes(vault.publicKey);
|
|
766
|
+
}
|
|
767
|
+
expectedVault;
|
|
768
|
+
connectHost;
|
|
769
|
+
credentialId;
|
|
770
|
+
publicKey;
|
|
771
|
+
vault;
|
|
772
|
+
async signOperation(operationMessage) {
|
|
773
|
+
if (!(operationMessage instanceof Uint8Array) || operationMessage.length === 0) {
|
|
774
|
+
throw new ConnectError("invalid_operation", "signOperation requires non-empty bytes");
|
|
775
|
+
}
|
|
776
|
+
const exactOperationMessage = new Uint8Array(operationMessage);
|
|
777
|
+
const result = await openCeremonyPopup("sign", {
|
|
778
|
+
...this.connectHost ? { connectHost: this.connectHost } : {},
|
|
779
|
+
signRequest: {
|
|
780
|
+
operationMessage: exactOperationMessage,
|
|
781
|
+
vault: {
|
|
782
|
+
vaultPda: this.vault.vaultPda,
|
|
783
|
+
publicKey: this.vault.publicKey,
|
|
784
|
+
userHandle: this.vault.userHandle,
|
|
785
|
+
credentialId: this.vault.credentialId,
|
|
786
|
+
...this.vault.walletLabel !== void 0 ? { walletLabel: this.vault.walletLabel } : {}
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
});
|
|
790
|
+
return validateHostedSignResult(result, exactOperationMessage, this.expectedVault);
|
|
791
|
+
}
|
|
792
|
+
};
|
|
651
793
|
function createPasskeySigner(vault, apiBase, opts = {}) {
|
|
794
|
+
resolveDexterApiBase(apiBase);
|
|
795
|
+
const expectedVault = new PublicKey(vault.vaultPda);
|
|
796
|
+
if (shouldUsePopup()) {
|
|
797
|
+
return new HostedPopupPasskeySigner(vault, expectedVault, opts.connectHost);
|
|
798
|
+
}
|
|
652
799
|
return new DexterApiBrowserPasskeySigner({
|
|
653
800
|
identity: { kind: "guest", userHandle: base64urlToBytes(vault.userHandle) },
|
|
654
801
|
publicKey: base64ToBytes(vault.publicKey),
|
|
655
802
|
anonPolicy: createAnonServerPolicy(apiBase),
|
|
803
|
+
// The API resolves the authorization envelope, but this browser still
|
|
804
|
+
// knows which connected vault the caller selected. Pin that exact PDA so a
|
|
805
|
+
// valid Dexter envelope for another vault cannot reach WebAuthn.
|
|
806
|
+
expectedVault,
|
|
656
807
|
...opts.__assertion ? { __assertion: opts.__assertion } : {}
|
|
657
808
|
});
|
|
658
809
|
}
|
|
810
|
+
async function validateHostedSignResult(result, operationMessage, expectedVault) {
|
|
811
|
+
if (!result || !(result.signature instanceof Uint8Array) || result.signature.length !== 64 || !(result.clientDataJSON instanceof Uint8Array) || result.clientDataJSON.length === 0 || !(result.authenticatorData instanceof Uint8Array) || result.authenticatorData.length < 37) {
|
|
812
|
+
throw new ConnectError("popup_result_malformed", "hosted signer returned malformed assertion bytes");
|
|
813
|
+
}
|
|
814
|
+
let clientData;
|
|
815
|
+
try {
|
|
816
|
+
clientData = parseStrictCollectedClientData(result.clientDataJSON);
|
|
817
|
+
} catch {
|
|
818
|
+
throw new ConnectError("popup_result_malformed", "hosted signer returned invalid clientDataJSON");
|
|
819
|
+
}
|
|
820
|
+
if (clientData.type !== "webauthn.get" || clientData.origin !== "https://dexter.cash" || clientData.crossOrigin !== false || !/^[A-Za-z0-9_-]+$/.test(clientData.challenge)) {
|
|
821
|
+
throw new ConnectError("popup_result_malformed", "hosted signer returned invalid WebAuthn client data");
|
|
822
|
+
}
|
|
823
|
+
const expectedRpHash = new Uint8Array(
|
|
824
|
+
await crypto.subtle.digest("SHA-256", new TextEncoder().encode("dexter.cash"))
|
|
825
|
+
);
|
|
826
|
+
const flags = result.authenticatorData[32] ?? 0;
|
|
827
|
+
if (!bytesEqual(result.authenticatorData.subarray(0, 32), expectedRpHash) || (flags & 1) === 0 || (flags & 4) === 0) {
|
|
828
|
+
throw new ConnectError("popup_result_malformed", "hosted signer returned invalid authenticator context");
|
|
829
|
+
}
|
|
830
|
+
let challenge;
|
|
831
|
+
try {
|
|
832
|
+
challenge = base64urlToBytes(clientData.challenge);
|
|
833
|
+
if (bytesToBase64url(challenge) !== clientData.challenge) throw new Error("non-canonical");
|
|
834
|
+
} catch {
|
|
835
|
+
throw new ConnectError("popup_result_malformed", "hosted signer returned an invalid challenge encoding");
|
|
836
|
+
}
|
|
837
|
+
try {
|
|
838
|
+
const operationHash = new Uint8Array(
|
|
839
|
+
await crypto.subtle.digest("SHA-256", new Uint8Array(operationMessage))
|
|
840
|
+
);
|
|
841
|
+
validatePasskeyAuthorizationChallenge({ challenge, operationHash, expectedVault });
|
|
842
|
+
} catch {
|
|
843
|
+
throw new ConnectError(
|
|
844
|
+
"popup_result_unbound",
|
|
845
|
+
"hosted signer returned an assertion for a different operation or vault"
|
|
846
|
+
);
|
|
847
|
+
}
|
|
848
|
+
return {
|
|
849
|
+
signature: new Uint8Array(result.signature),
|
|
850
|
+
clientDataJSON: new Uint8Array(result.clientDataJSON),
|
|
851
|
+
authenticatorData: new Uint8Array(result.authenticatorData)
|
|
852
|
+
};
|
|
853
|
+
}
|
|
659
854
|
|
|
660
855
|
// src/identity.ts
|
|
661
856
|
function presentOrNull(value) {
|
|
@@ -674,16 +869,20 @@ function resolveIdentity(input) {
|
|
|
674
869
|
|
|
675
870
|
// src/recover.ts
|
|
676
871
|
import { startAuthentication as startAuthentication2, browserSupportsWebAuthn as browserSupportsWebAuthn2 } from "@simplewebauthn/browser";
|
|
677
|
-
var DEFAULT_API_BASE4 = "https://api.dexter.cash";
|
|
678
872
|
var ANON_SIGN_BASE3 = "/api/passkey-anon/sign";
|
|
679
873
|
primeImmediateSupport();
|
|
680
874
|
async function recoverWallet(config = {}) {
|
|
875
|
+
let apiBase;
|
|
876
|
+
try {
|
|
877
|
+
apiBase = resolveDexterApiBase(config.apiBase);
|
|
878
|
+
} catch (err) {
|
|
879
|
+
return netError("untrusted_api_base", err);
|
|
880
|
+
}
|
|
681
881
|
if (shouldUsePopup(config.transport)) {
|
|
682
882
|
let outcome;
|
|
683
883
|
try {
|
|
684
884
|
outcome = await openCeremonyPopup("recover", {
|
|
685
885
|
connectHost: config.connectHost,
|
|
686
|
-
apiBase: config.apiBase,
|
|
687
886
|
preferImmediate: config.preferImmediate
|
|
688
887
|
});
|
|
689
888
|
} catch (err) {
|
|
@@ -703,7 +902,6 @@ async function recoverWallet(config = {}) {
|
|
|
703
902
|
error: new ConnectError("webauthn_unsupported", "WebAuthn unavailable in this environment")
|
|
704
903
|
};
|
|
705
904
|
}
|
|
706
|
-
const apiBase = (config.apiBase ?? DEFAULT_API_BASE4).replace(/\/$/, "");
|
|
707
905
|
const onPhase = config.onPhase;
|
|
708
906
|
onPhase?.("challenge");
|
|
709
907
|
let options;
|
|
@@ -714,8 +912,19 @@ async function recoverWallet(config = {}) {
|
|
|
714
912
|
body: "{}"
|
|
715
913
|
});
|
|
716
914
|
if (!res.ok) return { ok: false, reason: "error", error: new ConnectError(await readErrorCode(res)) };
|
|
717
|
-
|
|
915
|
+
const serverOptions = (await res.json()).options;
|
|
916
|
+
if (!serverOptions?.challenge) {
|
|
917
|
+
return {
|
|
918
|
+
ok: false,
|
|
919
|
+
reason: "error",
|
|
920
|
+
error: new ConnectError("recover_challenge_malformed", "no challenge in response")
|
|
921
|
+
};
|
|
922
|
+
}
|
|
923
|
+
options = { ...serverOptions, rpId: resolveDexterRpId(serverOptions.rpId) };
|
|
718
924
|
} catch (err) {
|
|
925
|
+
if (err instanceof ConnectError && err.code === "untrusted_rp_id") {
|
|
926
|
+
return { ok: false, reason: "error", error: err };
|
|
927
|
+
}
|
|
719
928
|
return netError("recover_challenge_failed", err);
|
|
720
929
|
}
|
|
721
930
|
onPhase?.("passkey");
|
|
@@ -858,6 +1067,9 @@ async function syncAcceptedPasskeys(args) {
|
|
|
858
1067
|
|
|
859
1068
|
export {
|
|
860
1069
|
ConnectError,
|
|
1070
|
+
resolveDexterApiBase,
|
|
1071
|
+
resolveDexterRpId,
|
|
1072
|
+
bytesEqual,
|
|
861
1073
|
shouldUsePopup,
|
|
862
1074
|
getActiveHandle,
|
|
863
1075
|
setActiveHandle,
|
|
@@ -872,8 +1084,9 @@ export {
|
|
|
872
1084
|
usdToAtomic,
|
|
873
1085
|
authoredPolicy,
|
|
874
1086
|
createWallet,
|
|
1087
|
+
base64urlToBytes,
|
|
1088
|
+
bytesToBase64,
|
|
875
1089
|
bytesToBase64url,
|
|
876
|
-
base64urlToBase64,
|
|
877
1090
|
passkeyLogin,
|
|
878
1091
|
continueWithDexter,
|
|
879
1092
|
createAnonServerPolicy,
|
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-BIh8JvP-.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 PasskeyLoginTokens, k as PasskeySignalSupport, l as RecoverVault, m as ResolvedIdentity, S as SESSION_TTL_30D, n as SignInResult, o as SpendPolicy, p as StoredWallet, q as authoredPolicy, r as continueWithDexter, s as createWallet, t as ejectActiveWallet, u as forgetWallet, v as getActiveHandle, w as getCredentialId, x as listWallets, y as passkeyLogin, z as passkeySignalSupport, B as prunePasskey, E as renamePasskey, F as resolveIdentity, G as setActiveHandle, J as subscribeWallet, K as switchWallet, L as syncAcceptedPasskeys, M as usdToAtomic } from './signals-BIh8JvP-.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-QP2WXXKP.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, n as SignInResult, a as RecoverOutcome, e as ContinueResult, P as PasskeyLoginTokens, C as ConnectVault, d as ConnectError, p as StoredWallet, k as PasskeySignalSupport, m as ResolvedIdentity, g as CreateWalletResult } from './signals-BIh8JvP-.js';
|
|
3
|
+
export { l as RecoverVault } from './signals-BIh8JvP-.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-QP2WXXKP.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+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2R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OWMwIDIxLjQgMTEgNDAuNCAyOS40IDUxLjRsMzQ0LjUgMTk4LjUxNVY4MzMuM2guMXYtMjcuOUwxMzcyLjcgNjA0YzMzLjcxNS0xOS41MiA3MC40NC0zMi44NTcgMTA4LjQ3LTM5LjgyOEwxNDQ3LjYgNDUwLjNDMTM2MSAzNTMuNSAxMjM3LjEgMjk4LjUgMTEwNy4zIDI5OS4xem0wIDExNy41LS42LjZjNzkuNjk5IDAgMTU2LjMgMjcuNSAyMTcuNiA3OC40LTIuNSAxLjItNy40IDQuMy0xMSA2LjFMOTUyLjggNzA5LjNjLTE4LjQgMTAuNC0yOS40IDMwLTI5LjQgNTEuNFYxMjQ4bC0xNTUuMS04OS40Vjc1NS44Yy0uMS0xODcuMDk5IDE1MS42MDEtMzM4LjkgMzM5LTMzOS4yeiIgZmlsbD0iI2ZmZiIvPgoJPHVzZSB4bGluazpocmVmPSIjYSIgdHJhbnNmb3JtPSJyb3RhdGUoNjAgMTIwMyAxMjAzKSIvPgogIAk8dXNlIHhsaW5rOmhyZWY9IiNhIiB0cmFuc2Zvcm09InJvdGF0ZSgxMjAgMTIwMyAxMjAzKSIvPgoJPHVzZSB4bGluazpocmVmPSIjYSIgdHJhbnNmb3JtPSJyb3RhdGUoMTgwIDEyMDMgMTIwMykiLz4KCTx1c2UgeGxpbms6aHJlZj0iI2EiIHRyYW5zZm9ybT0icm90YXRlKDI0MCAxMjAzIDEyMDMpIi8+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,
|
|
@@ -43,6 +43,31 @@ interface SignInResult {
|
|
|
43
43
|
* challenge → passkey (the OS prompt) → verifying → finalizing (create only).
|
|
44
44
|
*/
|
|
45
45
|
type CeremonyPhase = 'challenge' | 'passkey' | 'verifying' | 'finalizing';
|
|
46
|
+
/** Exact action the hosted Dexter consent window is being asked to perform. */
|
|
47
|
+
type CeremonyOperation = 'signin' | 'create' | 'continue' | 'recover' | 'sign';
|
|
48
|
+
/** Minimal vault identity transferred to Dexter's hosted signing window. */
|
|
49
|
+
interface HostedSignVaultIdentity {
|
|
50
|
+
vaultPda: string;
|
|
51
|
+
publicKey: string;
|
|
52
|
+
userHandle: string;
|
|
53
|
+
credentialId: string;
|
|
54
|
+
walletLabel?: string | null;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Sensitive signing input. This is structured-cloned to the pinned Dexter
|
|
58
|
+
* popup only after the browser-stamped hello/ack; it is never serialized into
|
|
59
|
+
* the popup URL.
|
|
60
|
+
*/
|
|
61
|
+
interface HostedSignRequestPayload {
|
|
62
|
+
operationMessage: Uint8Array;
|
|
63
|
+
vault: HostedSignVaultIdentity;
|
|
64
|
+
}
|
|
65
|
+
/** On-chain-ready assertion bytes returned by the hosted Dexter popup. */
|
|
66
|
+
interface HostedSignResult {
|
|
67
|
+
signature: Uint8Array;
|
|
68
|
+
clientDataJSON: Uint8Array;
|
|
69
|
+
authenticatorData: Uint8Array;
|
|
70
|
+
}
|
|
46
71
|
/**
|
|
47
72
|
* Vault identity on the wallet-only recover leg, as reported by
|
|
48
73
|
* /api/passkey-vault-anon/status. Narrower than ConnectVault on purpose —
|
|
@@ -85,7 +110,11 @@ interface RecoverWalletConfig extends DexterConnectConfig {
|
|
|
85
110
|
onPhase?: (phase: CeremonyPhase) => void;
|
|
86
111
|
}
|
|
87
112
|
interface DexterConnectConfig {
|
|
88
|
-
/**
|
|
113
|
+
/**
|
|
114
|
+
* Compatibility-only Dexter API base. Omit it or pass exactly
|
|
115
|
+
* https://api.dexter.cash. Noncanonical values fail before WebAuthn and this
|
|
116
|
+
* value is never propagated into the hosted popup.
|
|
117
|
+
*/
|
|
89
118
|
apiBase?: string;
|
|
90
119
|
/**
|
|
91
120
|
* Where the WebAuthn ceremony runs:
|
|
@@ -322,4 +351,4 @@ declare function syncAcceptedPasskeys(args: {
|
|
|
322
351
|
rpId?: string;
|
|
323
352
|
}): Promise<boolean>;
|
|
324
353
|
|
|
325
|
-
export { ACTIVE_WALLET_STORAGE_KEY as A,
|
|
354
|
+
export { ACTIVE_WALLET_STORAGE_KEY as A, prunePasskey as B, type ConnectVault as C, type DexterConnectConfig as D, renamePasskey as E, resolveIdentity as F, setActiveHandle as G, type HostedSignRequestPayload as H, type IdentityKind as I, subscribe as J, switchWallet as K, syncAcceptedPasskeys as L, usdToAtomic as M, type PasskeyLoginTokens as P, type RecoverWalletConfig as R, SESSION_TTL_30D as S, type RecoverOutcome as a, type CeremonyPhase as b, type CeremonyOperation as c, ConnectError as d, type ContinueResult as e, type CreateWalletConfig as f, type CreateWalletResult as g, type HostedSignResult as h, type HostedSignVaultIdentity as i, type IdentityInput as j, type PasskeySignalSupport as k, type RecoverVault as l, type ResolvedIdentity as m, type SignInResult as n, type SpendPolicy as o, type StoredWallet as p, authoredPolicy as q, continueWithDexter as r, createWallet as s, ejectActiveWallet as t, forgetWallet as u, getActiveHandle as v, getCredentialId as w, listWallets as x, passkeyLogin as y, passkeySignalSupport as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dexterai/connect",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.2",
|
|
4
4
|
"description": "Sign in with Dexter — passkey connector. Composes @dexterai/vault.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"typecheck": "tsc --noEmit"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@dexterai/vault": "
|
|
33
|
+
"@dexterai/vault": "^0.43.0",
|
|
34
34
|
"@solana/web3.js": "^1.98.0",
|
|
35
35
|
"@worldcoin/idkit": "^4.1.8",
|
|
36
36
|
"react": ">=18"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@dexterai/vault": "
|
|
47
|
+
"@dexterai/vault": "0.43.0",
|
|
48
48
|
"@solana/web3.js": "^1.98.4",
|
|
49
49
|
"@types/react": "^19.1.12",
|
|
50
50
|
"@types/react-dom": "^19.2.3",
|