@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.
Files changed (38) hide show
  1. package/dist/{chunk-6LTEG7VN.mjs → chunk-I56GRKAG.mjs} +19 -0
  2. package/dist/{chunk-VVL65GIB.mjs → chunk-JU5MWLXH.mjs} +14 -0
  3. package/dist/index.d.mts +2 -3
  4. package/dist/index.d.ts +2 -3
  5. package/dist/index.js +14 -0
  6. package/dist/index.mjs +1 -1
  7. package/dist/{interfaces-pNTEOKaK.d.ts → interfaces-1vfik3Ef.d.ts} +1 -1
  8. package/dist/{interfaces-cdKh3sLA.d.mts → interfaces-BdIeMGGD.d.mts} +1 -1
  9. package/dist/lib/index.d.mts +32 -2
  10. package/dist/lib/index.d.ts +32 -2
  11. package/dist/lib/index.js +21 -0
  12. package/dist/lib/index.mjs +5 -1
  13. package/dist/{post-message-CmgAfkOS.d.mts → post-message-Z6cLf0mS.d.mts} +3 -0
  14. package/dist/{post-message-CmgAfkOS.d.ts → post-message-Z6cLf0mS.d.ts} +3 -0
  15. package/dist/react/ethereum.d.mts +0 -1
  16. package/dist/react/ethereum.d.ts +0 -1
  17. package/dist/react/index.d.mts +41 -3
  18. package/dist/react/index.d.ts +41 -3
  19. package/dist/react/index.js +138 -12
  20. package/dist/react/index.mjs +137 -12
  21. package/dist/react/solana.d.mts +0 -1
  22. package/dist/react/solana.d.ts +0 -1
  23. package/dist/sdk/index.d.mts +63 -9
  24. package/dist/sdk/index.d.ts +63 -9
  25. package/dist/sdk/index.js +270 -17
  26. package/dist/sdk/index.mjs +255 -18
  27. package/dist/types/index.d.mts +135 -3
  28. package/dist/types/index.d.ts +135 -3
  29. package/dist/utils/index.d.mts +1 -1
  30. package/dist/utils/index.d.ts +1 -1
  31. package/dist/utils/index.js +14 -0
  32. package/dist/utils/index.mjs +1 -1
  33. package/dist/web/index.d.mts +2 -2
  34. package/dist/web/index.d.ts +2 -2
  35. package/dist/web/index.mjs +1 -1
  36. package/package.json +3 -1
  37. package/dist/chain-C9dvKXUY.d.mts +0 -48
  38. package/dist/chain-C9dvKXUY.d.ts +0 -48
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  PostMessageMethod,
3
3
  PostMessageType
4
- } from "../chunk-VVL65GIB.mjs";
4
+ } from "../chunk-JU5MWLXH.mjs";
5
5
  import {
6
6
  arrayLikeToBytes,
7
7
  authState,
@@ -10,7 +10,7 @@ import {
10
10
  bs58ToBytes,
11
11
  serializeEthereumTransaction,
12
12
  toB64url
13
- } from "../chunk-6LTEG7VN.mjs";
13
+ } from "../chunk-I56GRKAG.mjs";
14
14
  import "../chunk-GQKIA37O.mjs";
15
15
 
16
16
  // src/sdk/parent-passkey-assert.ts
