Skip to main content

SeedlessOnboardingController Actions

35 actions registered.

NameDeprecated
addNewSecretData
authenticate
authenticateForRecovery
changePassword
checkAccessTokenExpired
checkMetadataAccessTokenExpired
checkNodeAuthTokenExpired
clearState
completePasswordChange
createToprfKeyAndBackupSeedPhrase
fetchAllSecretData
fetchMetadataAccessCreds
getAccessToken
getIsUserAuthenticated
getSecretDataBackupState
getState
identifyIncompleteMetadataBackup
loadKeyringEncryptionKey
markPasswordChangeKeySyncPending
migrateToEnvelope
preloadToprfNodeDetails
reconcilePassword
recoverWithRecoverySecret
refreshAuthTokens
resetPasswordWithVaultKeys
resolvePasswordSyncState
restoreVaultWithPassword
revokePendingRefreshTokens
rotateRefreshToken
runMigrations
setLocked
storeKeyringEncryptionKey
submitPassword
updateBackupMetadataState
verifyVaultPassword

SeedlessOnboardingController:addNewSecretData​

Package: @metamask/seedless-onboarding-controller

Encrypt and add a new secret data to the metadata store.

Parameters:

NameDescription
dataThe data to add.
dataTypeThe data type classification for the secret data.
optionsOptional options object, which includes optional data to be added to the metadata store.
options.keyringIdThe keyring id of the backup keyring (SRP).

Returns: A promise that resolves to the success of the operation.

Handler signature:

(data: Uint8Array, dataType: EncAccountDataType, options?: {
keyringId?: string;
}) => Promise<void>

SeedlessOnboardingController:authenticate​

Package: @metamask/seedless-onboarding-controller

Authenticate OAuth user using the seedless onboarding flow and determine if the user is already registered or not.

Parameters:

NameDescription
paramsThe parameters for authenticate OAuth user.
params.idTokensThe ID token(s) issued by OAuth verification service. Currently this array only contains a single idToken which is verified by all the nodes, in future we are considering to issue a unique idToken for each node.
params.authConnectionThe social login provider.
params.authConnectionIdOAuth authConnectionId from dashboard
params.userIduser email or id from Social login
params.groupedAuthConnectionIdOptional grouped authConnectionId to be used for the authenticate request.
params.socialLoginEmailThe user email from Social login.
params.refreshTokenRefresh token issued during OAuth login. Written to state when provided.
params.revokeTokenrevoke token for revoking refresh token and get new refresh token and new revoke token.
params.accessTokenAccess token for pairing with profile sync auth service and to access other services.
params.metadataAccessTokenMetadata access token for accessing the metadata service before the vault is created or unlocked.
params.skipLockOptional flag to skip acquiring the controller lock. (to prevent deadlock in case the caller already acquired the lock)

Returns: A promise that resolves to the authentication result.

Handler signature:

(params: SeedlessAuthData & {
skipLock?: boolean;
}) => Promise<AuthenticateResult>

SeedlessOnboardingController:authenticateForRecovery​

Package: @metamask/seedless-onboarding-controller

Authenticate on the recovery verifier with the aal2 token and store the issued node auth tokens, the token's exp and sub (profile ID), the verifier IDs, and whether a share already exists, as recoverySession. The aal1 nodeAuthTokens, accessToken and metadataAccessToken are left as they are.

Parameters:

NameDescription
paramsThe function parameters.
params.aal2TokenThe aal2 token minted by the authentication API. Its exp caps the lifetime of the aal2 node auth tokens.
params.authConnectionIdThe recovery sub-verifier ID.
params.groupedAuthConnectionIdThe recovery aggregate verifier ID. Requires a successful authenticate first, since the recovery session is bound to the authenticated user.

Returns: A promise that resolves once the aal2 set is stored.

Handler signature:

({ aal2Token, authConnectionId, groupedAuthConnectionId, }: {
aal2Token: string;
authConnectionId: string;
groupedAuthConnectionId: string;
}) => Promise<void>

SeedlessOnboardingController:changePassword​

Package: @metamask/seedless-onboarding-controller

Update the password of the seedless onboarding flow.

Changing password will also update the encryption key, metadata store and the vault with new encrypted values. If the vault is envelope-managed, only the password envelope and the password OPRF key change; the vault keys and the backend vault stay as they are.

