Home

Embedded Signer

Password-based recovery

Password-based recovery gives the user ability to encrypt recovery share of the wallet

Password-based recovery#

Require that users set a password when the wallet is created, enforcing password-based recovery from the start

If encrypted by user-provided entropy, only the user can decrypt the recovery share. Openfort never sees or the user's password.

Using Openfort Auth#


_10
async function authSetAutomaticRecoveryMethod(email:string, password:string, recoveryPassword:string) {
_10
const response = await openfort.signUpWithEmailPassword({email, password});
_10
const chainId = 80002;
_10
const shieldAuth: ShieldAuthentication = {
_10
auth: ShieldAuthType.OPENFORT,
_10
token: response.token
_10
};
_10
await openfort.configureEmbeddedSigner(chainId, shieldAuth, recoveryPassword);
_10
}

Using Third-party Auth#

This example will showcase Firebase as the third-party auth provider. You can replace it with any other third-party auth provider supported by Openfort or with Custom Auth.


_11
async function authAndSetPassordRecoveryMethod(idToken: string, password: string) {
_11
await openfort.authenticateWithThirdPartyProvider("firebase", idToken, TokenType.idToken);
_11
const chainId = 80002;
_11
const shieldAuth: ShieldAuthentication = {
_11
auth: ShieldAuthType.OPENFORT,
_11
token: idToken,
_11
authProvider: "firebase",
_11
tokenType: "idToken",
_11
};
_11
await openfort.configureEmbeddedSigner(chainId, shieldAuth, password);
_11
}

Resources#