RNSignerClient

Defined in: account-kit/rn-signer/src/client.ts:65

Extends

Constructors

Constructor

1new RNSignerClient(params): RNSignerClient;

Defined in: account-kit/rn-signer/src/client.ts:78

Parameters

ParameterType

params

{ connection: | { apiKey: string; jwt?: undefined; rpcUrl?: undefined; } | { apiKey?: undefined; jwt: string; rpcUrl?: undefined; } | { apiKey?: undefined; jwt?: undefined; rpcUrl: string; } | { apiKey?: undefined; jwt: string; rpcUrl: string; } & object; oauthCallbackUrl?: string; rootOrgId?: string; rpId?: string; }

params.connection

| { apiKey: string; jwt?: undefined; rpcUrl?: undefined; } | { apiKey?: undefined; jwt: string; rpcUrl?: undefined; } | { apiKey?: undefined; jwt?: undefined; rpcUrl: string; } | { apiKey?: undefined; jwt: string; rpcUrl: string; } & object

params.oauthCallbackUrl?

string

params.rootOrgId?

string

params.rpId?

string

Returns

RNSignerClient

Overrides

1BaseSignerClient<
2 ExportWalletParams,
3 string
4>.constructor

Properties

PropertyTypeDescription

addMfa

(params) => Promise<AddMfaResult>

Initiates the setup of a new MFA factor for the current user. Mfa will need to be verified before it is active.

Throws

If no user is authenticated

Throws

If an unsupported factor type is provided

addOauthProvider

(params) => Promise<OauthProviderInfo>

Adds an OAuth provider for the authenticated user using the provided parameters. Throws an error if the user is not authenticated.

Throws

Throws if the user is not authenticated.

addPasskey

(options) => Promise<string[]>

Handles the creation of authenticators using WebAuthn attestation and the provided options. Requires the user to be authenticated.

Throws

If the user is not authenticated

eventEmitter

EventEmitter<AlchemySignerClientEvents>

experimental_addToMultiOwner

(orgId, members) => Promise<void>

This will add additional members to an existing multi-sig account

experimental_createApiKey

(params) => Promise<void>

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.)

Throws

If there is no authenticated user or the API key creation fails.

experimental_createMultiOwner

(additionalMembers) => Promise<{ evmSignerAddress: `0x${string}`; members: object[]; orgId: string; }>

This will create a multi-owner account with the current user and additional specified signers

experimental_deleteFromMultiOwner

(orgId, members) => Promise<void>

This will remove members from an existing multi-sig account

experimental_multiOwnerSignRawMessage

(msg, orgId, orgAddress) => Promise<`0x${string}`>

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.

getMfaFactors

() => Promise<{ multiFactors: MfaFactor[]; }>

Retrieves the list of MFA factors configured for the current user.

Throws

If no user is authenticated

getOauthNonce

(turnkeyPublicKey) => string

Turnkey requires the nonce in the id token to be in this format.

getOauthProviderUrl

(args) => Promise<string>

Returns the authentication url for the selected OAuth Proivder

Example

1cosnt oauthParams = {
2 authProviderId: "google",
3 isCustomProvider: false,
4 auth0Connection: undefined,
5 scope: undefined,
6 claims: undefined,
7 mode: "redirect",
8 redirectUrl: "https://your-url-path/oauth-return",
9 expirationSeconds: 3000
10};
11
12const turnkeyPublicKey = await this.initIframeStamper();
13const oauthCallbackUrl = this.oauthCallbackUrl;
14const oauthConfig = this.getOauthConfig() // Optional value for OauthConfig()
15const usesRelativeUrl = true // Optional value to determine if we use a relative (or absolute) url for the `redirect_url`
16
17const oauthProviderUrl = getOauthProviderUrl({
18 oauthParams,
19 turnkeyPublicKey,
20 oauthCallbackUrl
21})

getPasskeyStatus

() => Promise<{ isPasskeyAdded: boolean; }>

Retrieves the status of the passkey for the current user. Requires the user to be authenticated.

Throws

If the user is not authenticated

getUser

() => null | User

Returns the current user or null if no user is set.

initOauth

() => Promise<OauthConfig>

Asynchronously fetches and sets the OAuth configuration.

initOtp

(type, contact) => Promise<{ otpId: string; }>

Initiates an OTP (One-Time Password) verification process for a user contact.

Throws

When no user is currently authenticated

listAuthMethods

() => Promise<AuthMethods>

Retrieves the list of authentication methods for the current user.

Throws

If the user is not authenticated

lookupUserByAccessKey

(params) => Promise<{ orgId: null | string; }>

Looks up information based on an access key.

lookupUserByEmail