Parameters:

NameDescription
newPasswordThe new password to update.
oldPasswordThe old password to verify.

Returns: A promise that resolves to the success of the operation.

Handler signature:

(newPassword: string, oldPassword: string) => Promise<void>

SeedlessOnboardingController:checkAccessTokenExpired​

Package: @metamask/seedless-onboarding-controller

Check if the current access token should be refreshed. Returns true when the token is expired or when less than 10% of its lifetime remains (proactive refresh). When the vault is locked, the access token is not accessible, so we return false.

Returns: True if the access token should be refreshed, false otherwise.

Handler signature:

() => boolean

SeedlessOnboardingController:checkMetadataAccessTokenExpired​

Package: @metamask/seedless-onboarding-controller

Check if the current metadata access token should be refreshed. Returns true when the token is expired or when less than 10% of its lifetime remains (proactive refresh).

Returns: True if the metadata access token should be refreshed, false otherwise.

Handler signature:

() => boolean

SeedlessOnboardingController:checkNodeAuthTokenExpired​

Package: @metamask/seedless-onboarding-controller

Check if the current node auth token is expired.

Returns: True if the current node auth token is expired, false otherwise.

Handler signature:

() => boolean

SeedlessOnboardingController:clearState​

Package: @metamask/seedless-onboarding-controller

Clears the current state of the SeedlessOnboardingController.

Waits for any in-flight controller operation before clearing state and releases the in-memory decrypted vault data.

Returns: A promise that resolves once the state has been cleared.

Handler signature:

() => Promise<void>

SeedlessOnboardingController:completePasswordChange​

Package: @metamask/seedless-onboarding-controller

Complete password-change recovery.

Call this after the current Keyring encryption key has been synchronized and all required local writes have succeeded. The controller clears the lifecycle and saves the outdated-password cache as in sync. The next password check reads this cache.

This only completes a lifecycle that is at KEY_SYNC_PENDING; in any other state it is a no-op and the cache stays as it is.

Returns: A promise that resolves once recovery has been completed.

Handler signature:

() => Promise<void>

SeedlessOnboardingController:createToprfKeyAndBackupSeedPhrase​

Package: @metamask/seedless-onboarding-controller

Create a new TOPRF encryption key using given password and backups the provided seed phrase.

Parameters:

NameDescription
passwordThe password used to create new wallet and seedphrase
seedPhraseThe initial seed phrase (Mnemonic) created together with the wallet.
keyringIdThe keyring id of the backup seed phrase

Returns: A promise that resolves to the encrypted seed phrase and the encryption key.

Handler signature:

(password: string, seedPhrase: Uint8Array, keyringId: string) => Promise<void>

SeedlessOnboardingController:fetchAllSecretData​

Package: @metamask/seedless-onboarding-controller

Fetches all secret data items from the metadata store.

Decrypts the secret data with the keys of the unlocked vault. The vault and the envelope state are not changed.

Returns: A promise that resolves to the secret metadata items.

Handler signature:

() => Promise<SecretMetadata[]>

SeedlessOnboardingController:fetchMetadataAccessCreds​

Package: @metamask/seedless-onboarding-controller

Handler signature:

() => Promise<{
metadataAccessToken: string;
}>

SeedlessOnboardingController:getAccessToken​

Package: @metamask/seedless-onboarding-controller

Get the access token from the state.

If the tokens are expired, the method will refresh them and return the new access token.

Returns: The access token.

Handler signature:

() => Promise<string | undefined>

SeedlessOnboardingController:getIsUserAuthenticated​

Package: @metamask/seedless-onboarding-controller

Check if the user is authenticated with the seedless onboarding flow by checking the token values in the state.

This method will check the accessToken and revokeToken in the state, besides the social login authentication details. If both are present, the user is authenticated. If either is missing, the user is not authenticated.

This method is useful when we want to check if the state has valid authenticated user details to perform vault creations.

Returns: True if the user is authenticated, false otherwise.

Handler signature:

() => Promise<boolean>

SeedlessOnboardingController:getSecretDataBackupState​

Package: @metamask/seedless-onboarding-controller

Get backup state of the given secret data, from the controller state.

