@account-kit/signer 4.63.2 → 4.64.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 (52) hide show
  1. package/dist/esm/base.d.ts +0 -1
  2. package/dist/esm/base.js +8 -16
  3. package/dist/esm/base.js.map +1 -1
  4. package/dist/esm/client/base.d.ts +14 -0
  5. package/dist/esm/client/base.js +21 -1
  6. package/dist/esm/client/base.js.map +1 -1
  7. package/dist/esm/client/server.d.ts +61 -0
  8. package/dist/esm/client/server.js +193 -0
  9. package/dist/esm/client/server.js.map +1 -0
  10. package/dist/esm/client/types.d.ts +15 -1
  11. package/dist/esm/client/types.js.map +1 -1
  12. package/dist/esm/errors.d.ts +4 -0
  13. package/dist/esm/errors.js +11 -0
  14. package/dist/esm/errors.js.map +1 -1
  15. package/dist/esm/index.d.ts +2 -0
  16. package/dist/esm/index.js +2 -0
  17. package/dist/esm/index.js.map +1 -1
  18. package/dist/esm/serverSigner.d.ts +99 -0
  19. package/dist/esm/serverSigner.js +139 -0
  20. package/dist/esm/serverSigner.js.map +1 -0
  21. package/dist/esm/signer.d.ts +7 -1
  22. package/dist/esm/signer.js.map +1 -1
  23. package/dist/esm/version.d.ts +1 -1
  24. package/dist/esm/version.js +1 -1
  25. package/dist/esm/version.js.map +1 -1
  26. package/dist/types/base.d.ts +0 -1
  27. package/dist/types/base.d.ts.map +1 -1
  28. package/dist/types/client/base.d.ts +14 -0
  29. package/dist/types/client/base.d.ts.map +1 -1
  30. package/dist/types/client/server.d.ts +62 -0
  31. package/dist/types/client/server.d.ts.map +1 -0
  32. package/dist/types/client/types.d.ts +15 -1
  33. package/dist/types/client/types.d.ts.map +1 -1
  34. package/dist/types/errors.d.ts +4 -0
  35. package/dist/types/errors.d.ts.map +1 -1
  36. package/dist/types/index.d.ts +2 -0
  37. package/dist/types/index.d.ts.map +1 -1
  38. package/dist/types/serverSigner.d.ts +100 -0
  39. package/dist/types/serverSigner.d.ts.map +1 -0
  40. package/dist/types/signer.d.ts +7 -1
  41. package/dist/types/signer.d.ts.map +1 -1
  42. package/dist/types/version.d.ts +1 -1
  43. package/package.json +4 -4
  44. package/src/base.ts +8 -20
  45. package/src/client/base.ts +29 -1
  46. package/src/client/server.ts +149 -0
  47. package/src/client/types.ts +18 -1
  48. package/src/errors.ts +7 -0
  49. package/src/index.ts +6 -0
  50. package/src/serverSigner.ts +171 -0
  51. package/src/signer.ts +7 -1
  52. package/src/version.ts +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/client/server.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAMjD,MAAM,qBAAqB,GAAG,CAAC,OAAe,EAAE,EAAE;IAChD,OAAO,GAAG,EAAE;QACV,MAAM,IAAI,uBAAuB,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,GAAG,EAAE;IAC9B,OAAO;QACL,KAAK,EAAE,GAAG,EAAE;YACV,MAAM,IAAI,qBAAqB,EAAE,CAAC;QACpC,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,OAAO,kBAAmB,SAAQ,gBAA2B;IACjE;;;;;;;OAOG;IACH,YAAY,EAAE,UAAU,EAA4B;QAClD,sFAAsF;QACtF,MAAM,OAAO,GAAG,kBAAkB,EAAE,CAAC;QAErC,KAAK,CAAC,EAAE,UAAU,EAAE,OAAO,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C;oBAChB,aAAa,EAAE,MAAM,CAAC,UAAU;oBAChC,YAAY,EAAE,MAAM,CAAC,SAAS;iBAC/B,CAAC,CACH,CAAC;gBAEF,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;gBACzC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;gBACjB,OAAO,IAAI,CAAC;YACd,CAAC;WAAC;QAEF;;;WAGG;QACI;;;;mBAAc,qBAAqB,CAAC,UAAU,CAAC;WAAC;QAChD;;;;mBAAY,qBAAqB,CAAC,KAAK,CAAC;WAAC;QACtC;;;;mBAAqB,qBAAqB,CAAC,UAAU,CAAC;WAAC;QACvD;;;;mBAAsB,qBAAqB,CAAC,UAAU,CAAC;WAAC;QACzD;;;;mBAAgB,qBAAqB,CAAC,YAAY,CAAC;WAAC;QAC7C;;;;mBAAgB,qBAAqB,CAAC,qBAAqB,CAAC;WAAC;QACpE;;;;mBAAyB,qBAAqB,CAAC,kBAAkB,CAAC;WAAC;QACnE;;;;mBAAoB,qBAAqB,CAAC,gBAAgB,CAAC;WAAC;QAC5D;;;;mBAAiB,qBAAqB,CAAC,aAAa,CAAC;WAAC;QACtD;;;;mBAAe,qBAAqB,CAAC,eAAe,CAAC;WAAC;QACtD;;;;mBAAkB,qBAAqB,CAAC,mBAAmB,CAAC;WAAC;QAC7D;;;;mBAAyB,qBAAqB,CACrD,sBAAsB,CACvB;WAAC;QACO;;;;mBAAiB,qBAAqB,CAAC,cAAc,CAAC;WAAC;IApGhE,CAAC;CAqGF","sourcesContent":["import type { ConnectionConfig } from \"@aa-sdk/core\";\nimport { ApiKeyStamper } from \"@turnkey/api-key-stamper\";\nimport type { CreateAccountParams, SignupResponse, User } from \"./types\";\nimport { BaseSignerClient } from \"./base.js\";\nimport { NotAuthenticatedError, UnsupportedFeatureError } from \"../errors.js\";\nimport { TurnkeyClient } from \"@turnkey/http\";\nimport type { AuthParams } from \"../signer\";\nimport { p256 } from \"@noble/curves/p256\";\nimport { bytesToHex } from \"@noble/curves/utils\";\n\nexport interface ServerSignerClientParams {\n connection: ConnectionConfig;\n}\n\nconst unimplementedFunction = (feature: string) => {\n return () => {\n throw new UnsupportedFeatureError(feature);\n };\n};\n\nconst createDummyStamper = () => {\n return {\n stamp: () => {\n throw new NotAuthenticatedError();\n },\n };\n};\n\n/**\n * ServerSignerClient is a client for signing messages using an access key.\n * It extends the BaseSignerClient and uses the ApiKeyStamper for signing.\n * Primarily intended to be used server-side.\n */\nexport class ServerSignerClient extends BaseSignerClient<undefined> {\n /**\n * Creates an instance of ServerSignerClient.\n *\n * @param {ServerSignerClientParams} params The parameters for the client, including the access key and connection configuration\n * @param {ConnectionConfig} params.connection The connection configuration for the client\n * @param {string} params.accessKey The access key to be used for authentication\n * @param {string | undefined} params.accountId An optional ID to identify the account. Only required when using a single access key for multiple signers.\n */\n constructor({ connection }: ServerSignerClientParams) {\n // we will re-recreate the turnkey client (including the stamper) when we authenticate\n const stamper = createDummyStamper();\n\n super({ connection, stamper });\n }\n\n /**\n * Unsets the user for the client\n */\n public override disconnect = async (): Promise<void> => {\n this.user = undefined;\n };\n\n /**\n * Creates a new user with the given parameters.\n *\n * @param {CreateAccountParams} params The parameters for creating the account\n * @returns {Promise<SignupResponse>} A promise that resolves to the signup response\n */\n public override createAccount = async (\n params: CreateAccountParams,\n ): Promise<SignupResponse> => {\n if (params.type !== \"accessKey\") {\n throw new Error(\n \"ServerSignerClient only supports account creation via access key\",\n );\n }\n\n return this.request(\"/v1/signup\", {\n accessKey: {\n publicKey: params.publicKey,\n accountId: params.accountId,\n },\n });\n };\n\n /**\n * Authenticates the user with an access key.\n *\n * @param {Extract<AuthParams, { type: \"accessKey\" }>} params The parameters for the authentication\n * @returns {Promise<User>} A promise that resolves to the user\n */\n public authenticateWithAccessKey = async ({\n accessKey,\n accountId,\n }: Extract<AuthParams, { type: \"accessKey\" }>): Promise<User> => {\n const publicKey = bytesToHex(p256.getPublicKey(accessKey));\n\n const user = await this.lookupUserByAccessKey({\n publicKey,\n accountId,\n });\n\n const orgId =\n user?.orgId ??\n (\n await this.createAccount({\n type: \"accessKey\",\n publicKey,\n accountId,\n })\n )?.orgId;\n\n return this.completeAuthWithApiKey(\n { publicKey, privateKey: accessKey },\n orgId,\n );\n };\n\n private completeAuthWithApiKey = async (\n apiKey: { publicKey: string; privateKey: string },\n subOrgId: string,\n ) => {\n this.turnkeyClient = new TurnkeyClient(\n { baseUrl: \"https://api.turnkey.com\" },\n new ApiKeyStamper({\n apiPrivateKey: apiKey.privateKey,\n apiPublicKey: apiKey.publicKey,\n }),\n );\n\n const user = await this.whoami(subOrgId);\n this.user = user;\n return user;\n };\n\n /**\n * Unimplemented functions for server signer.\n * Required to extend the BaseSignerClient class.\n */\n public initSmsAuth = unimplementedFunction(\"Sms auth\");\n public submitJwt = unimplementedFunction(\"Jwt\");\n protected initSessionStamper = unimplementedFunction(\"Sessions\");\n protected initWebauthnStamper = unimplementedFunction(\"Webauthn\");\n override initEmailAuth = unimplementedFunction(\"Email auth\");\n public override submitOtpCode = unimplementedFunction(\"Otp code submission\");\n override completeAuthWithBundle = unimplementedFunction(\"Auth with bundle\");\n override oauthWithRedirect = unimplementedFunction(\"OAuth redirect\");\n override oauthWithPopup = unimplementedFunction(\"OAuth popup\");\n override exportWallet = unimplementedFunction(\"Wallet export\");\n override targetPublicKey = unimplementedFunction(\"Target public key\");\n override getWebAuthnAttestation = unimplementedFunction(\n \"WebAuthn attestation\",\n );\n override getOauthConfig = unimplementedFunction(\"OAuth config\");\n}\n"]}
@@ -46,6 +46,10 @@ export type CreateAccountParams = {
46
46
  type: "passkey";
47
47
  username: string;
48
48
  creationOpts?: CredentialCreationOptionOverrides;
49
+ } | {
50
+ type: "accessKey";
51
+ publicKey: string;
52
+ accountId?: string;
49
53
  };
50
54
  export type EmailType = "magicLink" | "otp";
