Prompt users to auth new devices
The React SDK will automatically prompt users for their auth factor on new devices when they use their wallet. There is no additional logic your application must implement to handle this.
The React SDK will automatically prompt users for their auth factor on new devices when they use their wallet. There is no additional logic your application must implement to handle this.
When a user uses their embedded wallet on a new device for the first time, the wallet must first be recovered on that device
By default, wallets created for your users will be automatically provisioned and should never need recovery. For these wallets, you can skip these steps and directly request a signature or transaction.
For wallets where the recovery_method
is 'privy'
the wallet will be automatically recovered
and should never need recovery. For these wallets, you can skip these steps and directly request a
signature or transaction.
Setting up your recovery listener
The wallet must be recovered before you can request signatures or transact with the embedded wallet. The React Native SDK will try to recover the user’s wallet once you start interacting with it. We recommend that you set up a global listener on your application to handle manual recovery in a single place.
To set up this configuration, use Privy’s useOnNeedsRecovery
hook.
AS a parameter, you must pass in an object defining the the onNeedsRecovery
callback.
onNeedsRecovery
will receive two parameters to drive what recovery looks like:
Parameter | Type | Description |
---|---|---|
recoveryMethod | "privy" | "user-passcode" | "google-drive" | "icloud" | "recovery-encryption-key" | An enum representing the recovery method used for this user. |
onRecovered | () => void | This is a callback function you should call once recovery has been completed. It takes no arguments. |
Recovering the wallet
To recover an embedded wallet for your user, use the recover
function returned by the Privy React Native SDK’s useRecoverEmbeddedWallet
hook.
You can determine the proper arguments for recover
via the account.recovery_method
property on the embedded wallet account:
user-passcode
, callrecover
withrecoveryMethod: 'user-passcode'
and the user inputpassword
.google-drive
, call recover withrecoveryMethod: 'google-drive'
.icloud
, call recover withrecoveryMethod: 'icloud'
. Note: this is only supported on iOS devices.