If the given secret data is not backed up and not found in the state, it will return undefined.

Parameters:

NameDescription
dataThe data to get the backup state of.
typeThe type of the secret data.

Returns: The backup state of the given secret data.

Handler signature:

(data: Uint8Array, type?: SecretType) => SocialBackupsMetadata | undefined

SeedlessOnboardingController:getState​

Package: @metamask/seedless-onboarding-controller

Handler signature:

() => SeedlessOnboardingControllerState

SeedlessOnboardingController:identifyIncompleteMetadataBackup​

Package: @metamask/seedless-onboarding-controller

Identify an incomplete or mismatched primary SRP backup and repair it.

The call waits until the repair attempt finishes. A failed write is logged and the promise still resolves. Call this only after the controller is unlocked.

Parameters:

NameDescription
passwordThe password used to export the local primary SRP.

Returns: A promise that resolves after the repair attempt finishes.

Handler signature:

(password: string) => Promise<void>

SeedlessOnboardingController:loadKeyringEncryptionKey​

Package: @metamask/seedless-onboarding-controller

Load the keyring encryption key from state, decrypted under the current encryption key.

Returns: The keyring encryption key.

Handler signature:

() => Promise<string>

SeedlessOnboardingController:markPasswordChangeKeySyncPending​

Package: @metamask/seedless-onboarding-controller

Mark the password-change lifecycle as KEY_SYNC_PENDING.

Called by the client coordinator before it synchronizes the current Keyring encryption key to Seedless. The controller only records the boundary; it does not perform or verify synchronization.

This only advances a lifecycle that is at LOCAL_PASSWORD_PENDING; in any other state it is a no-op.

Returns: A promise that resolves once the checkpoint has been persisted.

Handler signature:

() => Promise<void>

SeedlessOnboardingController:migrateToEnvelope​

Package: @metamask/seedless-onboarding-controller

Migrate the vault to envelope encryption, adopting its current key set as the vault key set K_v.

Writes, in order: rbek (K_v sealed for the Recovery Secret) under a fresh OPRF key, the OPRF key on the recovery verifier, and the control record under the vault's metadata lock. The control record is the commit. No data item is moved and no password is needed; the first pbek is written by the first password change.

Retries are safe. An unregistered rbek is abandoned and a new one is written. If the key is registered, K_v is resealed when the newest rbek does not hold it (e.g. after a legacy password change), then the control record is written. On an already migrated vault, it only checks the recovery verifier and reseals K_v if needed.

Requires an unlocked vault whose keys derive from the global password, the Recovery Secret registered at the escrows, and a valid aal2 session from authenticateForRecovery.

Parameters:

NameDescription
paramsThe function parameters.
params.recoverySecretThe 32-byte Recovery Secret held in escrow.

Returns: A promise that resolves once the vault is envelope-managed.

Handler signature:

({ recoverySecret, }: {
recoverySecret: Uint8Array;
}) => Promise<void>

SeedlessOnboardingController:preloadToprfNodeDetails​

Package: @metamask/seedless-onboarding-controller

Gets the node details for the TOPRF operations. This function can be called to get the node endpoints, indexes and pubkeys and cache them locally.

Handler signature:

() => Promise<void>

SeedlessOnboardingController:reconcilePassword​

Package: @metamask/seedless-onboarding-controller

Reconcile the local Seedless password with the remote password.

For LOCAL_STATE_PENDING it re-runs the existing password-sync flow (chain unlock + local vault rewrite) with the new password and advances the checkpoint to LOCAL_PASSWORD_PENDING. These operations are idempotent, so re-running them is safe whether or not the local Seedless vault was already rewritten. The controller is left unlocked.

For LOCAL_PASSWORD_PENDING or KEY_SYNC_PENDING the local Seedless vault is already rewritten. The method unlocks it with the supplied password so loadKeyringEncryptionKey and storeKeyringEncryptionKey work after a restart, without repeating remote TOPRF recovery or a vault rewrite. A newer accessToken from refreshAuthTokens is kept instead of being overwritten by the vault copy.

It always re-checks whether the remote password is outdated, including when the local Seedless vault was already rewritten. If it is, it runs the same password-sync flow, advances to LOCAL_PASSWORD_PENDING, and returns ReconcileKeyring so the client can reconcile the local Keyring. If the remote password is current, the checkpoint determines whether the client must reconcile the Keyring, sync its key, or do nothing.