51
55
  export type EmailAuthParams = {
@@ -61,6 +65,12 @@ export type SmsAuthParams = {
61
65
  phone: string;
62
66
  targetPublicKey: string;
63
67
  };
68
+ export type AccessKeyAuthParamsPublicKeyOnly = {
69
+ accessKey: {
70
+ publicKey: string;
71
+ accountId?: string;
72
+ };
73
+ };
64
74
  export type OauthParams = Extract<AuthParams, {
65
75
  type: "oauth";
66
76
  }> & {
@@ -135,7 +145,7 @@ export type SignerEndpoints = [
135
145
  challenge: string;
136
146
  attestation: Awaited<ReturnType<typeof getWebAuthnAttestation>>;
137
147
  };
138
- };
148
+ } | AccessKeyAuthParamsPublicKeyOnly;
139
149
  Response: SignupResponse;
140
150
  },
141
151
  {
@@ -162,6 +172,10 @@ export type SignerEndpoints = [
162
172
  Body: {
163
173
  email?: string;
164
174
  phone?: string;
175
+ accessKey?: {
176
+ publicKey: string;
177
+ accountId?: string;
178
+ };
165
179
  };
166
180
  Response: {
167
181
  orgId: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/client/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Address } from \"@aa-sdk/core\";\nimport type {\n TSignedRequest,\n TurnkeyApiTypes,\n getWebAuthnAttestation,\n} from \"@turnkey/http\";\nimport type { Hex } from \"viem\";\nimport type { AuthParams } from \"../signer\";\n\n// [!region VerificationOtp]\nexport type VerificationOtp = {\n /** The OTP ID returned from initOtp */\n id: string;\n /** The OTP code received by the user */\n code: string;\n};\n// [!endregion VerificationOtp]\n\nexport type CredentialCreationOptionOverrides = {\n publicKey?: Partial<CredentialCreationOptions[\"publicKey\"]>;\n} & Pick<CredentialCreationOptions, \"signal\">;\n\n// [!region User]\nexport type User = {\n email?: string;\n phone?: string;\n orgId: string;\n userId: string;\n address: Address;\n solanaAddress?: string;\n credentialId?: string;\n idToken?: string;\n accessToken?: string;\n claims?: Record<string, unknown>;\n};\n// [!endregion User]\n\nexport type ExportWalletParams = {\n iframeContainerId: string;\n iframeElementId?: string;\n};\n\nexport type ExportWalletOutput = boolean;\n\nexport type CreateAccountParams =\n | {\n type: \"email\";\n email: string;\n /** @deprecated This option will be overriden by dashboard settings. Please use the dashboard settings instead. This option will be removed in a future release. */\n emailMode?: EmailType;\n expirationSeconds?: number;\n redirectParams?: URLSearchParams;\n }\n | {\n type: \"sms\";\n phone: string;\n }\n | {\n type: \"passkey\";\n email: string;\n creationOpts?: CredentialCreationOptionOverrides;\n }\n | {\n type: \"passkey\";\n username: string;\n creationOpts?: CredentialCreationOptionOverrides;\n };\n\nexport type EmailType = \"magicLink\" | \"otp\";\n\nexport type EmailAuthParams = {\n email: string;\n /** @deprecated This option will be overriden by dashboard settings. Please use the dashboard settings instead. This option will be removed in a future release. */\n emailMode?: EmailType;\n expirationSeconds?: number;\n targetPublicKey: string;\n redirectParams?: URLSearchParams;\n multiFactors?: VerifyMfaParams[];\n};\n\nexport type SmsAuthParams = {\n phone: string;\n targetPublicKey: string;\n};\n\nexport type OauthParams = Extract<AuthParams, { type: \"oauth\" }> & {\n expirationSeconds?: number;\n fetchIdTokenOnly?: boolean;\n};\n\nexport type OtpParams = {\n orgId: string;\n otpId: string;\n otpCode: string;\n targetPublicKey: string;\n expirationSeconds?: number;\n multiFactors?: VerifyMfaParams[];\n};\n\nexport type OtpResponse =\n | {\n status: \"SUCCESS\";\n credentialBundle: string;\n }\n | {\n status: \"MFA_REQUIRED\";\n encryptedPayload: string;\n multiFactors: MfaFactor[];\n };\n\nexport type JwtParams = {\n jwt: string;\n targetPublicKey: string;\n authProvider?: string;\n expirationSeconds?: number;\n};\n\nexport type JwtResponse = {\n isSignUp: boolean;\n orgId: string;\n credentialBundle: string;\n};\n\nexport type SignupResponse = {\n orgId: string;\n userId?: string;\n address?: Address;\n solanaAddress?: string;\n otpId?: string;\n};\n\nexport type OauthConfig = {\n codeChallenge: string;\n requestKey: string;\n authProviders: AuthProviderConfig[];\n};\n\nexport type EmailConfig = {\n mode?: \"MAGIC_LINK\" | \"OTP\";\n};\n\nexport type SignerConfig = {\n email: EmailConfig;\n};\n\nexport type AuthProviderConfig = {\n id: string;\n isCustomProvider?: boolean;\n clientId: string;\n authEndpoint: string;\n};\n\nexport type SignerRoutes = SignerEndpoints[number][\"Route\"];\nexport type SignerBody<T extends SignerRoutes> = Extract<\n SignerEndpoints[number],\n { Route: T }\n>[\"Body\"];\nexport type SignerResponse<T extends SignerRoutes> = Extract<\n SignerEndpoints[number],\n { Route: T }\n>[\"Response\"];\n\nexport type SignerEndpoints = [\n {\n Route: \"/v1/signup\";\n Body:\n | (Omit<EmailAuthParams, \"redirectParams\"> & {\n redirectParams?: string;\n })\n | SmsAuthParams\n | {\n passkey: {\n challenge: string;\n attestation: Awaited<ReturnType<typeof getWebAuthnAttestation>>;\n };\n };\n Response: SignupResponse;\n },\n {\n Route: \"/v1/whoami\";\n Body: {\n stampedRequest: TSignedRequest;\n };\n Response: User;\n },\n {\n Route: \"/v1/auth\";\n Body:\n | (Omit<EmailAuthParams, \"redirectParams\"> & {\n redirectParams?: string;\n multiFactors?: VerifyMfaParams[];\n })\n | SmsAuthParams;\n Response: {\n orgId: string;\n otpId?: string;\n multiFactors?: MfaFactor[];\n };\n },\n {\n Route: \"/v1/lookup\";\n Body: {\n email?: string;\n phone?: string;\n };\n Response: {\n orgId: string | null;\n };\n },\n {\n Route: \"/v1/init-otp\";\n Body: {\n contact: string;\n otpType: \"OTP_TYPE_SMS\" | \"OTP_TYPE_EMAIL\";\n };\n Response: {\n otpId: string;\n };\n },\n {\n Route: \"/v1/verify-otp\";\n Body: {\n otpId: string;\n otpCode: string;\n };\n Response: {\n verificationToken: string;\n };\n },\n {\n Route: \"/v1/sign-payload\";\n Body: {\n stampedRequest: TSignedRequest;\n };\n Response: {\n signature: Hex;\n };\n },\n {\n Route: \"/v1/update-email-auth\";\n Body: {\n stampedRequest: TSignedRequest;\n };\n Response: void;\n },\n {\n Route: \"/v1/update-phone-auth\";\n Body: {\n stampedRequest: TSignedRequest;\n };\n Response: void;\n },\n {\n Route: \"/v1/add-oauth-provider\";\n Body: {\n stampedRequest: TSignedRequest;\n };\n Response: { oauthProviders: OauthProviderInfo[] };\n },\n {\n Route: \"/v1/remove-oauth-provider\";\n Body: {\n stampedRequest: TSignedRequest;\n };\n Response: void;\n },\n {\n Route: \"/v1/list-auth-methods\";\n Body: {};\n Response: AuthMethods;\n },\n {\n Route: \"/v1/prepare-oauth\";\n Body: {\n nonce: string;\n };\n Response: OauthConfig;\n },\n {\n Route: \"/v1/otp\";\n Body: OtpParams;\n Response: OtpResponse;\n },\n {\n Route: \"/v1/auth-list-multi-factors\";\n Body: {\n stampedRequest: TSignedRequest;\n };\n Response: {\n multiFactors: MfaFactor[];\n };\n },\n {\n Route: \"/v1/auth-delete-multi-factors\";\n Body: {\n stampedRequest: TSignedRequest;\n multiFactorIds: string[];\n };\n Response: {\n multiFactors: MfaFactor[];\n };\n },\n {\n Route: \"/v1/auth-request-multi-factor\";\n Body: {\n stampedRequest: TSignedRequest;\n multiFactorType: MultiFactorType;\n };\n Response: AddMfaResult;\n },\n {\n Route: \"/v1/auth-verify-multi-factor\";\n Body: VerifyMfaParams & {\n stampedRequest: TSignedRequest;\n };\n Response: {\n multiFactors: MfaFactor[];\n };\n },\n {\n Route: \"/v1/auth-jwt\";\n Body: JwtParams;\n Response: JwtResponse;\n },\n {\n Route: \"/v1/signer-config\";\n Body: {};\n Response: SignerConfig;\n },\n {\n Route: \"/v1/auth-validate-multi-factors\";\n Body: {\n encryptedPayload: string;\n multiFactors: VerifyMfaParams[];\n };\n Response: {\n payload: {\n credentialBundle?: string;\n };\n multiFactors: MfaFactor[];\n };\n },\n {\n Route: \"/v1/multi-owner-create\";\n Body: {\n members: {\n evmSignerAddress: Address;\n }[];\n };\n Response: {\n result: {\n orgId: string;\n evmSignerAddress: Address;\n members: {\n evmSignerAddress: Address;\n }[];\n };\n };\n },\n {\n Route: \"/v1/multi-owner-prepare-add\";\n Body: {\n organizationId: string;\n members: {\n evmSignerAddress: Address;\n }[];\n };\n Response: {\n result: TurnkeyApiTypes[\"v1CreateUsersRequest\"];\n };\n },\n {\n Route: \"/v1/multi-owner-add\";\n Body: {\n stampedRequest: TSignedRequest;\n };\n Response: {\n result: {\n members: {\n evmSignerAddress: Address;\n }[];\n updateRootQuorumRequest: TurnkeyApiTypes[\"v1UpdateRootQuorumRequest\"];\n };\n };\n },\n {\n Route: \"/v1/multi-owner-update-root-quorum\";\n Body: {\n stampedRequest: TSignedRequest;\n };\n Response: {\n result: TurnkeyApiTypes[\"v1UpdateRootQuorumResult\"];\n };\n },\n {\n Route: \"/v1/multi-owner-sign-raw-payload\";\n Body: {\n stampedRequest: TSignedRequest;\n };\n Response: {\n result: {\n signRawPayloadResult: TurnkeyApiTypes[\"v1SignRawPayloadResult\"];\n };\n };\n },\n {\n Route: \"/v1/multi-owner-prepare-delete\";\n Body: {\n organizationId: string;\n members: {\n evmSignerAddress: Address;\n }[];\n };\n Response: {\n result: {\n updateRootQuorumRequest: TurnkeyApiTypes[\"v1UpdateRootQuorumRequest\"];\n deleteMembersRequest: TurnkeyApiTypes[\"v1DeleteUsersRequest\"];\n };\n };\n },\n {\n Route: \"/v1/multi-owner-delete\";\n Body: {\n stampedRequest: TSignedRequest;\n };\n Response: {\n result: {\n deletedUserIds: string[];\n };\n };\n },\n];\n\nexport type AuthenticatingEventMetadata = {\n type:\n | \"email\"\n | \"passkey\"\n | \"oauth\"\n | \"otp\"\n | \"otpVerify\"\n | \"custom-jwt\"\n | \"sms\";\n};\n\nexport type AlchemySignerClientEvents = {\n connected(user: User): void;\n newUserSignup(): void;\n authenticating(data: AuthenticatingEventMetadata): void;\n connectedEmail(user: User, bundle: string): void;\n connectedPasskey(user: User): void;\n connectedOauth(user: User, bundle: string): void;\n connectedOtp(user: User, bundle: string): void;\n connectedJwt(user: User, bundle: string): void;\n disconnected(): void;\n};\n\nexport type AlchemySignerClientEvent = keyof AlchemySignerClientEvents;\n\nexport type GetWebAuthnAttestationResult = {\n attestation: Awaited<ReturnType<typeof getWebAuthnAttestation>>;\n challenge: ArrayBuffer | string;\n authenticatorUserId: BufferSource;\n};\n\nexport type AuthLinkingPrompt = {\n status: \"ACCOUNT_LINKING_CONFIRMATION_REQUIRED\";\n idToken: string;\n accessToken?: string;\n email: string;\n providerName: string;\n otpId: string;\n orgId: string;\n};\n\nexport type IdTokenOnly = {\n status: \"FETCHED_ID_TOKEN_ONLY\";\n idToken: string;\n accessToken?: string;\n providerName: string;\n};\n\nexport type OauthState = {\n authProviderId: string;\n isCustomProvider?: boolean;\n requestKey: string;\n turnkeyPublicKey: string;\n expirationSeconds?: number;\n redirectUrl?: string;\n openerOrigin?: string;\n fetchIdTokenOnly?: boolean;\n};\n\nexport type GetOauthProviderUrlArgs = {\n oauthParams: OauthParams;\n turnkeyPublicKey: string;\n oauthCallbackUrl: string;\n oauthConfig?: OauthConfig;\n usesRelativeUrl?: boolean;\n};\n\nexport type MfaFactor = {\n multiFactorId: string;\n multiFactorType: string;\n};\n\ntype MultiFactorType = \"totp\";\n\nexport type AddMfaParams = {\n multiFactorType: MultiFactorType;\n};\n\nexport type AddMfaResult = {\n multiFactorType: MultiFactorType;\n multiFactorId: string;\n multiFactorTotpUrl: string;\n};\n\nexport type VerifyMfaParams = {\n multiFactorId: string;\n multiFactorCode: string;\n};\n\nexport type RemoveMfaParams = {\n multiFactorIds: string[];\n};\n\nexport type ValidateMultiFactorsParams = {\n encryptedPayload: string;\n multiFactors: VerifyMfaParams[];\n};\n\nexport type MfaChallenge = {\n multiFactorId: string;\n multiFactorChallenge:\n | {\n code: string;\n }\n | Record<string, any>;\n};\n\nexport type SubmitOtpCodeResponse =\n | { bundle: string; mfaRequired: false }\n | { mfaRequired: true; encryptedPayload: string; multiFactors: MfaFactor[] };\n\nexport type AddOauthProviderParams = {\n providerName: string;\n oidcToken: string;\n};\n\nexport type AuthMethods = {\n email?: string;\n phone?: string;\n oauthProviders: OauthProviderInfo[];\n passkeys: PasskeyInfo[];\n};\n\nexport type OauthProviderInfo = {\n providerId: string;\n issuer: string;\n providerName?: string;\n userDisplayName?: string;\n};\n\nexport type PasskeyInfo = {\n authenticatorId: string;\n name: string;\n createdAt: number;\n};\n\nexport type experimental_CreateApiKeyParams = {\n name: string;\n publicKey: string;\n expirationSec: number;\n};\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/client/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Address } from \"@aa-sdk/core\";\nimport type {\n TSignedRequest,\n TurnkeyApiTypes,\n getWebAuthnAttestation,\n} from \"@turnkey/http\";\nimport type { Hex } from \"viem\";\nimport type { AuthParams } from \"../signer\";\n\n// [!region VerificationOtp]\nexport type VerificationOtp = {\n /** The OTP ID returned from initOtp */\n id: string;\n /** The OTP code received by the user */\n code: string;\n};\n// [!endregion VerificationOtp]\n\nexport type CredentialCreationOptionOverrides = {\n publicKey?: Partial<CredentialCreationOptions[\"publicKey\"]>;\n} & Pick<CredentialCreationOptions, \"signal\">;\n\n// [!region User]\nexport type User = {\n email?: string;\n phone?: string;\n orgId: string;\n userId: string;\n address: Address;\n solanaAddress?: string;\n credentialId?: string;\n idToken?: string;\n accessToken?: string;\n claims?: Record<string, unknown>;\n};\n// [!endregion User]\n\nexport type ExportWalletParams = {\n iframeContainerId: string;\n iframeElementId?: string;\n};\n\nexport type ExportWalletOutput = boolean;\n\nexport type CreateAccountParams =\n | {\n type: \"email\";\n email: string;\n /** @deprecated This option will be overriden by dashboard settings. Please use the dashboard settings instead. This option will be removed in a future release. */\n emailMode?: EmailType;\n expirationSeconds?: number;\n redirectParams?: URLSearchParams;\n }\n | {\n type: \"sms\";\n phone: string;\n }\n | {\n type: \"passkey\";\n email: string;\n creationOpts?: CredentialCreationOptionOverrides;\n }\n | {\n type: \"passkey\";\n username: string;\n creationOpts?: CredentialCreationOptionOverrides;\n }\n | {\n type: \"accessKey\";\n publicKey: string;\n accountId?: string;\n };\n\nexport type EmailType = \"magicLink\" | \"otp\";\n\nexport type EmailAuthParams = {\n email: string;\n /** @deprecated This option will be overriden by dashboard settings. Please use the dashboard settings instead. This option will be removed in a future release. */\n emailMode?: EmailType;\n expirationSeconds?: number;\n targetPublicKey: string;\n redirectParams?: URLSearchParams;\n multiFactors?: VerifyMfaParams[];\n};\n\nexport type SmsAuthParams = {\n phone: string;\n targetPublicKey: string;\n};\n\nexport type AccessKeyAuthParamsPublicKeyOnly = {\n accessKey: {\n publicKey: string;\n accountId?: string;\n };\n};\n\nexport type OauthParams = Extract<AuthParams, { type: \"oauth\" }> & {\n expirationSeconds?: number;\n fetchIdTokenOnly?: boolean;\n};\n\nexport type OtpParams = {\n orgId: string;\n otpId: string;\n otpCode: string;\n targetPublicKey: string;\n expirationSeconds?: number;\n multiFactors?: VerifyMfaParams[];\n};\n\nexport type OtpResponse =\n | {\n status: \"SUCCESS\";\n credentialBundle: string;\n }\n | {\n status: \"MFA_REQUIRED\";\n encryptedPayload: string;\n multiFactors: MfaFactor[];\n };\n\nexport type JwtParams = {\n jwt: string;\n targetPublicKey: string;\n authProvider?: string;\n expirationSeconds?: number;\n};\n\nexport type JwtResponse = {\n isSignUp: boolean;\n orgId: string;\n credentialBundle: string;\n};\n\nexport type SignupResponse = {\n orgId: string;\n userId?: string;\n address?: Address;\n solanaAddress?: string;\n otpId?: string;\n};\n\nexport type OauthConfig = {\n codeChallenge: string;\n requestKey: string;\n authProviders: AuthProviderConfig[];\n};\n\nexport type EmailConfig = {\n mode?: \"MAGIC_LINK\" | \"OTP\";\n};\n\nexport type SignerConfig = {\n email: EmailConfig;\n};\n\nexport type AuthProviderConfig = {\n id: string;\n isCustomProvider?: boolean;\n clientId: string;\n authEndpoint: string;\n};\n\nexport type SignerRoutes = SignerEndpoints[number][\"Route\"];\nexport type SignerBody<T extends SignerRoutes> = Extract<\n SignerEndpoints[number],\n { Route: T }\n>[\"Body\"];\nexport type SignerResponse<T extends SignerRoutes> = Extract<\n SignerEndpoints[number],\n { Route: T }\n>[\"Response\"];\n\nexport type SignerEndpoints = [\n {\n Route: \"/v1/signup\";\n Body:\n | (Omit<EmailAuthParams, \"redirectParams\"> & {\n redirectParams?: string;\n })\n | SmsAuthParams\n | {\n passkey: {\n challenge: string;\n attestation: Awaited<ReturnType<typeof getWebAuthnAttestation>>;\n };\n }\n | AccessKeyAuthParamsPublicKeyOnly;\n Response: SignupResponse;\n },\n {\n Route: \"/v1/whoami\";\n Body: {\n stampedRequest: TSignedRequest;\n };\n Response: User;\n },\n {\n Route: \"/v1/auth\";\n Body:\n | (Omit<EmailAuthParams, \"redirectParams\"> & {\n redirectParams?: string;\n multiFactors?: VerifyMfaParams[];\n })\n | SmsAuthParams;\n Response: {\n orgId: string;\n otpId?: string;\n multiFactors?: MfaFactor[];\n };\n },\n {\n Route: \"/v1/lookup\";\n Body: {\n email?: string;\n phone?: string;\n accessKey?: {\n publicKey: string;\n accountId?: string;\n };\n };\n Response: {\n orgId: string | null;\n };\n },\n {\n Route: \"/v1/init-otp\";\n Body: {\n contact: string;\n otpType: \"OTP_TYPE_SMS\" | \"OTP_TYPE_EMAIL\";\n };\n Response: {\n otpId: string;\n };\n },\n {\n Route: \"/v1/verify-otp\";\n Body: {\n otpId: string;\n otpCode: string;\n };\n Response: {\n verificationToken: string;\n };\n },\n {\n Route: \"/v1/sign-payload\";\n Body: {\n stampedRequest: TSignedRequest;\n };\n Response: {\n signature: Hex;\n };\n },\n {\n Route: \"/v1/update-email-auth\";\n Body: {\n stampedRequest: TSignedRequest;\n };\n Response: void;\n },\n {\n Route: \"/v1/update-phone-auth\";\n Body: {\n stampedRequest: TSignedRequest;\n };\n Response: void;\n },\n {\n Route: \"/v1/add-oauth-provider\";\n Body: {\n stampedRequest: TSignedRequest;\n };\n Response: { oauthProviders: OauthProviderInfo[] };\n },\n {\n Route: \"/v1/remove-oauth-provider\";\n Body: {\n stampedRequest: TSignedRequest;\n };\n Response: void;\n },\n {\n Route: \"/v1/list-auth-methods\";\n Body: {};\n Response: AuthMethods;\n },\n {\n Route: \"/v1/prepare-oauth\";\n Body: {\n nonce: string;\n };\n Response: OauthConfig;\n },\n {\n Route: \"/v1/otp\";\n Body: OtpParams;\n Response: OtpResponse;\n },\n {\n Route: \"/v1/auth-list-multi-factors\";\n Body: {\n stampedRequest: TSignedRequest;\n };\n Response: {\n multiFactors: MfaFactor[];\n };\n },\n {\n Route: \"/v1/auth-delete-multi-factors\";\n Body: {\n stampedRequest: TSignedRequest;\n multiFactorIds: string[];\n };\n Response: {\n multiFactors: MfaFactor[];\n };\n },\n {\n Route: \"/v1/auth-request-multi-factor\";\n Body: {\n stampedRequest: TSignedRequest;\n multiFactorType: MultiFactorType;\n };\n Response: AddMfaResult;\n },\n {\n Route: \"/v1/auth-verify-multi-factor\";\n Body: VerifyMfaParams & {\n stampedRequest: TSignedRequest;\n };\n Response: {\n multiFactors: MfaFactor[];\n };\n },\n {\n Route: \"/v1/auth-jwt\";\n Body: JwtParams;\n Response: JwtResponse;\n },\n {\n Route: \"/v1/signer-config\";\n Body: {};\n Response: SignerConfig;\n },\n {\n Route: \"/v1/auth-validate-multi-factors\";\n Body: {\n encryptedPayload: string;\n multiFactors: VerifyMfaParams[];\n };\n Response: {\n payload: {\n credentialBundle?: string;\n };\n multiFactors: MfaFactor[];\n };\n },\n {\n Route: \"/v1/multi-owner-create\";\n Body: {\n members: {\n evmSignerAddress: Address;\n }[];\n };\n Response: {\n result: {\n orgId: string;\n evmSignerAddress: Address;\n members: {\n evmSignerAddress: Address;\n }[];\n };\n };\n },\n {\n Route: \"/v1/multi-owner-prepare-add\";\n Body: {\n organizationId: string;\n members: {\n evmSignerAddress: Address;\n }[];\n };\n Response: {\n result: TurnkeyApiTypes[\"v1CreateUsersRequest\"];\n };\n },\n {\n Route: \"/v1/multi-owner-add\";\n Body: {\n stampedRequest: TSignedRequest;\n };\n Response: {\n result: {\n members: {\n evmSignerAddress: Address;\n }[];\n updateRootQuorumRequest: TurnkeyApiTypes[\"v1UpdateRootQuorumRequest\"];\n };\n };\n },\n {\n Route: \"/v1/multi-owner-update-root-quorum\";\n Body: {\n stampedRequest: TSignedRequest;\n };\n Response: {\n result: TurnkeyApiTypes[\"v1UpdateRootQuorumResult\"];\n };\n },\n {\n Route: \"/v1/multi-owner-sign-raw-payload\";\n Body: {\n stampedRequest: TSignedRequest;\n };\n Response: {\n result: {\n signRawPayloadResult: TurnkeyApiTypes[\"v1SignRawPayloadResult\"];\n };\n };\n },\n {\n Route: \"/v1/multi-owner-prepare-delete\";\n Body: {\n organizationId: string;\n members: {\n evmSignerAddress: Address;\n }[];\n };\n Response: {\n result: {\n updateRootQuorumRequest: TurnkeyApiTypes[\"v1UpdateRootQuorumRequest\"];\n deleteMembersRequest: TurnkeyApiTypes[\"v1DeleteUsersRequest\"];\n };\n };\n },\n {\n Route: \"/v1/multi-owner-delete\";\n Body: {\n stampedRequest: TSignedRequest;\n };\n Response: {\n result: {\n deletedUserIds: string[];\n };\n };\n },\n];\n\nexport type AuthenticatingEventMetadata = {\n type:\n | \"email\"\n | \"passkey\"\n | \"oauth\"\n | \"otp\"\n | \"otpVerify\"\n | \"custom-jwt\"\n | \"sms\";\n};\n\nexport type AlchemySignerClientEvents = {\n connected(user: User): void;\n newUserSignup(): void;\n authenticating(data: AuthenticatingEventMetadata): void;\n connectedEmail(user: User, bundle: string): void;\n connectedPasskey(user: User): void;\n connectedOauth(user: User, bundle: string): void;\n connectedOtp(user: User, bundle: string): void;\n connectedJwt(user: User, bundle: string): void;\n disconnected(): void;\n};\n\nexport type AlchemySignerClientEvent = keyof AlchemySignerClientEvents;\n\nexport type GetWebAuthnAttestationResult = {\n attestation: Awaited<ReturnType<typeof getWebAuthnAttestation>>;\n challenge: ArrayBuffer | string;\n authenticatorUserId: BufferSource;\n};\n\nexport type AuthLinkingPrompt = {\n status: \"ACCOUNT_LINKING_CONFIRMATION_REQUIRED\";\n idToken: string;\n accessToken?: string;\n email: string;\n providerName: string;\n otpId: string;\n orgId: string;\n};\n\nexport type IdTokenOnly = {\n status: \"FETCHED_ID_TOKEN_ONLY\";\n idToken: string;\n accessToken?: string;\n providerName: string;\n};\n\nexport type OauthState = {\n authProviderId: string;\n isCustomProvider?: boolean;\n requestKey: string;\n turnkeyPublicKey: string;\n expirationSeconds?: number;\n redirectUrl?: string;\n openerOrigin?: string;\n fetchIdTokenOnly?: boolean;\n};\n\nexport type GetOauthProviderUrlArgs = {\n oauthParams: OauthParams;\n turnkeyPublicKey: string;\n oauthCallbackUrl: string;\n oauthConfig?: OauthConfig;\n usesRelativeUrl?: boolean;\n};\n\nexport type MfaFactor = {\n multiFactorId: string;\n multiFactorType: string;\n};\n\ntype MultiFactorType = \"totp\";\n\nexport type AddMfaParams = {\n multiFactorType: MultiFactorType;\n};\n\nexport type AddMfaResult = {\n multiFactorType: MultiFactorType;\n multiFactorId: string;\n multiFactorTotpUrl: string;\n};\n\nexport type VerifyMfaParams = {\n multiFactorId: string;\n multiFactorCode: string;\n};\n\nexport type RemoveMfaParams = {\n multiFactorIds: string[];\n};\n\nexport type ValidateMultiFactorsParams = {\n encryptedPayload: string;\n multiFactors: VerifyMfaParams[];\n};\n\nexport type MfaChallenge = {\n multiFactorId: string;\n multiFactorChallenge:\n | {\n code: string;\n }\n | Record<string, any>;\n};\n\nexport type SubmitOtpCodeResponse =\n | { bundle: string; mfaRequired: false }\n | { mfaRequired: true; encryptedPayload: string; multiFactors: MfaFactor[] };\n\nexport type AddOauthProviderParams = {\n providerName: string;\n oidcToken: string;\n};\n\nexport type AuthMethods = {\n email?: string;\n phone?: string;\n oauthProviders: OauthProviderInfo[];\n passkeys: PasskeyInfo[];\n};\n\nexport type OauthProviderInfo = {\n providerId: string;\n issuer: string;\n providerName?: string;\n userDisplayName?: string;\n};\n\nexport type PasskeyInfo = {\n authenticatorId: string;\n name: string;\n createdAt: number;\n};\n\nexport type experimental_CreateApiKeyParams = {\n name: string;\n publicKey: string;\n expirationSec: number;\n};\n"]}
