BaseAlchemySigner
Defined in: account-kit/signer/src/base.ts:119
Base abstract class for Alchemy Signer, providing authentication and session management for smart accounts.
Implements the SmartAccountAuthenticator
interface and handles various signer events.
Extended by
Type Parameters
Implements
SmartAccountAuthenticator
<AuthParams
,User
,TClient
>
Constructors
Constructor
Defined in: account-kit/signer/src/base.ts:138
Initializes an instance with the provided client and session configuration. This function sets up the internal store, initializes the session manager, registers listeners and initializes the session manager to manage session state.
Parameters
Returns
BaseAlchemySigner
<TClient
>
Properties
Methods
addOauthProvider()
Defined in: account-kit/signer/src/base.ts:1260
Handles OAuth authentication by augmenting the provided arguments with a type and performing authentication based on the OAuth mode (either using redirect or popup).
Parameters
Returns
Promise
<OauthProviderInfo
>
A promise that resolves to an OauthProviderInfo
object containing provider information and the ID token.
fetchConfig()
Defined in: account-kit/signer/src/base.ts:1882
Returns
Promise
<SignerConfig
>
getAuthDetails()
Defined in: account-kit/signer/src/base.ts:479
Gets the current logged in user If a user has an ongoing session, it will use that session and try to authenticate
Example
Returns
Promise
<User
>
the current user
Throws
if there is no user logged in
Implementation of
getConfig()
Defined in: account-kit/signer/src/base.ts:1874
Returns the signer configuration while fetching it if it’s not already initialized.
Returns
Promise
<SignerConfig
>
A promise that resolves to the signer configuration
getMfaStatus()
Defined in: account-kit/signer/src/base.ts:719
Gets the current MFA status
Example
Returns
object
The current MFA status
getUser()
Unauthenticated call to look up a user’s organizationId by email or phone
Example
Param
the params to look up
Call Signature
Defined in: account-kit/signer/src/base.ts:752
Unauthenticated call to look up a user’s organizationId by email
Deprecated
Use getUser({ type: “email”, value: email }) instead
Example
Parameters
Returns
Promise
<
| null
| {
orgId
: string
;
}>
the organization id for the user if they exist
Call Signature
Defined in: account-kit/signer/src/base.ts:777
Unauthenticated call to look up a user’s organizationId by email or phone
Example
Parameters
Returns
Promise
<
| null
| {
orgId
: string
;
}>
the organization id for the user if they exist
initConfig()
Defined in: account-kit/signer/src/base.ts:1864
Returns
Promise
<SignerConfig
>
listAuthMethods()
Defined in: account-kit/signer/src/base.ts:1305
Retrieves a list of auth methods associated with the authenticated user.
Returns
Promise
<AuthMethods
>
A promise that resolves to an AuthMethods
object containing the user’s email, OAuth providers, and passkeys.
Throws
Thrown if the user is not authenticated
on()
Defined in: account-kit/signer/src/base.ts:183
Allows you to subscribe to events emitted by the signer
Type Parameters
Parameters
Returns
a function to remove the listener
Returns
void
preparePopupOauth()
Defined in: account-kit/signer/src/base.ts:285
Prepares the config needed to use popup-based OAuth login. This must be
called before calling .authenticate
with params { type: "oauth", mode: "popup" }
, and is recommended to be called on page load.
This method exists because browsers may prevent popups from opening unless triggered by user interaction, and so the OAuth config must already have been fetched at the time a user clicks a social login button.
Example
Returns
Promise
<OauthConfig
>
the config which must be loaded before using popup-based OAuth
removeOauthProvider()
Defined in: account-kit/signer/src/base.ts:1292
Removes an OAuth provider by its ID if the user is authenticated.
Parameters
Returns
Promise
<any
>
A promise indicating the result of the removal process
Throws
Thrown if the user is not authenticated
setEmail()
Implementation for setEmail method.
Param
An object containing the verificationCode (or simply an email for legacy usage)
Call Signature
Defined in: account-kit/signer/src/base.ts:842
Sets the email for the authenticated user, allowing them to login with that email.
Deprecated
You must contact Alchemy to enable this feature for your team, as there are important security considerations. In particular, you must not call this without first validating that the user owns this email account. It is recommended to now use the email verification flow instead.
Parameters
Returns
Promise
<string
>
A promise that resolves to the updated email address
Throws
If the user is not authenticated
Call Signature
Defined in: account-kit/signer/src/base.ts:854
Uses a verification code to update a user’s email, allowing them to login
with that email. sendVerificationCode
should be called first to obtain
the code.
Parameters
Returns
Promise
<string
>
A promise that resolves to the updated email address
Throws
If the user is not authenticated
toSolanaSigner()
Defined in: account-kit/signer/src/base.ts:1123
Creates a new instance of SolanaSigner
using the provided inner value.
This requires the signer to be authenticated first
Example
Returns
A new instance of SolanaSigner
toViemAccount()
Defined in: account-kit/signer/src/base.ts:1079
This method lets you adapt your AlchemySigner to a viem LocalAccount, which will let you use the signer as an EOA directly.
Example
Returns
object
a LocalAccount object that can be used with viem’s wallet client
Throws
if your signer is not authenticated
validateMultiFactors()
Defined in: account-kit/signer/src/base.ts:1805
Validates MFA factors that were required during authentication. This function should be called after MFA is required and the user has provided their MFA code. It completes the authentication process by validating the MFA factors and completing the auth bundle.
Example
Parameters
Returns
Promise
<User
>
A promise that resolves to the authenticated user
Throws
If there is no pending MFA context or if orgId is not found