Defined in: account-kit/signer/src/client/base.ts:111
Base class for all Alchemy Signer clients
| Type Parameter | Default type |
|---|---|
|
|
|
|
new BaseSignerClient<TExportWalletParams, TExportWalletOutput>(params): BaseSignerClient<TExportWalletParams, TExportWalletOutput>;Defined in: account-kit/signer/src/client/base.ts:126
Create a new instance of the Alchemy Signer client
Parameters
| Parameter | Type | Description |
|---|---|---|
|
| the parameters required to create the client |
Returns
BaseSignerClient<TExportWalletParams, TExportWalletOutput>
| Property | Type |
|---|---|
| |
| |
| |
|
Get Signature
get protected user(): undefined | User;Defined in: account-kit/signer/src/client/base.ts:147
Returns
undefined | User
Set Signature
set protected user(user): void;Defined in: account-kit/signer/src/client/base.ts:151
Parameters
| Parameter | Type |
|---|---|
|
|
Returns
void
addMfa(params): Promise<AddMfaResult>;Defined in: account-kit/signer/src/client/base.ts:1174
Initiates the setup of a new MFA factor for the current user. Mfa will need to be verified before it is active.
Parameters
| Parameter | Type | Description |
|---|---|---|
| The parameters required to enable a new MFA factor |
Returns
Promise<AddMfaResult>
A promise that resolves to the factor setup information
Throws
If no user is authenticated
Throws
If an unsupported factor type is provided
addOauthProvider(params): Promise<OauthProviderInfo>;Defined in: account-kit/signer/src/client/base.ts:616
Adds an OAuth provider for the authenticated user using the provided parameters. Throws an error if the user is not authenticated.
Parameters
| Parameter | Type | Description |
|---|---|---|
| The parameters for adding an OAuth provider, including |
Returns
Promise<OauthProviderInfo>
A Promise that resolves when the OAuth provider is added.
Throws
Throws if the user is not authenticated.
addPasskey(options): Promise<string[]>;Defined in: account-kit/signer/src/client/base.ts:509
Handles the creation of authenticators using WebAuthn attestation and the provided options. Requires the user to be authenticated.
Parameters
| Parameter | Type | Description |
|---|---|---|
|
| The options used to create the WebAuthn attestation |
Returns
Promise<string[]>
A promise that resolves to an array of authenticator IDs
Throws
If the user is not authenticated
abstract completeAuthWithBundle(params): Promise<User>;Defined in: account-kit/signer/src/client/base.ts:253
Parameters
| Parameter | Type |
|---|---|
| { |
|
|
|
|
|
|
| |
|
|
|
|
Returns
Promise<User>
createAccount(params): Promise<SignupResponse>;Defined in: account-kit/signer/src/client/base.ts:176
Authenticates the user by either email or passkey account creation flow. Emits events during the process.
Parameters
| Parameter | Type | Description |
|---|---|---|
| The parameters for creating an account, including the type (email or passkey) and additional details. |
Returns
Promise<SignupResponse>
A promise that resolves with the response object containing the account creation result.
abstract disconnect(): Promise<void>;Defined in: account-kit/signer/src/client/base.ts:278
Returns
Promise<void>
experimental_addToMultiOwner(orgId, members): Promise<void>;Defined in: account-kit/signer/src/client/base.ts:1019
This will add additional members to an existing multi-sig account
Parameters
| Parameter | Type | Description |
|---|---|---|
|
| orgId of the multi-sig to add members to |
|
| the addresses of the members to add |
Returns
Promise<void>
experimental_createApiKey(params): Promise<void>;Defined in: account-kit/signer/src/client/base.ts:782
Creates an API key that can take any action on behalf of the current user. (Note that this method is currently experimental and is subject to change.)
Parameters
| Parameter | Type | Description |
|---|---|---|
| Parameters for creating the API key. |
Returns
Promise<void>
Throws
If there is no authenticated user or the API key creation fails.
experimental_createMultiOwner(additionalMembers): Promise<{
evmSignerAddress: `0x${string}`;
members: object[];
orgId: string;
}>;Defined in: account-kit/signer/src/client/base.ts:997
This will create a multi-owner account with the current user and additional specified signers
Parameters
| Parameter | Type | Description |
|---|---|---|
|
| members to add, aside from the currently authenticated user |
Returns
Promise<{
evmSignerAddress: `0x${string}`;
members: object[];
orgId: string;
}>
created multi-owner account
experimental_deleteFromMultiOwner(orgId, members): Promise<void>;Defined in: account-kit/signer/src/client/base.ts:1057
This will remove members from an existing multi-sig account
Parameters
| Parameter | Type | Description |
|---|---|---|
|
| orgId of the multi-sig to remove members from |
|
| the addresses of the members to remove |
Returns
Promise<void>
experimental_multiOwnerExportPrivateKeyEncrypted(opts): Promise<ExportPrivateKeyEncryptedResult>;Defined in: account-kit/signer/src/client/base.ts:1571
Exports a private key for a given account in a multi-owner org
Parameters
| Parameter | Type | Description |
|---|---|---|
|
| the parameters for the export |
Returns
Promise<ExportPrivateKeyEncryptedResult>
the private key
experimental_multiOwnerSignRawMessage(
msg,
orgId,
orgAddress): Promise<`0x${string}`>;Defined in: account-kit/signer/src/client/base.ts:960
This will sign on behalf of the multi-owner org, without doing any transformations on the message. For SignMessage or SignTypedData, the caller should hash the message before calling this method and pass that result here.
Parameters
| Parameter | Type | Description |
|---|---|---|
|
| the hex representation of the bytes to sign |
|
| orgId of the multi-owner org to sign on behalf of |
|
| address of the multi-owner org to sign on behalf of |
Returns
Promise<`0x${string}`>
the signature over the raw hex
exportPrivateKeyEncrypted(opts): Promise<ExportPrivateKeyEncryptedResult>;Defined in: account-kit/signer/src/client/base.ts:1519
Exports a private key for a given account encrypted with the provided public key
Parameters
| Parameter | Type | Description |
|---|---|---|
|
| the parameters for the export |
Returns
Promise<ExportPrivateKeyEncryptedResult>
the private key
abstract exportWallet(params): Promise<TExportWalletOutput>;Defined in: account-kit/signer/src/client/base.ts:280
Parameters
| Parameter | Type |
|---|---|
|
|
Returns
Promise<TExportWalletOutput>
getMfaFactors(): Promise<{
multiFactors: MfaFactor[];
}>;Defined in: account-kit/signer/src/client/base.ts:1142
Retrieves the list of MFA factors configured for the current user.
Returns
Promise<{
multiFactors: MfaFactor[];
}>
A promise that resolves to an array of configured MFA factors
Throws
If no user is authenticated
abstract protected getOauthConfig(): Promise<OauthConfig>;Defined in: account-kit/signer/src/client/base.ts:286
Returns
Promise<OauthConfig>
protected getOauthNonce(turnkeyPublicKey): string;Defined in: account-kit/signer/src/client/base.ts:1509
Turnkey requires the nonce in the id token to be in this format.
Parameters
| Parameter | Type | Description |
|---|---|---|
|
| key from a Turnkey iframe |
Returns
string
nonce to be used in OIDC
protected getOauthProviderUrl(args): Promise<string>;Defined in: account-kit/signer/src/client/base.ts:1334
Returns the authentication url for the selected OAuth Proivder
Example
cosnt oauthParams = {
authProviderId: "google",
isCustomProvider: false,
auth0Connection: undefined,
scope: undefined,
claims: undefined,
mode: "redirect",
redirectUrl: "https://your-url-path/oauth-return",
expirationSeconds: 3000
};
const turnkeyPublicKey = await this.initIframeStamper();
const oauthCallbackUrl = this.oauthCallbackUrl;
const oauthConfig = this.getOauthConfig() // Optional value for OauthConfig()
const usesRelativeUrl = true // Optional value to determine if we use a relative (or absolute) url for the `redirect_url`
const oauthProviderUrl = getOauthProviderUrl({
oauthParams,
turnkeyPublicKey,
oauthCallbackUrl
})
Parameters
| Parameter | Type | Description |
|---|---|---|
| Required. The Oauth provider's auth parameters |
Returns
Promise<string>
returns the Oauth provider's url
getPasskeyStatus(): Promise<{
isPasskeyAdded: boolean;
}>;Defined in: account-kit/signer/src/client/base.ts:594
Retrieves the status of the passkey for the current user. Requires the user to be authenticated.
Returns
Promise<{
isPasskeyAdded: boolean;
}>
A promise that resolves to an object containing the passkey status
Throws
If the user is not authenticated
getUser(): null | User;Defined in: account-kit/signer/src/client/base.ts:1092
Returns the current user or null if no user is set.
Returns
null | User
the current user object or null if no user is available
abstract protected getWebAuthnAttestation(options?, userDetails?): Promise<GetWebAuthnAttestationResult>;Defined in: account-kit/signer/src/client/base.ts:288
Parameters
| Parameter | Type |
|---|---|
| |
| { |
|
|
Returns
Promise<GetWebAuthnAttestationResult>
abstract initEmailAuth(params): Promise<{
multiFactors?: MfaFactor[];
orgId: string;
otpId?: string;
}>;Defined in: account-kit/signer/src/client/base.ts:245
Parameters
| Parameter | Type |
|---|---|
|
|
Returns
Promise<{
multiFactors?: MfaFactor[];
orgId: string;
otpId?: string;
}>
initOauth(): Promise<OauthConfig>;Defined in: account-kit/signer/src/client/base.ts:142
Asynchronously fetches and sets the OAuth configuration.
Returns
Promise<OauthConfig>
A promise that resolves to the OAuth configuration
initOtp(type, contact): Promise<{
otpId: string;
}>;Defined in: account-kit/signer/src/client/base.ts:492
Initiates an OTP (One-Time Password) verification process for a user contact.
Parameters
| Parameter | Type | Description |
|---|---|---|
|
| The type of OTP to send, either "email" or "sms" |
|
| The email address or phone number to send the OTP to |
Returns
Promise<{
otpId: string;
}>
A promise that resolves to an object containing the OTP ID
Throws
When no user is currently authenticated
abstract protected initSessionStamper(): Promise<string>;Defined in: account-kit/signer/src/client/base.ts:296
Initializes the session stamper and returns its public key.
Returns
Promise<string>
abstract initSmsAuth(params): Promise<{
orgId: string;
otpId?: string;
}>;Defined in: account-kit/signer/src/client/base.ts:249
Parameters
| Parameter | Type |
|---|---|
|
|
Returns
Promise<{
orgId: string;
otpId?: string;
}>
abstract protected initWebauthnStamper(user, options): Promise<void>;Defined in: account-kit/signer/src/client/base.ts:298
Parameters
| Parameter | Type |
|---|---|
|
|
| | |
Returns
Promise<void>
listAuthMethods(): Promise<AuthMethods>;Defined in: account-kit/signer/src/client/base.ts:666
Retrieves the list of authentication methods for the current user.
Returns
Promise<AuthMethods>
A promise that resolves to the list of authentication methods
Throws
If the user is not authenticated
lookupUserByAccessKey(params): Promise<{
orgId: null | string;
}>;Defined in: account-kit/signer/src/client/base.ts:835
Looks up information based on an access key.
Parameters
| Parameter | Type | Description |
|---|---|---|
|
| The access key parameters |
Returns
Promise<{
orgId: null | string;
}>
The result of the lookup request
lookupUserByEmail(email): Promise<{
orgId: null | string;
}>;Defined in: account-kit/signer/src/client/base.ts:815
Looks up information based on an email address.
Parameters
| Parameter | Type | Description |
|---|---|---|
|
| the email address to look up |
Returns
Promise<{
orgId: null | string;
}>
the result of the lookup request
lookupUserByPhone(phone): Promise<{
orgId: null | string;
}>;Defined in: account-kit/signer/src/client/base.ts:825
Looks up information based on a phone number.
Parameters
| Parameter | Type | Description |
|---|---|---|
|
| the phone number to look up |
Returns
Promise<{
orgId: null | string;
}>
the result of the lookup request
lookupUserWithPasskey(user?): Promise<User>;Defined in: account-kit/signer/src/client/base.ts:572
Asynchronously handles the authentication process using WebAuthn Stamper. If a user is provided, sets the user and returns it. Otherwise, retrieves the current user and initializes the WebAuthn stamper.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
|
| An optional user object to authenticate |
Returns
Promise<User>
A promise that resolves to the authenticated user object
abstract oauthWithPopup(args): Promise<
| User
| AuthLinkingPrompt
| IdTokenOnly>;Defined in: account-kit/signer/src/client/base.ts:266
Parameters
| Parameter | Type |
|---|---|
|
|
Returns
Promise<
| User
| AuthLinkingPrompt
| IdTokenOnly>
abstract oauthWithRedirect(args): Promise<
| User
| IdTokenOnly>;Defined in: account-kit/signer/src/client/base.ts:262
Parameters
| Parameter | Type |
|---|---|
|
|
Returns
Promise<
| User
| IdTokenOnly>
on<E>(event, listener): () => any;Defined in: account-kit/signer/src/client/base.ts:314
Listen to events emitted by the client
Type Parameters
| Type Parameter |
|---|
|
Parameters
| Parameter | Type | Description |
|---|---|---|
|
| the event you want to listen to |
| the callback function to execute when an event is fired |
Returns
a function that will remove the listener when called
(): any;Returns
any
protected pollActivityCompletion<T>(
activity,
organizationId,
resultKey): Promise<NonNullable<object[T]>>;Defined in: account-kit/signer/src/client/base.ts:1454
Type Parameters
| Type Parameter |
|---|
|
Parameters
| Parameter | Type |
|---|---|
|
|
|
|
|
|
Returns
Promise<NonNullable<object[T]>>
removeEmail(): Promise<void>;Defined in: account-kit/signer/src/client/base.ts:382
Removes the email for the authenticated user, disallowing them from login with that email.
Returns
Promise<void>
A promise that resolves when the email is removed
Throws
If the user is not authenticated
removeMfa(params): Promise<{
multiFactors: MfaFactor[];
}>;Defined in: account-kit/signer/src/client/base.ts:1244
Removes existing MFA factors by ID.
Parameters
| Parameter | Type | Description |
|---|---|---|
| The parameters specifying which factors to disable |
Returns
Promise<{
multiFactors: MfaFactor[];
}>
A promise that resolves to the updated list of MFA factors
Throws
If no user is authenticated
removeOauthProvider(providerId): Promise<void>;Defined in: account-kit/signer/src/client/base.ts:644
Deletes a specified OAuth provider for the authenticated user.
Parameters
| Parameter | Type | Description |
|---|---|---|
|
| The ID of the provider to be deleted |
Returns
Promise<void>
Throws
If the user is not authenticated
removePasskey(authenticatorId): Promise<void>;Defined in: account-kit/signer/src/client/base.ts:551
Removes a passkey authenticator from the user's account.
Parameters
| Parameter | Type | Description |
|---|---|---|
|
| The ID of the authenticator to remove. |
Returns
Promise<void>
A promise that resolves when the authenticator is removed.
Throws
If the user is not authenticated.
removePhoneNumber(): Promise<void>;Defined in: account-kit/signer/src/client/base.ts:451
Removes the phone number for the authenticated user, disallowing them from login with that phone number.
Returns
Promise<void>
A promise that resolves when the phone number is removed
Throws
If the user is not authenticated
request<R>(route, body): Promise<SignerResponse<R>>;Defined in: account-kit/signer/src/client/base.ts:1104
Sends a POST request to the given signer route with the specified body and returns the response. Not intended to be used directly, use the specific methods instead on the client instead.
Type Parameters
| Type Parameter |
|---|
|
Parameters
| Parameter | Type | Description |
|---|---|---|
|
| The route to which the request should be sent |
|
| The request body containing the data to be sent |
Returns
Promise<SignerResponse<R>>
A promise that resolves to the response from the signer
Implementation for setEmail method with optional OTP verification.
Param
An OTP object containing the OTP ID & OTP code (or an email address for legacy usage)
Call Signature
setEmail(email): Promise<string>;Defined in: account-kit/signer/src/client/base.ts:336
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. Recommended to use the email verification flow instead.
Parameters
| Parameter | Type | Description |
|---|---|---|
|
| The email to set for the user |
Returns
Promise<string>
A promise that resolves to the updated email
Throws
If the user is not authenticated
Call Signature
setEmail(otp): Promise<string>;Defined in: account-kit/signer/src/client/base.ts:346
Sets the email for the authenticated user, allowing them to login with that
email. Must be called after calling initOtp with the email.
Parameters
| Parameter | Type | Description |
|---|---|---|
| The OTP verification object including the OTP ID and OTP code |
Returns
Promise<string>
A promise that resolves to the updated email
Throws
If the user is not authenticated
setPhoneNumber(otp): Promise<void>;Defined in: account-kit/signer/src/client/base.ts:436
Updates the phone number for the authenticated user, allowing them to login with that
phone number. Must be called after calling initOtp with the phone number.
Parameters
| Parameter | Type | Description |
|---|---|---|
| The OTP object including the OTP ID and OTP code |
Returns
Promise<void>
A promise that resolves when the phone number is set
Throws
If the user is not authenticated
protected setStamper(stamper): void;Defined in: account-kit/signer/src/client/base.ts:166
Sets the stamper of the TurnkeyClient.
Parameters
| Parameter | Type | Description |
|---|---|---|
|
| the stamper function to set for the TurnkeyClient |
Returns
void
signRawMessage(msg, mode): Promise<`0x${string}`>;Defined in: account-kit/signer/src/client/base.ts:852
This will sign a message with the user's private key, without doing any transformations on the message. For SignMessage or SignTypedData, the caller should hash the message before calling this method and pass that result here.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
|
|
| the hex representation of the bytes to sign |
|
|
| specify if signing should happen for solana or ethereum |
Returns
Promise<`0x${string}`>
the signature over the raw hex
stampGetOrganization(): Promise<TSignedRequest>;Defined in: account-kit/signer/src/client/base.ts:760
Generates a stamped getOrganization request for the current user.
Returns
Promise<TSignedRequest>
a promise that resolves to the "getOrganization" information for the logged in user
Throws
if no user is authenticated
stampWhoami(): Promise<TSignedRequest>;Defined in: account-kit/signer/src/client/base.ts:744
Generates a stamped whoami request for the current user. This request can then be used to call /signer/v1/whoami to get the user information. This is useful if you want to get the user information in a different context like a server. You can pass the stamped request to the server and then call our API to get the user information. Using this stamp is the most trusted way to get the user information since a stamp can only belong to the user who created it.
Returns
Promise<TSignedRequest>
a promise that resolves to the "whoami" information for the logged in user
Throws
if no organization ID is provided
abstract submitJwt(args): Promise<JwtResponse>;Defined in: account-kit/signer/src/client/base.ts:274
Parameters
| Parameter | Type |
|---|---|
|
|
Returns
Promise<JwtResponse>
abstract submitOtpCode(args): Promise<SubmitOtpCodeResponse>;Defined in: account-kit/signer/src/client/base.ts:270
Parameters
| Parameter | Type |
|---|---|
|
|
Returns
Promise<SubmitOtpCodeResponse>
abstract targetPublicKey(): Promise<string>;Defined in: account-kit/signer/src/client/base.ts:284
Returns
Promise<string>
validateMultiFactors(params): Promise<{
bundle: string;
}>;Defined in: account-kit/signer/src/client/base.ts:1276
Validates multiple MFA factors using the provided encrypted payload and MFA codes.
Parameters
| Parameter | Type | Description |
|---|---|---|
| The validation parameters |
Returns
Promise<{
bundle: string;
}>
A promise that resolves to an object containing the credential bundle
Throws
If no credential bundle is returned from the server
verifyMfa(params): Promise<{
multiFactors: MfaFactor[];
}>;Defined in: account-kit/signer/src/client/base.ts:1211
Verifies a newly created MFA factor to complete the setup process.
Parameters
| Parameter | Type | Description |
|---|---|---|
| The parameters required to verify the MFA factor |
Returns
Promise<{
multiFactors: MfaFactor[];
}>
A promise that resolves to the updated list of MFA factors
Throws
If no user is authenticated
whoami(
orgId?,
idToken?,
accessToken?): Promise<User>;Defined in: account-kit/signer/src/client/base.ts:684
Retrieves the current user or fetches the user information if not already available.
Parameters
| Parameter | Type | Description |
|---|---|---|
|
| optional organization ID, defaults to the user's organization ID |
|
| an OIDC ID token containing additional user information |
|
| an access token which if provided will be added to the user |
Returns
Promise<User>
A promise that resolves to the user object
Throws
if no organization ID is provided when there is no current user