@@ -13,3 +13,7 @@ export declare class MfaRequiredError extends BaseError {
13
13
  multiFactors: MfaFactor[];
14
14
  constructor(multiFactors: MfaFactor[]);
15
15
  }
16
+ export declare class UnsupportedFeatureError extends BaseError {
17
+ name: string;
18
+ constructor(feature: string);
19
+ }
@@ -46,4 +46,15 @@ export class MfaRequiredError extends BaseError {
46
46
  this.multiFactors = multiFactors;
47
47
  }
48
48
  }
49
+ export class UnsupportedFeatureError extends BaseError {
50
+ constructor(feature) {
51
+ super(`${feature} not supported by this signer`);
52
+ Object.defineProperty(this, "name", {
53
+ enumerable: true,
54
+ configurable: true,
55
+ writable: true,
56
+ value: "UnsupportedFeatureError"
57
+ });
58
+ }
59
+ }
49
60
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,OAAO,qBAAsB,SAAQ,SAAS;IAElD;QACE,KAAK,CACH;YACE,0BAA0B;YAC1B,wCAAwC;SACzC,CAAC,IAAI,CAAC,IAAI,CAAC,EACZ;YACE,QAAQ,EAAE,kBAAkB;SAC7B,CACF,CAAC;QAVK;;;;mBAAO,uBAAuB;WAAC;IAWxC,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,SAAS;IAEhD;QACE,KAAK,CAAC,2BAA2B,EAAE;YACjC,QAAQ,EAAE,wBAAwB;SACnC,CAAC,CAAC;QAJI;;;;mBAAO,qBAAqB;WAAC;IAKtC,CAAC;CACF;AAED,MAAM,OAAO,gBAAiB,SAAQ,SAAS;IAI7C,YAAY,YAAyB;QACnC,KAAK,CAAC,+BAA+B,CAAC,CAAC;QAJhC;;;;mBAAO,kBAAkB;WAAC;QAC5B;;;;;WAA0B;QAI/B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;CACF","sourcesContent":["import { BaseError } from \"@aa-sdk/core\";\nimport type { MfaFactor } from \"./client/types\";\nexport class NotAuthenticatedError extends BaseError {\n override name = \"NotAuthenticatedError\";\n constructor() {\n super(\n [\n \"Signer not authenticated\",\n \"Please authenticate to use this signer\",\n ].join(\"\\n\"),\n {\n docsPath: \"/signer/overview\",\n },\n );\n }\n}\n\nexport class OAuthProvidersError extends BaseError {\n override name = \"OAuthProvidersError\";\n constructor() {\n super(\"OAuth providers not found\", {\n docsPath: \"/react/getting-started\",\n });\n }\n}\n\nexport class MfaRequiredError extends BaseError {\n override name = \"MfaRequiredError\";\n public multiFactors: MfaFactor[];\n\n constructor(multiFactors: MfaFactor[]) {\n super(\"MFA is required for this user\");\n this.multiFactors = multiFactors;\n }\n}\n"]}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,OAAO,qBAAsB,SAAQ,SAAS;IAElD;QACE,KAAK,CACH;YACE,0BAA0B;YAC1B,wCAAwC;SACzC,CAAC,IAAI,CAAC,IAAI,CAAC,EACZ;YACE,QAAQ,EAAE,kBAAkB;SAC7B,CACF,CAAC;QAVK;;;;mBAAO,uBAAuB;WAAC;IAWxC,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,SAAS;IAEhD;QACE,KAAK,CAAC,2BAA2B,EAAE;YACjC,QAAQ,EAAE,wBAAwB;SACnC,CAAC,CAAC;QAJI;;;;mBAAO,qBAAqB;WAAC;IAKtC,CAAC;CACF;AAED,MAAM,OAAO,gBAAiB,SAAQ,SAAS;IAI7C,YAAY,YAAyB;QACnC,KAAK,CAAC,+BAA+B,CAAC,CAAC;QAJhC;;;;mBAAO,kBAAkB;WAAC;QAC5B;;;;;WAA0B;QAI/B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;CACF;AAED,MAAM,OAAO,uBAAwB,SAAQ,SAAS;IAEpD,YAAY,OAAe;QACzB,KAAK,CAAC,GAAG,OAAO,+BAA+B,CAAC,CAAC;QAF1C;;;;mBAAO,yBAAyB;WAAC;IAG1C,CAAC;CACF","sourcesContent":["import { BaseError } from \"@aa-sdk/core\";\nimport type { MfaFactor } from \"./client/types\";\nexport class NotAuthenticatedError extends BaseError {\n override name = \"NotAuthenticatedError\";\n constructor() {\n super(\n [\n \"Signer not authenticated\",\n \"Please authenticate to use this signer\",\n ].join(\"\\n\"),\n {\n docsPath: \"/signer/overview\",\n },\n );\n }\n}\n\nexport class OAuthProvidersError extends BaseError {\n override name = \"OAuthProvidersError\";\n constructor() {\n super(\"OAuth providers not found\", {\n docsPath: \"/react/getting-started\",\n });\n }\n}\n\nexport class MfaRequiredError extends BaseError {\n override name = \"MfaRequiredError\";\n public multiFactors: MfaFactor[];\n\n constructor(multiFactors: MfaFactor[]) {\n super(\"MFA is required for this user\");\n this.multiFactors = multiFactors;\n }\n}\n\nexport class UnsupportedFeatureError extends BaseError {\n override name = \"UnsupportedFeatureError\";\n constructor(feature: string) {\n super(`${feature} not supported by this signer`);\n }\n}\n"]}
@@ -1,6 +1,8 @@
1
1
  export { BaseAlchemySigner } from "./base.js";