(email) => Promise<{ orgId: null | string; }>

Looks up information based on an email address.

lookupUserByPhone

(phone) => Promise<{ orgId: null | string; }>

Looks up information based on a phone number.

lookupUserWithPasskey

(user?) => Promise<User>

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.

oauthCallbackUrl

string

oauthConfig

undefined | OauthConfig

on

<E>(event, listener) => () => EventEmitter<AlchemySignerClientEvents, any>

Listen to events emitted by the client

pollActivityCompletion

<T>(activity, organizationId, resultKey) => Promise<NonNullable<object[T]>>

removeEmail

() => Promise<void>

Removes the email for the authenticated user, disallowing them from login with that email.

Throws

If the user is not authenticated

removeMfa

(params) => Promise<{ multiFactors: MfaFactor[]; }>

Removes existing MFA factors by ID.

Throws

If no user is authenticated

removeOauthProvider

(providerId) => Promise<void>

Deletes a specified OAuth provider for the authenticated user.

Throws

If the user is not authenticated

removePasskey

(authenticatorId) => Promise<void>

Removes a passkey authenticator from the user’s account.

Throws

If the user is not authenticated.

removePhoneNumber

() => Promise<void>

Removes the phone number for the authenticated user, disallowing them from login with that phone number.

Throws

If the user is not authenticated

request

<R>(route, body) => Promise<SignerResponse<R>>

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.

rootOrg

string

rpId

undefined | string

setPhoneNumber

(otp) => Promise<void>

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.

Throws

If the user is not authenticated

signRawMessage

(msg, mode?) => Promise<`0x${string}`>

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.

stampGetOrganization

() => Promise<TSignedRequest>

Generates a stamped getOrganization request for the current user.

Throws

if no user is authenticated

stampWhoami

() => Promise<TSignedRequest>

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.

Throws

if no organization ID is provided

turnkeyClient

TurnkeyClient

validateMultiFactors

(params) => Promise<{ bundle: string; }>

Validates multiple MFA factors using the provided encrypted payload and MFA codes.

Throws

If no credential bundle is returned from the server

verifyMfa

(params) => Promise<{ multiFactors: MfaFactor[]; }>

Verifies a newly created MFA factor to complete the setup process.

Throws

If no user is authenticated

whoami

(orgId?, idToken?, accessToken?) => Promise<User>

Retrieves the current user or fetches the user information if not already available.

Throws

if no organization ID is provided when there is no current user

Accessors

user

Get Signature

1get protected user(): undefined | User;

Defined in: account-kit/signer/dist/types/client/base.d.ts:43

Returns

undefined | User

Set Signature

1set protected user(user): void;

Defined in: account-kit/signer/dist/types/client/base.d.ts:44

Parameters
ParameterType

user

undefined | User

Returns

void

Inherited from

1BaseSignerClient.user;

Methods

completeAuthWithBundle()

1completeAuthWithBundle(params): Promise<User>;

Defined in: account-kit/rn-signer/src/client.ts:181

Parameters

ParameterType

params

{ accessToken?: string; authenticatingType: "email" | "otp" | "sms" | "passkey" | "oauth" | "otpVerify" | "custom-jwt"; bundle: string; connectedEventName: keyof AlchemySignerClientEvents; idToken?: string; orgId: string; }

params.accessToken?

string

params.authenticatingType

"email" | "otp" | "sms" | "passkey" | "oauth" | "otpVerify" | "custom-jwt"

params.bundle

string

params.connectedEventName

keyof AlchemySignerClientEvents

params.idToken?

string

params.orgId

string

Returns

Promise<User>

Overrides

1BaseSignerClient.completeAuthWithBundle;

createAccount()

1createAccount(params): Promise<SignupResponse>;

Defined in: account-kit/signer/dist/types/client/base.d.ts:57

Authenticates the user by either email or passkey account creation flow. Emits events during the process.

Parameters

ParameterTypeDescription

params

CreateAccountParams

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.

Inherited from

1BaseSignerClient.createAccount;

disconnect()

1disconnect(): Promise<void>;

Defined in: account-kit/rn-signer/src/client.ts:295

Returns

Promise<void>

Overrides

1BaseSignerClient.disconnect;

exportWallet()

1exportWallet(params?): Promise<string>;

Defined in: account-kit/rn-signer/src/client.ts:308

Exports the wallet and returns the decrypted private key or seed phrase.

Parameters

ParameterTypeDescription

params?

ExportWalletParams

exportWallet parameters

Returns

Promise<string>

The decrypted private key or seed phrase

Throws

If the user is not authenticated or export fails

Overrides

1BaseSignerClient.exportWallet;

getOauthConfig()

