Appearance
Upgrading recovery
Once a wallet has been created, users have the ability to upgrade from automatic recovery to a user-owned recovery method, or to switch between different user-owned recovery methods.
INFO
Please note that:
- If a user's embedded wallet requires recovery, they will need to complete recovery with their existing method before upgrading their recovery method.
- Once a wallet is upgraded to a user-owned recovery method, it cannot be set back to automatic recovery.
- iCloud recovery is only supported on iOS devices.
- Users cannot upgrade recovery to the same cloud provider (i.e. Google drive to Google drive) as the user's existing recovery method.
Upgrading a user's recovery method
To prompt users to set or upgrade recovery on their wallet, call the setRecovery
method on the wallet
object returned from the useEmbeddedWallet
hook.
This method will support the user-controlled recovery methods you have enabled in the Dashboard. This will always include setting up a password or resetting their password as an option.
TIP
Users can reset their password using this method as well.
tsx
import {useEmbeddedWallet} from '@privy-io/expo';
const UpgradeWalletToPasswordButton = () => {
const [password, setPassword] = useState('');
const wallet = useEmbeddedWallet();
return (
<View>
{/* Make sure to handle sensitive information appropriately */}
<TextInput value={password} onChangeText={setPassword} />
<Button
onPress={() =>
wallet.setRecovery({
recoveryMethod: 'user-passcode',
password,
})
}
>
Set password
</Button>
</View>
);
};