2
+ export { AlchemyServerSigner, createServerSigner, generateAccessKey, } from "./serverSigner.js";
2
3
  export { BaseSignerClient } from "./client/base.js";
3
4
  export { AlchemySignerWebClient, OauthCancelledError, OauthFailedError, } from "./client/index.js";
5
+ export { ServerSignerClient } from "./client/server.js";
4
6
  export type * from "./client/types.js";
5
7
  export { NotAuthenticatedError, OAuthProvidersError, MfaRequiredError, } from "./errors.js";
6
8
  export { DEFAULT_SESSION_MS, SessionManagerParamsSchema, } from "./session/manager.js";
package/dist/esm/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  export { BaseAlchemySigner } from "./base.js";
2
+ export { AlchemyServerSigner, createServerSigner, generateAccessKey, } from "./serverSigner.js";
2
3
  export { BaseSignerClient } from "./client/base.js";
3
4
  export { AlchemySignerWebClient, OauthCancelledError, OauthFailedError, } from "./client/index.js";
5
+ export { ServerSignerClient } from "./client/server.js";
4
6
  export { NotAuthenticatedError, OAuthProvidersError, MfaRequiredError, } from "./errors.js";
5
7
  export { DEFAULT_SESSION_MS, SessionManagerParamsSchema, } from "./session/manager.js";