1protected getOauthConfig(): Promise<OauthConfig>;

Defined in: account-kit/rn-signer/src/client.ts:463

Returns

Promise<OauthConfig>

Overrides

1BaseSignerClient.getOauthConfig;

getWebAuthnAttestation()

1protected getWebAuthnAttestation(options?, userDetails?): Promise<GetWebAuthnAttestationResult & object>;

Defined in: account-kit/rn-signer/src/client.ts:432

Parameters

ParameterType

options?

CredentialCreationOptionOverrides

userDetails?

{ username: string; }

userDetails.username?

string

Returns

Promise<GetWebAuthnAttestationResult & object>

Overrides

1BaseSignerClient.getWebAuthnAttestation;

initEmailAuth()

1initEmailAuth(params): Promise<{
2 multiFactors?: MfaFactor[];
3 orgId: string;
4 otpId?: string;
5}>;

Defined in: account-kit/rn-signer/src/client.ts:129

Parameters

ParameterType

params

Omit<EmailAuthParams, "targetPublicKey">

Returns

Promise<{ multiFactors?: MfaFactor[]; orgId: string; otpId?: string; }>

Overrides

1BaseSignerClient.initEmailAuth;

initSessionStamper()

1protected initSessionStamper(): Promise<string>;

Defined in: account-kit/rn-signer/src/client.ts:470

Initializes the session stamper and returns its public key.

Returns

Promise<string>

Overrides

1BaseSignerClient.initSessionStamper;

initSmsAuth()

1initSmsAuth(params): Promise<{
2 orgId: string;
3 otpId?: string;
4}>;

Defined in: account-kit/rn-signer/src/client.ts:154

Parameters

ParameterType

params

Omit<SmsAuthParams, "targetPublicKey">

Returns

Promise<{ orgId: string; otpId?: string; }>

Overrides

1BaseSignerClient.initSmsAuth;

initWebauthnStamper()

1protected initWebauthnStamper(user, options?): Promise<void>;

Defined in: account-kit/rn-signer/src/client.ts:474

Parameters

ParameterType

user

undefined | User

options?

CredentialCreationOptionOverrides

Returns

Promise<void>

Overrides

1BaseSignerClient.initWebauthnStamper;

oauthWithPopup()

1oauthWithPopup(_args): Promise<User>;

Defined in: account-kit/rn-signer/src/client.ts:289

Parameters

ParameterType

_args

any

Returns

Promise<User>

Overrides

1BaseSignerClient.oauthWithPopup;

oauthWithRedirect()

1oauthWithRedirect(args): Promise<User | IdTokenOnly>;

Defined in: account-kit/rn-signer/src/client.ts:215

Parameters

ParameterType

args

any

Returns

Promise<User | IdTokenOnly>

Overrides

1BaseSignerClient.oauthWithRedirect;

setEmail()

Call Signature

1setEmail(email): Promise<string>;

Defined in: account-kit/signer/dist/types/client/base.d.ts:116

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
ParameterTypeDescription

email

string

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

Inherited from
1BaseSignerClient.setEmail;

Call Signature

1setEmail(otp): Promise<string>;

Defined in: account-kit/signer/dist/types/client/base.d.ts:125

Sets the email for the authenticated user, allowing them to login with that email. Must be called after calling initOtp with the email.

Parameters
ParameterTypeDescription

otp

VerificationOtp

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

Inherited from
1BaseSignerClient.setEmail;

setStamper()

1protected setStamper(stamper): void;

Defined in: account-kit/signer/dist/types/client/base.d.ts:50

Sets the stamper of the TurnkeyClient.

Parameters

ParameterTypeDescription

stamper

TStamper

the stamper function to set for the TurnkeyClient

Returns

void

Inherited from

1BaseSignerClient.setStamper;

submitJwt()

1submitJwt(args): Promise<JwtResponse>;

Defined in: account-kit/rn-signer/src/client.ts:167

Parameters

ParameterType

args

Omit<JwtParams, "targetPublicKey">

Returns

Promise<JwtResponse>

Overrides

1BaseSignerClient.submitJwt;

submitOtpCode()

1submitOtpCode(args): Promise<SubmitOtpCodeResponse>;

Defined in: account-kit/rn-signer/src/client.ts:92

Parameters

ParameterType

args

Omit<OtpParams, "targetPublicKey">

Returns

Promise<SubmitOtpCodeResponse>

Overrides

1BaseSignerClient.submitOtpCode;

targetPublicKey()

1targetPublicKey(): Promise<string>;

Defined in: account-kit/rn-signer/src/client.ts:428

Returns

Promise<string>

Overrides

1BaseSignerClient.targetPublicKey;