The client remains responsible for the Keyring side (classifying the local Keyring via KeyringController:verifyPassword and running the old-Keyring or new-Keyring branch), because this controller does not depend on KeyringController. See the password sync flow.

Parameters:

NameDescription
paramsThe reconciliation parameters.
params.globalPasswordThe current global password.
params.maxKeyChainLengthThe maximum chain length of the pwd encryption keys.

Returns: The reconciliation instruction.

Handler signature:

({ globalPassword, maxKeyChainLength, }: {
globalPassword: string;
maxKeyChainLength?: number;
}) => Promise<PasswordSyncInstruction>

SeedlessOnboardingController:recoverWithRecoverySecret​

Package: @metamask/seedless-onboarding-controller

Recover an envelope-managed vault with the Recovery Secret instead of the password: open rbek to get the vault key set K_v, fetch the secret data with it, and create the local vault under password.

Intended for wallet rehydration, not while the wallet is locked. If this device has envelope state, the recovered vault keys must be the ones it names.

password only encrypts the local vault. This sets isLocalPassword, which resetPasswordWithVaultKeys, changePassword and reconcilePassword clear once the password is global. envelope.passwordAuthPubKey is set to the live password OPRF key, so resolvePasswordSyncState reports a password change made elsewhere after recovery.

Authenticate with social login and call authenticateForRecovery first.

Parameters:

NameDescription
paramsThe function parameters.
params.recoverySecretThe 32-byte Recovery Secret from escrow.
params.passwordThe password of the new local vault.

Returns: The secret data of the vault.

Handler signature:

({ recoverySecret, password, }: {
recoverySecret: Uint8Array;
password: string;
}) => Promise<SecretMetadata[]>

SeedlessOnboardingController:refreshAuthTokens​

Package: @metamask/seedless-onboarding-controller

Refresh expired nodeAuthTokens, accessToken, and metadataAccessToken using the stored refresh token.

Concurrent callers share a single in-flight HTTP request — if a refresh is already in-progress the returned promise resolves when that request settles rather than firing a duplicate request with the same token.

Returns: A promise that resolves when the tokens have been refreshed.

Handler signature:

() => Promise<void>

SeedlessOnboardingController:resetPasswordWithVaultKeys​

Package: @metamask/seedless-onboarding-controller

Set a new global password on an envelope-managed vault without the old one, after recoverWithRecoverySecret.

Only allowed while isLocalPassword is set, which is the state the vault is left in after recoverWithRecoverySecret, and with a valid aal2 session from authenticateForRecovery. A successful reset clears isLocalPassword and records the LOCAL_PASSWORD_PENDING password-change lifecycle checkpoint; clients must advance and complete the lifecycle via markPasswordChangeKeySyncPending and completePasswordChange, and after that use changePassword instead.

The password OPRF key swap is signed with the auth key stored in the vault's control record, so the old password is not needed. The vault keys and the backend vault stay as they are, and the local vault is re-encrypted under the new password.

Parameters:

NameDescription
paramsThe function parameters.
params.newPasswordThe new global password.

Returns: A promise that resolves once the new password is global.

Handler signature:

({ newPassword, }: {
newPassword: string;
}) => Promise<void>

SeedlessOnboardingController:resolvePasswordSyncState​

Package: @metamask/seedless-onboarding-controller

Resolve the password-sync instruction without consuming a password.

Checks the remote password before routing recovery for every valid password-sync checkpoint. The checkpoint then determines the next local recovery instruction when the passwords are in sync.

Parameters:

NameDescription
optionsThe options.
options.skipCacheWhether to bypass the outdated cache. Recovery checkpoints always bypass the cache.

Returns: The sync/recovery instruction.

Handler signature:

(options?: {
skipCache?: boolean;
}) => Promise<PasswordSyncInstruction>

SeedlessOnboardingController:restoreVaultWithPassword​

Package: @metamask/seedless-onboarding-controller

Restores the local vault with the global password.