6
8
  export { AlchemyWebSigner } from "./signer.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,kBAAkB,EAClB,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EACL,gCAAgC,EAChC,uBAAuB,GACxB,MAAM,mBAAmB,CAAC","sourcesContent":["export { BaseAlchemySigner } from \"./base.js\";\nexport { BaseSignerClient } from \"./client/base.js\";\nexport {\n AlchemySignerWebClient,\n OauthCancelledError,\n OauthFailedError,\n} from \"./client/index.js\";\nexport type * from \"./client/types.js\";\nexport {\n NotAuthenticatedError,\n OAuthProvidersError,\n MfaRequiredError,\n} from \"./errors.js\";\nexport {\n DEFAULT_SESSION_MS,\n SessionManagerParamsSchema,\n} from \"./session/manager.js\";\nexport type * from \"./signer.js\";\nexport { AlchemyWebSigner } from \"./signer.js\";\nexport type * from \"./solanaSigner.js\";\nexport type * from \"./types.js\";\nexport { AlchemySignerStatus } from \"./types.js\";\nexport { SolanaSigner } from \"./solanaSigner.js\";\nexport {\n createSolanaSponsoredTransaction,\n createSolanaTransaction,\n} from \"./utils/solana.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,kBAAkB,EAClB,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EACL,gCAAgC,EAChC,uBAAuB,GACxB,MAAM,mBAAmB,CAAC","sourcesContent":["export { BaseAlchemySigner } from \"./base.js\";\nexport {\n AlchemyServerSigner,\n createServerSigner,\n generateAccessKey,\n} from \"./serverSigner.js\";\nexport { BaseSignerClient } from \"./client/base.js\";\nexport {\n AlchemySignerWebClient,\n OauthCancelledError,\n OauthFailedError,\n} from \"./client/index.js\";\nexport { ServerSignerClient } from \"./client/server.js\";\nexport type * from \"./client/types.js\";\nexport {\n NotAuthenticatedError,\n OAuthProvidersError,\n MfaRequiredError,\n} from \"./errors.js\";\nexport {\n DEFAULT_SESSION_MS,\n SessionManagerParamsSchema,\n} from \"./session/manager.js\";\nexport type * from \"./signer.js\";\nexport { AlchemyWebSigner } from \"./signer.js\";\nexport type * from \"./solanaSigner.js\";\nexport type * from \"./types.js\";\nexport { AlchemySignerStatus } from \"./types.js\";\nexport { SolanaSigner } from \"./solanaSigner.js\";\nexport {\n createSolanaSponsoredTransaction,\n createSolanaTransaction,\n} from \"./utils/solana.js\";\n"]}
