This guide will show you how to create a secured embedded wallet with a passkey, completely headlessly. We will use the createPasskey and createEmbeddedWallet methods, available from the useEmbeddedWallet hook.
Here are the steps we need to follow:
Ensure the user is logged in
Create a passkey for the user
Create the embedded wallet with the passkey provided from the previous step
To create a passkey for the user, we will use the createPasskey method from the useEmbeddedWallet hook. This method will request the user create a passkey through their device UI and return a WebAuthnAttestation object to be used next while creating the embedded wallet.Method signature:
To create the embedded wallet, we will use the createEmbeddedWallet method from the useEmbeddedWallet hook. This method will create the wallet with the passkey we generated in the previous step.Method signature: