Passkey authentication
Last updated
Last updated
The network allows users to issue key generation requests and authenticate them using Passkeys. This chapter describes the protocol flow in detail and points to code examples.
We provide Passkey authentication via module. Let's create the NetworkSigner
with associated PasskeyAuth
object.
The response will contain the passkeyCredentialId
information used to request authentication. The dApp is responsible for storing that value persistently (most likely on their backend). The passkeyCredentialId
can be later reused in subsequent keygen requests. In our demo webpage we use local storage for simplicity.
The esk
key can be later used by the frontend in subsequent signgen requests for authenticating.
This section describes the passkey authentication flow in detail.
Aggregator
- Gateway to the network of operators, gets requests from WPBE
and forwards them to Operators
Operator
- Node that runs DKLS23 protocol, waits for incoming requests from Aggregator
User wants to do a keygen, WPFE
library prepares setup_opts
and starts the protocol:
WPFE
generates a random ephemeral key pair {ephPK, ephSK}
WPFE
creates KeygenSetupOpts
, that contains public part ephPK
, permissions, and other parameters required to do keygen
3-9 passing the setup_opts
, and collecting the challenges from the operators
WPBE
calculates final_challenge
that consist of a hash of the setup_opts
and challenges ch_i
from the Operators
Forward final_challenge
to WPFE
Fetch passkey_id
This step is implementation-specific. In our demo webpage, we simply store the passkey_id on the browser's local storage. However, in a real-world scenario, the dApp should store passkey information on its backend.
If passkey_id
is not set, we register a new passkey; otherwise, we use the one already created:
The passkey_id
is not set, create a register request, use final_challenge
from the network as a challenge for passkey registration
User authenticates using passkey compatible device
Get the authentication response sigs
Pass it to WPBE
The passkey_id
is set, create login request, use final_challenge
from the network as a challenge for passkey authentication
User authenticates using passkey compatible device
Get the authentication response sigs
Pass it to WPBE
User signature goes to the network:
1-5 Creation of setup_msg by Aggregator
Aggregator sends setup_msg
to all Operators, the setup_msg
contains all information required to authenticate and execute keygen
7-8 Operators compute final_challenge
on their own, using data from setup_msg
Verification of passkeys depends on the passkey with the givenpasskey_id
being stored in the Operators database.
If passkey_id
is not set, verify registration of passkey,
Store passkey_id
in the database
The passkey_id
is present in the database, fetch the passkey and verify the request
Update passkey in the database after verification
6-11 Run keygen and return a response to the user.
Now, you can generate a key like in the EOA example by calling the method.
Calling this method will prompt the browser to request Passkey User Verification. Once user verification is done, the is returned.
WPFE
- Wallet Provider frontend. Logic implemented in library. Communicates with WPBE
WPBE
- Wallet Provider service backend. The example service is . Communicates with Aggregator