@@ -0,0 +1,99 @@
1
+ import { type AuthorizationRequest, type SmartAccountSigner } from "@aa-sdk/core";
2
+ import { ServerSignerClient, type ServerSignerClientParams } from "./client/server.js";
3
+ import { type Address, type Hex, type SignableMessage, type SignedAuthorization, type TypedData, type TypedDataDefinition } from "viem";
4
+ import type { AccessKeyAuthParams } from "./signer.js";
5
+ import { SolanaSigner } from "./solanaSigner.js";
6
+ /**
7
+ * AlchemyServerSigner is a signer that can sign messages and typed data using an access key.
8
+ * It extends the SmartAccountSigner interface and uses the ServerSignerClient to sign requests.
9
+ * Primarily intended to be used server-side.
10
+ */
11
+ export declare class AlchemyServerSigner implements SmartAccountSigner {
12
+ inner: ServerSignerClient;
13
+ signerType: string;
14
+ /**
15
+ * Creates an instance of AlchemyServerSigner.
16
+ *
17
+ * @param {ServerSignerClient} client The underlying signer client
18
+ */
19
+ constructor(client: ServerSignerClient);
20
+ /**
21
+ * Gets the address of the user from the signer client.
22
+ *
23
+ * @returns {Promise<Address>} The address of the user
24
+ * @throws {Error} If the user cannot be retrieved from the signer client
25
+ */
26
+ getAddress(): Promise<Address>;
27
+ /**
28
+ * Signs a message using the inner client.
29
+ *
30
+ * @param {SignableMessage} msg The message to sign
31
+ * @returns {Promise<Hex>} The signed message
32
+ */
33
+ signMessage(msg: SignableMessage): Promise<Hex>;
34
+ /**
35
+ * Signs typed data using the inner client.
36
+ *
37
+ * @param {TypedDataDefinition<TTypedData, TPrimaryType>} params The typed data to sign
38
+ * @returns {Promise<Hex>} The signed typed data
39
+ */
40
+ signTypedData<const TTypedData extends TypedData | Record<string, unknown>, TPrimaryType extends keyof TTypedData | "EIP712Domain" = keyof TTypedData>(params: TypedDataDefinition<TTypedData, TPrimaryType>): Promise<Hex>;
41
+ /**
42
+ * Signs an authorization using the inner client.
43
+ *
44
+ * @param {Authorization<number, false>} unsignedAuthorization The unsigned authorization to sign
45
+ * @returns {Promise<Authorization<number, true>>} The signed authorization
46
+ */
47
+ signAuthorization(unsignedAuthorization: AuthorizationRequest<number>): Promise<SignedAuthorization<number>>;
48
+ /**
49
+ * Creates a new instance of `SolanaSigner` using the inner client.
50
+ *
51
+ * @example
52
+ * ```ts
53
+ * import { AlchemyServerSigner } from "@account-kit/signer";
54
+ *
55
+ * const signer = await createServerSigner({
56
+ * auth: { accessKey },
57
+ * connection: {
58
+ * apiKey: "alchemy-api-key",
59
+ * },
60
+ * });
61
+ *
62
+ * const solanaSigner = signer.toSolanaSigner();
63
+ * ```
64
+ *
65
+ * @returns {SolanaSigner} A new instance of `SolanaSigner`
66
+ */
67
+ toSolanaSigner(): SolanaSigner;
68
+ }
69
+ type CreateServerSignerParams = ServerSignerClientParams & {
70
+ auth: AccessKeyAuthParams;
71
+ };
72
+ /**
73
+ * Creates a new server signer.
74
+ *
75
+ * @example
76
+ * ```ts
77
+ * const signer = await createServerSigner({
78
+ * auth: { accessKey },
79
+ * connection: {
80
+ * apiKey: "alchemy-api-key",
81
+ * }
82
+ * });
83
+ *
84
+ * console.log("Signer address:", await signer.getAddress());
85
+ * ```
86
+ *
87
+ * @param {CreateServerSignerParams} params Parameters
88
+ * @param {AccessKeyAuthParams} params.auth Authentication config for the server signer
89
+ * @param {ConnectionConfig} params.connection Connection config for the server signer
90
+ * @returns {Promise<AlchemyServerSigner>} A promise that resolves to a server signer
91
+ */
92
+ export declare const createServerSigner: (params: CreateServerSignerParams) => Promise<AlchemyServerSigner>;
93
+ /**
94
+ * Generates a new access key for use in the server signer
95
+ *
96
+ * @returns {Hex} A randomly generated access key
97
+ */
98
+ export declare const generateAccessKey: () => string;
99
+ export {};
@@ -0,0 +1,139 @@
1
+ import { unpackSignRawMessageBytes, } from "@aa-sdk/core";
2
+ import { ServerSignerClient, } from "./client/server.js";
3
+ import { hashMessage, hashTypedData, } from "viem";
4
+ import { hashAuthorization } from "viem/utils";
5
+ import { SolanaSigner } from "./solanaSigner.js";
6
+ import { p256 } from "@noble/curves/p256";
7
+ import { bytesToHex } from "@noble/curves/utils";
8
+ /**
9
+ * AlchemyServerSigner is a signer that can sign messages and typed data using an access key.
10
+ * It extends the SmartAccountSigner interface and uses the ServerSignerClient to sign requests.
11
+ * Primarily intended to be used server-side.
12
+ */
13
+ export class AlchemyServerSigner {
14
+ /**
15
+ * Creates an instance of AlchemyServerSigner.
16
+ *
17
+ * @param {ServerSignerClient} client The underlying signer client
18
+ */
19
+ constructor(client) {
20
+ Object.defineProperty(this, "inner", {
21
+ enumerable: true,
22
+ configurable: true,
23
+ writable: true,
24
+ value: void 0
25
+ });
26
+ Object.defineProperty(this, "signerType", {
27
+ enumerable: true,
28
+ configurable: true,
29
+ writable: true,
30
+ value: "alchemy-server-signer"
31
+ });
32
+ this.inner = client;
33
+ }
34
+ /**
35
+ * Gets the address of the user from the signer client.
36
+ *
37
+ * @returns {Promise<Address>} The address of the user
38
+ * @throws {Error} If the user cannot be retrieved from the signer client
39
+ */
40
+ async getAddress() {
41
+ const { address } = await this.inner.whoami();
42
+ return address;
43
+ }
44
+ /**
45
+ * Signs a message using the inner client.
46
+ *
47
+ * @param {SignableMessage} msg The message to sign
48
+ * @returns {Promise<Hex>} The signed message
49
+ */
50
+ async signMessage(msg) {
51
+ const messageHash = hashMessage(msg);
52
+ return this.inner.signRawMessage(messageHash);
53
+ }
54
+ /**
55
+ * Signs typed data using the inner client.
56
+ *
57
+ * @param {TypedDataDefinition<TTypedData, TPrimaryType>} params The typed data to sign
58
+ * @returns {Promise<Hex>} The signed typed data
59
+ */
60
+ async signTypedData(params) {
61
+ const messageHash = hashTypedData(params);
62
+ return this.inner.signRawMessage(messageHash);
63
+ }
64
+ /**
65
+ * Signs an authorization using the inner client.
66
+ *
67
+ * @param {Authorization<number, false>} unsignedAuthorization The unsigned authorization to sign
68
+ * @returns {Promise<Authorization<number, true>>} The signed authorization
69
+ */
70
+ async signAuthorization(unsignedAuthorization) {
71
+ const hashedAuthorization = hashAuthorization(unsignedAuthorization);
72
+ const signedAuthorizationHex = await this.inner.signRawMessage(hashedAuthorization);
73
+ const signature = unpackSignRawMessageBytes(signedAuthorizationHex);
74
+ const { address, contractAddress, ...unsignedAuthorizationRest } = unsignedAuthorization;
75
+ return {
76
+ ...unsignedAuthorizationRest,
77
+ ...signature,
78
+ address: address ?? contractAddress,
79
+ };
80
+ }
81
+ /**
82
+ * Creates a new instance of `SolanaSigner` using the inner client.
83
+ *
84
+ * @example
85
+ * ```ts
86
+ * import { AlchemyServerSigner } from "@account-kit/signer";
87
+ *
88
+ * const signer = await createServerSigner({
89
+ * auth: { accessKey },
90
+ * connection: {
91
+ * apiKey: "alchemy-api-key",
92
+ * },
93
+ * });
94
+ *
95
+ * const solanaSigner = signer.toSolanaSigner();
96
+ * ```
97
+ *
98
+ * @returns {SolanaSigner} A new instance of `SolanaSigner`
99
+ */
100
+ toSolanaSigner() {
101
+ return new SolanaSigner(this.inner);
102
+ }
103
+ }
104
+ /**
105
+ * Creates a new server signer.
106
+ *
107
+ * @example
108
+ * ```ts
109
+ * const signer = await createServerSigner({
110
+ * auth: { accessKey },
111
+ * connection: {
112
+ * apiKey: "alchemy-api-key",
113
+ * }
114
+ * });
115
+ *
116
+ * console.log("Signer address:", await signer.getAddress());
117
+ * ```
118
+ *
119
+ * @param {CreateServerSignerParams} params Parameters
120
+ * @param {AccessKeyAuthParams} params.auth Authentication config for the server signer
121
+ * @param {ConnectionConfig} params.connection Connection config for the server signer
122
+ * @returns {Promise<AlchemyServerSigner>} A promise that resolves to a server signer
123
+ */
124
+ export const createServerSigner = async (params) => {
125
+ const client = new ServerSignerClient(params);
126
+ const signer = new AlchemyServerSigner(client);
127
+ await signer.inner.authenticateWithAccessKey({
128
+ ...params.auth,
129
+ type: "accessKey",
130
+ });
131
+ return signer;
132
+ };
133
+ /**
134
+ * Generates a new access key for use in the server signer
135
+ *
136
+ * @returns {Hex} A randomly generated access key
137
+ */
138
+ export const generateAccessKey = () => bytesToHex(p256.utils.randomPrivateKey());
139
+ //# source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B,qBAAmD;QAEnD,MAAM,mBAAmB,GAAG,iBAAiB,CAAC,qBAAqB,CAAC,CAAC;QACrE,MAAM,sBAAsB,GAC1B,MAAM,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC;QACvD,MAAM,SAAS,GAAG,yBAAyB,CAAC,sBAAsB,CAAC,CAAC;QACpE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,yBAAyB,EAAE,GAC9D,qBAAqB,CAAC;QAExB,OAAO;YACL,GAAG,yBAAyB;YAC5B,GAAG,SAAS;YACZ,OAAO,EAAE,OAAO,IAAI,eAAe;SACpC,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,cAAc;QACZ,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;CACF;AAMD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EACrC,MAAgC,EACF,EAAE;IAChC,MAAM,MAAM,GAAG,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAG,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAE/C,MAAM,MAAM,CAAC,KAAK,CAAC,yBAAyB,CAAC;QAC3C,GAAG,MAAM,CAAC,IAAI;QACd,IAAI,EAAE,WAAW;KAClB,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,EAAE,CACpC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC,CAAC","sourcesContent":["import {\n type AuthorizationRequest,\n type SmartAccountSigner,\n unpackSignRawMessageBytes,\n} from \"@aa-sdk/core\";\nimport {\n ServerSignerClient,\n type ServerSignerClientParams,\n} from \"./client/server.js\";\nimport {\n hashMessage,\n hashTypedData,\n type Address,\n type Hex,\n type SignableMessage,\n type SignedAuthorization,\n type TypedData,\n type TypedDataDefinition,\n} from \"viem\";\nimport { hashAuthorization } from \"viem/utils\";\nimport type { AccessKeyAuthParams } from \"./signer.js\";\nimport { SolanaSigner } from \"./solanaSigner.js\";\nimport { p256 } from \"@noble/curves/p256\";\nimport { bytesToHex } from \"@noble/curves/utils\";\n\n/**\n * AlchemyServerSigner is a signer that can sign messages and typed data using an access key.\n * It extends the SmartAccountSigner interface and uses the ServerSignerClient to sign requests.\n * Primarily intended to be used server-side.\n */\nexport class AlchemyServerSigner implements SmartAccountSigner {\n inner: ServerSignerClient;\n signerType = \"alchemy-server-signer\";\n\n /**\n * Creates an instance of AlchemyServerSigner.\n *\n * @param {ServerSignerClient} client The underlying signer client\n */\n constructor(client: ServerSignerClient) {\n this.inner = client;\n }\n\n /**\n * Gets the address of the user from the signer client.\n *\n * @returns {Promise<Address>} The address of the user\n * @throws {Error} If the user cannot be retrieved from the signer client\n */\n async getAddress(): Promise<Address> {\n const { address } = await this.inner.whoami();\n return address;\n }\n\n /**\n * Signs a message using the inner client.\n *\n * @param {SignableMessage} msg The message to sign\n * @returns {Promise<Hex>} The signed message\n */\n async signMessage(msg: SignableMessage): Promise<Hex> {\n const messageHash = hashMessage(msg);\n return this.inner.signRawMessage(messageHash);\n }\n\n /**\n * Signs typed data using the inner client.\n *\n * @param {TypedDataDefinition<TTypedData, TPrimaryType>} params The typed data to sign\n * @returns {Promise<Hex>} The signed typed data\n */\n async signTypedData<\n const TTypedData extends TypedData | Record<string, unknown>,\n TPrimaryType extends keyof TTypedData | \"EIP712Domain\" = keyof TTypedData,\n >(params: TypedDataDefinition<TTypedData, TPrimaryType>): Promise<Hex> {\n const messageHash = hashTypedData(params);\n return this.inner.signRawMessage(messageHash);\n }\n\n /**\n * Signs an authorization using the inner client.\n *\n * @param {Authorization<number, false>} unsignedAuthorization The unsigned authorization to sign\n * @returns {Promise<Authorization<number, true>>} The signed authorization\n */\n async signAuthorization(\n unsignedAuthorization: AuthorizationRequest<number>,\n ): Promise<SignedAuthorization<number>> {\n const hashedAuthorization = hashAuthorization(unsignedAuthorization);\n const signedAuthorizationHex =\n await this.inner.signRawMessage(hashedAuthorization);\n const signature = unpackSignRawMessageBytes(signedAuthorizationHex);\n const { address, contractAddress, ...unsignedAuthorizationRest } =\n unsignedAuthorization;\n\n return {\n ...unsignedAuthorizationRest,\n ...signature,\n address: address ?? contractAddress,\n };\n }\n\n /**\n * Creates a new instance of `SolanaSigner` using the inner client.\n *\n * @example\n * ```ts\n * import { AlchemyServerSigner } from \"@account-kit/signer\";\n *\n * const signer = await createServerSigner({\n * auth: { accessKey },\n * connection: {\n * apiKey: \"alchemy-api-key\",\n * },\n * });\n *\n * const solanaSigner = signer.toSolanaSigner();\n * ```\n *\n * @returns {SolanaSigner} A new instance of `SolanaSigner`\n */\n toSolanaSigner(): SolanaSigner {\n return new SolanaSigner(this.inner);\n }\n}\n\ntype CreateServerSignerParams = ServerSignerClientParams & {\n auth: AccessKeyAuthParams;\n};\n\n/**\n * Creates a new server signer.\n *\n * @example\n * ```ts\n * const signer = await createServerSigner({\n * auth: { accessKey },\n * connection: {\n * apiKey: \"alchemy-api-key\",\n * }\n * });\n *\n * console.log(\"Signer address:\", await signer.getAddress());\n * ```\n *\n * @param {CreateServerSignerParams} params Parameters\n * @param {AccessKeyAuthParams} params.auth Authentication config for the server signer\n * @param {ConnectionConfig} params.connection Connection config for the server signer\n * @returns {Promise<AlchemyServerSigner>} A promise that resolves to a server signer\n */\nexport const createServerSigner = async (\n params: CreateServerSignerParams,\n): Promise<AlchemyServerSigner> => {\n const client = new ServerSignerClient(params);\n const signer = new AlchemyServerSigner(client);\n\n await signer.inner.authenticateWithAccessKey({\n ...params.auth,\n type: \"accessKey\",\n });\n\n return signer;\n};\n\n/**\n * Generates a new access key for use in the server signer\n *\n * @returns {Hex} A randomly generated access key\n */\nexport const generateAccessKey = () =>\n bytesToHex(p256.utils.randomPrivateKey());\n"]}
@@ -2,6 +2,10 @@ import { z } from "zod";
2
2
  import { BaseAlchemySigner } from "./base.js";
