@account-kit/signer 4.83.0 → 4.83.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/base.js +1 -1
- package/dist/esm/base.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +5 -5
- package/src/base.ts +1 -1
- package/src/version.ts +1 -1
package/dist/esm/base.js
CHANGED
|
@@ -474,7 +474,7 @@ export class BaseAlchemySigner {
|
|
|
474
474
|
value: SignerLogger.profiled("BaseAlchemySigner.signTransaction", async (tx, args) => {
|
|
475
475
|
const serializeFn = args?.serializer ?? serializeTransaction;
|
|
476
476
|
const serializedTx = serializeFn(tx);
|
|
477
|
-
const signatureHex = await this.inner.signRawMessage(keccak256(serializedTx));
|
|
477
|
+
const signatureHex = await this.inner.signRawMessage(keccak256(await serializedTx));
|
|
478
478
|
const signature = unpackSignRawMessageBytes(signatureHex);
|
|
479
479
|
return serializeFn(tx, signature);
|
|
480
480
|
})
|
package/dist/esm/base.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,yBAAyB,GAC1B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,WAAW,EACX,aAAa,EACb,SAAS,EACT,oBAAoB,GAYrB,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAcN,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM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AE,EAAE;QACV,IAAI,eAAe,EAAE,CAAC;YACpB,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAC;QACpB,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,EACD,EAAE,eAAe,EAAE,IAAI,EAAE,CAC1B,CAAC;IAEF,OAAO,GAAG,EAAE;QACV,eAAe,GAAG,IAAI,CAAC;QACvB,WAAW,EAAE,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,MAAM,CACb,MAA8C;IAE9C,OAAO,CAAC,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;AAChE,CAAC;AAED,SAAS,mBAAmB,CAAC,MAAe;IAC1C,OAAO,CACJ,MAA4B,EAAE,MAAM;QACrC,uCAAuC,CACxC,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,MAAe;IACpC,OAAQ,MAAsB,EAAE,MAAM,KAAK,uBAAuB,CAAC;AACrE,CAAC","sourcesContent":["import {\n type SmartAccountAuthenticator,\n type AuthorizationRequest,\n unpackSignRawMessageBytes,\n} from \"@aa-sdk/core\";\nimport {\n hashMessage,\n hashTypedData,\n keccak256,\n serializeTransaction,\n type GetTransactionType,\n type Hex,\n type IsNarrowable,\n type LocalAccount,\n type SerializeTransactionFn,\n type SignableMessage,\n type SignedAuthorization,\n type TransactionSerializable,\n type TransactionSerialized,\n type TypedData,\n type TypedDataDefinition,\n} from \"viem\";\nimport { toAccount } from \"viem/accounts\";\nimport type { Mutate, StoreApi } from \"zustand\";\nimport { subscribeWithSelector } from \"zustand/middleware\";\nimport { createStore } from \"zustand/vanilla\";\nimport type { BaseSignerClient } from \"./client/base\";\nimport {\n type EmailType,\n type MfaFactor,\n type OauthConfig,\n type OauthParams,\n type User,\n type VerifyMfaParams,\n type AddMfaParams,\n type AddMfaResult,\n type RemoveMfaParams,\n type AuthLinkingPrompt,\n type OauthProviderInfo,\n type IdTokenOnly,\n type AuthMethods,\n} from \"./client/types.js\";\nimport { NotAuthenticatedError, UnsupportedFeatureError } from \"./errors.js\";\nimport { SignerLogger } from \"./metrics.js\";\nimport {\n SessionManager,\n type SessionManagerParams,\n} from \"./session/manager.js\";\nimport type { SessionManagerEvents } from \"./session/types\";\nimport type { AuthParams } from \"./signer\";\nimport { SolanaSigner } from \"./solanaSigner.js\";\nimport {\n AlchemySignerStatus,\n type AlchemySignerEvent,\n type AlchemySignerEvents,\n type ErrorInfo,\n type ValidateMultiFactorsArgs,\n} from \"./types.js\";\nimport { assertNever } from \"./utils/typeAssertions.js\";\nimport { hashAuthorization } from \"viem/utils\";\n\nexport interface BaseAlchemySignerParams<TClient extends BaseSignerClient> {\n client: TClient;\n sessionConfig?: Omit<SessionManagerParams, \"client\">;\n initialError?: ErrorInfo;\n initialAuthLinkingPrompt?: AuthLinkingPrompt;\n}\n\ntype AlchemySignerStore = {\n user: User | null;\n status: AlchemySignerStatus;\n error: ErrorInfo | null;\n otpId?: string;\n isNewUser?: boolean;\n mfaStatus: {\n mfaRequired: boolean;\n mfaFactorId?: string;\n encryptedPayload?: string;\n };\n authLinkingStatus?: {\n email: string;\n providerName: string;\n idToken: string;\n accessToken?: string;\n };\n};\n\ntype InternalStore = Mutate<\n StoreApi<AlchemySignerStore>,\n [[\"zustand/subscribeWithSelector\", never]]\n>;\n\nexport type EmailConfig = {\n mode?: \"MAGIC_LINK\" | \"OTP\";\n};\n\nexport type SignerConfig = {\n email: EmailConfig;\n};\n\ntype GetUserParams =\n | {\n type: \"email\";\n value: string;\n }\n | {\n type: \"phone\";\n value: string;\n };\n\ntype VerificationParams = {\n verificationCode: string;\n};\n\n/**\n * Base abstract class for Alchemy Signer, providing authentication and session management for smart accounts.\n * Implements the `SmartAccountAuthenticator` interface and handles various signer events.\n */\nexport abstract class BaseAlchemySigner<TClient extends BaseSignerClient>\n implements SmartAccountAuthenticator<AuthParams, User, TClient>\n{\n signerType: \"alchemy-signer\" | \"rn-alchemy-signer\" = \"alchemy-signer\";\n inner: TClient;\n private sessionManager: SessionManager;\n private store: InternalStore;\n private config: Promise<SignerConfig>;\n\n /**\n * Initializes an instance with the provided client and session configuration.\n * This function sets up the internal store, initializes the session manager,\n * registers listeners and initializes the session manager to manage session state.\n *\n * @param {BaseAlchemySignerParams<TClient>} param0 Object containing the client and session configuration\n * @param {TClient} param0.client The client instance to be used internally\n * @param {SessionConfig} param0.sessionConfig Configuration for managing sessions\n * @param {ErrorInfo | undefined} param0.initialError Error already present on the signer when initialized, if any\n */\n constructor({\n client,\n sessionConfig,\n initialError,\n initialAuthLinkingPrompt,\n }: BaseAlchemySignerParams<TClient>) {\n this.inner = client;\n this.store = createStore(\n subscribeWithSelector(\n () =>\n ({\n user: null,\n status: AlchemySignerStatus.INITIALIZING,\n error: initialError ?? null,\n mfaStatus: {\n mfaRequired: false,\n mfaFactorId: undefined,\n },\n }) satisfies AlchemySignerStore,\n ),\n );\n // NOTE: it's important that the session manager share a client\n // with the signer. The SessionManager leverages the Signer's client\n // to manage session state.\n this.sessionManager = new SessionManager({\n ...sessionConfig,\n client: this.inner,\n });\n // register listeners first\n this.registerListeners();\n // then initialize so that we can catch those events\n this.sessionManager.initialize();\n this.config = this.fetchConfig();\n if (initialAuthLinkingPrompt) {\n this.setAuthLinkingPrompt(initialAuthLinkingPrompt);\n }\n }\n\n /**\n * Allows you to subscribe to events emitted by the signer\n *\n * @param {AlchemySignerEvent} event the event to subscribe to\n * @param {AlchemySignerEvents[AlchemySignerEvent]} listener the function to run when the event is emitted\n * @returns {() => void} a function to remove the listener\n */\n on = <E extends AlchemySignerEvent>(\n event: E,\n listener: AlchemySignerEvents[E],\n ) => {\n // NOTE: we're using zustand here to handle this because we are able to use the fireImmediately\n // option which deals with a possible race condition where the listener is added after the event\n // is fired. In the Client and SessionManager we use EventEmitter because it's easier to handle internally\n switch (event) {\n case \"connected\":\n return subscribeWithDelayedFireImmediately(\n this.store,\n ({ status }) => status,\n (status) =>\n status === AlchemySignerStatus.CONNECTED &&\n (listener as AlchemySignerEvents[\"connected\"])(\n this.store.getState().user!,\n ),\n );\n case \"disconnected\":\n return subscribeWithDelayedFireImmediately(\n this.store,\n ({ status }) => status,\n (status) =>\n status === AlchemySignerStatus.DISCONNECTED &&\n (listener as AlchemySignerEvents[\"disconnected\"])(),\n );\n case \"statusChanged\":\n return subscribeWithDelayedFireImmediately(\n this.store,\n ({ status }) => status,\n listener as AlchemySignerEvents[\"statusChanged\"],\n );\n case \"errorChanged\":\n return subscribeWithDelayedFireImmediately(\n this.store,\n ({ error }) => error,\n (error) =>\n (listener as AlchemySignerEvents[\"errorChanged\"])(\n error ?? undefined,\n ),\n );\n case \"newUserSignup\":\n return subscribeWithDelayedFireImmediately(\n this.store,\n ({ isNewUser }) => isNewUser,\n (isNewUser) => {\n if (isNewUser) (listener as AlchemySignerEvents[\"newUserSignup\"])();\n },\n );\n case \"mfaStatusChanged\":\n return subscribeWithDelayedFireImmediately(\n this.store,\n ({ mfaStatus }) => mfaStatus,\n (mfaStatus) =>\n (listener as AlchemySignerEvents[\"mfaStatusChanged\"])(mfaStatus),\n );\n case \"emailAuthLinkingRequired\":\n return subscribeWithDelayedFireImmediately(\n this.store,\n ({ authLinkingStatus }) => authLinkingStatus,\n (authLinkingStatus) => {\n if (authLinkingStatus) {\n (listener as AlchemySignerEvents[\"emailAuthLinkingRequired\"])(\n authLinkingStatus.email,\n );\n }\n },\n );\n default:\n assertNever(event, `Unknown event type ${event}`);\n }\n };\n\n /**\n * Prepares the config needed to use popup-based OAuth login. This must be\n * called before calling `.authenticate` with params `{ type: \"oauth\", mode:\n * \"popup\" }`, and is recommended to be called on page load.\n *\n * This method exists because browsers may prevent popups from opening unless\n * triggered by user interaction, and so the OAuth config must already have\n * been fetched at the time a user clicks a social login button.\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 * await signer.preparePopupOauth();\n * ```\n * @returns {Promise<OauthConfig>} the config which must be loaded before\n * using popup-based OAuth\n */\n preparePopupOauth = (): Promise<OauthConfig> => this.inner.initOauth();\n\n /**\n * Authenticate a user with either an email or a passkey and create a session for that user\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 * const result = await signer.authenticate({\n * type: \"email\",\n * email: \"foo@mail.com\",\n * });\n * ```\n *\n * @param {AuthParams} params - undefined if passkey login, otherwise an object with email and bundle to resolve\n * @returns {Promise<User>} the user that was authenticated\n */\n authenticate: (params: AuthParams) => Promise<User> = SignerLogger.profiled(\n \"BaseAlchemySigner.authenticate\",\n async (params) => {\n const { type } = params;\n const result = (() => {\n switch (type) {\n case \"email\":\n return this.authenticateWithEmail(params);\n case \"sms\":\n return this.authenticateWithSms(params);\n case \"passkey\":\n return this.authenticateWithPasskey(params);\n case \"oauth\":\n return this.authenticateWithOauth(params);\n case \"oauthReturn\":\n return this.handleOauthReturn(params);\n case \"otp\":\n return this.authenticateWithOtp(params);\n case \"custom-jwt\":\n return this.authenticateWithJwt(params);\n case \"accessKey\":\n throw new UnsupportedFeatureError(\"Access key auth\");\n default:\n assertNever(type, `Unknown auth type: ${type}`);\n }\n })();\n\n this.trackAuthenticateType(params);\n\n return result.catch((error) => {\n /**\n * 2 things going on here:\n * 1. for oauth flows we expect the status to remain in authenticating\n * 2. we do the ternary, because if we explicitly pass in `undefined` for the status, zustand will set the value of status to `undefined`.\n * However, if we omit it, then it will not override the current value of status.\n */\n this.store.setState({\n error: toErrorInfo(error),\n ...(type === \"oauthReturn\" || type === \"oauth\"\n ? {}\n : { status: AlchemySignerStatus.DISCONNECTED }),\n });\n throw error;\n });\n },\n );\n\n private trackAuthenticateType = (params: AuthParams) => {\n const { type } = params;\n switch (type) {\n case \"email\": {\n // we just want to track the start of email auth\n if (\"bundle\" in params) return;\n SignerLogger.trackEvent({\n name: \"signer_authnticate\",\n data: { authType: \"email\" },\n });\n return;\n }\n case \"sms\": {\n // we just want to track the start of phone auth\n SignerLogger.trackEvent({\n name: \"signer_authnticate\",\n data: { authType: \"sms\" },\n });\n return;\n }\n case \"passkey\": {\n const isAnon = !(\"email\" in params) && params.createNew == null;\n SignerLogger.trackEvent({\n name: \"signer_authnticate\",\n data: {\n authType: isAnon ? \"passkey_anon\" : \"passkey_email\",\n },\n });\n return;\n }\n case \"custom-jwt\": {\n SignerLogger.trackEvent({\n name: \"signer_authnticate\",\n data: {\n authType: \"custom-jwt\",\n provider: params.authProviderId,\n },\n });\n return;\n }\n case \"oauth\":\n SignerLogger.trackEvent({\n name: \"signer_authnticate\",\n data: {\n authType: \"oauth\",\n provider: params.authProviderId,\n },\n });\n break;\n case \"oauthReturn\":\n break;\n case \"otp\":\n SignerLogger.trackEvent({\n name: \"signer_authnticate\",\n data: { authType: \"otp\" },\n });\n break;\n case \"accessKey\":\n break;\n default:\n assertNever(type, `Unknown auth type: ${type}`);\n }\n };\n\n /**\n * Clear a user session and log them out\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 * await signer.disconnect();\n * ```\n *\n * @returns {Promise<void>} a promise that resolves when the user is logged out\n */\n disconnect: () => Promise<void> = async () => {\n await this.inner.disconnect();\n };\n\n /**\n * Gets the current logged in user\n * If a user has an ongoing session, it will use that session and\n * try to authenticate\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 * // throws if not logged in\n * const user = await signer.getAuthDetails();\n * ```\n *\n * @throws if there is no user logged in\n * @returns {Promise<User>} the current user\n */\n getAuthDetails = async (): Promise<User> => {\n const sessionUser = await this.sessionManager.getSessionUser();\n if (sessionUser != null) {\n return sessionUser;\n }\n\n return this.inner.whoami();\n };\n\n /**\n * Retrieves the address of the current user by calling the `whoami` method on `this.inner`.\n *\n * @returns {Promise<string>} A promise that resolves to the address of the current user.\n */\n getAddress: () => Promise<`0x${string}`> = SignerLogger.profiled(\n \"BaseAlchemySigner.getAddress\",\n async () => {\n const { address } = await this.inner.whoami();\n\n return address;\n },\n );\n\n /**\n * Signs a raw message after hashing it.\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 * const signature = await signer.signMessage(\"Hello, world!\");\n * ```\n *\n * @param {string} msg the message to be hashed and then signed\n * @returns {Promise<string>} a promise that resolves to the signed message\n */\n signMessage: (msg: SignableMessage) => Promise<`0x${string}`> =\n SignerLogger.profiled(\"BaseAlchemySigner.signMessage\", async (msg) => {\n const messageHash = hashMessage(msg);\n\n const result = await this.inner.signRawMessage(messageHash);\n\n SignerLogger.trackEvent({\n name: \"signer_sign_message\",\n });\n\n return result;\n });\n\n /**\n * Signs a typed message by first hashing it and then signing the hashed message using the `signRawMessage` method.\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 * const signature = await signer.signTypedData({\n * domain: {},\n * types: {},\n * primaryType: \"\",\n * message: {},\n * });\n * ```\n *\n * @param {TypedDataDefinition<TTypedData, TPrimaryType>} params The parameters for the typed message to be hashed and signed\n * @returns {Promise<any>} A promise that resolves to the signed message\n */\n signTypedData: <\n const TTypedData extends TypedData | Record<string, unknown>,\n TPrimaryType extends keyof TTypedData | \"EIP712Domain\" = keyof TTypedData,\n >(\n params: TypedDataDefinition<TTypedData, TPrimaryType>,\n ) => Promise<Hex> = SignerLogger.profiled(\n \"BaseAlchemySigner.signTypedData\",\n async (params) => {\n const messageHash = hashTypedData(params);\n\n return this.inner.signRawMessage(messageHash);\n },\n );\n\n /**\n * Serializes a transaction, signs it with a raw message, and then returns the serialized transaction with the signature.\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 * const tx = await signer.signTransaction({\n * to: \"0x1234\",\n * value: \"0x1234\",\n * data: \"0x1234\",\n * });\n * ```\n *\n * @param {Transaction} tx the transaction to be serialized and signed\n * @param {{serializer?: SerializeTransactionFn}} args options for serialization\n * @param {() => Hex} [args.serializer] an optional serializer function. If not provided, the default `serializeTransaction` function will be used\n * @returns {Promise<string>} a promise that resolves to the serialized transaction with the signature\n */\n signTransaction: <\n serializer extends\n SerializeTransactionFn<TransactionSerializable> = SerializeTransactionFn<TransactionSerializable>,\n transaction extends Parameters<serializer>[0] = Parameters<serializer>[0],\n >(\n transaction: transaction,\n options?:\n | {\n serializer?: serializer | undefined;\n }\n | undefined,\n ) => Promise<\n IsNarrowable<\n TransactionSerialized<GetTransactionType<transaction>>,\n Hex\n > extends true\n ? TransactionSerialized<GetTransactionType<transaction>>\n : Hex\n > = SignerLogger.profiled(\n \"BaseAlchemySigner.signTransaction\",\n async (tx, args) => {\n const serializeFn = args?.serializer ?? serializeTransaction;\n const serializedTx = serializeFn(tx);\n const signatureHex = await this.inner.signRawMessage(\n keccak256(serializedTx),\n );\n\n const signature = unpackSignRawMessageBytes(signatureHex);\n\n return serializeFn(tx, signature);\n },\n );\n\n /**\n * Signs an EIP-7702 Authorization and then returns the authorization with the signature.\n *\n * @example\n * ```ts twoslash\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 * const tx = await signer.signAuthorization({\n * contractAddress: \"0x1234123412341234123412341234123412341234\",\n * chainId: 1,\n * nonce: 0,\n * });\n * ```\n *\n * @param {AuthorizationRequest<number>} unsignedAuthorization the authorization to be signed\n * @returns {Promise<SignedAuthorization<number>> | undefined} a promise that resolves to the authorization with the signature\n */\n signAuthorization: (\n unsignedAuthorization: AuthorizationRequest<number>,\n ) => Promise<SignedAuthorization<number>> = SignerLogger.profiled(\n \"BaseAlchemySigner.signAuthorization\",\n async (unsignedAuthorization) => {\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 /**\n * Gets the current MFA status\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 * const mfaStatus = signer.getMfaStatus();\n * if (mfaStatus === AlchemyMfaStatus.REQUIRED) {\n * // Handle MFA requirement\n * }\n * ```\n *\n * @returns {{ mfaRequired: boolean; mfaFactorId?: string }} The current MFA status\n */\n getMfaStatus = (): {\n mfaRequired: boolean;\n mfaFactorId?: string;\n } => {\n return this.store.getState().mfaStatus;\n };\n\n /**\n * Unauthenticated call to look up a user's organizationId by email\n *\n * @deprecated Use getUser({ type: \"email\", value: email }) instead\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 * const result = await signer.getUser(\"foo@mail.com\");\n * ```\n *\n * @param {string} email the email to lookup\n * @returns {Promise<{orgId: string}>} the organization id for the user if they exist\n */\n getUser(email: string): Promise<{ orgId: string } | null>;\n /**\n * Unauthenticated call to look up a user's organizationId by email or phone\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 * const result = await signer.getUser({ type: \"email\", value: \"foo@mail.com\" });\n * ```\n *\n * @param {string} email the email to lookup\n * @returns {Promise<{orgId: string}>} the organization id for the user if they exist\n */\n getUser(params: GetUserParams): Promise<{ orgId: string } | null>;\n /**\n * Unauthenticated call to look up a user's organizationId by email or phone\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 * const result = await signer.getUser({ type: \"email\", value: \"foo@mail.com\" });\n * ```\n *\n * @param {string | GetUserParams} params the params to look up\n * @returns {Promise<{orgId: string}>} the organization id for the user if they exist\n */\n getUser(params: string | GetUserParams): Promise<{ orgId: string } | null> {\n return SignerLogger.profiled(\n \"BaseAlchemySigner.getUser\",\n async (params: string | GetUserParams) => {\n const _params =\n typeof params === \"string\"\n ? { type: \"email\" as const, value: params }\n : params;\n\n const result =\n _params.type === \"email\"\n ? await this.inner.lookupUserByEmail(_params.value)\n : _params.type === \"phone\"\n ? await this.inner.lookupUserByPhone(_params.value)\n : assertNever(_params, \"unhandled get user params\");\n\n if (result?.orgId == null) {\n return null;\n }\n\n return {\n orgId: result.orgId,\n };\n },\n )(params);\n }\n\n /**\n * Sets the email for the authenticated user, allowing them to login with that\n * email.\n *\n * @deprecated You must contact Alchemy to enable this feature for your team,\n * as there are important security considerations. In particular, you must not\n * call this without first validating that the user owns this email account.\n * It is recommended to now use the email verification flow instead.\n *\n * @param {string} email The email to set for the user\n * @returns {Promise<string>} A promise that resolves to the updated email address\n * @throws {NotAuthenticatedError} If the user is not authenticated\n */\n setEmail(email: string): Promise<string>;\n\n /**\n * Uses a verification code to update a user's email, allowing them to login\n * with that email. `sendVerificationCode` should be called first to obtain\n * the code.\n *\n * @param {VerificationParams} params An object containing the verification code\n * @param {string} params.verificationCode The OTP verification code\n * @returns {Promise<string>} A promise that resolves to the updated email address\n * @throws {NotAuthenticatedError} If the user is not authenticated\n */\n setEmail(params: VerificationParams): Promise<string>;\n\n /**\n * Implementation for setEmail method.\n *\n * @param {string | VerificationParams} params An object containing the verificationCode (or simply an email for legacy usage)\n * @returns {Promise<void>} A promise that resolves when the email is set\n */\n async setEmail(params: string | VerificationParams): Promise<string> {\n return SignerLogger.profiled(\n \"BaseAlchemySigner.setEmail\",\n async (params: string | { verificationCode: string }) => {\n if (typeof params === \"string\") {\n // Deprecated usage for backwards compatibility.\n const email = params;\n return await this.inner.setEmail(email);\n }\n const { otpId } = this.store.getState();\n if (!otpId) {\n throw new Error(\"Missing OTP ID\");\n }\n return await this.inner.setEmail({\n id: otpId,\n code: params.verificationCode,\n });\n },\n )(params);\n }\n\n /**\n * Removes the email for the authenticated user, disallowing them from login with that email.\n *\n * @returns {Promise<void>} A promise that resolves when the email is removed\n * @throws {NotAuthenticatedError} If the user is not authenticated\n */\n removeEmail: () => Promise<void> = SignerLogger.profiled(\n \"BaseAlchemySigner.removeEmail\",\n async () => {\n await this.inner.removeEmail();\n },\n );\n\n /**\n * Sets the phone number for the authenticated user, allowing them to login with that\n * phone number. `sendVerificationCode` should be called first to obtain the code.\n *\n * @param {VerificationParams} params An object containing the verification code\n * @param {string} params.verificationCode The OTP verification code\n * @returns {Promise<void>} A promise that resolves when the phone number is set\n * @throws {NotAuthenticatedError} If the user is not authenticated\n */\n setPhoneNumber: (params: VerificationParams) => Promise<void> =\n SignerLogger.profiled(\n \"BaseAlchemySigner.setPhoneNumber\",\n async ({ verificationCode }) => {\n const { otpId } = this.store.getState();\n if (!otpId) {\n throw new Error(\"Missing OTP ID\");\n }\n await this.inner.setPhoneNumber({\n id: otpId,\n code: verificationCode,\n });\n },\n );\n\n /**\n * Removes the phone number for the authenticated user, disallowing them from login with that phone number.\n *\n * @returns {Promise<void>} A promise that resolves when the phone number is removed\n * @throws {NotAuthenticatedError} If the user is not authenticated\n */\n removePhoneNumber: () => Promise<void> = SignerLogger.profiled(\n \"BaseAlchemySigner.removePhoneNumber\",\n async () => {\n await this.inner.removePhoneNumber();\n },\n );\n\n /**\n * Initiates an OTP (One-Time Password) verification process for a user contact.\n * Use this method before calling `setEmail` with verification code to verify ownership of the email address.\n *\n * @param {\"email\" | \"sms\"} type The type of OTP to send, either \"email\" or \"sms\"\n * @param {string} contact The email address or phone number to send the OTP to\n * @returns {Promise<{ otpId: string }>} A promise that resolves to an object containing the OTP ID\n * @throws {NotAuthenticatedError} If the user is not authenticated\n */\n sendVerificationCode: (\n type: \"email\" | \"sms\",\n contact: string,\n ) => Promise<{ otpId: string }> = SignerLogger.profiled(\n \"BaseAlchemySigner.sendVerificationCode\",\n async (type, contact) => {\n const { otpId } = await this.inner.initOtp(type, contact);\n this.store.setState({ otpId });\n return { otpId };\n },\n );\n\n /**\n * Adds a passkey to the user's account\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 * const result = await signer.addPasskey()\n * ```\n *\n * @param {CredentialCreationOptions | undefined} params optional parameters for the passkey creation\n * @returns {Promise<string[]>} an array of the authenticator ids added to the user\n */\n addPasskey: (params?: CredentialCreationOptions) => Promise<string[]> =\n SignerLogger.profiled(\"BaseAlchemySigner.addPasskey\", async (params) => {\n return this.inner.addPasskey(params ?? {});\n });\n\n /**\n * Removes a passkey from a user's account\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 * const authMethods = await signer.listAuthMethods();\n * const passkey = authMethods.passkeys[0];\n *\n * const result = await signer.removePasskey(passkey.authenticatorId);\n * ```\n *\n * @param {CredentialCreationOptions | undefined} params optional parameters for the passkey creation\n * @returns {Promise<string[]>} an array of the authenticator ids added to the user\n */\n removePasskey: (authenticatorId: string) => Promise<void> =\n SignerLogger.profiled(\n \"BaseAlchemySigner.removePasskey\",\n async (authenticatorId) => {\n return this.inner.removePasskey(authenticatorId);\n },\n );\n\n getPasskeyStatus: () => Promise<{ isPasskeyAdded: boolean }> =\n SignerLogger.profiled(\"BaseAlchemySigner.getPasskeyStatus\", async () => {\n return this.inner.getPasskeyStatus();\n });\n\n /**\n * Used to export the wallet for a given user\n * If the user is authenticated with an Email, this will return a seed phrase\n * If the user is authenticated with a Passkey, this will return a private key\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 * // the params passed to this are different based on the specific signer\n * const result = signer.exportWallet()\n * ```\n *\n * @param {unknown} params exportWallet parameters\n * @returns {Promise<unknown>} the result of the wallet export operation\n */\n exportWallet: TClient[\"exportWallet\"] = async (params) => {\n return this.inner.exportWallet(params);\n };\n\n /**\n * Exports a private key for a given account encrypted with the provided public key\n *\n * @param {ExportPrivateKeyParams} opts the parameters for the export\n * @returns {Promise<string>} the private key\n */\n exportPrivateKeyEncrypted: TClient[\"exportPrivateKeyEncrypted\"] = (opts) => {\n return this.inner.exportPrivateKeyEncrypted(opts);\n };\n\n /**\n * This method lets you adapt your AlchemySigner to a viem LocalAccount, which\n * will let you use the signer as an EOA directly.\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 * const account = signer.toViemAccount();\n * ```\n *\n * @throws if your signer is not authenticated\n * @returns {LocalAccount} a LocalAccount object that can be used with viem's wallet client\n */\n toViemAccount = (): LocalAccount => {\n // if we want this method to be synchronous, then we need to do this check here\n // otherwise we can use the sessionManager to get the user\n if (!this.inner.getUser()) {\n throw new NotAuthenticatedError();\n }\n\n return toAccount({\n address: this.inner.getUser()!.address,\n signMessage: (msg) => this.signMessage(msg.message),\n signTypedData: <\n const typedData extends TypedData | Record<string, unknown>,\n primaryType extends keyof typedData | \"EIP712Domain\" = keyof typedData,\n >(\n typedDataDefinition: TypedDataDefinition<typedData, primaryType>,\n ) => this.signTypedData<typedData, primaryType>(typedDataDefinition),\n signTransaction: this.signTransaction,\n });\n };\n\n /**\n * Creates a new instance of `SolanaSigner` using the provided inner value.\n * This requires the signer to be authenticated first\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 * const solanaSigner = signer.toSolanaSigner();\n * ```\n *\n * @returns {SolanaSigner} A new instance of `SolanaSigner`\n */\n toSolanaSigner = (): SolanaSigner => {\n if (!this.inner.getUser()) {\n throw new NotAuthenticatedError();\n }\n\n return new SolanaSigner(this.inner);\n };\n\n private authenticateWithEmail = async (\n params: Extract<AuthParams, { type: \"email\" }>,\n ): Promise<User> => {\n if (\"bundle\" in params) {\n return this.completeEmailAuth(params);\n }\n\n const { orgId, otpId, isNewUser } = await this.initOrCreateEmailUser(\n params.email,\n params.emailMode,\n params.multiFactors,\n params.redirectParams,\n );\n\n this.setAwaitingEmailAuth({ orgId, otpId, isNewUser });\n\n // Clear the auth linking status if the email has changed. This would mean\n // that the previously initiated social login is not associated with the\n // email which is now being used to login.\n const { authLinkingStatus } = this.store.getState();\n if (authLinkingStatus && authLinkingStatus.email !== params.email) {\n this.store.setState({ authLinkingStatus: undefined });\n }\n\n // We wait for the session manager to emit a connected event if\n // cross tab sessions are permitted\n return this.waitForConnected();\n };\n\n private authenticateWithSms = async (\n params: Extract<AuthParams, { type: \"sms\" }>,\n ): Promise<User> => {\n const { orgId, otpId, isNewUser } = await this.initOrCreateSmsUser(\n params.phone,\n );\n\n this.setAwaitingSmsAuth({ orgId, otpId, isNewUser });\n\n // TODO: add phone auth linking\n // // Clear the auth linking status if the email has changed. This would mean\n // // that the previously initiated social login is not associated with the\n // // email which is now being used to login.\n // const { authLinkingStatus } = this.store.getState();\n // if (authLinkingStatus && authLinkingStatus.email !== params.email) {\n // this.store.setState({ authLinkingStatus: undefined });\n // }\n\n // We wait for the session manager to emit a connected event if\n // cross tab sessions are permitted\n return this.waitForConnected();\n };\n\n private authenticateWithPasskey = async (\n args: Extract<AuthParams, { type: \"passkey\" }>,\n ): Promise<User> => {\n let user: User;\n const shouldCreateNew = async () => {\n if (\"email\" in args) {\n const existingUser = await this.getUser({\n type: \"email\",\n value: args.email,\n });\n return existingUser == null;\n }\n\n return args.createNew;\n };\n\n if (await shouldCreateNew()) {\n const result = await this.inner.createAccount(\n args as Extract<\n AuthParams,\n { type: \"passkey\" } & ({ email: string } | { createNew: true })\n >,\n );\n // account creation for passkeys returns the whoami response so we don't have to\n // call it again after signup\n user = {\n address: result.address!,\n userId: result.userId!,\n orgId: result.orgId,\n };\n } else {\n user = await this.inner.lookupUserWithPasskey();\n if (!user) {\n this.store.setState({\n status: AlchemySignerStatus.DISCONNECTED,\n });\n throw new Error(\"No user found\");\n }\n }\n\n return user;\n };\n\n private authenticateWithOauth = async (\n args: Extract<AuthParams, { type: \"oauth\" }>,\n ): Promise<User> => {\n this.store.setState({ authLinkingStatus: undefined });\n const params: OauthParams = {\n ...args,\n expirationSeconds: this.getExpirationSeconds(),\n };\n if (params.mode === \"redirect\") {\n const user = await this.inner.oauthWithRedirect(params);\n if (!isUser(user)) {\n throw new Error(\"Expected user from oauth with redirect\");\n }\n return user;\n }\n const result = await this.inner.oauthWithPopup(params);\n if (isIdTokenOnly(result)) {\n throw new Error(\n \"Should not get only id token when authenticating with oauth\",\n );\n }\n if (!isAuthLinkingPrompt(result)) {\n return result;\n }\n this.setAuthLinkingPrompt(result);\n return this.waitForConnected();\n };\n\n /**\n * Handles OAuth authentication by augmenting the provided arguments with a type and performing authentication based on the OAuth mode (either using redirect or popup).\n *\n * @param {Omit<Extract<AuthParams, { type: \"oauth\" }>, \"type\">} args Authentication parameters omitting the type, which will be set to \"oauth\"\n * @returns {Promise<OauthProviderInfo>} A promise that resolves to an `OauthProviderInfo` object containing provider information and the ID token.\n */\n public addOauthProvider = async (\n args: Omit<Extract<AuthParams, { type: \"oauth\" }>, \"type\">,\n ): Promise<OauthProviderInfo> => {\n // This cast is required to suppress a spurious type error. We're just\n // putting the omitted field back in, but TypeScript doesn't recognize that.\n const argsWithType = { type: \"oauth\", ...args } as Extract<\n AuthParams,\n { type: \"oauth\" }\n >;\n const params: OauthParams = {\n ...argsWithType,\n fetchIdTokenOnly: true,\n };\n const result = await (params.mode === \"redirect\"\n ? this.inner.oauthWithRedirect(params)\n : this.inner.oauthWithPopup(params));\n if (!isIdTokenOnly(result)) {\n throw new Error(\"Expected id token only from oauth response\");\n }\n return await this.inner.addOauthProvider({\n providerName: result.providerName,\n oidcToken: result.idToken,\n });\n };\n\n /**\n * Removes an OAuth provider by its ID if the user is authenticated.\n *\n * @param {string} providerId The ID of the OAuth provider to be removed, as obtained from `listOauthProviders`\n * @returns {Promise<any>} A promise indicating the result of the removal process\n * @throws {NotAuthenticatedError} Thrown if the user is not authenticated\n */\n public removeOauthProvider = async (providerId: string) => {\n if (!this.inner.getUser()) {\n throw new NotAuthenticatedError();\n }\n return this.inner.removeOauthProvider(providerId);\n };\n\n /**\n * Retrieves a list of auth methods associated with the authenticated user.\n *\n * @returns {Promise<AuthMethods>} A promise that resolves to an `AuthMethods` object containing the user's email, OAuth providers, and passkeys.\n * @throws {NotAuthenticatedError} Thrown if the user is not authenticated\n */\n public listAuthMethods = async (): Promise<AuthMethods> => {\n if (!this.inner.getUser()) {\n throw new NotAuthenticatedError();\n }\n return this.inner.listAuthMethods();\n };\n\n private authenticateWithJwt = async (\n args: Extract<AuthParams, { type: \"custom-jwt\" }>,\n ): Promise<User> => {\n const { credentialBundle, orgId, isSignUp } = await this.inner.submitJwt({\n jwt: args.jwt,\n authProvider: args.authProviderId,\n expirationSeconds: this.getExpirationSeconds(),\n });\n\n const user = await this.inner.completeAuthWithBundle({\n bundle: credentialBundle,\n orgId: orgId,\n connectedEventName: \"connectedJwt\",\n authenticatingType: \"custom-jwt\",\n });\n\n this.emitNewUserEvent(isSignUp);\n return user;\n };\n\n private authenticateWithOtp = async (\n args: Extract<AuthParams, { type: \"otp\" }>,\n ): Promise<User> => {\n const tempSession = this.sessionManager.getTemporarySession();\n const { orgId, isNewUser } = tempSession ?? {};\n const { otpId } = this.store.getState();\n if (!orgId) {\n throw new Error(\"orgId not found in session\");\n }\n if (!otpId) {\n throw new Error(\"otpId not found in session\");\n }\n\n const response = await this.inner.submitOtpCode({\n orgId,\n otpId,\n otpCode: args.otpCode,\n expirationSeconds: this.getExpirationSeconds(),\n multiFactors: args.multiFactors,\n });\n\n if (response.mfaRequired) {\n this.handleMfaRequired(response.encryptedPayload, response.multiFactors);\n return this.waitForConnected();\n }\n\n const user = await this.inner.completeAuthWithBundle({\n bundle: response.bundle,\n orgId,\n connectedEventName: \"connectedOtp\",\n authenticatingType: \"otp\",\n });\n\n this.emitNewUserEvent(isNewUser);\n if (tempSession) {\n this.sessionManager.setTemporarySession({\n ...tempSession,\n isNewUser: false,\n });\n }\n\n const { authLinkingStatus } = this.store.getState();\n if (authLinkingStatus) {\n (async () => {\n this.inner.addOauthProvider({\n providerName: authLinkingStatus.providerName,\n oidcToken: authLinkingStatus.idToken,\n });\n })();\n }\n\n return user;\n };\n\n private setAwaitingEmailAuth = ({\n orgId,\n otpId,\n isNewUser,\n }: {\n orgId: string;\n otpId?: string;\n isNewUser?: boolean;\n }): void => {\n this.sessionManager.setTemporarySession({\n orgId,\n isNewUser,\n });\n this.store.setState({\n status: AlchemySignerStatus.AWAITING_EMAIL_AUTH,\n otpId,\n error: null,\n });\n };\n\n private setAwaitingSmsAuth = ({\n orgId,\n otpId,\n isNewUser,\n }: {\n orgId: string;\n otpId?: string;\n isNewUser?: boolean;\n }): void => {\n this.sessionManager.setTemporarySession({\n orgId,\n isNewUser,\n });\n this.store.setState({\n status: AlchemySignerStatus.AWAITING_SMS_AUTH,\n otpId,\n error: null,\n });\n };\n\n private handleOauthReturn = ({\n bundle,\n orgId,\n idToken,\n accessToken,\n isNewUser,\n }: Extract<AuthParams, { type: \"oauthReturn\" }>): Promise<User> => {\n const user = this.inner.completeAuthWithBundle({\n bundle,\n orgId,\n connectedEventName: \"connectedOauth\",\n authenticatingType: \"oauth\",\n idToken,\n accessToken,\n });\n\n this.emitNewUserEvent(isNewUser);\n\n return user;\n };\n\n private handleMfaRequired(\n encryptedPayload: string,\n multiFactors: MfaFactor[],\n ) {\n // Store complete MFA context in the temporary session\n const tempSession = this.sessionManager.getTemporarySession();\n if (tempSession) {\n this.sessionManager.setTemporarySession({\n ...tempSession,\n encryptedPayload,\n mfaFactorId: multiFactors?.[0]?.multiFactorId,\n });\n }\n\n // Keep minimal state in the store for UI updates\n this.store.setState({\n status: AlchemySignerStatus.AWAITING_MFA_AUTH,\n error: null,\n mfaStatus: {\n mfaRequired: true,\n mfaFactorId: multiFactors?.[0]?.multiFactorId,\n },\n });\n }\n\n private getExpirationSeconds = () =>\n Math.floor(this.sessionManager.expirationTimeMs / 1000);\n\n private registerListeners = () => {\n // Declare listeners in an object to typecheck that every event type is\n // handled.\n const listeners: SessionManagerEvents = {\n connected: (session) => {\n this.store.setState({\n user: session.user,\n status: AlchemySignerStatus.CONNECTED,\n error: null,\n });\n },\n disconnected: () => {\n this.store.setState({\n user: null,\n status: AlchemySignerStatus.DISCONNECTED,\n });\n },\n initialized: () => {\n this.store.setState((state) => ({\n status: state.user\n ? AlchemySignerStatus.CONNECTED\n : AlchemySignerStatus.DISCONNECTED,\n ...(state.user ? { error: null } : undefined),\n }));\n },\n };\n\n for (const [event, listener] of Object.entries(listeners)) {\n this.sessionManager.on(event as keyof SessionManagerEvents, listener);\n }\n\n this.inner.on(\"authenticating\", ({ type }) => {\n const status = (() => {\n switch (type) {\n case \"email\":\n return AlchemySignerStatus.AUTHENTICATING_EMAIL;\n case \"passkey\":\n return AlchemySignerStatus.AUTHENTICATING_PASSKEY;\n case \"oauth\":\n return AlchemySignerStatus.AUTHENTICATING_OAUTH;\n case \"otp\":\n case \"otpVerify\":\n return AlchemySignerStatus.AWAITING_OTP_AUTH;\n case \"sms\":\n return AlchemySignerStatus.AWAITING_SMS_AUTH;\n case \"custom-jwt\":\n return AlchemySignerStatus.AUTHENTICATING_JWT;\n default:\n assertNever(type, \"unhandled authenticating type\");\n }\n })();\n\n // trigger new user event on signer from client\n this.inner.on(\"newUserSignup\", () => {\n this.emitNewUserEvent(true);\n });\n\n this.store.setState({\n status,\n error: null,\n });\n });\n };\n\n private emitNewUserEvent = (isNewUser?: boolean) => {\n // assumes that if isNewUser is undefined it is a returning user\n if (isNewUser) this.store.setState({ isNewUser });\n };\n\n private async initOrCreateEmailUser(\n email: string,\n emailMode?: EmailType,\n multiFactors?: VerifyMfaParams[],\n redirectParams?: URLSearchParams,\n ): Promise<{\n orgId: string;\n otpId?: string;\n isNewUser: boolean;\n }> {\n const existingUser = await this.getUser(email);\n const expirationSeconds = this.getExpirationSeconds();\n\n if (existingUser) {\n const { orgId, otpId } = await this.inner.initEmailAuth({\n email: email,\n emailMode: emailMode,\n expirationSeconds,\n redirectParams: redirectParams,\n multiFactors,\n });\n return {\n orgId,\n otpId,\n isNewUser: false,\n };\n }\n\n const { orgId, otpId } = await this.inner.createAccount({\n type: \"email\",\n email,\n emailMode,\n expirationSeconds,\n redirectParams,\n });\n return {\n orgId,\n otpId,\n isNewUser: true,\n };\n }\n\n private async initOrCreateSmsUser(phone: string): Promise<{\n orgId: string;\n otpId?: string;\n isNewUser: boolean;\n }> {\n const existingUser = await this.getUser({ type: \"phone\", value: phone });\n\n if (existingUser) {\n const { orgId, otpId } = await this.inner.initSmsAuth({\n phone,\n });\n return {\n orgId,\n otpId,\n isNewUser: false,\n };\n }\n\n const { orgId, otpId } = await this.inner.createAccount({\n type: \"sms\",\n phone,\n });\n return {\n orgId,\n otpId,\n isNewUser: true,\n };\n }\n\n private async completeEmailAuth(\n params: Extract<AuthParams, { type: \"email\"; bundle: string }>,\n ): Promise<User> {\n const temporarySession = params.orgId\n ? { orgId: params.orgId }\n : this.sessionManager.getTemporarySession();\n\n if (!temporarySession) {\n this.store.setState({ status: AlchemySignerStatus.DISCONNECTED });\n throw new Error(\"Could not find email auth init session!\");\n }\n\n const user = await this.inner.completeAuthWithBundle({\n bundle: params.bundle,\n orgId: temporarySession.orgId,\n connectedEventName: \"connectedEmail\",\n authenticatingType: \"email\",\n });\n\n // fire new user event\n this.emitNewUserEvent(params.isNewUser);\n\n return user;\n }\n\n /**\n * Retrieves the list of MFA factors configured for the current user.\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 * const { multiFactors } = await signer.getMfaFactors();\n * ```\n *\n * @throws {NotAuthenticatedError} If no user is authenticated\n * @returns {Promise<{ multiFactors: Array<MfaFactor> }>} A promise that resolves to an array of configured MFA factors\n */\n getMfaFactors: () => Promise<{ multiFactors: MfaFactor[] }> =\n SignerLogger.profiled(\"BaseAlchemySigner.getMfaFactors\", async () => {\n return this.inner.getMfaFactors();\n });\n\n /**\n * Initiates the setup of a new MFA factor for the current user.\n * The factor will need to be verified using verifyMfa before it becomes active.\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 * const result = await signer.addMfa({ multiFactorType: \"totp\" });\n * // Result contains multiFactorTotpUrl to display as QR code\n * ```\n *\n * @param {AddMfaParams} params The parameters required to enable a new MFA factor\n * @throws {NotAuthenticatedError} If no user is authenticated\n * @returns {Promise<AddMfaResult>} A promise that resolves to the factor setup information\n */\n addMfa: (params: AddMfaParams) => Promise<AddMfaResult> =\n SignerLogger.profiled(\"BaseAlchemySigner.addMfa\", async (params) => {\n return this.inner.addMfa(params);\n });\n\n /**\n * Verifies a newly created MFA factor to complete the setup process.\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 * const result = await signer.verifyMfa({\n * multiFactorId: \"factor-id\",\n * multiFactorCode: \"123456\" // 6-digit code from authenticator app\n * });\n * ```\n *\n * @param {VerifyMfaParams} params The parameters required to verify the MFA factor\n * @throws {NotAuthenticatedError} If no user is authenticated\n * @returns {Promise<{ multiFactors: MfaFactor[] }>} A promise that resolves to the updated list of MFA factors\n */\n verifyMfa: (\n params: VerifyMfaParams,\n ) => Promise<{ multiFactors: MfaFactor[] }> = SignerLogger.profiled(\n \"BaseAlchemySigner.verifyMfa\",\n async (params) => {\n return this.inner.verifyMfa(params);\n },\n );\n\n /**\n * Removes existing MFA factors by their IDs.\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 * const result = await signer.removeMfa({\n * multiFactorIds: [\"factor-id-1\", \"factor-id-2\"]\n * });\n * ```\n *\n * @param {RemoveMfaParams} params The parameters specifying which factors to disable\n * @throws {NotAuthenticatedError} If no user is authenticated\n * @returns {Promise<{ multiFactors: MfaFactor[] }>} A promise that resolves to the updated list of MFA factors\n */\n removeMfa: (\n params: RemoveMfaParams,\n ) => Promise<{ multiFactors: MfaFactor[] }> = SignerLogger.profiled(\n \"BaseAlchemySigner.removeMfa\",\n async (params) => {\n return this.inner.removeMfa(params);\n },\n );\n\n /**\n * Validates MFA factors that were required during authentication.\n * This function should be called after MFA is required and the user has provided their MFA code.\n * It completes the authentication process by validating the MFA factors and completing the auth bundle.\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 * // After MFA is required and user provides code\n * const user = await signer.validateMultiFactors({\n * multiFactorCode: \"123456\", // 6-digit code from authenticator app\n * multiFactorId: \"factor-id\"\n * });\n * ```\n *\n * @param {ValidateMultiFactorsArgs} params - Parameters for validating MFA factors\n * @throws {Error} If there is no pending MFA context or if orgId is not found\n * @returns {Promise<User>} A promise that resolves to the authenticated user\n */\n public async validateMultiFactors(\n params: ValidateMultiFactorsArgs,\n ): Promise<User> {\n // Get MFA context from temporary session\n const tempSession = this.sessionManager.getTemporarySession();\n if (\n !tempSession?.orgId ||\n !tempSession.encryptedPayload ||\n !tempSession.mfaFactorId\n ) {\n throw new Error(\n \"No pending MFA context found. Call submitOtpCode() first.\",\n );\n }\n\n if (\n params.multiFactorId &&\n tempSession.mfaFactorId !== params.multiFactorId\n ) {\n throw new Error(\"MFA factor ID mismatch\");\n }\n\n // Call the low-level client\n const { bundle } = await this.inner.validateMultiFactors({\n encryptedPayload: tempSession.encryptedPayload,\n multiFactors: [\n {\n multiFactorId: tempSession.mfaFactorId,\n multiFactorCode: params.multiFactorCode,\n },\n ],\n });\n\n // Complete the authentication\n const user = await this.inner.completeAuthWithBundle({\n bundle,\n orgId: tempSession.orgId,\n connectedEventName: \"connectedOtp\",\n authenticatingType: \"otp\",\n });\n\n // Remove MFA data from temporary session\n this.sessionManager.setTemporarySession({\n ...tempSession,\n encryptedPayload: undefined,\n mfaFactorId: undefined,\n });\n\n // Update UI state\n this.store.setState({\n mfaStatus: {\n mfaRequired: false,\n mfaFactorId: undefined,\n },\n });\n\n return user;\n }\n\n protected initConfig = async (): Promise<SignerConfig> => {\n this.config = this.fetchConfig();\n return this.config;\n };\n\n /**\n * Returns the signer configuration while fetching it if it's not already initialized.\n *\n * @returns {Promise<SignerConfig>} A promise that resolves to the signer configuration\n */\n public getConfig = async (): Promise<SignerConfig> => {\n if (!this.config) {\n return this.initConfig();\n }\n\n return this.config;\n };\n\n protected fetchConfig = async (): Promise<SignerConfig> => {\n return this.inner.request(\"/v1/signer-config\", {});\n };\n\n private setAuthLinkingPrompt = (prompt: AuthLinkingPrompt) => {\n this.setAwaitingEmailAuth({\n orgId: prompt.orgId,\n otpId: prompt.otpId,\n isNewUser: false,\n });\n this.store.setState({\n authLinkingStatus: {\n email: prompt.email,\n providerName: prompt.providerName,\n idToken: prompt.idToken,\n accessToken: prompt.accessToken,\n },\n });\n };\n\n private waitForConnected = (): Promise<User> => {\n return new Promise<User>((resolve) => {\n const removeListener = this.sessionManager.on(\"connected\", (session) => {\n resolve(session.user);\n removeListener();\n });\n });\n };\n}\n\nfunction toErrorInfo(error: unknown): ErrorInfo {\n return error instanceof Error\n ? { name: error.name, message: error.message }\n : { name: \"Error\", message: \"Unknown error\" };\n}\n\n// eslint-disable-next-line jsdoc/require-param, jsdoc/require-returns\n/**\n * Zustand's `fireImmediately` option calls the listener before\n * `store.subscribe` has returned, which breaks listeners which call\n * unsubscribe, e.g.\n *\n * ```ts\n * const unsubscribe = store.subscribe(\n * selector,\n * (update) => {\n * handleUpdate(update);\n * unsubscribe();\n * },\n * { fireImmediately: true },\n * )\n * ```\n *\n * since `unsubscribe` is still undefined at the time the listener is called. To\n * prevent this, if the listener triggers before `subscribe` has returned, delay\n * the callback to a later run of the event loop.\n */\nfunction subscribeWithDelayedFireImmediately<T>(\n store: InternalStore,\n selector: (state: AlchemySignerStore) => T,\n listener: (selectedState: T, previousSelectedState: T) => void,\n): () => void {\n // Until this function has returned, maintain a queue of events that will be\n // processed once it does.\n const queue: [selectedState: T, previousSelectedState: T][] = [];\n let queueHasEmptied = false;\n let hasUnsubscribed = false;\n\n function drainQueue() {\n // Note that this handles the case where more events are added to the queue\n // during the handling of previous events.\n for (let i = 0; i < queue.length && !hasUnsubscribed; i++) {\n const args = queue[i];\n listener(...args);\n }\n queueHasEmptied = true;\n }\n\n // Schedule the queue to be drained after this function has returned.\n setTimeout(drainQueue, 0);\n\n const unsubscribe = store.subscribe(\n selector,\n (...args) => {\n if (queueHasEmptied) {\n listener(...args);\n } else {\n queue.push(args);\n }\n },\n { fireImmediately: true },\n );\n\n return () => {\n hasUnsubscribed = true;\n unsubscribe();\n };\n}\n\nfunction isUser(\n result: User | AuthLinkingPrompt | IdTokenOnly,\n): result is User {\n return !isAuthLinkingPrompt(result) && !isIdTokenOnly(result);\n}\n\nfunction isAuthLinkingPrompt(result: unknown): result is AuthLinkingPrompt {\n return (\n (result as AuthLinkingPrompt)?.status ===\n \"ACCOUNT_LINKING_CONFIRMATION_REQUIRED\"\n );\n}\n\nfunction isIdTokenOnly(result: unknown): result is IdTokenOnly {\n return (result as IdTokenOnly)?.status === \"FETCHED_ID_TOKEN_ONLY\";\n}\n"]}
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,yBAAyB,GAC1B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,WAAW,EACX,aAAa,EACb,SAAS,EACT,oBAAoB,GAYrB,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAcN,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EACL,cAAc,GAEf,MA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YACpB,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAC;QACpB,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC;IACH,CAAC,EACD,EAAE,eAAe,EAAE,IAAI,EAAE,CAC1B,CAAC;IAEF,OAAO,GAAG,EAAE;QACV,eAAe,GAAG,IAAI,CAAC;QACvB,WAAW,EAAE,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,MAAM,CACb,MAA8C;IAE9C,OAAO,CAAC,mBAAmB,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;AAChE,CAAC;AAED,SAAS,mBAAmB,CAAC,MAAe;IAC1C,OAAO,CACJ,MAA4B,EAAE,MAAM;QACrC,uCAAuC,CACxC,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,MAAe;IACpC,OAAQ,MAAsB,EAAE,MAAM,KAAK,uBAAuB,CAAC;AACrE,CAAC","sourcesContent":["import {\n type SmartAccountAuthenticator,\n type AuthorizationRequest,\n unpackSignRawMessageBytes,\n} from \"@aa-sdk/core\";\nimport {\n hashMessage,\n hashTypedData,\n keccak256,\n serializeTransaction,\n type GetTransactionType,\n type Hex,\n type IsNarrowable,\n type LocalAccount,\n type SerializeTransactionFn,\n type SignableMessage,\n type SignedAuthorization,\n type TransactionSerializable,\n type TransactionSerialized,\n type TypedData,\n type TypedDataDefinition,\n} from \"viem\";\nimport { toAccount } from \"viem/accounts\";\nimport type { Mutate, StoreApi } from \"zustand\";\nimport { subscribeWithSelector } from \"zustand/middleware\";\nimport { createStore } from \"zustand/vanilla\";\nimport type { BaseSignerClient } from \"./client/base\";\nimport {\n type EmailType,\n type MfaFactor,\n type OauthConfig,\n type OauthParams,\n type User,\n type VerifyMfaParams,\n type AddMfaParams,\n type AddMfaResult,\n type RemoveMfaParams,\n type AuthLinkingPrompt,\n type OauthProviderInfo,\n type IdTokenOnly,\n type AuthMethods,\n} from \"./client/types.js\";\nimport { NotAuthenticatedError, UnsupportedFeatureError } from \"./errors.js\";\nimport { SignerLogger } from \"./metrics.js\";\nimport {\n SessionManager,\n type SessionManagerParams,\n} from \"./session/manager.js\";\nimport type { SessionManagerEvents } from \"./session/types\";\nimport type { AuthParams } from \"./signer\";\nimport { SolanaSigner } from \"./solanaSigner.js\";\nimport {\n AlchemySignerStatus,\n type AlchemySignerEvent,\n type AlchemySignerEvents,\n type ErrorInfo,\n type ValidateMultiFactorsArgs,\n} from \"./types.js\";\nimport { assertNever } from \"./utils/typeAssertions.js\";\nimport { hashAuthorization } from \"viem/utils\";\n\nexport interface BaseAlchemySignerParams<TClient extends BaseSignerClient> {\n client: TClient;\n sessionConfig?: Omit<SessionManagerParams, \"client\">;\n initialError?: ErrorInfo;\n initialAuthLinkingPrompt?: AuthLinkingPrompt;\n}\n\ntype AlchemySignerStore = {\n user: User | null;\n status: AlchemySignerStatus;\n error: ErrorInfo | null;\n otpId?: string;\n isNewUser?: boolean;\n mfaStatus: {\n mfaRequired: boolean;\n mfaFactorId?: string;\n encryptedPayload?: string;\n };\n authLinkingStatus?: {\n email: string;\n providerName: string;\n idToken: string;\n accessToken?: string;\n };\n};\n\ntype InternalStore = Mutate<\n StoreApi<AlchemySignerStore>,\n [[\"zustand/subscribeWithSelector\", never]]\n>;\n\nexport type EmailConfig = {\n mode?: \"MAGIC_LINK\" | \"OTP\";\n};\n\nexport type SignerConfig = {\n email: EmailConfig;\n};\n\ntype GetUserParams =\n | {\n type: \"email\";\n value: string;\n }\n | {\n type: \"phone\";\n value: string;\n };\n\ntype VerificationParams = {\n verificationCode: string;\n};\n\n/**\n * Base abstract class for Alchemy Signer, providing authentication and session management for smart accounts.\n * Implements the `SmartAccountAuthenticator` interface and handles various signer events.\n */\nexport abstract class BaseAlchemySigner<TClient extends BaseSignerClient>\n implements SmartAccountAuthenticator<AuthParams, User, TClient>\n{\n signerType: \"alchemy-signer\" | \"rn-alchemy-signer\" = \"alchemy-signer\";\n inner: TClient;\n private sessionManager: SessionManager;\n private store: InternalStore;\n private config: Promise<SignerConfig>;\n\n /**\n * Initializes an instance with the provided client and session configuration.\n * This function sets up the internal store, initializes the session manager,\n * registers listeners and initializes the session manager to manage session state.\n *\n * @param {BaseAlchemySignerParams<TClient>} param0 Object containing the client and session configuration\n * @param {TClient} param0.client The client instance to be used internally\n * @param {SessionConfig} param0.sessionConfig Configuration for managing sessions\n * @param {ErrorInfo | undefined} param0.initialError Error already present on the signer when initialized, if any\n */\n constructor({\n client,\n sessionConfig,\n initialError,\n initialAuthLinkingPrompt,\n }: BaseAlchemySignerParams<TClient>) {\n this.inner = client;\n this.store = createStore(\n subscribeWithSelector(\n () =>\n ({\n user: null,\n status: AlchemySignerStatus.INITIALIZING,\n error: initialError ?? null,\n mfaStatus: {\n mfaRequired: false,\n mfaFactorId: undefined,\n },\n }) satisfies AlchemySignerStore,\n ),\n );\n // NOTE: it's important that the session manager share a client\n // with the signer. The SessionManager leverages the Signer's client\n // to manage session state.\n this.sessionManager = new SessionManager({\n ...sessionConfig,\n client: this.inner,\n });\n // register listeners first\n this.registerListeners();\n // then initialize so that we can catch those events\n this.sessionManager.initialize();\n this.config = this.fetchConfig();\n if (initialAuthLinkingPrompt) {\n this.setAuthLinkingPrompt(initialAuthLinkingPrompt);\n }\n }\n\n /**\n * Allows you to subscribe to events emitted by the signer\n *\n * @param {AlchemySignerEvent} event the event to subscribe to\n * @param {AlchemySignerEvents[AlchemySignerEvent]} listener the function to run when the event is emitted\n * @returns {() => void} a function to remove the listener\n */\n on = <E extends AlchemySignerEvent>(\n event: E,\n listener: AlchemySignerEvents[E],\n ) => {\n // NOTE: we're using zustand here to handle this because we are able to use the fireImmediately\n // option which deals with a possible race condition where the listener is added after the event\n // is fired. In the Client and SessionManager we use EventEmitter because it's easier to handle internally\n switch (event) {\n case \"connected\":\n return subscribeWithDelayedFireImmediately(\n this.store,\n ({ status }) => status,\n (status) =>\n status === AlchemySignerStatus.CONNECTED &&\n (listener as AlchemySignerEvents[\"connected\"])(\n this.store.getState().user!,\n ),\n );\n case \"disconnected\":\n return subscribeWithDelayedFireImmediately(\n this.store,\n ({ status }) => status,\n (status) =>\n status === AlchemySignerStatus.DISCONNECTED &&\n (listener as AlchemySignerEvents[\"disconnected\"])(),\n );\n case \"statusChanged\":\n return subscribeWithDelayedFireImmediately(\n this.store,\n ({ status }) => status,\n listener as AlchemySignerEvents[\"statusChanged\"],\n );\n case \"errorChanged\":\n return subscribeWithDelayedFireImmediately(\n this.store,\n ({ error }) => error,\n (error) =>\n (listener as AlchemySignerEvents[\"errorChanged\"])(\n error ?? undefined,\n ),\n );\n case \"newUserSignup\":\n return subscribeWithDelayedFireImmediately(\n this.store,\n ({ isNewUser }) => isNewUser,\n (isNewUser) => {\n if (isNewUser) (listener as AlchemySignerEvents[\"newUserSignup\"])();\n },\n );\n case \"mfaStatusChanged\":\n return subscribeWithDelayedFireImmediately(\n this.store,\n ({ mfaStatus }) => mfaStatus,\n (mfaStatus) =>\n (listener as AlchemySignerEvents[\"mfaStatusChanged\"])(mfaStatus),\n );\n case \"emailAuthLinkingRequired\":\n return subscribeWithDelayedFireImmediately(\n this.store,\n ({ authLinkingStatus }) => authLinkingStatus,\n (authLinkingStatus) => {\n if (authLinkingStatus) {\n (listener as AlchemySignerEvents[\"emailAuthLinkingRequired\"])(\n authLinkingStatus.email,\n );\n }\n },\n );\n default:\n assertNever(event, `Unknown event type ${event}`);\n }\n };\n\n /**\n * Prepares the config needed to use popup-based OAuth login. This must be\n * called before calling `.authenticate` with params `{ type: \"oauth\", mode:\n * \"popup\" }`, and is recommended to be called on page load.\n *\n * This method exists because browsers may prevent popups from opening unless\n * triggered by user interaction, and so the OAuth config must already have\n * been fetched at the time a user clicks a social login button.\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 * await signer.preparePopupOauth();\n * ```\n * @returns {Promise<OauthConfig>} the config which must be loaded before\n * using popup-based OAuth\n */\n preparePopupOauth = (): Promise<OauthConfig> => this.inner.initOauth();\n\n /**\n * Authenticate a user with either an email or a passkey and create a session for that user\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 * const result = await signer.authenticate({\n * type: \"email\",\n * email: \"foo@mail.com\",\n * });\n * ```\n *\n * @param {AuthParams} params - undefined if passkey login, otherwise an object with email and bundle to resolve\n * @returns {Promise<User>} the user that was authenticated\n */\n authenticate: (params: AuthParams) => Promise<User> = SignerLogger.profiled(\n \"BaseAlchemySigner.authenticate\",\n async (params) => {\n const { type } = params;\n const result = (() => {\n switch (type) {\n case \"email\":\n return this.authenticateWithEmail(params);\n case \"sms\":\n return this.authenticateWithSms(params);\n case \"passkey\":\n return this.authenticateWithPasskey(params);\n case \"oauth\":\n return this.authenticateWithOauth(params);\n case \"oauthReturn\":\n return this.handleOauthReturn(params);\n case \"otp\":\n return this.authenticateWithOtp(params);\n case \"custom-jwt\":\n return this.authenticateWithJwt(params);\n case \"accessKey\":\n throw new UnsupportedFeatureError(\"Access key auth\");\n default:\n assertNever(type, `Unknown auth type: ${type}`);\n }\n })();\n\n this.trackAuthenticateType(params);\n\n return result.catch((error) => {\n /**\n * 2 things going on here:\n * 1. for oauth flows we expect the status to remain in authenticating\n * 2. we do the ternary, because if we explicitly pass in `undefined` for the status, zustand will set the value of status to `undefined`.\n * However, if we omit it, then it will not override the current value of status.\n */\n this.store.setState({\n error: toErrorInfo(error),\n ...(type === \"oauthReturn\" || type === \"oauth\"\n ? {}\n : { status: AlchemySignerStatus.DISCONNECTED }),\n });\n throw error;\n });\n },\n );\n\n private trackAuthenticateType = (params: AuthParams) => {\n const { type } = params;\n switch (type) {\n case \"email\": {\n // we just want to track the start of email auth\n if (\"bundle\" in params) return;\n SignerLogger.trackEvent({\n name: \"signer_authnticate\",\n data: { authType: \"email\" },\n });\n return;\n }\n case \"sms\": {\n // we just want to track the start of phone auth\n SignerLogger.trackEvent({\n name: \"signer_authnticate\",\n data: { authType: \"sms\" },\n });\n return;\n }\n case \"passkey\": {\n const isAnon = !(\"email\" in params) && params.createNew == null;\n SignerLogger.trackEvent({\n name: \"signer_authnticate\",\n data: {\n authType: isAnon ? \"passkey_anon\" : \"passkey_email\",\n },\n });\n return;\n }\n case \"custom-jwt\": {\n SignerLogger.trackEvent({\n name: \"signer_authnticate\",\n data: {\n authType: \"custom-jwt\",\n provider: params.authProviderId,\n },\n });\n return;\n }\n case \"oauth\":\n SignerLogger.trackEvent({\n name: \"signer_authnticate\",\n data: {\n authType: \"oauth\",\n provider: params.authProviderId,\n },\n });\n break;\n case \"oauthReturn\":\n break;\n case \"otp\":\n SignerLogger.trackEvent({\n name: \"signer_authnticate\",\n data: { authType: \"otp\" },\n });\n break;\n case \"accessKey\":\n break;\n default:\n assertNever(type, `Unknown auth type: ${type}`);\n }\n };\n\n /**\n * Clear a user session and log them out\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 * await signer.disconnect();\n * ```\n *\n * @returns {Promise<void>} a promise that resolves when the user is logged out\n */\n disconnect: () => Promise<void> = async () => {\n await this.inner.disconnect();\n };\n\n /**\n * Gets the current logged in user\n * If a user has an ongoing session, it will use that session and\n * try to authenticate\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 * // throws if not logged in\n * const user = await signer.getAuthDetails();\n * ```\n *\n * @throws if there is no user logged in\n * @returns {Promise<User>} the current user\n */\n getAuthDetails = async (): Promise<User> => {\n const sessionUser = await this.sessionManager.getSessionUser();\n if (sessionUser != null) {\n return sessionUser;\n }\n\n return this.inner.whoami();\n };\n\n /**\n * Retrieves the address of the current user by calling the `whoami` method on `this.inner`.\n *\n * @returns {Promise<string>} A promise that resolves to the address of the current user.\n */\n getAddress: () => Promise<`0x${string}`> = SignerLogger.profiled(\n \"BaseAlchemySigner.getAddress\",\n async () => {\n const { address } = await this.inner.whoami();\n\n return address;\n },\n );\n\n /**\n * Signs a raw message after hashing it.\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 * const signature = await signer.signMessage(\"Hello, world!\");\n * ```\n *\n * @param {string} msg the message to be hashed and then signed\n * @returns {Promise<string>} a promise that resolves to the signed message\n */\n signMessage: (msg: SignableMessage) => Promise<`0x${string}`> =\n SignerLogger.profiled(\"BaseAlchemySigner.signMessage\", async (msg) => {\n const messageHash = hashMessage(msg);\n\n const result = await this.inner.signRawMessage(messageHash);\n\n SignerLogger.trackEvent({\n name: \"signer_sign_message\",\n });\n\n return result;\n });\n\n /**\n * Signs a typed message by first hashing it and then signing the hashed message using the `signRawMessage` method.\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 * const signature = await signer.signTypedData({\n * domain: {},\n * types: {},\n * primaryType: \"\",\n * message: {},\n * });\n * ```\n *\n * @param {TypedDataDefinition<TTypedData, TPrimaryType>} params The parameters for the typed message to be hashed and signed\n * @returns {Promise<any>} A promise that resolves to the signed message\n */\n signTypedData: <\n const TTypedData extends TypedData | Record<string, unknown>,\n TPrimaryType extends keyof TTypedData | \"EIP712Domain\" = keyof TTypedData,\n >(\n params: TypedDataDefinition<TTypedData, TPrimaryType>,\n ) => Promise<Hex> = SignerLogger.profiled(\n \"BaseAlchemySigner.signTypedData\",\n async (params) => {\n const messageHash = hashTypedData(params);\n\n return this.inner.signRawMessage(messageHash);\n },\n );\n\n /**\n * Serializes a transaction, signs it with a raw message, and then returns the serialized transaction with the signature.\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 * const tx = await signer.signTransaction({\n * to: \"0x1234\",\n * value: \"0x1234\",\n * data: \"0x1234\",\n * });\n * ```\n *\n * @param {Transaction} tx the transaction to be serialized and signed\n * @param {{serializer?: SerializeTransactionFn}} args options for serialization\n * @param {() => Hex} [args.serializer] an optional serializer function. If not provided, the default `serializeTransaction` function will be used\n * @returns {Promise<string>} a promise that resolves to the serialized transaction with the signature\n */\n signTransaction: <\n serializer extends\n SerializeTransactionFn<TransactionSerializable> = SerializeTransactionFn<TransactionSerializable>,\n transaction extends Parameters<serializer>[0] = Parameters<serializer>[0],\n >(\n transaction: transaction,\n options?:\n | {\n serializer?: serializer | undefined;\n }\n | undefined,\n ) => Promise<\n IsNarrowable<\n TransactionSerialized<GetTransactionType<transaction>>,\n Hex\n > extends true\n ? TransactionSerialized<GetTransactionType<transaction>>\n : Hex\n > = SignerLogger.profiled(\n \"BaseAlchemySigner.signTransaction\",\n async (tx, args) => {\n const serializeFn = args?.serializer ?? serializeTransaction;\n const serializedTx = serializeFn(tx);\n const signatureHex = await this.inner.signRawMessage(\n keccak256(await serializedTx),\n );\n\n const signature = unpackSignRawMessageBytes(signatureHex);\n\n return serializeFn(tx, signature);\n },\n );\n\n /**\n * Signs an EIP-7702 Authorization and then returns the authorization with the signature.\n *\n * @example\n * ```ts twoslash\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 * const tx = await signer.signAuthorization({\n * contractAddress: \"0x1234123412341234123412341234123412341234\",\n * chainId: 1,\n * nonce: 0,\n * });\n * ```\n *\n * @param {AuthorizationRequest<number>} unsignedAuthorization the authorization to be signed\n * @returns {Promise<SignedAuthorization<number>> | undefined} a promise that resolves to the authorization with the signature\n */\n signAuthorization: (\n unsignedAuthorization: AuthorizationRequest<number>,\n ) => Promise<SignedAuthorization<number>> = SignerLogger.profiled(\n \"BaseAlchemySigner.signAuthorization\",\n async (unsignedAuthorization) => {\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 /**\n * Gets the current MFA status\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 * const mfaStatus = signer.getMfaStatus();\n * if (mfaStatus === AlchemyMfaStatus.REQUIRED) {\n * // Handle MFA requirement\n * }\n * ```\n *\n * @returns {{ mfaRequired: boolean; mfaFactorId?: string }} The current MFA status\n */\n getMfaStatus = (): {\n mfaRequired: boolean;\n mfaFactorId?: string;\n } => {\n return this.store.getState().mfaStatus;\n };\n\n /**\n * Unauthenticated call to look up a user's organizationId by email\n *\n * @deprecated Use getUser({ type: \"email\", value: email }) instead\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 * const result = await signer.getUser(\"foo@mail.com\");\n * ```\n *\n * @param {string} email the email to lookup\n * @returns {Promise<{orgId: string}>} the organization id for the user if they exist\n */\n getUser(email: string): Promise<{ orgId: string } | null>;\n /**\n * Unauthenticated call to look up a user's organizationId by email or phone\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 * const result = await signer.getUser({ type: \"email\", value: \"foo@mail.com\" });\n * ```\n *\n * @param {string} email the email to lookup\n * @returns {Promise<{orgId: string}>} the organization id for the user if they exist\n */\n getUser(params: GetUserParams): Promise<{ orgId: string } | null>;\n /**\n * Unauthenticated call to look up a user's organizationId by email or phone\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 * const result = await signer.getUser({ type: \"email\", value: \"foo@mail.com\" });\n * ```\n *\n * @param {string | GetUserParams} params the params to look up\n * @returns {Promise<{orgId: string}>} the organization id for the user if they exist\n */\n getUser(params: string | GetUserParams): Promise<{ orgId: string } | null> {\n return SignerLogger.profiled(\n \"BaseAlchemySigner.getUser\",\n async (params: string | GetUserParams) => {\n const _params =\n typeof params === \"string\"\n ? { type: \"email\" as const, value: params }\n : params;\n\n const result =\n _params.type === \"email\"\n ? await this.inner.lookupUserByEmail(_params.value)\n : _params.type === \"phone\"\n ? await this.inner.lookupUserByPhone(_params.value)\n : assertNever(_params, \"unhandled get user params\");\n\n if (result?.orgId == null) {\n return null;\n }\n\n return {\n orgId: result.orgId,\n };\n },\n )(params);\n }\n\n /**\n * Sets the email for the authenticated user, allowing them to login with that\n * email.\n *\n * @deprecated You must contact Alchemy to enable this feature for your team,\n * as there are important security considerations. In particular, you must not\n * call this without first validating that the user owns this email account.\n * It is recommended to now use the email verification flow instead.\n *\n * @param {string} email The email to set for the user\n * @returns {Promise<string>} A promise that resolves to the updated email address\n * @throws {NotAuthenticatedError} If the user is not authenticated\n */\n setEmail(email: string): Promise<string>;\n\n /**\n * Uses a verification code to update a user's email, allowing them to login\n * with that email. `sendVerificationCode` should be called first to obtain\n * the code.\n *\n * @param {VerificationParams} params An object containing the verification code\n * @param {string} params.verificationCode The OTP verification code\n * @returns {Promise<string>} A promise that resolves to the updated email address\n * @throws {NotAuthenticatedError} If the user is not authenticated\n */\n setEmail(params: VerificationParams): Promise<string>;\n\n /**\n * Implementation for setEmail method.\n *\n * @param {string | VerificationParams} params An object containing the verificationCode (or simply an email for legacy usage)\n * @returns {Promise<void>} A promise that resolves when the email is set\n */\n async setEmail(params: string | VerificationParams): Promise<string> {\n return SignerLogger.profiled(\n \"BaseAlchemySigner.setEmail\",\n async (params: string | { verificationCode: string }) => {\n if (typeof params === \"string\") {\n // Deprecated usage for backwards compatibility.\n const email = params;\n return await this.inner.setEmail(email);\n }\n const { otpId } = this.store.getState();\n if (!otpId) {\n throw new Error(\"Missing OTP ID\");\n }\n return await this.inner.setEmail({\n id: otpId,\n code: params.verificationCode,\n });\n },\n )(params);\n }\n\n /**\n * Removes the email for the authenticated user, disallowing them from login with that email.\n *\n * @returns {Promise<void>} A promise that resolves when the email is removed\n * @throws {NotAuthenticatedError} If the user is not authenticated\n */\n removeEmail: () => Promise<void> = SignerLogger.profiled(\n \"BaseAlchemySigner.removeEmail\",\n async () => {\n await this.inner.removeEmail();\n },\n );\n\n /**\n * Sets the phone number for the authenticated user, allowing them to login with that\n * phone number. `sendVerificationCode` should be called first to obtain the code.\n *\n * @param {VerificationParams} params An object containing the verification code\n * @param {string} params.verificationCode The OTP verification code\n * @returns {Promise<void>} A promise that resolves when the phone number is set\n * @throws {NotAuthenticatedError} If the user is not authenticated\n */\n setPhoneNumber: (params: VerificationParams) => Promise<void> =\n SignerLogger.profiled(\n \"BaseAlchemySigner.setPhoneNumber\",\n async ({ verificationCode }) => {\n const { otpId } = this.store.getState();\n if (!otpId) {\n throw new Error(\"Missing OTP ID\");\n }\n await this.inner.setPhoneNumber({\n id: otpId,\n code: verificationCode,\n });\n },\n );\n\n /**\n * Removes the phone number for the authenticated user, disallowing them from login with that phone number.\n *\n * @returns {Promise<void>} A promise that resolves when the phone number is removed\n * @throws {NotAuthenticatedError} If the user is not authenticated\n */\n removePhoneNumber: () => Promise<void> = SignerLogger.profiled(\n \"BaseAlchemySigner.removePhoneNumber\",\n async () => {\n await this.inner.removePhoneNumber();\n },\n );\n\n /**\n * Initiates an OTP (One-Time Password) verification process for a user contact.\n * Use this method before calling `setEmail` with verification code to verify ownership of the email address.\n *\n * @param {\"email\" | \"sms\"} type The type of OTP to send, either \"email\" or \"sms\"\n * @param {string} contact The email address or phone number to send the OTP to\n * @returns {Promise<{ otpId: string }>} A promise that resolves to an object containing the OTP ID\n * @throws {NotAuthenticatedError} If the user is not authenticated\n */\n sendVerificationCode: (\n type: \"email\" | \"sms\",\n contact: string,\n ) => Promise<{ otpId: string }> = SignerLogger.profiled(\n \"BaseAlchemySigner.sendVerificationCode\",\n async (type, contact) => {\n const { otpId } = await this.inner.initOtp(type, contact);\n this.store.setState({ otpId });\n return { otpId };\n },\n );\n\n /**\n * Adds a passkey to the user's account\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 * const result = await signer.addPasskey()\n * ```\n *\n * @param {CredentialCreationOptions | undefined} params optional parameters for the passkey creation\n * @returns {Promise<string[]>} an array of the authenticator ids added to the user\n */\n addPasskey: (params?: CredentialCreationOptions) => Promise<string[]> =\n SignerLogger.profiled(\"BaseAlchemySigner.addPasskey\", async (params) => {\n return this.inner.addPasskey(params ?? {});\n });\n\n /**\n * Removes a passkey from a user's account\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 * const authMethods = await signer.listAuthMethods();\n * const passkey = authMethods.passkeys[0];\n *\n * const result = await signer.removePasskey(passkey.authenticatorId);\n * ```\n *\n * @param {CredentialCreationOptions | undefined} params optional parameters for the passkey creation\n * @returns {Promise<string[]>} an array of the authenticator ids added to the user\n */\n removePasskey: (authenticatorId: string) => Promise<void> =\n SignerLogger.profiled(\n \"BaseAlchemySigner.removePasskey\",\n async (authenticatorId) => {\n return this.inner.removePasskey(authenticatorId);\n },\n );\n\n getPasskeyStatus: () => Promise<{ isPasskeyAdded: boolean }> =\n SignerLogger.profiled(\"BaseAlchemySigner.getPasskeyStatus\", async () => {\n return this.inner.getPasskeyStatus();\n });\n\n /**\n * Used to export the wallet for a given user\n * If the user is authenticated with an Email, this will return a seed phrase\n * If the user is authenticated with a Passkey, this will return a private key\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 * // the params passed to this are different based on the specific signer\n * const result = signer.exportWallet()\n * ```\n *\n * @param {unknown} params exportWallet parameters\n * @returns {Promise<unknown>} the result of the wallet export operation\n */\n exportWallet: TClient[\"exportWallet\"] = async (params) => {\n return this.inner.exportWallet(params);\n };\n\n /**\n * Exports a private key for a given account encrypted with the provided public key\n *\n * @param {ExportPrivateKeyParams} opts the parameters for the export\n * @returns {Promise<string>} the private key\n */\n exportPrivateKeyEncrypted: TClient[\"exportPrivateKeyEncrypted\"] = (opts) => {\n return this.inner.exportPrivateKeyEncrypted(opts);\n };\n\n /**\n * This method lets you adapt your AlchemySigner to a viem LocalAccount, which\n * will let you use the signer as an EOA directly.\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 * const account = signer.toViemAccount();\n * ```\n *\n * @throws if your signer is not authenticated\n * @returns {LocalAccount} a LocalAccount object that can be used with viem's wallet client\n */\n toViemAccount = (): LocalAccount => {\n // if we want this method to be synchronous, then we need to do this check here\n // otherwise we can use the sessionManager to get the user\n if (!this.inner.getUser()) {\n throw new NotAuthenticatedError();\n }\n\n return toAccount({\n address: this.inner.getUser()!.address,\n signMessage: (msg) => this.signMessage(msg.message),\n signTypedData: <\n const typedData extends TypedData | Record<string, unknown>,\n primaryType extends keyof typedData | \"EIP712Domain\" = keyof typedData,\n >(\n typedDataDefinition: TypedDataDefinition<typedData, primaryType>,\n ) => this.signTypedData<typedData, primaryType>(typedDataDefinition),\n signTransaction: this.signTransaction,\n });\n };\n\n /**\n * Creates a new instance of `SolanaSigner` using the provided inner value.\n * This requires the signer to be authenticated first\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 * const solanaSigner = signer.toSolanaSigner();\n * ```\n *\n * @returns {SolanaSigner} A new instance of `SolanaSigner`\n */\n toSolanaSigner = (): SolanaSigner => {\n if (!this.inner.getUser()) {\n throw new NotAuthenticatedError();\n }\n\n return new SolanaSigner(this.inner);\n };\n\n private authenticateWithEmail = async (\n params: Extract<AuthParams, { type: \"email\" }>,\n ): Promise<User> => {\n if (\"bundle\" in params) {\n return this.completeEmailAuth(params);\n }\n\n const { orgId, otpId, isNewUser } = await this.initOrCreateEmailUser(\n params.email,\n params.emailMode,\n params.multiFactors,\n params.redirectParams,\n );\n\n this.setAwaitingEmailAuth({ orgId, otpId, isNewUser });\n\n // Clear the auth linking status if the email has changed. This would mean\n // that the previously initiated social login is not associated with the\n // email which is now being used to login.\n const { authLinkingStatus } = this.store.getState();\n if (authLinkingStatus && authLinkingStatus.email !== params.email) {\n this.store.setState({ authLinkingStatus: undefined });\n }\n\n // We wait for the session manager to emit a connected event if\n // cross tab sessions are permitted\n return this.waitForConnected();\n };\n\n private authenticateWithSms = async (\n params: Extract<AuthParams, { type: \"sms\" }>,\n ): Promise<User> => {\n const { orgId, otpId, isNewUser } = await this.initOrCreateSmsUser(\n params.phone,\n );\n\n this.setAwaitingSmsAuth({ orgId, otpId, isNewUser });\n\n // TODO: add phone auth linking\n // // Clear the auth linking status if the email has changed. This would mean\n // // that the previously initiated social login is not associated with the\n // // email which is now being used to login.\n // const { authLinkingStatus } = this.store.getState();\n // if (authLinkingStatus && authLinkingStatus.email !== params.email) {\n // this.store.setState({ authLinkingStatus: undefined });\n // }\n\n // We wait for the session manager to emit a connected event if\n // cross tab sessions are permitted\n return this.waitForConnected();\n };\n\n private authenticateWithPasskey = async (\n args: Extract<AuthParams, { type: \"passkey\" }>,\n ): Promise<User> => {\n let user: User;\n const shouldCreateNew = async () => {\n if (\"email\" in args) {\n const existingUser = await this.getUser({\n type: \"email\",\n value: args.email,\n });\n return existingUser == null;\n }\n\n return args.createNew;\n };\n\n if (await shouldCreateNew()) {\n const result = await this.inner.createAccount(\n args as Extract<\n AuthParams,\n { type: \"passkey\" } & ({ email: string } | { createNew: true })\n >,\n );\n // account creation for passkeys returns the whoami response so we don't have to\n // call it again after signup\n user = {\n address: result.address!,\n userId: result.userId!,\n orgId: result.orgId,\n };\n } else {\n user = await this.inner.lookupUserWithPasskey();\n if (!user) {\n this.store.setState({\n status: AlchemySignerStatus.DISCONNECTED,\n });\n throw new Error(\"No user found\");\n }\n }\n\n return user;\n };\n\n private authenticateWithOauth = async (\n args: Extract<AuthParams, { type: \"oauth\" }>,\n ): Promise<User> => {\n this.store.setState({ authLinkingStatus: undefined });\n const params: OauthParams = {\n ...args,\n expirationSeconds: this.getExpirationSeconds(),\n };\n if (params.mode === \"redirect\") {\n const user = await this.inner.oauthWithRedirect(params);\n if (!isUser(user)) {\n throw new Error(\"Expected user from oauth with redirect\");\n }\n return user;\n }\n const result = await this.inner.oauthWithPopup(params);\n if (isIdTokenOnly(result)) {\n throw new Error(\n \"Should not get only id token when authenticating with oauth\",\n );\n }\n if (!isAuthLinkingPrompt(result)) {\n return result;\n }\n this.setAuthLinkingPrompt(result);\n return this.waitForConnected();\n };\n\n /**\n * Handles OAuth authentication by augmenting the provided arguments with a type and performing authentication based on the OAuth mode (either using redirect or popup).\n *\n * @param {Omit<Extract<AuthParams, { type: \"oauth\" }>, \"type\">} args Authentication parameters omitting the type, which will be set to \"oauth\"\n * @returns {Promise<OauthProviderInfo>} A promise that resolves to an `OauthProviderInfo` object containing provider information and the ID token.\n */\n public addOauthProvider = async (\n args: Omit<Extract<AuthParams, { type: \"oauth\" }>, \"type\">,\n ): Promise<OauthProviderInfo> => {\n // This cast is required to suppress a spurious type error. We're just\n // putting the omitted field back in, but TypeScript doesn't recognize that.\n const argsWithType = { type: \"oauth\", ...args } as Extract<\n AuthParams,\n { type: \"oauth\" }\n >;\n const params: OauthParams = {\n ...argsWithType,\n fetchIdTokenOnly: true,\n };\n const result = await (params.mode === \"redirect\"\n ? this.inner.oauthWithRedirect(params)\n : this.inner.oauthWithPopup(params));\n if (!isIdTokenOnly(result)) {\n throw new Error(\"Expected id token only from oauth response\");\n }\n return await this.inner.addOauthProvider({\n providerName: result.providerName,\n oidcToken: result.idToken,\n });\n };\n\n /**\n * Removes an OAuth provider by its ID if the user is authenticated.\n *\n * @param {string} providerId The ID of the OAuth provider to be removed, as obtained from `listOauthProviders`\n * @returns {Promise<any>} A promise indicating the result of the removal process\n * @throws {NotAuthenticatedError} Thrown if the user is not authenticated\n */\n public removeOauthProvider = async (providerId: string) => {\n if (!this.inner.getUser()) {\n throw new NotAuthenticatedError();\n }\n return this.inner.removeOauthProvider(providerId);\n };\n\n /**\n * Retrieves a list of auth methods associated with the authenticated user.\n *\n * @returns {Promise<AuthMethods>} A promise that resolves to an `AuthMethods` object containing the user's email, OAuth providers, and passkeys.\n * @throws {NotAuthenticatedError} Thrown if the user is not authenticated\n */\n public listAuthMethods = async (): Promise<AuthMethods> => {\n if (!this.inner.getUser()) {\n throw new NotAuthenticatedError();\n }\n return this.inner.listAuthMethods();\n };\n\n private authenticateWithJwt = async (\n args: Extract<AuthParams, { type: \"custom-jwt\" }>,\n ): Promise<User> => {\n const { credentialBundle, orgId, isSignUp } = await this.inner.submitJwt({\n jwt: args.jwt,\n authProvider: args.authProviderId,\n expirationSeconds: this.getExpirationSeconds(),\n });\n\n const user = await this.inner.completeAuthWithBundle({\n bundle: credentialBundle,\n orgId: orgId,\n connectedEventName: \"connectedJwt\",\n authenticatingType: \"custom-jwt\",\n });\n\n this.emitNewUserEvent(isSignUp);\n return user;\n };\n\n private authenticateWithOtp = async (\n args: Extract<AuthParams, { type: \"otp\" }>,\n ): Promise<User> => {\n const tempSession = this.sessionManager.getTemporarySession();\n const { orgId, isNewUser } = tempSession ?? {};\n const { otpId } = this.store.getState();\n if (!orgId) {\n throw new Error(\"orgId not found in session\");\n }\n if (!otpId) {\n throw new Error(\"otpId not found in session\");\n }\n\n const response = await this.inner.submitOtpCode({\n orgId,\n otpId,\n otpCode: args.otpCode,\n expirationSeconds: this.getExpirationSeconds(),\n multiFactors: args.multiFactors,\n });\n\n if (response.mfaRequired) {\n this.handleMfaRequired(response.encryptedPayload, response.multiFactors);\n return this.waitForConnected();\n }\n\n const user = await this.inner.completeAuthWithBundle({\n bundle: response.bundle,\n orgId,\n connectedEventName: \"connectedOtp\",\n authenticatingType: \"otp\",\n });\n\n this.emitNewUserEvent(isNewUser);\n if (tempSession) {\n this.sessionManager.setTemporarySession({\n ...tempSession,\n isNewUser: false,\n });\n }\n\n const { authLinkingStatus } = this.store.getState();\n if (authLinkingStatus) {\n (async () => {\n this.inner.addOauthProvider({\n providerName: authLinkingStatus.providerName,\n oidcToken: authLinkingStatus.idToken,\n });\n })();\n }\n\n return user;\n };\n\n private setAwaitingEmailAuth = ({\n orgId,\n otpId,\n isNewUser,\n }: {\n orgId: string;\n otpId?: string;\n isNewUser?: boolean;\n }): void => {\n this.sessionManager.setTemporarySession({\n orgId,\n isNewUser,\n });\n this.store.setState({\n status: AlchemySignerStatus.AWAITING_EMAIL_AUTH,\n otpId,\n error: null,\n });\n };\n\n private setAwaitingSmsAuth = ({\n orgId,\n otpId,\n isNewUser,\n }: {\n orgId: string;\n otpId?: string;\n isNewUser?: boolean;\n }): void => {\n this.sessionManager.setTemporarySession({\n orgId,\n isNewUser,\n });\n this.store.setState({\n status: AlchemySignerStatus.AWAITING_SMS_AUTH,\n otpId,\n error: null,\n });\n };\n\n private handleOauthReturn = ({\n bundle,\n orgId,\n idToken,\n accessToken,\n isNewUser,\n }: Extract<AuthParams, { type: \"oauthReturn\" }>): Promise<User> => {\n const user = this.inner.completeAuthWithBundle({\n bundle,\n orgId,\n connectedEventName: \"connectedOauth\",\n authenticatingType: \"oauth\",\n idToken,\n accessToken,\n });\n\n this.emitNewUserEvent(isNewUser);\n\n return user;\n };\n\n private handleMfaRequired(\n encryptedPayload: string,\n multiFactors: MfaFactor[],\n ) {\n // Store complete MFA context in the temporary session\n const tempSession = this.sessionManager.getTemporarySession();\n if (tempSession) {\n this.sessionManager.setTemporarySession({\n ...tempSession,\n encryptedPayload,\n mfaFactorId: multiFactors?.[0]?.multiFactorId,\n });\n }\n\n // Keep minimal state in the store for UI updates\n this.store.setState({\n status: AlchemySignerStatus.AWAITING_MFA_AUTH,\n error: null,\n mfaStatus: {\n mfaRequired: true,\n mfaFactorId: multiFactors?.[0]?.multiFactorId,\n },\n });\n }\n\n private getExpirationSeconds = () =>\n Math.floor(this.sessionManager.expirationTimeMs / 1000);\n\n private registerListeners = () => {\n // Declare listeners in an object to typecheck that every event type is\n // handled.\n const listeners: SessionManagerEvents = {\n connected: (session) => {\n this.store.setState({\n user: session.user,\n status: AlchemySignerStatus.CONNECTED,\n error: null,\n });\n },\n disconnected: () => {\n this.store.setState({\n user: null,\n status: AlchemySignerStatus.DISCONNECTED,\n });\n },\n initialized: () => {\n this.store.setState((state) => ({\n status: state.user\n ? AlchemySignerStatus.CONNECTED\n : AlchemySignerStatus.DISCONNECTED,\n ...(state.user ? { error: null } : undefined),\n }));\n },\n };\n\n for (const [event, listener] of Object.entries(listeners)) {\n this.sessionManager.on(event as keyof SessionManagerEvents, listener);\n }\n\n this.inner.on(\"authenticating\", ({ type }) => {\n const status = (() => {\n switch (type) {\n case \"email\":\n return AlchemySignerStatus.AUTHENTICATING_EMAIL;\n case \"passkey\":\n return AlchemySignerStatus.AUTHENTICATING_PASSKEY;\n case \"oauth\":\n return AlchemySignerStatus.AUTHENTICATING_OAUTH;\n case \"otp\":\n case \"otpVerify\":\n return AlchemySignerStatus.AWAITING_OTP_AUTH;\n case \"sms\":\n return AlchemySignerStatus.AWAITING_SMS_AUTH;\n case \"custom-jwt\":\n return AlchemySignerStatus.AUTHENTICATING_JWT;\n default:\n assertNever(type, \"unhandled authenticating type\");\n }\n })();\n\n // trigger new user event on signer from client\n this.inner.on(\"newUserSignup\", () => {\n this.emitNewUserEvent(true);\n });\n\n this.store.setState({\n status,\n error: null,\n });\n });\n };\n\n private emitNewUserEvent = (isNewUser?: boolean) => {\n // assumes that if isNewUser is undefined it is a returning user\n if (isNewUser) this.store.setState({ isNewUser });\n };\n\n private async initOrCreateEmailUser(\n email: string,\n emailMode?: EmailType,\n multiFactors?: VerifyMfaParams[],\n redirectParams?: URLSearchParams,\n ): Promise<{\n orgId: string;\n otpId?: string;\n isNewUser: boolean;\n }> {\n const existingUser = await this.getUser(email);\n const expirationSeconds = this.getExpirationSeconds();\n\n if (existingUser) {\n const { orgId, otpId } = await this.inner.initEmailAuth({\n email: email,\n emailMode: emailMode,\n expirationSeconds,\n redirectParams: redirectParams,\n multiFactors,\n });\n return {\n orgId,\n otpId,\n isNewUser: false,\n };\n }\n\n const { orgId, otpId } = await this.inner.createAccount({\n type: \"email\",\n email,\n emailMode,\n expirationSeconds,\n redirectParams,\n });\n return {\n orgId,\n otpId,\n isNewUser: true,\n };\n }\n\n private async initOrCreateSmsUser(phone: string): Promise<{\n orgId: string;\n otpId?: string;\n isNewUser: boolean;\n }> {\n const existingUser = await this.getUser({ type: \"phone\", value: phone });\n\n if (existingUser) {\n const { orgId, otpId } = await this.inner.initSmsAuth({\n phone,\n });\n return {\n orgId,\n otpId,\n isNewUser: false,\n };\n }\n\n const { orgId, otpId } = await this.inner.createAccount({\n type: \"sms\",\n phone,\n });\n return {\n orgId,\n otpId,\n isNewUser: true,\n };\n }\n\n private async completeEmailAuth(\n params: Extract<AuthParams, { type: \"email\"; bundle: string }>,\n ): Promise<User> {\n const temporarySession = params.orgId\n ? { orgId: params.orgId }\n : this.sessionManager.getTemporarySession();\n\n if (!temporarySession) {\n this.store.setState({ status: AlchemySignerStatus.DISCONNECTED });\n throw new Error(\"Could not find email auth init session!\");\n }\n\n const user = await this.inner.completeAuthWithBundle({\n bundle: params.bundle,\n orgId: temporarySession.orgId,\n connectedEventName: \"connectedEmail\",\n authenticatingType: \"email\",\n });\n\n // fire new user event\n this.emitNewUserEvent(params.isNewUser);\n\n return user;\n }\n\n /**\n * Retrieves the list of MFA factors configured for the current user.\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 * const { multiFactors } = await signer.getMfaFactors();\n * ```\n *\n * @throws {NotAuthenticatedError} If no user is authenticated\n * @returns {Promise<{ multiFactors: Array<MfaFactor> }>} A promise that resolves to an array of configured MFA factors\n */\n getMfaFactors: () => Promise<{ multiFactors: MfaFactor[] }> =\n SignerLogger.profiled(\"BaseAlchemySigner.getMfaFactors\", async () => {\n return this.inner.getMfaFactors();\n });\n\n /**\n * Initiates the setup of a new MFA factor for the current user.\n * The factor will need to be verified using verifyMfa before it becomes active.\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 * const result = await signer.addMfa({ multiFactorType: \"totp\" });\n * // Result contains multiFactorTotpUrl to display as QR code\n * ```\n *\n * @param {AddMfaParams} params The parameters required to enable a new MFA factor\n * @throws {NotAuthenticatedError} If no user is authenticated\n * @returns {Promise<AddMfaResult>} A promise that resolves to the factor setup information\n */\n addMfa: (params: AddMfaParams) => Promise<AddMfaResult> =\n SignerLogger.profiled(\"BaseAlchemySigner.addMfa\", async (params) => {\n return this.inner.addMfa(params);\n });\n\n /**\n * Verifies a newly created MFA factor to complete the setup process.\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 * const result = await signer.verifyMfa({\n * multiFactorId: \"factor-id\",\n * multiFactorCode: \"123456\" // 6-digit code from authenticator app\n * });\n * ```\n *\n * @param {VerifyMfaParams} params The parameters required to verify the MFA factor\n * @throws {NotAuthenticatedError} If no user is authenticated\n * @returns {Promise<{ multiFactors: MfaFactor[] }>} A promise that resolves to the updated list of MFA factors\n */\n verifyMfa: (\n params: VerifyMfaParams,\n ) => Promise<{ multiFactors: MfaFactor[] }> = SignerLogger.profiled(\n \"BaseAlchemySigner.verifyMfa\",\n async (params) => {\n return this.inner.verifyMfa(params);\n },\n );\n\n /**\n * Removes existing MFA factors by their IDs.\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 * const result = await signer.removeMfa({\n * multiFactorIds: [\"factor-id-1\", \"factor-id-2\"]\n * });\n * ```\n *\n * @param {RemoveMfaParams} params The parameters specifying which factors to disable\n * @throws {NotAuthenticatedError} If no user is authenticated\n * @returns {Promise<{ multiFactors: MfaFactor[] }>} A promise that resolves to the updated list of MFA factors\n */\n removeMfa: (\n params: RemoveMfaParams,\n ) => Promise<{ multiFactors: MfaFactor[] }> = SignerLogger.profiled(\n \"BaseAlchemySigner.removeMfa\",\n async (params) => {\n return this.inner.removeMfa(params);\n },\n );\n\n /**\n * Validates MFA factors that were required during authentication.\n * This function should be called after MFA is required and the user has provided their MFA code.\n * It completes the authentication process by validating the MFA factors and completing the auth bundle.\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 * // After MFA is required and user provides code\n * const user = await signer.validateMultiFactors({\n * multiFactorCode: \"123456\", // 6-digit code from authenticator app\n * multiFactorId: \"factor-id\"\n * });\n * ```\n *\n * @param {ValidateMultiFactorsArgs} params - Parameters for validating MFA factors\n * @throws {Error} If there is no pending MFA context or if orgId is not found\n * @returns {Promise<User>} A promise that resolves to the authenticated user\n */\n public async validateMultiFactors(\n params: ValidateMultiFactorsArgs,\n ): Promise<User> {\n // Get MFA context from temporary session\n const tempSession = this.sessionManager.getTemporarySession();\n if (\n !tempSession?.orgId ||\n !tempSession.encryptedPayload ||\n !tempSession.mfaFactorId\n ) {\n throw new Error(\n \"No pending MFA context found. Call submitOtpCode() first.\",\n );\n }\n\n if (\n params.multiFactorId &&\n tempSession.mfaFactorId !== params.multiFactorId\n ) {\n throw new Error(\"MFA factor ID mismatch\");\n }\n\n // Call the low-level client\n const { bundle } = await this.inner.validateMultiFactors({\n encryptedPayload: tempSession.encryptedPayload,\n multiFactors: [\n {\n multiFactorId: tempSession.mfaFactorId,\n multiFactorCode: params.multiFactorCode,\n },\n ],\n });\n\n // Complete the authentication\n const user = await this.inner.completeAuthWithBundle({\n bundle,\n orgId: tempSession.orgId,\n connectedEventName: \"connectedOtp\",\n authenticatingType: \"otp\",\n });\n\n // Remove MFA data from temporary session\n this.sessionManager.setTemporarySession({\n ...tempSession,\n encryptedPayload: undefined,\n mfaFactorId: undefined,\n });\n\n // Update UI state\n this.store.setState({\n mfaStatus: {\n mfaRequired: false,\n mfaFactorId: undefined,\n },\n });\n\n return user;\n }\n\n protected initConfig = async (): Promise<SignerConfig> => {\n this.config = this.fetchConfig();\n return this.config;\n };\n\n /**\n * Returns the signer configuration while fetching it if it's not already initialized.\n *\n * @returns {Promise<SignerConfig>} A promise that resolves to the signer configuration\n */\n public getConfig = async (): Promise<SignerConfig> => {\n if (!this.config) {\n return this.initConfig();\n }\n\n return this.config;\n };\n\n protected fetchConfig = async (): Promise<SignerConfig> => {\n return this.inner.request(\"/v1/signer-config\", {});\n };\n\n private setAuthLinkingPrompt = (prompt: AuthLinkingPrompt) => {\n this.setAwaitingEmailAuth({\n orgId: prompt.orgId,\n otpId: prompt.otpId,\n isNewUser: false,\n });\n this.store.setState({\n authLinkingStatus: {\n email: prompt.email,\n providerName: prompt.providerName,\n idToken: prompt.idToken,\n accessToken: prompt.accessToken,\n },\n });\n };\n\n private waitForConnected = (): Promise<User> => {\n return new Promise<User>((resolve) => {\n const removeListener = this.sessionManager.on(\"connected\", (session) => {\n resolve(session.user);\n removeListener();\n });\n });\n };\n}\n\nfunction toErrorInfo(error: unknown): ErrorInfo {\n return error instanceof Error\n ? { name: error.name, message: error.message }\n : { name: \"Error\", message: \"Unknown error\" };\n}\n\n// eslint-disable-next-line jsdoc/require-param, jsdoc/require-returns\n/**\n * Zustand's `fireImmediately` option calls the listener before\n * `store.subscribe` has returned, which breaks listeners which call\n * unsubscribe, e.g.\n *\n * ```ts\n * const unsubscribe = store.subscribe(\n * selector,\n * (update) => {\n * handleUpdate(update);\n * unsubscribe();\n * },\n * { fireImmediately: true },\n * )\n * ```\n *\n * since `unsubscribe` is still undefined at the time the listener is called. To\n * prevent this, if the listener triggers before `subscribe` has returned, delay\n * the callback to a later run of the event loop.\n */\nfunction subscribeWithDelayedFireImmediately<T>(\n store: InternalStore,\n selector: (state: AlchemySignerStore) => T,\n listener: (selectedState: T, previousSelectedState: T) => void,\n): () => void {\n // Until this function has returned, maintain a queue of events that will be\n // processed once it does.\n const queue: [selectedState: T, previousSelectedState: T][] = [];\n let queueHasEmptied = false;\n let hasUnsubscribed = false;\n\n function drainQueue() {\n // Note that this handles the case where more events are added to the queue\n // during the handling of previous events.\n for (let i = 0; i < queue.length && !hasUnsubscribed; i++) {\n const args = queue[i];\n listener(...args);\n }\n queueHasEmptied = true;\n }\n\n // Schedule the queue to be drained after this function has returned.\n setTimeout(drainQueue, 0);\n\n const unsubscribe = store.subscribe(\n selector,\n (...args) => {\n if (queueHasEmptied) {\n listener(...args);\n } else {\n queue.push(args);\n }\n },\n { fireImmediately: true },\n );\n\n return () => {\n hasUnsubscribed = true;\n unsubscribe();\n };\n}\n\nfunction isUser(\n result: User | AuthLinkingPrompt | IdTokenOnly,\n): result is User {\n return !isAuthLinkingPrompt(result) && !isIdTokenOnly(result);\n}\n\nfunction isAuthLinkingPrompt(result: unknown): result is AuthLinkingPrompt {\n return (\n (result as AuthLinkingPrompt)?.status ===\n \"ACCOUNT_LINKING_CONFIRMATION_REQUIRED\"\n );\n}\n\nfunction isIdTokenOnly(result: unknown): result is IdTokenOnly {\n return (result as IdTokenOnly)?.status === \"FETCHED_ID_TOKEN_ONLY\";\n}\n"]}
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.83.
|
|
1
|
+
export declare const VERSION = "4.83.2";
|
package/dist/esm/version.js
CHANGED
package/dist/esm/version.js.map
CHANGED
|
@@ -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.83.
|
|
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.83.2\";\n"]}
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "4.83.
|
|
1
|
+
export declare const VERSION = "4.83.2";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@account-kit/signer",
|
|
3
|
-
"version": "4.83.
|
|
3
|
+
"version": "4.83.2",
|
|
4
4
|
"description": "Core interfaces and clients for interfacing with the Alchemy Signer API",
|
|
5
5
|
"author": "Alchemy",
|
|
6
6
|
"license": "MIT",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"typescript-template": "*"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@aa-sdk/core": "^4.83.
|
|
51
|
-
"@account-kit/logging": "^4.83.
|
|
50
|
+
"@aa-sdk/core": "^4.83.2",
|
|
51
|
+
"@account-kit/logging": "^4.83.2",
|
|
52
52
|
"@noble/curves": "^1.9.2",
|
|
53
53
|
"@noble/hashes": "1.7.1",
|
|
54
54
|
"@noble/secp256k1": "^2.3.0",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"zustand": "^5.0.0-rc.2"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"viem": "^2.
|
|
66
|
+
"viem": "^2.45.0"
|
|
67
67
|
},
|
|
68
68
|
"publishConfig": {
|
|
69
69
|
"access": "public",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"url": "https://github.com/alchemyplatform/aa-sdk/issues"
|
|
78
78
|
},
|
|
79
79
|
"homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "fe3be8b21c170c84542f44381a20c51eb87a73f9"
|
|
81
81
|
}
|
package/src/base.ts
CHANGED
|
@@ -633,7 +633,7 @@ export abstract class BaseAlchemySigner<TClient extends BaseSignerClient>
|
|
|
633
633
|
const serializeFn = args?.serializer ?? serializeTransaction;
|
|
634
634
|
const serializedTx = serializeFn(tx);
|
|
635
635
|
const signatureHex = await this.inner.signRawMessage(
|
|
636
|
-
keccak256(serializedTx),
|
|
636
|
+
keccak256(await serializedTx),
|
|
637
637
|
);
|
|
638
638
|
|
|
639
639
|
const signature = unpackSignRawMessageBytes(signatureHex);
|
package/src/version.ts
CHANGED