@moon-x/core 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-6LTEG7VN.mjs → chunk-I56GRKAG.mjs} +19 -0
- package/dist/{chunk-VVL65GIB.mjs → chunk-JU5MWLXH.mjs} +14 -0
- package/dist/index.d.mts +2 -3
- package/dist/index.d.ts +2 -3
- package/dist/index.js +14 -0
- package/dist/index.mjs +1 -1
- package/dist/{interfaces-pNTEOKaK.d.ts → interfaces-1vfik3Ef.d.ts} +1 -1
- package/dist/{interfaces-cdKh3sLA.d.mts → interfaces-BdIeMGGD.d.mts} +1 -1
- package/dist/lib/index.d.mts +32 -2
- package/dist/lib/index.d.ts +32 -2
- package/dist/lib/index.js +21 -0
- package/dist/lib/index.mjs +5 -1
- package/dist/{post-message-CmgAfkOS.d.mts → post-message-Z6cLf0mS.d.mts} +3 -0
- package/dist/{post-message-CmgAfkOS.d.ts → post-message-Z6cLf0mS.d.ts} +3 -0
- package/dist/react/ethereum.d.mts +0 -1
- package/dist/react/ethereum.d.ts +0 -1
- package/dist/react/index.d.mts +41 -3
- package/dist/react/index.d.ts +41 -3
- package/dist/react/index.js +138 -12
- package/dist/react/index.mjs +137 -12
- package/dist/react/solana.d.mts +0 -1
- package/dist/react/solana.d.ts +0 -1
- package/dist/sdk/index.d.mts +63 -9
- package/dist/sdk/index.d.ts +63 -9
- package/dist/sdk/index.js +270 -17
- package/dist/sdk/index.mjs +255 -18
- package/dist/types/index.d.mts +135 -3
- package/dist/types/index.d.ts +135 -3
- package/dist/utils/index.d.mts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +14 -0
- package/dist/utils/index.mjs +1 -1
- package/dist/web/index.d.mts +2 -2
- package/dist/web/index.d.ts +2 -2
- package/dist/web/index.mjs +1 -1
- package/package.json +3 -1
- package/dist/chain-C9dvKXUY.d.mts +0 -48
- package/dist/chain-C9dvKXUY.d.ts +0 -48
package/dist/react/index.js
CHANGED
|
@@ -33,6 +33,7 @@ __export(react_exports, {
|
|
|
33
33
|
SDKProvider: () => SDKProvider,
|
|
34
34
|
useAddPasskey: () => useAddPasskey,
|
|
35
35
|
useCreateWallet: () => useCreateWallet,
|
|
36
|
+
useEphemeralSigner: () => useEphemeralSigner,
|
|
36
37
|
useImportKey: () => useImportKey,
|
|
37
38
|
useLoginWithEmail: () => useLoginWithEmail,
|
|
38
39
|
useLogout: () => useLogout,
|
|
@@ -221,6 +222,130 @@ var useImportKey = () => {
|
|
|
221
222
|
};
|
|
222
223
|
};
|
|
223
224
|
|
|
225
|
+
// src/react/use-ephemeral-signer.ts
|
|
226
|
+
var import_react7 = require("react");
|
|
227
|
+
var useEphemeralSigner = () => {
|
|
228
|
+
const sdk = useMoonKeySDK();
|
|
229
|
+
const [signers, setSigners] = (0, import_react7.useState)([]);
|
|
230
|
+
const [isLoading, setIsLoading] = (0, import_react7.useState)(true);
|
|
231
|
+
const [isRefreshing, setIsRefreshing] = (0, import_react7.useState)(false);
|
|
232
|
+
const [hasLoadedOnce, setHasLoadedOnce] = (0, import_react7.useState)(false);
|
|
233
|
+
const [isProvisioning, setIsProvisioning] = (0, import_react7.useState)(false);
|
|
234
|
+
const [lastProvisioned, setLastProvisioned] = (0, import_react7.useState)(null);
|
|
235
|
+
const [isRevoking, setIsRevoking] = (0, import_react7.useState)(false);
|
|
236
|
+
const [error, setError] = (0, import_react7.useState)(null);
|
|
237
|
+
const refreshInternal = (0, import_react7.useCallback)(
|
|
238
|
+
async (setErrorOnFailure) => {
|
|
239
|
+
if (!sdk.listEphemeralSigners) {
|
|
240
|
+
const msg = "listEphemeralSigners not available on this SDK";
|
|
241
|
+
if (setErrorOnFailure) setError(msg);
|
|
242
|
+
throw new Error(msg);
|
|
243
|
+
}
|
|
244
|
+
if (hasLoadedOnce) {
|
|
245
|
+
setIsRefreshing(true);
|
|
246
|
+
} else {
|
|
247
|
+
setIsLoading(true);
|
|
248
|
+
}
|
|
249
|
+
try {
|
|
250
|
+
const next = await sdk.listEphemeralSigners();
|
|
251
|
+
setSigners(next.signers ?? []);
|
|
252
|
+
setHasLoadedOnce(true);
|
|
253
|
+
return next;
|
|
254
|
+
} catch (err) {
|
|
255
|
+
if (setErrorOnFailure) {
|
|
256
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
257
|
+
setError(msg);
|
|
258
|
+
}
|
|
259
|
+
throw err;
|
|
260
|
+
} finally {
|
|
261
|
+
setIsLoading(false);
|
|
262
|
+
setIsRefreshing(false);
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
[sdk, hasLoadedOnce]
|
|
266
|
+
);
|
|
267
|
+
const refresh = (0, import_react7.useCallback)(async () => {
|
|
268
|
+
setError(null);
|
|
269
|
+
return refreshInternal(true);
|
|
270
|
+
}, [refreshInternal]);
|
|
271
|
+
const provision = (0, import_react7.useCallback)(
|
|
272
|
+
async (params) => {
|
|
273
|
+
if (!sdk.provisionEphemeralSigner) {
|
|
274
|
+
const msg = "provisionEphemeralSigner not available on this SDK";
|
|
275
|
+
setError(msg);
|
|
276
|
+
throw new Error(msg);
|
|
277
|
+
}
|
|
278
|
+
setIsProvisioning(true);
|
|
279
|
+
setError(null);
|
|
280
|
+
try {
|
|
281
|
+
const next = await sdk.provisionEphemeralSigner(
|
|
282
|
+
params
|
|
283
|
+
);
|
|
284
|
+
setLastProvisioned(next);
|
|
285
|
+
refreshInternal(false).catch(() => {
|
|
286
|
+
});
|
|
287
|
+
return next;
|
|
288
|
+
} catch (err) {
|
|
289
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
290
|
+
setError(msg);
|
|
291
|
+
throw err;
|
|
292
|
+
} finally {
|
|
293
|
+
setIsProvisioning(false);
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
[sdk, refreshInternal]
|
|
297
|
+
);
|
|
298
|
+
const revoke = (0, import_react7.useCallback)(
|
|
299
|
+
async (params) => {
|
|
300
|
+
if (!sdk.revokeEphemeralSigner) {
|
|
301
|
+
const msg = "revokeEphemeralSigner not available on this SDK";
|
|
302
|
+
setError(msg);
|
|
303
|
+
throw new Error(msg);
|
|
304
|
+
}
|
|
305
|
+
setIsRevoking(true);
|
|
306
|
+
setError(null);
|
|
307
|
+
try {
|
|
308
|
+
await sdk.revokeEphemeralSigner(params);
|
|
309
|
+
refreshInternal(false).catch(() => {
|
|
310
|
+
});
|
|
311
|
+
} catch (err) {
|
|
312
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
313
|
+
setError(msg);
|
|
314
|
+
throw err;
|
|
315
|
+
} finally {
|
|
316
|
+
setIsRevoking(false);
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
[sdk, refreshInternal]
|
|
320
|
+
);
|
|
321
|
+
const reset = (0, import_react7.useCallback)(() => {
|
|
322
|
+
setLastProvisioned(null);
|
|
323
|
+
setError(null);
|
|
324
|
+
}, []);
|
|
325
|
+
const didAutoFetchRef = (0, import_react7.useRef)(false);
|
|
326
|
+
(0, import_react7.useEffect)(() => {
|
|
327
|
+
if (didAutoFetchRef.current) return;
|
|
328
|
+
if (!sdk.ready) return;
|
|
329
|
+
if (!sdk.listEphemeralSigners) return;
|
|
330
|
+
didAutoFetchRef.current = true;
|
|
331
|
+
refresh().catch(() => {
|
|
332
|
+
});
|
|
333
|
+
}, [sdk.ready, sdk.listEphemeralSigners, refresh]);
|
|
334
|
+
return {
|
|
335
|
+
signers,
|
|
336
|
+
isLoading,
|
|
337
|
+
isRefreshing,
|
|
338
|
+
refresh,
|
|
339
|
+
provision,
|
|
340
|
+
isProvisioning,
|
|
341
|
+
lastProvisioned,
|
|
342
|
+
revoke,
|
|
343
|
+
isRevoking,
|
|
344
|
+
error,
|
|
345
|
+
reset
|
|
346
|
+
};
|
|
347
|
+
};
|
|
348
|
+
|
|
224
349
|
// src/lib/auth/authentication-state.ts
|
|
225
350
|
var AuthenticationState = class {
|
|
226
351
|
constructor() {
|
|
@@ -428,7 +553,7 @@ var import_web3 = require("@solana/web3.js");
|
|
|
428
553
|
var import_bn = __toESM(require("bn.js"));
|
|
429
554
|
|
|
430
555
|
// src/react/use-passkey-status.ts
|
|
431
|
-
var
|
|
556
|
+
var import_react8 = require("react");
|
|
432
557
|
var sharedHasPasskey = null;
|
|
433
558
|
var sharedPasskeys = [];
|
|
434
559
|
var sharedLoading = false;
|
|
@@ -493,18 +618,18 @@ async function sharedRefresh(sdk) {
|
|
|
493
618
|
}
|
|
494
619
|
var usePasskeyStatus = () => {
|
|
495
620
|
const sdk = useMoonKeySDK();
|
|
496
|
-
const [, forceUpdate] = (0,
|
|
497
|
-
(0,
|
|
621
|
+
const [, forceUpdate] = (0, import_react8.useReducer)((x) => x + 1, 0);
|
|
622
|
+
(0, import_react8.useEffect)(() => {
|
|
498
623
|
const cb = () => forceUpdate();
|
|
499
624
|
subscribers.add(cb);
|
|
500
625
|
return () => {
|
|
501
626
|
subscribers.delete(cb);
|
|
502
627
|
};
|
|
503
628
|
}, []);
|
|
504
|
-
const refresh = (0,
|
|
629
|
+
const refresh = (0, import_react8.useCallback)(async () => {
|
|
505
630
|
return sharedRefresh(sdk);
|
|
506
631
|
}, [sdk]);
|
|
507
|
-
(0,
|
|
632
|
+
(0, import_react8.useEffect)(() => {
|
|
508
633
|
if (!sdk?.getPasskeyStatus) return;
|
|
509
634
|
if (sdk.ready && !sdk.isAuthenticated) {
|
|
510
635
|
resetShared();
|
|
@@ -523,12 +648,12 @@ var usePasskeyStatus = () => {
|
|
|
523
648
|
};
|
|
524
649
|
|
|
525
650
|
// src/react/use-manage-passkeys.ts
|
|
526
|
-
var
|
|
651
|
+
var import_react9 = require("react");
|
|
527
652
|
var useAddPasskey = () => {
|
|
528
653
|
const sdk = useMoonKeySDK();
|
|
529
|
-
const [isAdding, setIsAdding] = (0,
|
|
530
|
-
const [error, setError] = (0,
|
|
531
|
-
const addPasskey = (0,
|
|
654
|
+
const [isAdding, setIsAdding] = (0, import_react9.useState)(false);
|
|
655
|
+
const [error, setError] = (0, import_react9.useState)(null);
|
|
656
|
+
const addPasskey = (0, import_react9.useCallback)(
|
|
532
657
|
async (params) => {
|
|
533
658
|
if (!sdk?.addPasskey) throw new Error("SDK not ready");
|
|
534
659
|
setIsAdding(true);
|
|
@@ -549,9 +674,9 @@ var useAddPasskey = () => {
|
|
|
549
674
|
};
|
|
550
675
|
var useRemovePasskey = () => {
|
|
551
676
|
const sdk = useMoonKeySDK();
|
|
552
|
-
const [isRemoving, setIsRemoving] = (0,
|
|
553
|
-
const [error, setError] = (0,
|
|
554
|
-
const removePasskey = (0,
|
|
677
|
+
const [isRemoving, setIsRemoving] = (0, import_react9.useState)(false);
|
|
678
|
+
const [error, setError] = (0, import_react9.useState)(null);
|
|
679
|
+
const removePasskey = (0, import_react9.useCallback)(
|
|
555
680
|
async (credentialIdB64url) => {
|
|
556
681
|
if (!sdk?.removePasskey) throw new Error("SDK not ready");
|
|
557
682
|
setIsRemoving(true);
|
|
@@ -575,6 +700,7 @@ var useRemovePasskey = () => {
|
|
|
575
700
|
SDKProvider,
|
|
576
701
|
useAddPasskey,
|
|
577
702
|
useCreateWallet,
|
|
703
|
+
useEphemeralSigner,
|
|
578
704
|
useImportKey,
|
|
579
705
|
useLoginWithEmail,
|
|
580
706
|
useLogout,
|
package/dist/react/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
formatPasskeyLabel,
|
|
3
3
|
resolvePasskeyMetadata
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-I56GRKAG.mjs";
|
|
5
5
|
import "../chunk-GQKIA37O.mjs";
|
|
6
6
|
import {
|
|
7
7
|
SDKProvider,
|
|
@@ -170,8 +170,132 @@ var useImportKey = () => {
|
|
|
170
170
|
};
|
|
171
171
|
};
|
|
172
172
|
|
|
173
|
+
// src/react/use-ephemeral-signer.ts
|
|
174
|
+
import { useCallback as useCallback6, useEffect as useEffect3, useRef as useRef3, useState as useState5 } from "react";
|
|
175
|
+
var useEphemeralSigner = () => {
|
|
176
|
+
const sdk = useMoonKeySDK();
|
|
177
|
+
const [signers, setSigners] = useState5([]);
|
|
178
|
+
const [isLoading, setIsLoading] = useState5(true);
|
|
179
|
+
const [isRefreshing, setIsRefreshing] = useState5(false);
|
|
180
|
+
const [hasLoadedOnce, setHasLoadedOnce] = useState5(false);
|
|
181
|
+
const [isProvisioning, setIsProvisioning] = useState5(false);
|
|
182
|
+
const [lastProvisioned, setLastProvisioned] = useState5(null);
|
|
183
|
+
const [isRevoking, setIsRevoking] = useState5(false);
|
|
184
|
+
const [error, setError] = useState5(null);
|
|
185
|
+
const refreshInternal = useCallback6(
|
|
186
|
+
async (setErrorOnFailure) => {
|
|
187
|
+
if (!sdk.listEphemeralSigners) {
|
|
188
|
+
const msg = "listEphemeralSigners not available on this SDK";
|
|
189
|
+
if (setErrorOnFailure) setError(msg);
|
|
190
|
+
throw new Error(msg);
|
|
191
|
+
}
|
|
192
|
+
if (hasLoadedOnce) {
|
|
193
|
+
setIsRefreshing(true);
|
|
194
|
+
} else {
|
|
195
|
+
setIsLoading(true);
|
|
196
|
+
}
|
|
197
|
+
try {
|
|
198
|
+
const next = await sdk.listEphemeralSigners();
|
|
199
|
+
setSigners(next.signers ?? []);
|
|
200
|
+
setHasLoadedOnce(true);
|
|
201
|
+
return next;
|
|
202
|
+
} catch (err) {
|
|
203
|
+
if (setErrorOnFailure) {
|
|
204
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
205
|
+
setError(msg);
|
|
206
|
+
}
|
|
207
|
+
throw err;
|
|
208
|
+
} finally {
|
|
209
|
+
setIsLoading(false);
|
|
210
|
+
setIsRefreshing(false);
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
[sdk, hasLoadedOnce]
|
|
214
|
+
);
|
|
215
|
+
const refresh = useCallback6(async () => {
|
|
216
|
+
setError(null);
|
|
217
|
+
return refreshInternal(true);
|
|
218
|
+
}, [refreshInternal]);
|
|
219
|
+
const provision = useCallback6(
|
|
220
|
+
async (params) => {
|
|
221
|
+
if (!sdk.provisionEphemeralSigner) {
|
|
222
|
+
const msg = "provisionEphemeralSigner not available on this SDK";
|
|
223
|
+
setError(msg);
|
|
224
|
+
throw new Error(msg);
|
|
225
|
+
}
|
|
226
|
+
setIsProvisioning(true);
|
|
227
|
+
setError(null);
|
|
228
|
+
try {
|
|
229
|
+
const next = await sdk.provisionEphemeralSigner(
|
|
230
|
+
params
|
|
231
|
+
);
|
|
232
|
+
setLastProvisioned(next);
|
|
233
|
+
refreshInternal(false).catch(() => {
|
|
234
|
+
});
|
|
235
|
+
return next;
|
|
236
|
+
} catch (err) {
|
|
237
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
238
|
+
setError(msg);
|
|
239
|
+
throw err;
|
|
240
|
+
} finally {
|
|
241
|
+
setIsProvisioning(false);
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
[sdk, refreshInternal]
|
|
245
|
+
);
|
|
246
|
+
const revoke = useCallback6(
|
|
247
|
+
async (params) => {
|
|
248
|
+
if (!sdk.revokeEphemeralSigner) {
|
|
249
|
+
const msg = "revokeEphemeralSigner not available on this SDK";
|
|
250
|
+
setError(msg);
|
|
251
|
+
throw new Error(msg);
|
|
252
|
+
}
|
|
253
|
+
setIsRevoking(true);
|
|
254
|
+
setError(null);
|
|
255
|
+
try {
|
|
256
|
+
await sdk.revokeEphemeralSigner(params);
|
|
257
|
+
refreshInternal(false).catch(() => {
|
|
258
|
+
});
|
|
259
|
+
} catch (err) {
|
|
260
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
261
|
+
setError(msg);
|
|
262
|
+
throw err;
|
|
263
|
+
} finally {
|
|
264
|
+
setIsRevoking(false);
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
[sdk, refreshInternal]
|
|
268
|
+
);
|
|
269
|
+
const reset = useCallback6(() => {
|
|
270
|
+
setLastProvisioned(null);
|
|
271
|
+
setError(null);
|
|
272
|
+
}, []);
|
|
273
|
+
const didAutoFetchRef = useRef3(false);
|
|
274
|
+
useEffect3(() => {
|
|
275
|
+
if (didAutoFetchRef.current) return;
|
|
276
|
+
if (!sdk.ready) return;
|
|
277
|
+
if (!sdk.listEphemeralSigners) return;
|
|
278
|
+
didAutoFetchRef.current = true;
|
|
279
|
+
refresh().catch(() => {
|
|
280
|
+
});
|
|
281
|
+
}, [sdk.ready, sdk.listEphemeralSigners, refresh]);
|
|
282
|
+
return {
|
|
283
|
+
signers,
|
|
284
|
+
isLoading,
|
|
285
|
+
isRefreshing,
|
|
286
|
+
refresh,
|
|
287
|
+
provision,
|
|
288
|
+
isProvisioning,
|
|
289
|
+
lastProvisioned,
|
|
290
|
+
revoke,
|
|
291
|
+
isRevoking,
|
|
292
|
+
error,
|
|
293
|
+
reset
|
|
294
|
+
};
|
|
295
|
+
};
|
|
296
|
+
|
|
173
297
|
// src/react/use-passkey-status.ts
|
|
174
|
-
import { useCallback as
|
|
298
|
+
import { useCallback as useCallback7, useEffect as useEffect4, useReducer } from "react";
|
|
175
299
|
var sharedHasPasskey = null;
|
|
176
300
|
var sharedPasskeys = [];
|
|
177
301
|
var sharedLoading = false;
|
|
@@ -237,17 +361,17 @@ async function sharedRefresh(sdk) {
|
|
|
237
361
|
var usePasskeyStatus = () => {
|
|
238
362
|
const sdk = useMoonKeySDK();
|
|
239
363
|
const [, forceUpdate] = useReducer((x) => x + 1, 0);
|
|
240
|
-
|
|
364
|
+
useEffect4(() => {
|
|
241
365
|
const cb = () => forceUpdate();
|
|
242
366
|
subscribers.add(cb);
|
|
243
367
|
return () => {
|
|
244
368
|
subscribers.delete(cb);
|
|
245
369
|
};
|
|
246
370
|
}, []);
|
|
247
|
-
const refresh =
|
|
371
|
+
const refresh = useCallback7(async () => {
|
|
248
372
|
return sharedRefresh(sdk);
|
|
249
373
|
}, [sdk]);
|
|
250
|
-
|
|
374
|
+
useEffect4(() => {
|
|
251
375
|
if (!sdk?.getPasskeyStatus) return;
|
|
252
376
|
if (sdk.ready && !sdk.isAuthenticated) {
|
|
253
377
|
resetShared();
|
|
@@ -266,12 +390,12 @@ var usePasskeyStatus = () => {
|
|
|
266
390
|
};
|
|
267
391
|
|
|
268
392
|
// src/react/use-manage-passkeys.ts
|
|
269
|
-
import { useCallback as
|
|
393
|
+
import { useCallback as useCallback8, useState as useState6 } from "react";
|
|
270
394
|
var useAddPasskey = () => {
|
|
271
395
|
const sdk = useMoonKeySDK();
|
|
272
|
-
const [isAdding, setIsAdding] =
|
|
273
|
-
const [error, setError] =
|
|
274
|
-
const addPasskey =
|
|
396
|
+
const [isAdding, setIsAdding] = useState6(false);
|
|
397
|
+
const [error, setError] = useState6(null);
|
|
398
|
+
const addPasskey = useCallback8(
|
|
275
399
|
async (params) => {
|
|
276
400
|
if (!sdk?.addPasskey) throw new Error("SDK not ready");
|
|
277
401
|
setIsAdding(true);
|
|
@@ -292,9 +416,9 @@ var useAddPasskey = () => {
|
|
|
292
416
|
};
|
|
293
417
|
var useRemovePasskey = () => {
|
|
294
418
|
const sdk = useMoonKeySDK();
|
|
295
|
-
const [isRemoving, setIsRemoving] =
|
|
296
|
-
const [error, setError] =
|
|
297
|
-
const removePasskey =
|
|
419
|
+
const [isRemoving, setIsRemoving] = useState6(false);
|
|
420
|
+
const [error, setError] = useState6(null);
|
|
421
|
+
const removePasskey = useCallback8(
|
|
298
422
|
async (credentialIdB64url) => {
|
|
299
423
|
if (!sdk?.removePasskey) throw new Error("SDK not ready");
|
|
300
424
|
setIsRemoving(true);
|
|
@@ -317,6 +441,7 @@ export {
|
|
|
317
441
|
SDKProvider,
|
|
318
442
|
useAddPasskey,
|
|
319
443
|
useCreateWallet,
|
|
444
|
+
useEphemeralSigner,
|
|
320
445
|
useImportKey,
|
|
321
446
|
useLoginWithEmail,
|
|
322
447
|
useLogout,
|
package/dist/react/solana.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SolanaGetBalanceParams, SolanaGetBalanceResult, SolanaSendTransactionParams, SolanaSendTransactionResult, SolanaSignMessageParams, SolanaSignMessageResult, SolanaSignTransactionParams, SolanaSignTransactionResult } from '../types/index.mjs';
|
|
2
|
-
import '../chain-C9dvKXUY.mjs';
|
|
3
2
|
|
|
4
3
|
declare const useSignMessage: () => {
|
|
5
4
|
signMessage: (params: SolanaSignMessageParams) => Promise<SolanaSignMessageResult>;
|
package/dist/react/solana.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SolanaGetBalanceParams, SolanaGetBalanceResult, SolanaSendTransactionParams, SolanaSendTransactionResult, SolanaSignMessageParams, SolanaSignMessageResult, SolanaSignTransactionParams, SolanaSignTransactionResult } from '../types/index.js';
|
|
2
|
-
import '../chain-C9dvKXUY.js';
|
|
3
2
|
|
|
4
3
|
declare const useSignMessage: () => {
|
|
5
4
|
signMessage: (params: SolanaSignMessageParams) => Promise<SolanaSignMessageResult>;
|
package/dist/sdk/index.d.mts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { T as Transport, P as PasskeyAssertor, K as KvStorage } from '../interfaces-
|
|
2
|
-
export { O as OAuthOpener, a as PlatformImpls, W as WebAuthnAssertionResponse, b as WebAuthnRequestOptions } from '../interfaces-
|
|
1
|
+
import { T as Transport, P as PasskeyAssertor, K as KvStorage } from '../interfaces-BdIeMGGD.mjs';
|
|
2
|
+
export { O as OAuthOpener, a as PlatformImpls, W as WebAuthnAssertionResponse, b as WebAuthnRequestOptions } from '../interfaces-BdIeMGGD.mjs';
|
|
3
3
|
import { C as CachedAssertion } from '../passkey-cache-WnDFQ-v4.mjs';
|
|
4
|
-
import { EthereumSignMessageParams, EthereumSignMessageResult, EthereumSignTransactionParams, EthereumSignTransactionResult, EthereumSignTypedDataParams, EthereumSignTypedDataResult, EthereumSignHashParams, EthereumSignHashResult, EthereumSign7702AuthorizationParams, EthereumSign7702AuthorizationResult, EthereumSendTransactionParams, EthereumSendTransactionResult, EthereumGetBalanceParams, EthereumGetBalanceResult, EthereumGetTokenAccountsByOwnerParams, EthereumGetTokenAccountsByOwnerResult, SolanaSignMessageParams, SolanaSignMessageResult, SolanaSignTransactionParams, SolanaSignTransactionResult, SolanaSendTransactionParams, SolanaSendTransactionResult, SolanaGetBalanceParams, SolanaGetBalanceResult, SolanaGetTokenAccountsByOwnerParams, SolanaGetTokenAccountsByOwnerResult, SendEmailOtpResponse, PublicWallet } from '../types/index.mjs';
|
|
5
|
-
import '../post-message-
|
|
6
|
-
import '../chain-C9dvKXUY.mjs';
|
|
4
|
+
import { EthereumSignMessageParams, EthereumSignMessageResult, EthereumSignTransactionParams, EthereumSignTransactionResult, EthereumSignTypedDataParams, EthereumSignTypedDataResult, EthereumSignHashParams, EthereumSignHashResult, EthereumSign7702AuthorizationParams, EthereumSign7702AuthorizationResult, EthereumSendTransactionParams, EthereumSendTransactionResult, EthereumGetBalanceParams, EthereumGetBalanceResult, EthereumGetTokenAccountsByOwnerParams, EthereumGetTokenAccountsByOwnerResult, SolanaSignMessageParams, SolanaSignMessageResult, SolanaSignTransactionParams, SolanaSignTransactionResult, SolanaSendTransactionParams, SolanaSendTransactionResult, SolanaGetBalanceParams, SolanaGetBalanceResult, SolanaGetTokenAccountsByOwnerParams, SolanaGetTokenAccountsByOwnerResult, SendEmailOtpResponse, PublicWallet, ProvisionEphemeralSignerParams, ProvisionEphemeralSignerResult, ListEphemeralSignersResult, RevokeEphemeralSignerParams } from '../types/index.mjs';
|
|
5
|
+
import '../post-message-Z6cLf0mS.mjs';
|
|
7
6
|
|
|
8
7
|
type AssertPasskeyInParentResult = CachedAssertion;
|
|
9
8
|
declare const assertPasskeyInParent: ({ transport, passkey, publishableKey, validateCredentialInAllowList, }: {
|
|
@@ -30,17 +29,19 @@ interface ScopedPresenceToken {
|
|
|
30
29
|
}
|
|
31
30
|
interface GetInternalPresenceTokensResult {
|
|
32
31
|
tokens: Record<string, ScopedPresenceToken>;
|
|
32
|
+
tokenBatches: Record<string, ScopedPresenceToken[]>;
|
|
33
33
|
userHandleB64url: string;
|
|
34
34
|
credentialIdB64url: string;
|
|
35
35
|
}
|
|
36
|
-
declare const getInternalPresenceTokens: ({ transport, passkey, publishableKey, relyingPartyOrigin, scopes, }: {
|
|
36
|
+
declare const getInternalPresenceTokens: ({ transport, passkey, publishableKey, relyingPartyOrigin, scopes, scopeCounts, }: {
|
|
37
37
|
transport: Transport;
|
|
38
38
|
passkey: PasskeyAssertor;
|
|
39
39
|
publishableKey: string;
|
|
40
40
|
relyingPartyOrigin: string;
|
|
41
|
-
scopes
|
|
41
|
+
scopes?: string[];
|
|
42
|
+
scopeCounts?: Record<string, number>;
|
|
42
43
|
}) => Promise<GetInternalPresenceTokensResult>;
|
|
43
|
-
declare const flattenPresenceTokens: (result: GetInternalPresenceTokensResult) => Record<string, string>;
|
|
44
|
+
declare const flattenPresenceTokens: (result: Pick<GetInternalPresenceTokensResult, "tokens"> & Partial<GetInternalPresenceTokensResult>) => Record<string, string>;
|
|
44
45
|
|
|
45
46
|
declare const getHeadlessEthereumMethods: ({ transport, passkey, publishableKey, relyingPartyOrigin, }: {
|
|
46
47
|
transport: Transport;
|
|
@@ -137,6 +138,9 @@ declare const getHeadlessGeneralMethods: ({ transport, passkey, storage, publish
|
|
|
137
138
|
importKey: (walletType: "solana" | "ethereum", key: string) => Promise<{
|
|
138
139
|
wallet: PublicWallet;
|
|
139
140
|
}>;
|
|
141
|
+
provisionEphemeralSigner: (params: ProvisionEphemeralSignerParams) => Promise<ProvisionEphemeralSignerResult>;
|
|
142
|
+
listEphemeralSigners: () => Promise<ListEphemeralSignersResult>;
|
|
143
|
+
revokeEphemeralSigner: (params: RevokeEphemeralSignerParams) => Promise<void>;
|
|
140
144
|
getWallets: (walletType: "solana" | "ethereum") => Promise<{
|
|
141
145
|
wallets: unknown[];
|
|
142
146
|
walletType: string;
|
|
@@ -154,4 +158,54 @@ declare const getHeadlessGeneralMethods: ({ transport, passkey, storage, publish
|
|
|
154
158
|
getUser: () => Promise<unknown>;
|
|
155
159
|
};
|
|
156
160
|
|
|
157
|
-
|
|
161
|
+
interface EphemeralSignerSignInput {
|
|
162
|
+
/** Lowercase-hex 32-byte Ed25519 agent public key (no 0x prefix). */
|
|
163
|
+
apiPubHex: string;
|
|
164
|
+
/** Lowercase-hex 32-byte Ed25519 agent private key (no 0x prefix). */
|
|
165
|
+
apiPrivHex: string;
|
|
166
|
+
/**
|
|
167
|
+
* Wallet UUID (from `user.wallets[i].id`) the agent should sign on
|
|
168
|
+
* behalf of. Must be one of the wallets the agent was provisioned
|
|
169
|
+
* for. The SDK resolves this internally to the wallet's MPC `key_id`
|
|
170
|
+
* + stored `derivation_path` — integrators never see those values.
|
|
171
|
+
*/
|
|
172
|
+
walletId: string;
|
|
173
|
+
/**
|
|
174
|
+
* Lowercase-hex digest to sign — keccak256 of the message/tx for
|
|
175
|
+
* ECDSA, raw bytes for Ed25519. No 0x prefix.
|
|
176
|
+
*/
|
|
177
|
+
rawSigningPayloadHex: string;
|
|
178
|
+
/** Defaults to now. SES rejects timestamps further than ±5 min from its clock. */
|
|
179
|
+
issuedAt?: Date;
|
|
180
|
+
/** Wallets backend base URL (no trailing slash). */
|
|
181
|
+
baseUrl: string;
|
|
182
|
+
/**
|
|
183
|
+
* MoonX publishable key (`moon_pk_…`). The wallets backend's
|
|
184
|
+
* /ephemeral-signers/* router group is gated by RequirePublicToken — every
|
|
185
|
+
* call needs an `Authorization: PublicToken <publishableKey>` header.
|
|
186
|
+
*/
|
|
187
|
+
publishableKey: string;
|
|
188
|
+
/** Optional fetch override — e.g. for Next.js route handlers or test stubs. */
|
|
189
|
+
fetchImpl?: typeof fetch;
|
|
190
|
+
}
|
|
191
|
+
interface EphemeralSignerSignResult {
|
|
192
|
+
scheme: "ecdsa_secp256k1" | "eddsa_ed25519";
|
|
193
|
+
signature: {
|
|
194
|
+
/** ECDSA only. Lowercase-hex 32-byte r. */
|
|
195
|
+
r?: string;
|
|
196
|
+
/** ECDSA only. Lowercase-hex 32-byte s. */
|
|
197
|
+
s?: string;
|
|
198
|
+
/** ECDSA only. 0..3. */
|
|
199
|
+
recovery_id?: number;
|
|
200
|
+
/** Ed25519 only. Lowercase-hex 64-byte signature. */
|
|
201
|
+
signature?: string;
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
declare class EphemeralSignerSignError extends Error {
|
|
205
|
+
readonly status?: number | undefined;
|
|
206
|
+
readonly body?: string | undefined;
|
|
207
|
+
constructor(message: string, status?: number | undefined, body?: string | undefined);
|
|
208
|
+
}
|
|
209
|
+
declare function signWithEphemeralSigner(input: EphemeralSignerSignInput): Promise<EphemeralSignerSignResult>;
|
|
210
|
+
|
|
211
|
+
export { type AssertPasskeyInParentResult, EphemeralSignerSignError, type EphemeralSignerSignInput, type EphemeralSignerSignResult, type GetInternalPresenceTokensResult, type GetPresenceTokenResult, KvStorage, type LoginWithCodeParams, PasskeyAssertor, type ScopedPresenceToken, type SendCodeParams, Transport, type VerifyOAuthParams, assertPasskeyInParent, flattenPresenceTokens, getHeadlessAuthenticationMethods, getHeadlessEthereumMethods, getHeadlessGeneralMethods, getHeadlessSolanaMethods, getInternalPresenceTokens, getPresenceToken, signWithEphemeralSigner };
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { T as Transport, P as PasskeyAssertor, K as KvStorage } from '../interfaces-
|
|
2
|
-
export { O as OAuthOpener, a as PlatformImpls, W as WebAuthnAssertionResponse, b as WebAuthnRequestOptions } from '../interfaces-
|
|
1
|
+
import { T as Transport, P as PasskeyAssertor, K as KvStorage } from '../interfaces-1vfik3Ef.js';
|
|
2
|
+
export { O as OAuthOpener, a as PlatformImpls, W as WebAuthnAssertionResponse, b as WebAuthnRequestOptions } from '../interfaces-1vfik3Ef.js';
|
|
3
3
|
import { C as CachedAssertion } from '../passkey-cache-WnDFQ-v4.js';
|
|
4
|
-
import { EthereumSignMessageParams, EthereumSignMessageResult, EthereumSignTransactionParams, EthereumSignTransactionResult, EthereumSignTypedDataParams, EthereumSignTypedDataResult, EthereumSignHashParams, EthereumSignHashResult, EthereumSign7702AuthorizationParams, EthereumSign7702AuthorizationResult, EthereumSendTransactionParams, EthereumSendTransactionResult, EthereumGetBalanceParams, EthereumGetBalanceResult, EthereumGetTokenAccountsByOwnerParams, EthereumGetTokenAccountsByOwnerResult, SolanaSignMessageParams, SolanaSignMessageResult, SolanaSignTransactionParams, SolanaSignTransactionResult, SolanaSendTransactionParams, SolanaSendTransactionResult, SolanaGetBalanceParams, SolanaGetBalanceResult, SolanaGetTokenAccountsByOwnerParams, SolanaGetTokenAccountsByOwnerResult, SendEmailOtpResponse, PublicWallet } from '../types/index.js';
|
|
5
|
-
import '../post-message-
|
|
6
|
-
import '../chain-C9dvKXUY.js';
|
|
4
|
+
import { EthereumSignMessageParams, EthereumSignMessageResult, EthereumSignTransactionParams, EthereumSignTransactionResult, EthereumSignTypedDataParams, EthereumSignTypedDataResult, EthereumSignHashParams, EthereumSignHashResult, EthereumSign7702AuthorizationParams, EthereumSign7702AuthorizationResult, EthereumSendTransactionParams, EthereumSendTransactionResult, EthereumGetBalanceParams, EthereumGetBalanceResult, EthereumGetTokenAccountsByOwnerParams, EthereumGetTokenAccountsByOwnerResult, SolanaSignMessageParams, SolanaSignMessageResult, SolanaSignTransactionParams, SolanaSignTransactionResult, SolanaSendTransactionParams, SolanaSendTransactionResult, SolanaGetBalanceParams, SolanaGetBalanceResult, SolanaGetTokenAccountsByOwnerParams, SolanaGetTokenAccountsByOwnerResult, SendEmailOtpResponse, PublicWallet, ProvisionEphemeralSignerParams, ProvisionEphemeralSignerResult, ListEphemeralSignersResult, RevokeEphemeralSignerParams } from '../types/index.js';
|
|
5
|
+
import '../post-message-Z6cLf0mS.js';
|
|
7
6
|
|
|
8
7
|
type AssertPasskeyInParentResult = CachedAssertion;
|
|
9
8
|
declare const assertPasskeyInParent: ({ transport, passkey, publishableKey, validateCredentialInAllowList, }: {
|
|
@@ -30,17 +29,19 @@ interface ScopedPresenceToken {
|
|
|
30
29
|
}
|
|
31
30
|
interface GetInternalPresenceTokensResult {
|
|
32
31
|
tokens: Record<string, ScopedPresenceToken>;
|
|
32
|
+
tokenBatches: Record<string, ScopedPresenceToken[]>;
|
|
33
33
|
userHandleB64url: string;
|
|
34
34
|
credentialIdB64url: string;
|
|
35
35
|
}
|
|
36
|
-
declare const getInternalPresenceTokens: ({ transport, passkey, publishableKey, relyingPartyOrigin, scopes, }: {
|
|
36
|
+
declare const getInternalPresenceTokens: ({ transport, passkey, publishableKey, relyingPartyOrigin, scopes, scopeCounts, }: {
|
|
37
37
|
transport: Transport;
|
|
38
38
|
passkey: PasskeyAssertor;
|
|
39
39
|
publishableKey: string;
|
|
40
40
|
relyingPartyOrigin: string;
|
|
41
|
-
scopes
|
|
41
|
+
scopes?: string[];
|
|
42
|
+
scopeCounts?: Record<string, number>;
|
|
42
43
|
}) => Promise<GetInternalPresenceTokensResult>;
|
|
43
|
-
declare const flattenPresenceTokens: (result: GetInternalPresenceTokensResult) => Record<string, string>;
|
|
44
|
+
declare const flattenPresenceTokens: (result: Pick<GetInternalPresenceTokensResult, "tokens"> & Partial<GetInternalPresenceTokensResult>) => Record<string, string>;
|
|
44
45
|
|
|
45
46
|
declare const getHeadlessEthereumMethods: ({ transport, passkey, publishableKey, relyingPartyOrigin, }: {
|
|
46
47
|
transport: Transport;
|
|
@@ -137,6 +138,9 @@ declare const getHeadlessGeneralMethods: ({ transport, passkey, storage, publish
|
|
|
137
138
|
importKey: (walletType: "solana" | "ethereum", key: string) => Promise<{
|
|
138
139
|
wallet: PublicWallet;
|
|
139
140
|
}>;
|
|
141
|
+
provisionEphemeralSigner: (params: ProvisionEphemeralSignerParams) => Promise<ProvisionEphemeralSignerResult>;
|
|
142
|
+
listEphemeralSigners: () => Promise<ListEphemeralSignersResult>;
|
|
143
|
+
revokeEphemeralSigner: (params: RevokeEphemeralSignerParams) => Promise<void>;
|
|
140
144
|
getWallets: (walletType: "solana" | "ethereum") => Promise<{
|
|
141
145
|
wallets: unknown[];
|
|
142
146
|
walletType: string;
|
|
@@ -154,4 +158,54 @@ declare const getHeadlessGeneralMethods: ({ transport, passkey, storage, publish
|
|
|
154
158
|
getUser: () => Promise<unknown>;
|
|
155
159
|
};
|
|
156
160
|
|
|
157
|
-
|
|
161
|
+
interface EphemeralSignerSignInput {
|
|
162
|
+
/** Lowercase-hex 32-byte Ed25519 agent public key (no 0x prefix). */
|
|
163
|
+
apiPubHex: string;
|
|
164
|
+
/** Lowercase-hex 32-byte Ed25519 agent private key (no 0x prefix). */
|
|
165
|
+
apiPrivHex: string;
|
|
166
|
+
/**
|
|
167
|
+
* Wallet UUID (from `user.wallets[i].id`) the agent should sign on
|
|
168
|
+
* behalf of. Must be one of the wallets the agent was provisioned
|
|
169
|
+
* for. The SDK resolves this internally to the wallet's MPC `key_id`
|
|
170
|
+
* + stored `derivation_path` — integrators never see those values.
|
|
171
|
+
*/
|
|
172
|
+
walletId: string;
|
|
173
|
+
/**
|
|
174
|
+
* Lowercase-hex digest to sign — keccak256 of the message/tx for
|
|
175
|
+
* ECDSA, raw bytes for Ed25519. No 0x prefix.
|
|
176
|
+
*/
|
|
177
|
+
rawSigningPayloadHex: string;
|
|
178
|
+
/** Defaults to now. SES rejects timestamps further than ±5 min from its clock. */
|
|
179
|
+
issuedAt?: Date;
|
|
180
|
+
/** Wallets backend base URL (no trailing slash). */
|
|
181
|
+
baseUrl: string;
|
|
182
|
+
/**
|
|
183
|
+
* MoonX publishable key (`moon_pk_…`). The wallets backend's
|
|
184
|
+
* /ephemeral-signers/* router group is gated by RequirePublicToken — every
|
|
185
|
+
* call needs an `Authorization: PublicToken <publishableKey>` header.
|
|
186
|
+
*/
|
|
187
|
+
publishableKey: string;
|
|
188
|
+
/** Optional fetch override — e.g. for Next.js route handlers or test stubs. */
|
|
189
|
+
fetchImpl?: typeof fetch;
|
|
190
|
+
}
|
|
191
|
+
interface EphemeralSignerSignResult {
|
|
192
|
+
scheme: "ecdsa_secp256k1" | "eddsa_ed25519";
|
|
193
|
+
signature: {
|
|
194
|
+
/** ECDSA only. Lowercase-hex 32-byte r. */
|
|
195
|
+
r?: string;
|
|
196
|
+
/** ECDSA only. Lowercase-hex 32-byte s. */
|
|
197
|
+
s?: string;
|
|
198
|
+
/** ECDSA only. 0..3. */
|
|
199
|
+
recovery_id?: number;
|
|
200
|
+
/** Ed25519 only. Lowercase-hex 64-byte signature. */
|
|
201
|
+
signature?: string;
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
declare class EphemeralSignerSignError extends Error {
|
|
205
|
+
readonly status?: number | undefined;
|
|
206
|
+
readonly body?: string | undefined;
|
|
207
|
+
constructor(message: string, status?: number | undefined, body?: string | undefined);
|
|
208
|
+
}
|
|
209
|
+
declare function signWithEphemeralSigner(input: EphemeralSignerSignInput): Promise<EphemeralSignerSignResult>;
|
|
210
|
+
|
|
211
|
+
export { type AssertPasskeyInParentResult, EphemeralSignerSignError, type EphemeralSignerSignInput, type EphemeralSignerSignResult, type GetInternalPresenceTokensResult, type GetPresenceTokenResult, KvStorage, type LoginWithCodeParams, PasskeyAssertor, type ScopedPresenceToken, type SendCodeParams, Transport, type VerifyOAuthParams, assertPasskeyInParent, flattenPresenceTokens, getHeadlessAuthenticationMethods, getHeadlessEthereumMethods, getHeadlessGeneralMethods, getHeadlessSolanaMethods, getInternalPresenceTokens, getPresenceToken, signWithEphemeralSigner };
|