3
3
  import { AlchemySignerWebClient } from "./client/index.js";
4
4
  import type { CredentialCreationOptionOverrides, VerifyMfaParams } from "./client/types.js";
5
+ export type AccessKeyAuthParams = {
6
+ accessKey: string;
7
+ accountId?: string;
8
+ };
5
9
  export type AuthParams = {
6
10
  type: "email";
7
11
  email: string;
@@ -49,7 +53,9 @@ export type AuthParams = {
49
53
  type: "otp";
50
54
  otpCode: string;
51
55
  multiFactors?: VerifyMfaParams[];
52
- };
56
+ } | ({
57
+ type: "accessKey";
58
+ } & AccessKeyAuthParams);
53
59
  export type OauthProviderConfig = {
54
60
  authProviderId: "auth0";
55
61
  isCustomProvider?: false;
@@ -1 +1 @@
1
- {"version":3,"file":"signer.js","sourceRoot":"","sources":["../../src/signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EACL,+BAA+B,EAC/B,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAM3B,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAuFlE,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC;KACvC,MAAM,CAAC;IACN,MAAM,EAAE,CAAC;SACN,MAAM,EAA0B;SAChC,EAAE,CAAC,+BAA+B,CAAC;CACvC,CAAC;KACD,MAAM,CAAC;IACN,aAAa,EAAE,0BAA0B,CAAC,IAAI,CAAC;QAC7C,MAAM,EAAE,IAAI;KACb,CAAC,CAAC,QAAQ,EAAE;CACd,CAAC,CAAC;AAIL;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,iBAAyC;IAE7E;;;;;;;;;;;;;;;;;;;;OAoBG;IAEH,YAAY,MAA2B;QACrC,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,GACjC,yBAAyB,CAAC,KAAK,CAA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C,IAAI,CAAC,EAAE,CAAC;QAChD,MAAM,KAAK,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,SAAS,CAAC;QACvD,eAAe,KAAf,eAAe,GAAK,KAAK,IAAI,IAAI,EAAC;QAClC,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACpB,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IACD,IAAI,eAAe,EAAE,CAAC;QACpB,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,MAAgD,CAAC;AAC1D,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { BaseAlchemySigner } from \"./base.js\";\nimport {\n AlchemySignerClientParamsSchema,\n AlchemySignerWebClient,\n} from \"./client/index.js\";\nimport type {\n AuthLinkingPrompt,\n CredentialCreationOptionOverrides,\n VerifyMfaParams,\n} from \"./client/types.js\";\nimport { SessionManagerParamsSchema } from \"./session/manager.js\";\n\nexport type AuthParams =\n | {\n type: \"email\";\n email: string;\n /** @deprecated This option will be overriden by dashboard settings. Please use the dashboard settings instead. This option will be removed in a future release. */\n emailMode?: \"magicLink\" | \"otp\";\n redirectParams?: URLSearchParams;\n multiFactors?: VerifyMfaParams[];\n }\n | { type: \"email\"; bundle: string; orgId?: string; isNewUser?: boolean }\n | {\n type: \"sms\";\n phone: string;\n }\n | {\n type: \"passkey\";\n email: string;\n creationOpts?: CredentialCreationOptionOverrides;\n }\n | {\n type: \"passkey\";\n createNew: false;\n }\n | {\n type: \"passkey\";\n createNew: true;\n username: string;\n creationOpts?: CredentialCreationOptionOverrides;\n }\n | ({\n type: \"oauth\";\n scope?: string;\n claims?: string;\n otherParameters?: Record<string, string>;\n } & OauthProviderConfig &\n OauthRedirectConfig)\n | {\n type: \"oauthReturn\";\n bundle: string;\n orgId: string;\n idToken: string;\n accessToken?: string;\n isNewUser?: boolean;\n }\n | {\n type: \"custom-jwt\";\n jwt: string;\n authProviderId?: string;\n }\n | {\n type: \"otp\";\n otpCode: string;\n multiFactors?: VerifyMfaParams[];\n };\n\nexport type OauthProviderConfig =\n | {\n authProviderId: \"auth0\";\n isCustomProvider?: false;\n auth0Connection?: string;\n }\n | {\n authProviderId: KnownAuthProvider;\n isCustomProvider?: false;\n auth0Connection?: never;\n }\n | {\n authProviderId: string;\n isCustomProvider: true;\n auth0Connection?: never;\n };\n\nexport type OauthRedirectConfig =\n | { mode: \"redirect\"; redirectUrl: string }\n | { mode: \"popup\"; redirectUrl?: never };\n\nexport type KnownAuthProvider =\n | \"google\"\n | \"apple\"\n | \"facebook\"\n | \"twitch\"\n | \"auth0\";\n\nexport type OauthMode = \"redirect\" | \"popup\";\n\nexport const AlchemySignerParamsSchema = z\n .object({\n client: z\n .custom<AlchemySignerWebClient>()\n .or(AlchemySignerClientParamsSchema),\n })\n .extend({\n sessionConfig: SessionManagerParamsSchema.omit({\n client: true,\n }).optional(),\n });\n\nexport type AlchemySignerParams = z.input<typeof AlchemySignerParamsSchema>;\n\n/**\n * A SmartAccountSigner that can be used with any SmartContractAccount\n */\nexport class AlchemyWebSigner extends BaseAlchemySigner<AlchemySignerWebClient> {\n private static replaceStateFilterInstalled = false;\n /**\n * Initializes an instance with the provided Alchemy signer parameters after parsing them with a schema.\n *\n * @example\n * ```ts\n * import { AlchemyWebSigner } from \"@account-kit/signer\";\n *\n * const signer = new AlchemyWebSigner({\n * client: {\n * connection: {\n * rpcUrl: \"/api/rpc\",\n * },\n * iframeConfig: {\n * iframeContainerId: \"alchemy-signer-iframe-container\",\n * },\n * },\n * });\n * ```\n *\n * @param {AlchemySignerParams} params The parameters for the Alchemy signer, including the client and session configuration\n */\n\n constructor(params: AlchemySignerParams) {\n const { sessionConfig, ...params_ } =\n AlchemySignerParamsSchema.parse(params);\n\n let client: AlchemySignerWebClient;\n if (\"connection\" in params_.client) {\n client = new AlchemySignerWebClient(params_.client);\n } else {\n client = params_.client;\n }\n\n const qpStructure = {\n emailBundle: \"bundle\",\n // We don't need this, but we still want to remove it from the URL.\n emailOrgId: \"orgId\",\n status: \"alchemy-status\",\n oauthBundle: \"alchemy-bundle\",\n oauthOrgId: \"alchemy-org-id\",\n idToken: \"alchemy-id-token\",\n accessToken: \"alchemy-access-token\",\n isSignup: \"aa-is-signup\",\n otpId: \"alchemy-otp-id\",\n email: \"alchemy-email\",\n authProvider: \"alchemy-auth-provider\",\n oauthError: \"alchemy-error\",\n };\n\n const {\n emailBundle,\n status,\n oauthBundle,\n oauthOrgId,\n idToken,\n accessToken,\n isSignup,\n otpId,\n email,\n authProvider,\n oauthError,\n } = getAndRemoveQueryParams(qpStructure);\n\n if (!AlchemyWebSigner.replaceStateFilterInstalled) {\n installReplaceStateFilter(Object.values(qpStructure));\n AlchemyWebSigner.replaceStateFilterInstalled = true;\n }\n\n const initialError =\n oauthError != null\n ? { name: \"OauthError\", message: oauthError }\n : undefined;\n\n const initialAuthLinkingPrompt: AuthLinkingPrompt | undefined = (() => {\n if (status !== \"ACCOUNT_LINKING_CONFIRMATION_REQUIRED\") {\n return undefined;\n }\n if (\n idToken == null ||\n email == null ||\n authProvider == null ||\n otpId == null ||\n oauthOrgId == null\n ) {\n console.error(\"Missing required query params for auth linking prompt\");\n return undefined;\n }\n return {\n status,\n idToken,\n accessToken,\n email,\n providerName: authProvider,\n otpId,\n orgId: oauthOrgId,\n };\n })();\n\n super({ client, sessionConfig, initialError, initialAuthLinkingPrompt });\n\n const isNewUser = isSignup === \"true\";\n\n this.signerType = \"alchemy-signer\";\n\n if (emailBundle) {\n this.authenticate({\n type: \"email\",\n bundle: emailBundle,\n isNewUser,\n });\n } else if (oauthBundle && oauthOrgId && idToken) {\n this.authenticate({\n type: \"oauthReturn\",\n bundle: oauthBundle,\n orgId: oauthOrgId,\n idToken,\n accessToken,\n isNewUser,\n });\n }\n }\n}\n\n/**\n * Overrides `window.history.replaceState` to remove the specified query params from target URLs.\n *\n * @param {string[]} qpToRemove The query params to remove from target URLs.\n */\nfunction installReplaceStateFilter(qpToRemove: string[]) {\n const originalReplaceState = window.history.replaceState;\n\n const processUrl = (src: string | URL | undefined | null) => {\n if (!src) {\n return src;\n }\n\n try {\n const url = new URL(src, document.baseURI);\n const originalSearch = url.search;\n\n qpToRemove.forEach((qp) => url.searchParams.delete(qp));\n if (originalSearch === url.search) return src;\n\n console.log(\"[Alchemy] filtered query params from URL\");\n return url;\n } catch (e) {\n console.log(\"[Alchemy] failed to process URL in state filter\", e);\n return src;\n }\n };\n\n window.history.replaceState = function (...args) {\n const [state, unused, url] = args;\n\n const result = originalReplaceState.apply(this, [\n state,\n unused,\n processUrl(url),\n ]);\n\n return result;\n };\n\n console.log(\"[Alchemy] installed window.history.replaceState interceptor\");\n}\n\n/**\n * Reads and removes the specified query params from the URL.\n *\n * @param {T} keys object whose values are the query parameter keys to read and\n * remove\n * @returns {{ [K in keyof T]: string | undefined }} object with the same keys\n * as the input whose values are the values of the query params.\n */\nfunction getAndRemoveQueryParams<T extends Record<string, string>>(\n keys: T,\n): { [K in keyof T]: string | undefined } {\n const url = new URL(window.location.href);\n const result: Record<string, string | undefined> = {};\n let foundQueryParam = false;\n for (const [key, param] of Object.entries(keys)) {\n const value = url.searchParams.get(param) ?? undefined;\n foundQueryParam ||= value != null;\n result[key] = value;\n url.searchParams.delete(param);\n }\n if (foundQueryParam) {\n window.history.replaceState(window.history.state, \"\", url.toString());\n }\n return result as { [K in keyof T]: string | undefined };\n}\n"]}
1
+ {"version":3,"file":"signer.js","sourceRoot":"","sources":["../../src/signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EACL,+BAA+B,EAC/B,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;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AElC,MAAM,MAAM,GAAG,oBAAoB,CAAC,KAAK,CAAC,IAAI,EAAE;YAC9C,KAAK;YACL,MAAM;YACN,UAAU,CAAC,GAAG,CAAC;SAChB,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;IAEF,OAAO,CAAC,GAAG,CAAC,6DAA6D,CAAC,CAAC;AAC7E,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,uBAAuB,CAC9B,IAAO;IAEP,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC1C,MAAM,MAAM,GAAuC,EAAE,CAAC;IACtD,IAAI,eAAe,GAAG,KAAK,CAAC;IAC5B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QAChD,MAAM,KAAK,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,SAAS,CAAC;QACvD,eAAe,KAAf,eAAe,GAAK,KAAK,IAAI,IAAI,EAAC;QAClC,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACpB,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IACD,IAAI,eAAe,EAAE,CAAC;QACpB,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,MAAgD,CAAC;AAC1D,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { BaseAlchemySigner } from \"./base.js\";\nimport {\n AlchemySignerClientParamsSchema,\n AlchemySignerWebClient,\n} from \"./client/index.js\";\nimport type {\n AuthLinkingPrompt,\n CredentialCreationOptionOverrides,\n VerifyMfaParams,\n} from \"./client/types.js\";\nimport { SessionManagerParamsSchema } from \"./session/manager.js\";\n\nexport type AccessKeyAuthParams = {\n accessKey: string;\n accountId?: string;\n};\n\nexport type AuthParams =\n | {\n type: \"email\";\n email: string;\n /** @deprecated This option will be overriden by dashboard settings. Please use the dashboard settings instead. This option will be removed in a future release. */\n emailMode?: \"magicLink\" | \"otp\";\n redirectParams?: URLSearchParams;\n multiFactors?: VerifyMfaParams[];\n }\n | { type: \"email\"; bundle: string; orgId?: string; isNewUser?: boolean }\n | {\n type: \"sms\";\n phone: string;\n }\n | {\n type: \"passkey\";\n email: string;\n creationOpts?: CredentialCreationOptionOverrides;\n }\n | {\n type: \"passkey\";\n createNew: false;\n }\n | {\n type: \"passkey\";\n createNew: true;\n username: string;\n creationOpts?: CredentialCreationOptionOverrides;\n }\n | ({\n type: \"oauth\";\n scope?: string;\n claims?: string;\n otherParameters?: Record<string, string>;\n } & OauthProviderConfig &\n OauthRedirectConfig)\n | {\n type: \"oauthReturn\";\n bundle: string;\n orgId: string;\n idToken: string;\n accessToken?: string;\n isNewUser?: boolean;\n }\n | {\n type: \"custom-jwt\";\n jwt: string;\n authProviderId?: string;\n }\n | {\n type: \"otp\";\n otpCode: string;\n multiFactors?: VerifyMfaParams[];\n }\n | ({ type: \"accessKey\" } & AccessKeyAuthParams);\n\nexport type OauthProviderConfig =\n | {\n authProviderId: \"auth0\";\n isCustomProvider?: false;\n auth0Connection?: string;\n }\n | {\n authProviderId: KnownAuthProvider;\n isCustomProvider?: false;\n auth0Connection?: never;\n }\n | {\n authProviderId: string;\n isCustomProvider: true;\n auth0Connection?: never;\n };\n\nexport type OauthRedirectConfig =\n | { mode: \"redirect\"; redirectUrl: string }\n | { mode: \"popup\"; redirectUrl?: never };\n\nexport type KnownAuthProvider =\n | \"google\"\n | \"apple\"\n | \"facebook\"\n | \"twitch\"\n | \"auth0\";\n\nexport type OauthMode = \"redirect\" | \"popup\";\n\nexport const AlchemySignerParamsSchema = z\n .object({\n client: z\n .custom<AlchemySignerWebClient>()\n .or(AlchemySignerClientParamsSchema),\n })\n .extend({\n sessionConfig: SessionManagerParamsSchema.omit({\n client: true,\n }).optional(),\n });\n\nexport type AlchemySignerParams = z.input<typeof AlchemySignerParamsSchema>;\n\n/**\n * A SmartAccountSigner that can be used with any SmartContractAccount\n */\nexport class AlchemyWebSigner extends BaseAlchemySigner<AlchemySignerWebClient> {\n private static replaceStateFilterInstalled = false;\n /**\n * Initializes an instance with the provided Alchemy signer parameters after parsing them with a schema.\n *\n * @example\n * ```ts\n * import { AlchemyWebSigner } from \"@account-kit/signer\";\n *\n * const signer = new AlchemyWebSigner({\n * client: {\n * connection: {\n * rpcUrl: \"/api/rpc\",\n * },\n * iframeConfig: {\n * iframeContainerId: \"alchemy-signer-iframe-container\",\n * },\n * },\n * });\n * ```\n *\n * @param {AlchemySignerParams} params The parameters for the Alchemy signer, including the client and session configuration\n */\n\n constructor(params: AlchemySignerParams) {\n const { sessionConfig, ...params_ } =\n AlchemySignerParamsSchema.parse(params);\n\n let client: AlchemySignerWebClient;\n if (\"connection\" in params_.client) {\n client = new AlchemySignerWebClient(params_.client);\n } else {\n client = params_.client;\n }\n\n const qpStructure = {\n emailBundle: \"bundle\",\n // We don't need this, but we still want to remove it from the URL.\n emailOrgId: \"orgId\",\n status: \"alchemy-status\",\n oauthBundle: \"alchemy-bundle\",\n oauthOrgId: \"alchemy-org-id\",\n idToken: \"alchemy-id-token\",\n accessToken: \"alchemy-access-token\",\n isSignup: \"aa-is-signup\",\n otpId: \"alchemy-otp-id\",\n email: \"alchemy-email\",\n authProvider: \"alchemy-auth-provider\",\n oauthError: \"alchemy-error\",\n };\n\n const {\n emailBundle,\n status,\n oauthBundle,\n oauthOrgId,\n idToken,\n accessToken,\n isSignup,\n otpId,\n email,\n authProvider,\n oauthError,\n } = getAndRemoveQueryParams(qpStructure);\n\n if (!AlchemyWebSigner.replaceStateFilterInstalled) {\n installReplaceStateFilter(Object.values(qpStructure));\n AlchemyWebSigner.replaceStateFilterInstalled = true;\n }\n\n const initialError =\n oauthError != null\n ? { name: \"OauthError\", message: oauthError }\n : undefined;\n\n const initialAuthLinkingPrompt: AuthLinkingPrompt | undefined = (() => {\n if (status !== \"ACCOUNT_LINKING_CONFIRMATION_REQUIRED\") {\n return undefined;\n }\n if (\n idToken == null ||\n email == null ||\n authProvider == null ||\n otpId == null ||\n oauthOrgId == null\n ) {\n console.error(\"Missing required query params for auth linking prompt\");\n return undefined;\n }\n return {\n status,\n idToken,\n accessToken,\n email,\n providerName: authProvider,\n otpId,\n orgId: oauthOrgId,\n };\n })();\n\n super({ client, sessionConfig, initialError, initialAuthLinkingPrompt });\n\n const isNewUser = isSignup === \"true\";\n\n this.signerType = \"alchemy-signer\";\n\n if (emailBundle) {\n this.authenticate({\n type: \"email\",\n bundle: emailBundle,\n isNewUser,\n });\n } else if (oauthBundle && oauthOrgId && idToken) {\n this.authenticate({\n type: \"oauthReturn\",\n bundle: oauthBundle,\n orgId: oauthOrgId,\n idToken,\n accessToken,\n isNewUser,\n });\n }\n }\n}\n\n/**\n * Overrides `window.history.replaceState` to remove the specified query params from target URLs.\n *\n * @param {string[]} qpToRemove The query params to remove from target URLs.\n */\nfunction installReplaceStateFilter(qpToRemove: string[]) {\n const originalReplaceState = window.history.replaceState;\n\n const processUrl = (src: string | URL | undefined | null) => {\n if (!src) {\n return src;\n }\n\n try {\n const url = new URL(src, document.baseURI);\n const originalSearch = url.search;\n\n qpToRemove.forEach((qp) => url.searchParams.delete(qp));\n if (originalSearch === url.search) return src;\n\n console.log(\"[Alchemy] filtered query params from URL\");\n return url;\n } catch (e) {\n console.log(\"[Alchemy] failed to process URL in state filter\", e);\n return src;\n }\n };\n\n window.history.replaceState = function (...args) {\n const [state, unused, url] = args;\n\n const result = originalReplaceState.apply(this, [\n state,\n unused,\n processUrl(url),\n ]);\n\n return result;\n };\n\n console.log(\"[Alchemy] installed window.history.replaceState interceptor\");\n}\n\n/**\n * Reads and removes the specified query params from the URL.\n *\n * @param {T} keys object whose values are the query parameter keys to read and\n * remove\n * @returns {{ [K in keyof T]: string | undefined }} object with the same keys\n * as the input whose values are the values of the query params.\n */\nfunction getAndRemoveQueryParams<T extends Record<string, string>>(\n keys: T,\n): { [K in keyof T]: string | undefined } {\n const url = new URL(window.location.href);\n const result: Record<string, string | undefined> = {};\n let foundQueryParam = false;\n for (const [key, param] of Object.entries(keys)) {\n const value = url.searchParams.get(param) ?? undefined;\n foundQueryParam ||= value != null;\n result[key] = value;\n url.searchParams.delete(param);\n }\n if (foundQueryParam) {\n window.history.replaceState(window.history.state, \"\", url.toString());\n }\n return result as { [K in keyof T]: string | undefined };\n}\n"]}
@@ -1 +1 @@
1
- export declare const VERSION = "4.63.2";
1
+ export declare const VERSION = "4.64.0";
@@ -1,4 +1,4 @@
1
1
  // This file is autogenerated by inject-version.ts. Any changes will be
2
2
  // overwritten on commit!
3
- export const VERSION = "4.63.2";
3
+ export const VERSION = "4.64.0";
4
4
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yBAAyB;AACzB,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"4.63.2\";\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yBAAyB;AACzB,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"4.64.0\";\n"]}
@@ -321,7 +321,6 @@ export declare abstract class BaseAlchemySigner<TClient extends BaseSignerClient
321
321
  mfaRequired: boolean;
322
322
  mfaFactorId?: string;
323
323
  };
324
- private unpackSignRawMessageBytes;
325
324
  /**
326
325
  * Unauthenticated call to look up a user's organizationId by email
327
326
  *
@@ -1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