@@ -84,7 +84,8 @@ var getInternalPresenceTokens = async ({
84
84
  passkey,
85
85
  publishableKey,
86
86
  relyingPartyOrigin,
87
- scopes
87
+ scopes,
88
+ scopeCounts
88
89
  }) => {
89
90
  const { token, optionsJSON } = await transport.send(
90
91
  PostMessageType.AUTH,
@@ -92,24 +93,36 @@ var getInternalPresenceTokens = async ({
92
93
  { publishableKey, relyingPartyOrigin }
93
94
  );
94
95
  const { response, userHandleB64url, credentialIdB64url } = await passkey.assertForInternalPresence({ optionsJSON });
96
+ const verifyPayload = {
97
+ publishableKey,
98
+ relyingPartyOrigin,
99
+ token,
100
+ response,
101
+ purpose: "internal"
102
+ };
103
+ if (scopes && scopes.length > 0) verifyPayload.scopes = scopes;
104
+ if (scopeCounts && Object.keys(scopeCounts).length > 0) {
105
+ verifyPayload.scope_counts = scopeCounts;
106
+ }
95
107
  const verify = await transport.send(
96
108
  PostMessageType.AUTH,
97
109
  PostMessageMethod.PASSKEY_PRESENCE_VERIFY,
98
- {
99
- publishableKey,
100
- relyingPartyOrigin,
101
- token,
102
- response,
103
- purpose: "internal",
104
- scopes
105
- }
110
+ verifyPayload
106
111
  );
107
112
  const out = {};
108
113
  for (const [scope, t] of Object.entries(verify.tokens ?? {})) {
109
114
  out[scope] = { token: t.token, expiresAt: t.expires_at };
110
115
  }
116
+ const outBatches = {};
117
+ for (const [scope, batch] of Object.entries(verify.token_batches ?? {})) {
118
+ outBatches[scope] = batch.map((t) => ({
119
+ token: t.token,
120
+ expiresAt: t.expires_at
121
+ }));
122
+ }
111
123
  return {
112
124
  tokens: out,
125
+ tokenBatches: outBatches,
113
126
  userHandleB64url,
114
127
  credentialIdB64url
115
128
  };
@@ -556,6 +569,8 @@ var getHeadlessAuthenticationMethods = ({
556
569
  var SCOPES_CREATE_WALLET = ["dek_bootstrap", "keyshare_write"];
557
570
  var SCOPES_IMPORT_KEY = ["dek_bootstrap", "keyshare_write"];
558
571
  var SCOPES_REMOVE_PASSKEY = ["passkey_remove"];
572
+ var SCOPES_PROVISION_EPHEMERAL_SIGNER = ["keyshare_read"];
573
+ var SCOPES_REVOKE_EPHEMERAL_SIGNER = ["ephemeral_signer_revoke"];
559
574
  var getHeadlessGeneralMethods = ({
560
575
  transport,
561
576
  passkey,
@@ -571,7 +586,11 @@ var getHeadlessGeneralMethods = ({
571
586
  { publishableKey }
572
587
  ),
573
588
  removePasskey: async (credentialIdB64url) => {
574
- const { tokens, userHandleB64url, credentialIdB64url: assertedCredId } = await getInternalPresenceTokens({
589
+ const {
590
+ tokens,
591
+ userHandleB64url,
592
+ credentialIdB64url: assertedCredId
593
+ } = await getInternalPresenceTokens({
575
594
  transport,
576
595
  passkey,
577
596
  publishableKey,
@@ -644,6 +663,83 @@ var getHeadlessGeneralMethods = ({
644
663
  );
645
664
  return { wallet };
646
665
  },
666
+ provisionEphemeralSigner: async (params) => {
667
+ const walletCount = params.walletIds.length;
668
+ if (walletCount === 0) {
669
+ throw new Error(
670
+ "provisionEphemeralSigner: at least one walletId required"
671
+ );
672
+ }
673
+ const { userHandleB64url, credentialIdB64url, tokenBatches } = await getInternalPresenceTokens({
674
+ transport,
675
+ passkey,
676
+ publishableKey,
677
+ relyingPartyOrigin,
678
+ scopeCounts: { [SCOPES_PROVISION_EPHEMERAL_SIGNER[0]]: walletCount }
679
+ });
680
+ const keyshareReadBatch = (tokenBatches[SCOPES_PROVISION_EPHEMERAL_SIGNER[0]] ?? []).map((t) => t.token);
681
+ if (keyshareReadBatch.length !== walletCount) {
682
+ throw new Error(
683
+ `provisionEphemeralSigner: server returned ${keyshareReadBatch.length} tokens, expected ${walletCount}`
684
+ );
685
+ }
686
+ return transport.send(
687
+ PostMessageType.WALLET,
688
+ PostMessageMethod.PROVISION_EPHEMERAL_SIGNER,
689
+ {
690
+ publishableKey,
691
+ userHandleB64url,
692
+ credentialIdB64url,
693
+ // One keyshare_read token per wallet, parallel to params.walletIds
694
+ // (iframe consumes them positionally after wallet resolution).
695
+ presenceTokenBatches: {
696
+ [SCOPES_PROVISION_EPHEMERAL_SIGNER[0]]: keyshareReadBatch
697
+ },
698
+ walletIds: params.walletIds,
699
+ expiresAt: params.expiresAt?.toISOString(),
700
+ label: params.label
701
+ }
702
+ );
703
+ },
704
+ // Read-only: list the user's active (non-revoked) provisioned agents
705
+ // for the current app. No WebAuthn ceremony needed — the wallet
706
+ // session JWT is enough since this exposes only metadata (api_pub,
707
+ // key_ids, expiry) and not the private agent material.
708
+ listEphemeralSigners: async () => {
709
+ return transport.send(
710
+ PostMessageType.WALLET,
711
+ PostMessageMethod.LIST_EPHEMERAL_SIGNERS,
712
+ { publishableKey }
713
+ );
714
+ },
715
+ // Soft-revoke a signer (and forward the revoke to SES). Requires a
716
+ // fresh WebAuthn-bound presence token: ephemeral_signer_revoke scope. Wallet JWT
717
+ // alone isn't enough because revoke is destructive (DoS-grade) — the
718
+ // presence proof confirms it's really the user driving it.
719
+ revokeEphemeralSigner: async (params) => {
720
+ const { userHandleB64url, credentialIdB64url, tokens } = await getInternalPresenceTokens({
721
+ transport,
722
+ passkey,
723
+ publishableKey,
724
+ relyingPartyOrigin,
725
+ scopes: SCOPES_REVOKE_EPHEMERAL_SIGNER
726
+ });
727
+ await transport.send(
728
+ PostMessageType.WALLET,
729
+ PostMessageMethod.REVOKE_EPHEMERAL_SIGNER,
730
+ {
731
+ publishableKey,
732
+ apiPubHex: params.apiPubHex,
733
+ userHandleB64url,
734
+ credentialIdB64url,
735
+ presenceTokens: flattenPresenceTokens({
736
+ tokens,
737
+ userHandleB64url,
738
+ credentialIdB64url
739
+ })
740
+ }
741
+ );
742
+ },
647
743
  getWallets: async (walletType) => {
648
744
  const { wallets } = await transport.send(
649
745
  PostMessageType.WALLET,
@@ -660,11 +756,9 @@ var getHeadlessGeneralMethods = ({
660
756
  // silently extend session lifetime.
661
757
  getSessionTokens: async () => {
662
758
  try {
663
- const session = await transport.send(
664
- PostMessageType.AUTH,
665
- PostMessageMethod.GET_CURRENT_SESSION,
666
- { publishableKey }
667
- );
759
+ const session = await transport.send(PostMessageType.AUTH, PostMessageMethod.GET_CURRENT_SESSION, {
760
+ publishableKey
761
+ });
668
762
  return session ? {
669
763
  accessToken: session.accessToken,
670
764
  identityToken: session.identityToken,
@@ -728,7 +822,149 @@ var getHeadlessGeneralMethods = ({
728
822
  }
729
823
  }
730
824
  });
825
+
826
+ // src/sdk/ephemeral-signer-sign.ts
827
+ import { ed25519 } from "@noble/curves/ed25519";
828
+ import { bytesToHex, hexToBytes } from "@noble/hashes/utils";
829
+ function normalizeBase(url) {
830
+ return url.replace(/\/+$/, "");
831
+ }
832
+ var EphemeralSignerSignError = class extends Error {
833
+ constructor(message, status, body) {
834
+ super(message);
835
+ this.status = status;
836
+ this.body = body;
837
+ this.name = "EphemeralSignerSignError";
838
+ }
839
+ };
840
+ var bindingsCache = /* @__PURE__ */ new Map();
841
+ async function resolveBinding(input) {
842
+ const cached = bindingsCache.get(input.apiPubHex);
843
+ if (cached) {
844
+ const hit2 = cached.find((b) => b.walletId === input.walletId);
845
+ if (hit2) return hit2;
846
+ }
847
+ const issuedAt = (/* @__PURE__ */ new Date()).toISOString();
848
+ const signedBodyBytes = new TextEncoder().encode(
849
+ JSON.stringify({ issued_at: issuedAt })
850
+ );
851
+ const apiPrivBytes = hexToBytes(input.apiPrivHex);
852
+ const agentSig = ed25519.sign(signedBodyBytes, apiPrivBytes);
853
+ const url = `${normalizeBase(input.baseUrl)}/v0/wallets/ephemeral-signers/me/wallets`;
854
+ const fetchFn = input.fetchImpl ?? fetch;
855
+ let response;
856
+ try {
857
+ response = await fetchFn(url, {
858
+ method: "POST",
859
+ headers: {
860
+ "Content-Type": "application/json",
861
+ Authorization: `PublicToken ${input.publishableKey}`
862
+ },
863
+ body: JSON.stringify({
864
+ api_pub: input.apiPubHex,
865
+ signed_body: bytesToHex(signedBodyBytes),
866
+ agent_signature: bytesToHex(agentSig)
867
+ })
868
+ });
869
+ } catch (e) {
870
+ throw new EphemeralSignerSignError(
871
+ `wallet binding fetch failed: ${e instanceof Error ? e.message : String(e)}`
872
+ );
873
+ }
874
+ if (!response.ok) {
875
+ const body = await response.text().catch(() => "");
876
+ throw new EphemeralSignerSignError(
877
+ `wallet binding fetch failed: ${response.status}`,
878
+ response.status,
879
+ body
880
+ );
881
+ }
882
+ const json = await response.json();
883
+ const bindings = json.wallets.map((w) => ({
884
+ walletId: w.wallet_id,
885
+ keyId: w.key_id,
886
+ derivationPath: w.derivation_path
887
+ }));
888
+ bindingsCache.set(input.apiPubHex, bindings);
889
+ const hit = bindings.find((b) => b.walletId === input.walletId);
890
+ if (!hit) {
891
+ throw new EphemeralSignerSignError(
892
+ `walletId ${input.walletId} is not authorized for this agent`
893
+ );
894
+ }
895
+ return hit;
896
+ }
897
+ async function signWithEphemeralSigner(input) {
898
+ if (!/^[0-9a-f]{64}$/i.test(input.apiPubHex)) {
899
+ throw new EphemeralSignerSignError(
900
+ "apiPubHex must be 64 lowercase hex chars (32-byte Ed25519 pubkey)"
901
+ );
902
+ }
903
+ if (!/^[0-9a-f]{64}$/i.test(input.apiPrivHex)) {
904
+ throw new EphemeralSignerSignError(
905
+ "apiPrivHex must be 64 lowercase hex chars (32-byte Ed25519 privkey)"
906
+ );
907
+ }
908
+ if (!input.walletId) {
909
+ throw new EphemeralSignerSignError("walletId is required");
910
+ }
911
+ if (!input.rawSigningPayloadHex || !/^[0-9a-f]+$/i.test(input.rawSigningPayloadHex)) {
912
+ throw new EphemeralSignerSignError(
913
+ "rawSigningPayloadHex must be a non-empty lowercase hex string"
914
+ );
915
+ }
916
+ if (!input.publishableKey) {
917
+ throw new EphemeralSignerSignError(
918
+ "publishableKey is required \u2014 wallets backend gates /ephemeral-signers/* with RequirePublicToken"
919
+ );
920
+ }
921
+ const binding = await resolveBinding(input);
922
+ const issuedAt = (input.issuedAt ?? /* @__PURE__ */ new Date()).toISOString();
923
+ const signedPayload = {
924
+ raw_signing_payload: input.rawSigningPayloadHex,
925
+ key_id: binding.keyId,
926
+ derivation_path: binding.derivationPath,
927
+ issued_at: issuedAt
928
+ };
929
+ const signedBodyBytes = new TextEncoder().encode(
930
+ JSON.stringify(signedPayload)
931
+ );
932
+ const apiPrivBytes = hexToBytes(input.apiPrivHex);
933
+ const agentSig = ed25519.sign(signedBodyBytes, apiPrivBytes);
934
+ const requestBody = {
935
+ api_pub: input.apiPubHex,
936
+ signed_body: bytesToHex(signedBodyBytes),
937
+ agent_signature: bytesToHex(agentSig)
938
+ };
939
+ const url = `${normalizeBase(input.baseUrl)}/v0/wallets/ephemeral-signers/sign`;
940
+ const fetchFn = input.fetchImpl ?? fetch;
941
+ let response;
942
+ try {
943
+ response = await fetchFn(url, {
944
+ method: "POST",
945
+ headers: {
946
+ "Content-Type": "application/json",
947
+ Authorization: `PublicToken ${input.publishableKey}`
948
+ },
949
+ body: JSON.stringify(requestBody)
950
+ });
951
+ } catch (e) {
952
+ throw new EphemeralSignerSignError(
953
+ `transport failure: ${e instanceof Error ? e.message : String(e)}`
954
+ );
955
+ }
956
+ if (!response.ok) {
957
+ const body = await response.text().catch(() => "");
958
+ throw new EphemeralSignerSignError(
959
+ `ephemeral signer sign failed: ${response.status}`,
960
+ response.status,
961
+ body
962
+ );
963
+ }
964
+ return await response.json();
965
+ }
731
966
  export {
967
+ EphemeralSignerSignError,
732
968
  assertPasskeyInParent,
733
969
  flattenPresenceTokens,
734
970
  getHeadlessAuthenticationMethods,
@@ -736,5 +972,6 @@ export {
736
972
  getHeadlessGeneralMethods,
737
973
  getHeadlessSolanaMethods,
738
974
  getInternalPresenceTokens,
739
- getPresenceToken
975
+ getPresenceToken,
976
+ signWithEphemeralSigner
740
977
  };
@@ -1,5 +1,49 @@
1
- import { a as ChainLikeWithId, C as Chain } from '../chain-C9dvKXUY.mjs';
2
- export { B as BlockExplorer, E as EthereumChainConfig, N as NativeCurrency, R as RpcConfig, b as RpcUrls } from '../chain-C9dvKXUY.mjs';
1
+ type RpcUrls = {
2
+ http: readonly string[];
3
+ webSocket?: readonly string[];
4
+ };
5
+ type NativeCurrency = {
6
+ name: string;
7
+ symbol: string;
8
+ decimals: number;
9
+ };
10
+ type BlockExplorer = {
11
+ name: string;
12
+ url: string;
13
+ };
14
+ type Chain = {
15
+ id: number;
16
+ name: string;
17
+ network?: string;
18
+ nativeCurrency: NativeCurrency;
19
+ blockExplorers?: {
20
+ [key: string]: BlockExplorer;
21
+ default: BlockExplorer;
22
+ };
23
+ rpcUrls: {
24
+ [key: string]: RpcUrls;
25
+ default: RpcUrls;
26
+ };
27
+ testnet?: boolean;
28
+ };
29
+ type ChainLikeWithId = {
30
+ id: number;
31
+ };
32
+ type RpcConfig = {
33
+ rpcUrls?: {
34
+ [chainId: number]: string;
35
+ };
36
+ rpcTimeout?: number;
37
+ };
38
+ interface EthereumChainConfig {
39
+ defaultChain?: any;
40
+ supportedChains?: any[];
41
+ rpcs?: {
42
+ 'ethereum:mainnet': {
43
+ rpc: string;
44
+ };
45
+ };
46
+ }
3
47
 
4
48
  interface PublicWallet {
5
49
  id: string;
@@ -619,6 +663,94 @@ interface SolanaGetTokenAccountsByOwnerResult {
619
663
  tokenAccounts: any[];
620
664
  }
621
665
 
666
+ type EphemeralSignerScheme = "ecdsa_secp256k1" | "eddsa_ed25519";
667
+ type EphemeralSignerChain = "ethereum" | "solana";
668
+ interface ProvisionEphemeralSignerParams {
669
+ /**
670
+ * Wallet IDs (from `user.wallets[i].id`) the agent will be authorized
671
+ * over. The iframe resolves each ID to its `key_id`, chain → MPC
672
+ * scheme, and stored `derivation_path` — integrator code doesn't need
673
+ * to know about MPC internals or BIP-32 path formatting.
674
+ */
675
+ walletIds: string[];
676
+ /**
677
+ * Optional expiration. If set, the SES enclave refuses sign requests
678
+ * issued after this timestamp. Omit for an open-ended provisioning
679
+ * the user can revoke later.
680
+ */
681
+ expiresAt?: Date;
682
+ /**
683
+ * Optional user-facing name ("DCA bot"). Stored on the wallets
684
+ * backend for the manage view — not sealed into the SES AAD, so
685
+ * renaming later is a DB-only edit and doesn't invalidate the
686
+ * provisioned signer.
687
+ */
688
+ label?: string;
689
+ }
690
+ /**
691
+ * Per-wallet display entry inside an EphemeralSigner. The list
692
+ * response is deliberately slim — schemes / derivation paths stay
693
+ * server-side (SES enforces them) and are exposed via a per-signer
694
+ * detail endpoint if ever needed.
695
+ */
696
+ interface EphemeralSignerWallet {
697
+ /** Wallet's public address/key, as stored in `platform.wallets.public_key`. */
698
+ address: string;
699
+ /** "ethereum", "solana", etc. */
700
+ chain: string;
701
+ }
702
+ /**
703
+ * One previously-provisioned ephemeral signer as returned by the list
704
+ * endpoint. Lighter than ProvisionEphemeralSignerResult — no enclave
705
+ * attestation metadata, no priv key. Drives the manage view.
706
+ */
707
+ interface EphemeralSigner {
708
+ /** Lowercase-hex Ed25519 public key. Unique within the app. */
709
+ api_pub: string;
710
+ label?: string;
711
+ /** One entry per wallet the signer is authorized over, in provisioning order. */
712
+ wallets: EphemeralSignerWallet[];
713
+ /** RFC3339. Omitted if the signer has no expiration. */
714
+ expires_at?: string;
715
+ /** RFC3339. When the row was created. */
716
+ provisioned_at: string;
717
+ }
718
+ interface ListEphemeralSignersResult {
719
+ signers: EphemeralSigner[];
720
+ }
721
+ interface RevokeEphemeralSignerParams {
722
+ /** Lowercase-hex Ed25519 signer public key, no 0x. */
723
+ apiPubHex: string;
724
+ }
725
+ interface ProvisionEphemeralSignerResult {
726
+ /** 32-byte Ed25519 signer public key (lowercase hex, no 0x). Already provisioned in the SES enclave. */
727
+ apiPubHex: string;
728
+ /**
729
+ * 32-byte Ed25519 signer private key (lowercase hex, no 0x). MoonX
730
+ * does not persist this — the caller is responsible for surfacing it
731
+ * to the user exactly once and never storing it server-side.
732
+ */
733
+ apiPrivHex: string;
734
+ /** AWS Nitro module ID from the verified attestation (e.g. `i-…-enc…`). */
735
+ moduleId: string;
736
+ /** PCR indices that matched the operator-pinned allowlist (typically [0,1,2]). */
737
+ pcrsMatched: number[];
738
+ /**
739
+ * The exact ProvisionAad JSON the iframe sealed to the enclave —
740
+ * useful for rendering a confirmation summary in the parent UI
741
+ * without rebuilding it from `wallets`.
742
+ */
743
+ aad: {
744
+ api_pub: string;
745
+ shares: Array<{
746
+ key_id: string;
747
+ scheme: EphemeralSignerScheme;
748
+ allowed_derivation_paths: string[];
749
+ }>;
750
+ expires_at: string | null;
751
+ };
752
+ }
753
+
622
754
  type EmailOtpFlowState = {
623
755
  status: "start";
624
756
  } | {
@@ -1194,4 +1326,4 @@ interface WalletVerifyRequest {
1194
1326
  sessionExpiresIn: number;
1195
1327
  }
1196
1328
 
1197
- export { type AccessTokenClaims, type AppConfigRequest, type AppConfigResponse, type AttachOAuthTokenRequest, type AttachOAuthTokenResponse, type AuthAppearance, type AuthFlow, type AuthFlowComponent, type AuthLoginMethod, type AuthProviderConfig, type BaseGetBalanceParams, type BaseGetBalanceResult, type BaseGetTokenAccountsParams, type BaseSendTransactionParams, type BaseSendTransactionResult, type BaseSignMessageParams, type BaseSignMessageResult, type BaseSignTransactionParams, type BaseSignTransactionResult, type BaseTokenClaims, type BaseUIOptions, type BaseWalletHooks, Chain, ChainLikeWithId, type ContractUIOptions, type CreateWalletResponse, type DefaultFundingMethod, type DeleteSessionRequest, type DeleteSessionResponse, type DetachOAuthTokenRequest, type DeviceFingerprint, type DisplayMode, type EmailOtpConfig, type EmailOtpFlowState, type EthereumFundingConfig, type EthereumGetBalanceParams, type EthereumGetBalanceResult, type EthereumGetTokenAccountsByOwnerParams, type EthereumGetTokenAccountsByOwnerResult, type EthereumSendTransactionParams, type EthereumSendTransactionRequest, type EthereumSendTransactionResult, type EthereumSign7702AuthorizationParams, type EthereumSign7702AuthorizationResult, type EthereumSignHashParams, type EthereumSignHashResult, type EthereumSignMessageParams, type EthereumSignMessageResult, type EthereumSignTransactionParams, type EthereumSignTransactionResult, type EthereumSignTypedDataParams, type EthereumSignTypedDataResult, type EthereumSwitchChainParams, type ExportKeyConfig, type Factor, type FlexibleTheme, type FundWalletConfig, type FundingEvents, type FundingMethod, type FundingUIConfig, type GetCurrentSessionRequest, type GetCurrentSessionResponse, type Hex, type IdentityTokenClaims, type IdpProvider, type IsAuthenticatedRequest, type IsAuthenticatedResponse, type LoginTokenBundle, type LogoutRequest, type LogoutResponse, type MessageTypeProperty, type MessageTypes, type MoonKeyThemeConfig, type MoonPaySignRequest, type MoonPaySignResponse, type MpcKeyShares, Network, type OAuthRequest, type OAuthResponse, type OnrampFundingSettings, type PasskeyEnrollConfig, type PasskeySettings, type PreferredCardProvider, type PrefillConfig, type PresenceTokenClaims, type PublicEthereumWallet, type PublicSessionData, type PublicWallet, type RefreshSessionRequest, type RefreshSessionResponse, type RetrieveWalletKeyRequest, type RetrieveWalletKeyResponse, type SdkSettings, type SendEmailOtpRequest, type SendEmailOtpResponse, type SendTransactionConfig, type SendTransactionRequest, type SessionData, type SharesDeviceRequest, type SharesDeviceResponse, type Sign7702AuthorizationError, type Sign7702AuthorizationParams, type Sign7702AuthorizationResponse, type Sign7702AuthorizationResult, type SignMessageConfig, type SignTransactionConfig, type SignTypedDataError, type SignTypedDataParams, type SignTypedDataResponse, type SignTypedDataResult, type SmsSettings, type SolanaChain, type SolanaFundingConfig, type SolanaGetBalanceParams, type SolanaGetBalanceResult, type SolanaGetTokenAccountsByOwnerParams, type SolanaGetTokenAccountsByOwnerResult, type SolanaSendTransactionParams, type SolanaSendTransactionResult, type SolanaSignMessageParams, type SolanaSignMessageResult, type SolanaSignTransactionParams, type SolanaSignTransactionResult, type TransactionCommitment, type TransactionEncoding, type TransactionUIOptions, type TypedMessage, type UseFundWalletInterface, type UsersMePublicResponse, type UsersMeRequest, type UsersMeResponse, type VerifiedSession, type VerifyEmailOtpRequest, type VerifyEmailOtpResponse, type VerifyEmailOtpUser, type VerifyOAuthTokenRequest, type VerifyOAuthTokenResponse, type VerifySiweWalletRegistrationRequest, WALLET_ERROR_CODES, type Wallet, type WalletChain, type WalletChainType, type WalletConnectConfig, WalletCreationError, type WalletError, type WalletErrorCode, type WalletKeyRequest, type WalletListEntry, type WalletRegistrationNonceRequest, type WalletRegistrationNonceResponse, type WalletType, type WalletVerifyRequest };
1329
+ export { type AccessTokenClaims, type AppConfigRequest, type AppConfigResponse, type AttachOAuthTokenRequest, type AttachOAuthTokenResponse, type AuthAppearance, type AuthFlow, type AuthFlowComponent, type AuthLoginMethod, type AuthProviderConfig, type BaseGetBalanceParams, type BaseGetBalanceResult, type BaseGetTokenAccountsParams, type BaseSendTransactionParams, type BaseSendTransactionResult, type BaseSignMessageParams, type BaseSignMessageResult, type BaseSignTransactionParams, type BaseSignTransactionResult, type BaseTokenClaims, type BaseUIOptions, type BaseWalletHooks, type BlockExplorer, type Chain, type ChainLikeWithId, type ContractUIOptions, type CreateWalletResponse, type DefaultFundingMethod, type DeleteSessionRequest, type DeleteSessionResponse, type DetachOAuthTokenRequest, type DeviceFingerprint, type DisplayMode, type EmailOtpConfig, type EmailOtpFlowState, type EphemeralSigner, type EphemeralSignerChain, type EphemeralSignerScheme, type EphemeralSignerWallet, type EthereumChainConfig, type EthereumFundingConfig, type EthereumGetBalanceParams, type EthereumGetBalanceResult, type EthereumGetTokenAccountsByOwnerParams, type EthereumGetTokenAccountsByOwnerResult, type EthereumSendTransactionParams, type EthereumSendTransactionRequest, type EthereumSendTransactionResult, type EthereumSign7702AuthorizationParams, type EthereumSign7702AuthorizationResult, type EthereumSignHashParams, type EthereumSignHashResult, type EthereumSignMessageParams, type EthereumSignMessageResult, type EthereumSignTransactionParams, type EthereumSignTransactionResult, type EthereumSignTypedDataParams, type EthereumSignTypedDataResult, type EthereumSwitchChainParams, type ExportKeyConfig, type Factor, type FlexibleTheme, type FundWalletConfig, type FundingEvents, type FundingMethod, type FundingUIConfig, type GetCurrentSessionRequest, type GetCurrentSessionResponse, type Hex, type IdentityTokenClaims, type IdpProvider, type IsAuthenticatedRequest, type IsAuthenticatedResponse, type ListEphemeralSignersResult, type LoginTokenBundle, type LogoutRequest, type LogoutResponse, type MessageTypeProperty, type MessageTypes, type MoonKeyThemeConfig, type MoonPaySignRequest, type MoonPaySignResponse, type MpcKeyShares, type NativeCurrency, Network, type OAuthRequest, type OAuthResponse, type OnrampFundingSettings, type PasskeyEnrollConfig, type PasskeySettings, type PreferredCardProvider, type PrefillConfig, type PresenceTokenClaims, type ProvisionEphemeralSignerParams, type ProvisionEphemeralSignerResult, type PublicEthereumWallet, type PublicSessionData, type PublicWallet, type RefreshSessionRequest, type RefreshSessionResponse, type RetrieveWalletKeyRequest, type RetrieveWalletKeyResponse, type RevokeEphemeralSignerParams, type RpcConfig, type RpcUrls, type SdkSettings, type SendEmailOtpRequest, type SendEmailOtpResponse, type SendTransactionConfig, type SendTransactionRequest, type SessionData, type SharesDeviceRequest, type SharesDeviceResponse, type Sign7702AuthorizationError, type Sign7702AuthorizationParams, type Sign7702AuthorizationResponse, type Sign7702AuthorizationResult, type SignMessageConfig, type SignTransactionConfig, type SignTypedDataError, type SignTypedDataParams, type SignTypedDataResponse, type SignTypedDataResult, type SmsSettings, type SolanaChain, type SolanaFundingConfig, type SolanaGetBalanceParams, type SolanaGetBalanceResult, type SolanaGetTokenAccountsByOwnerParams, type SolanaGetTokenAccountsByOwnerResult, type SolanaSendTransactionParams, type SolanaSendTransactionResult, type SolanaSignMessageParams, type SolanaSignMessageResult, type SolanaSignTransactionParams, type SolanaSignTransactionResult, type TransactionCommitment, type TransactionEncoding, type TransactionUIOptions, type TypedMessage, type UseFundWalletInterface, type UsersMePublicResponse, type UsersMeRequest, type UsersMeResponse, type VerifiedSession, type VerifyEmailOtpRequest, type VerifyEmailOtpResponse, type VerifyEmailOtpUser, type VerifyOAuthTokenRequest, type VerifyOAuthTokenResponse, type VerifySiweWalletRegistrationRequest, WALLET_ERROR_CODES, type Wallet, type WalletChain, type WalletChainType, type WalletConnectConfig, WalletCreationError, type WalletError, type WalletErrorCode, type WalletKeyRequest, type WalletListEntry, type WalletRegistrationNonceRequest, type WalletRegistrationNonceResponse, type WalletType, type WalletVerifyRequest };
@@ -1,5 +1,49 @@
1
- import { a as ChainLikeWithId, C as Chain } from '../chain-C9dvKXUY.js';
2
- export { B as BlockExplorer, E as EthereumChainConfig, N as NativeCurrency, R as RpcConfig, b as RpcUrls } from '../chain-C9dvKXUY.js';
1
+ type RpcUrls = {
2
+ http: readonly string[];
3
+ webSocket?: readonly string[];
4
+ };
5
+ type NativeCurrency = {
6
+ name: string;
7
+ symbol: string;
8
+ decimals: number;
9
+ };
10
+ type BlockExplorer = {
11
+ name: string;
12
+ url: string;
13
+ };
14
+ type Chain = {
15
+ id: number;
16
+ name: string;
17
+ network?: string;
18
+ nativeCurrency: NativeCurrency;
19
+ blockExplorers?: {
20
+ [key: string]: BlockExplorer;
21
+ default: BlockExplorer;
22
+ };
23
+ rpcUrls: {
24
+ [key: string]: RpcUrls;
25
+ default: RpcUrls;
26
+ };
27
+ testnet?: boolean;
28
+ };
29
+ type ChainLikeWithId = {
30
+ id: number;
31
+ };
32
+ type RpcConfig = {
33
+ rpcUrls?: {
34
+ [chainId: number]: string;
35
+ };
36
+ rpcTimeout?: number;
37
+ };
38
+ interface EthereumChainConfig {
39
+ defaultChain?: any;
40
+ supportedChains?: any[];
41
+ rpcs?: {
42
+ 'ethereum:mainnet': {
43
+ rpc: string;
44
+ };
45
+ };
46
+ }
3
47
 
4
48
  interface PublicWallet {
5
49
  id: string;
@@ -619,6 +663,94 @@ interface SolanaGetTokenAccountsByOwnerResult {
619
663
  tokenAccounts: any[];
620
664
  }
621
665
 
666
+ type EphemeralSignerScheme = "ecdsa_secp256k1" | "eddsa_ed25519";
667
+ type EphemeralSignerChain = "ethereum" | "solana";
668
+ interface ProvisionEphemeralSignerParams {
669
+ /**
670
+ * Wallet IDs (from `user.wallets[i].id`) the agent will be authorized
671
+ * over. The iframe resolves each ID to its `key_id`, chain → MPC
672
+ * scheme, and stored `derivation_path` — integrator code doesn't need
673
+ * to know about MPC internals or BIP-32 path formatting.
674
+ */
675
+ walletIds: string[];
676
+ /**
677
+ * Optional expiration. If set, the SES enclave refuses sign requests
678
+ * issued after this timestamp. Omit for an open-ended provisioning
679
+ * the user can revoke later.
680
+ */
681
+ expiresAt?: Date;
682
+ /**
683
+ * Optional user-facing name ("DCA bot"). Stored on the wallets
684
+ * backend for the manage view — not sealed into the SES AAD, so
685
+ * renaming later is a DB-only edit and doesn't invalidate the
686
+ * provisioned signer.
687
+ */
688
+ label?: string;
689
+ }
690
+ /**
691
+ * Per-wallet display entry inside an EphemeralSigner. The list
692
+ * response is deliberately slim — schemes / derivation paths stay
693
+ * server-side (SES enforces them) and are exposed via a per-signer
694
+ * detail endpoint if ever needed.
695
+ */
696
+ interface EphemeralSignerWallet {
697
+ /** Wallet's public address/key, as stored in `platform.wallets.public_key`. */
698
+ address: string;
699
+ /** "ethereum", "solana", etc. */
700
+ chain: string;
701
+ }
702
+ /**
703
+ * One previously-provisioned ephemeral signer as returned by the list
704
+ * endpoint. Lighter than ProvisionEphemeralSignerResult — no enclave
705
+ * attestation metadata, no priv key. Drives the manage view.
706
+ */
707
+ interface EphemeralSigner {
708
+ /** Lowercase-hex Ed25519 public key. Unique within the app. */
709
+ api_pub: string;
710
+ label?: string;
711
+ /** One entry per wallet the signer is authorized over, in provisioning order. */
712
+ wallets: EphemeralSignerWallet[];
713
+ /** RFC3339. Omitted if the signer has no expiration. */
714
+ expires_at?: string;
715
+ /** RFC3339. When the row was created. */
716
+ provisioned_at: string;
717
+ }
718
+ interface ListEphemeralSignersResult {
719
+ signers: EphemeralSigner[];
720
+ }
721
+ interface RevokeEphemeralSignerParams {
722
+ /** Lowercase-hex Ed25519 signer public key, no 0x. */
723
+ apiPubHex: string;
724
+ }
725
+ interface ProvisionEphemeralSignerResult {
726
+ /** 32-byte Ed25519 signer public key (lowercase hex, no 0x). Already provisioned in the SES enclave. */
727
+ apiPubHex: string;
728
+ /**
729
+ * 32-byte Ed25519 signer private key (lowercase hex, no 0x). MoonX
730
+ * does not persist this — the caller is responsible for surfacing it
731
+ * to the user exactly once and never storing it server-side.
732
+ */
733
+ apiPrivHex: string;
734
+ /** AWS Nitro module ID from the verified attestation (e.g. `i-…-enc…`). */
735
+ moduleId: string;
736
+ /** PCR indices that matched the operator-pinned allowlist (typically [0,1,2]). */
737
+ pcrsMatched: number[];
738
+ /**
739
+ * The exact ProvisionAad JSON the iframe sealed to the enclave —
740
+ * useful for rendering a confirmation summary in the parent UI
741
+ * without rebuilding it from `wallets`.
742
+ */
743
+ aad: {
744
+ api_pub: string;
745
+ shares: Array<{
746
+ key_id: string;
747
+ scheme: EphemeralSignerScheme;
748
+ allowed_derivation_paths: string[];
749
+ }>;
750
+ expires_at: string | null;
751
+ };
752
+ }
753
+
622
754
  type EmailOtpFlowState = {
623
755
  status: "start";
624
756
  } | {
@@ -1194,4 +1326,4 @@ interface WalletVerifyRequest {
1194
1326
  sessionExpiresIn: number;
1195
1327
  }
1196
1328
 
1197
- export { type AccessTokenClaims, type AppConfigRequest, type AppConfigResponse, type AttachOAuthTokenRequest, type AttachOAuthTokenResponse, type AuthAppearance, type AuthFlow, type AuthFlowComponent, type AuthLoginMethod, type AuthProviderConfig, type BaseGetBalanceParams, type BaseGetBalanceResult, type BaseGetTokenAccountsParams, type BaseSendTransactionParams, type BaseSendTransactionResult, type BaseSignMessageParams, type BaseSignMessageResult, type BaseSignTransactionParams, type BaseSignTransactionResult, type BaseTokenClaims, type BaseUIOptions, type BaseWalletHooks, Chain, ChainLikeWithId, type ContractUIOptions, type CreateWalletResponse, type DefaultFundingMethod, type DeleteSessionRequest, type DeleteSessionResponse, type DetachOAuthTokenRequest, type DeviceFingerprint, type DisplayMode, type EmailOtpConfig, type EmailOtpFlowState, type EthereumFundingConfig, type EthereumGetBalanceParams, type EthereumGetBalanceResult, type EthereumGetTokenAccountsByOwnerParams, type EthereumGetTokenAccountsByOwnerResult, type EthereumSendTransactionParams, type EthereumSendTransactionRequest, type EthereumSendTransactionResult, type EthereumSign7702AuthorizationParams, type EthereumSign7702AuthorizationResult, type EthereumSignHashParams, type EthereumSignHashResult, type EthereumSignMessageParams, type EthereumSignMessageResult, type EthereumSignTransactionParams, type EthereumSignTransactionResult, type EthereumSignTypedDataParams, type EthereumSignTypedDataResult, type EthereumSwitchChainParams, type ExportKeyConfig, type Factor, type FlexibleTheme, type FundWalletConfig, type FundingEvents, type FundingMethod, type FundingUIConfig, type GetCurrentSessionRequest, type GetCurrentSessionResponse, type Hex, type IdentityTokenClaims, type IdpProvider, type IsAuthenticatedRequest, type IsAuthenticatedResponse, type LoginTokenBundle, type LogoutRequest, type LogoutResponse, type MessageTypeProperty, type MessageTypes, type MoonKeyThemeConfig, type MoonPaySignRequest, type MoonPaySignResponse, type MpcKeyShares, Network, type OAuthRequest, type OAuthResponse, type OnrampFundingSettings, type PasskeyEnrollConfig, type PasskeySettings, type PreferredCardProvider, type PrefillConfig, type PresenceTokenClaims, type PublicEthereumWallet, type PublicSessionData, type PublicWallet, type RefreshSessionRequest, type RefreshSessionResponse, type RetrieveWalletKeyRequest, type RetrieveWalletKeyResponse, type SdkSettings, type SendEmailOtpRequest, type SendEmailOtpResponse, type SendTransactionConfig, type SendTransactionRequest, type SessionData, type SharesDeviceRequest, type SharesDeviceResponse, type Sign7702AuthorizationError, type Sign7702AuthorizationParams, type Sign7702AuthorizationResponse, type Sign7702AuthorizationResult, type SignMessageConfig, type SignTransactionConfig, type SignTypedDataError, type SignTypedDataParams, type SignTypedDataResponse, type SignTypedDataResult, type SmsSettings, type SolanaChain, type SolanaFundingConfig, type SolanaGetBalanceParams, type SolanaGetBalanceResult, type SolanaGetTokenAccountsByOwnerParams, type SolanaGetTokenAccountsByOwnerResult, type SolanaSendTransactionParams, type SolanaSendTransactionResult, type SolanaSignMessageParams, type SolanaSignMessageResult, type SolanaSignTransactionParams, type SolanaSignTransactionResult, type TransactionCommitment, type TransactionEncoding, type TransactionUIOptions, type TypedMessage, type UseFundWalletInterface, type UsersMePublicResponse, type UsersMeRequest, type UsersMeResponse, type VerifiedSession, type VerifyEmailOtpRequest, type VerifyEmailOtpResponse, type VerifyEmailOtpUser, type VerifyOAuthTokenRequest, type VerifyOAuthTokenResponse, type VerifySiweWalletRegistrationRequest, WALLET_ERROR_CODES, type Wallet, type WalletChain, type WalletChainType, type WalletConnectConfig, WalletCreationError, type WalletError, type WalletErrorCode, type WalletKeyRequest, type WalletListEntry, type WalletRegistrationNonceRequest, type WalletRegistrationNonceResponse, type WalletType, type WalletVerifyRequest };
1329
+ export { type AccessTokenClaims, type AppConfigRequest, type AppConfigResponse, type AttachOAuthTokenRequest, type AttachOAuthTokenResponse, type AuthAppearance, type AuthFlow, type AuthFlowComponent, type AuthLoginMethod, type AuthProviderConfig, type BaseGetBalanceParams, type BaseGetBalanceResult, type BaseGetTokenAccountsParams, type BaseSendTransactionParams, type BaseSendTransactionResult, type BaseSignMessageParams, type BaseSignMessageResult, type BaseSignTransactionParams, type BaseSignTransactionResult, type BaseTokenClaims, type BaseUIOptions, type BaseWalletHooks, type BlockExplorer, type Chain, type ChainLikeWithId, type ContractUIOptions, type CreateWalletResponse, type DefaultFundingMethod, type DeleteSessionRequest, type DeleteSessionResponse, type DetachOAuthTokenRequest, type DeviceFingerprint, type DisplayMode, type EmailOtpConfig, type EmailOtpFlowState, type EphemeralSigner, type EphemeralSignerChain, type EphemeralSignerScheme, type EphemeralSignerWallet, type EthereumChainConfig, type EthereumFundingConfig, type EthereumGetBalanceParams, type EthereumGetBalanceResult, type EthereumGetTokenAccountsByOwnerParams, type EthereumGetTokenAccountsByOwnerResult, type EthereumSendTransactionParams, type EthereumSendTransactionRequest, type EthereumSendTransactionResult, type EthereumSign7702AuthorizationParams, type EthereumSign7702AuthorizationResult, type EthereumSignHashParams, type EthereumSignHashResult, type EthereumSignMessageParams, type EthereumSignMessageResult, type EthereumSignTransactionParams, type EthereumSignTransactionResult, type EthereumSignTypedDataParams, type EthereumSignTypedDataResult, type EthereumSwitchChainParams, type ExportKeyConfig, type Factor, type FlexibleTheme, type FundWalletConfig, type FundingEvents, type FundingMethod, type FundingUIConfig, type GetCurrentSessionRequest, type GetCurrentSessionResponse, type Hex, type IdentityTokenClaims, type IdpProvider, type IsAuthenticatedRequest, type IsAuthenticatedResponse, type ListEphemeralSignersResult, type LoginTokenBundle, type LogoutRequest, type LogoutResponse, type MessageTypeProperty, type MessageTypes, type MoonKeyThemeConfig, type MoonPaySignRequest, type MoonPaySignResponse, type MpcKeyShares, type NativeCurrency, Network, type OAuthRequest, type OAuthResponse, type OnrampFundingSettings, type PasskeyEnrollConfig, type PasskeySettings, type PreferredCardProvider, type PrefillConfig, type PresenceTokenClaims, type ProvisionEphemeralSignerParams, type ProvisionEphemeralSignerResult, type PublicEthereumWallet, type PublicSessionData, type PublicWallet, type RefreshSessionRequest, type RefreshSessionResponse, type RetrieveWalletKeyRequest, type RetrieveWalletKeyResponse, type RevokeEphemeralSignerParams, type RpcConfig, type RpcUrls, type SdkSettings, type SendEmailOtpRequest, type SendEmailOtpResponse, type SendTransactionConfig, type SendTransactionRequest, type SessionData, type SharesDeviceRequest, type SharesDeviceResponse, type Sign7702AuthorizationError, type Sign7702AuthorizationParams, type Sign7702AuthorizationResponse, type Sign7702AuthorizationResult, type SignMessageConfig, type SignTransactionConfig, type SignTypedDataError, type SignTypedDataParams, type SignTypedDataResponse, type SignTypedDataResult, type SmsSettings, type SolanaChain, type SolanaFundingConfig, type SolanaGetBalanceParams, type SolanaGetBalanceResult, type SolanaGetTokenAccountsByOwnerParams, type SolanaGetTokenAccountsByOwnerResult, type SolanaSendTransactionParams, type SolanaSendTransactionResult, type SolanaSignMessageParams, type SolanaSignMessageResult, type SolanaSignTransactionParams, type SolanaSignTransactionResult, type TransactionCommitment, type TransactionEncoding, type TransactionUIOptions, type TypedMessage, type UseFundWalletInterface, type UsersMePublicResponse, type UsersMeRequest, type UsersMeResponse, type VerifiedSession, type VerifyEmailOtpRequest, type VerifyEmailOtpResponse, type VerifyEmailOtpUser, type VerifyOAuthTokenRequest, type VerifyOAuthTokenResponse, type VerifySiweWalletRegistrationRequest, WALLET_ERROR_CODES, type Wallet, type WalletChain, type WalletChainType, type WalletConnectConfig, WalletCreationError, type WalletError, type WalletErrorCode, type WalletKeyRequest, type WalletListEntry, type WalletRegistrationNonceRequest, type WalletRegistrationNonceResponse, type WalletType, type WalletVerifyRequest };
@@ -1,4 +1,4 @@
1
- export { F as FORWARDED_ERROR_FIELDS, P as PostMessageClient, a as PostMessageMethod, b as PostMessageServer, c as PostMessageType } from '../post-message-CmgAfkOS.mjs';
1
+ export { F as FORWARDED_ERROR_FIELDS, P as PostMessageClient, a as PostMessageMethod, b as PostMessageServer, c as PostMessageType } from '../post-message-Z6cLf0mS.mjs';
2
2
 
3
3
  /**
4
4
  * Get the appropriate MoonKey API URL based on environment configuration