Derives the keys from password, fetches and decrypts the secret data, and creates the local vault under password, replacing any existing one. If the vault is envelope-managed, the password opens the vault keys and the envelope state is set; otherwise any existing envelope state is cleared. isLocalPassword and seedlessOperationLifecycle are cleared.

Parameters:

NameDescription
paramsThe function parameters.
params.passwordThe global password.

Returns: The secret data of the vault.

Handler signature:

({ password, }: {
password: string;
}) => Promise<SecretMetadata[]>

SeedlessOnboardingController:revokePendingRefreshTokens​

Package: @metamask/seedless-onboarding-controller

Revoke all pending refresh tokens.

This method is to be called after user is authenticated.

Returns: A Promise that resolves to void.

Handler signature:

() => Promise<void>

SeedlessOnboardingController:rotateRefreshToken​

Package: @metamask/seedless-onboarding-controller

Rotate the refresh token — fetch a new refresh/revoke token pair from the auth service and persist the new revoke token in the vault.

This method should be called after a successful JWT refresh.

When idTokens are provided, their sub claim is checked against state.userId before the renewal request. A mismatch throws SeedlessOnboardingControllerErrorMessage.IdentityMismatch and the vault revoke token is not renewed.

Parameters:

NameDescription
idTokensId tokens from the JWT refresh. Only the first token is validated. Omit when the caller has no id token to check.

Returns: A Promise that resolves to void.

Handler signature:

(idTokens?: string[]) => Promise<void>

SeedlessOnboardingController:runMigrations​

Package: @metamask/seedless-onboarding-controller

Run any pending seedless onboarding migrations.

This method should be called by clients after the controller is unlocked to ensure legacy data is migrated to the latest format.

Migrations are idempotent - running this multiple times is safe. The migration version is tracked in state to prevent re-running migrations.

Returns: A promise that resolves to true if data was actually migrated (items were updated on the server), false otherwise.

Handler signature:

() => Promise<boolean>

SeedlessOnboardingController:setLocked​

Package: @metamask/seedless-onboarding-controller

Set the controller to locked state, and deallocate the secrets (vault encryption key and salt).

When the controller is locked, the user will not be able to perform any operations on the controller/vault.

Returns: A promise that resolves to the success of the operation.

Handler signature:

() => Promise<void>

SeedlessOnboardingController:storeKeyringEncryptionKey​

Package: @metamask/seedless-onboarding-controller

Store the keyring encryption key in state, encrypted under the current encryption key.

Remains lifecycle-neutral: the client calls this during recovery without advancing the lifecycle checkpoint.

Parameters:

NameDescription
keyringEncryptionKeyThe keyring encryption key.

Handler signature:

(keyringEncryptionKey: string) => Promise<void>

SeedlessOnboardingController:submitPassword​

Package: @metamask/seedless-onboarding-controller

Submit the password to the controller, verify the password validity and unlock the controller.

This method will be used especially when user unlock the wallet. The provided password will be verified against the encrypted vault, encryption key will be derived and saved in the controller state.

This operation is useful when user performs some actions that requires the user password/encryption key. e.g. add new srp backup

Parameters:

NameDescription
passwordThe password to submit.

Returns: A promise that resolves to the success of the operation.

Handler signature:

(password: string) => Promise<void>

SeedlessOnboardingController:updateBackupMetadataState​

Package: @metamask/seedless-onboarding-controller

Update the backup metadata state for the given secret data.

Parameters:

NameDescription
secretDataThe data to backup, can be a single backup or array of backups.
secretData.keyringIdThe keyring id associated with the backup secret data.
secretData.dataThe secret data to update the backup metadata state.

Handler signature:

(secretData: (Omit<SocialBackupsMetadata, 'hash'> & {
data: Uint8Array;
}) | (Omit<SocialBackupsMetadata, 'hash'> & {
data: Uint8Array;
})[]) => void

SeedlessOnboardingController:verifyVaultPassword​

Package: @metamask/seedless-onboarding-controller

Verify the password validity by decrypting the vault.

Parameters:

NameDescription
passwordThe password to verify.
optionsOptional options object.
options.skipLockWhether to skip the lock acquisition. (to prevent deadlock in case the caller already acquired the lock)

Returns: A promise that resolves to the success of the operation.

Handler signature:

(password: string, options?: {
skipLock?: boolean;
}) => Promise<void>