Create a User Passkey Session
A passkey session is an expiring session enabled by an initial passkey authentication. You could think of this as a
By calling createPasskeySession()
, the SDK stores the resulting auth bundle in local storage for later retrieval, and also returns it to the caller. If you don’t want to rely on getActiveClient()
(a helper method within @turnkey/sdk-react
to retrieve active Turnkey clients) and instead want to manage the stampers yourself, you can inject the auth bundle into the iframe — see the code for specifics.
Steps using @turnkey/sdk-react
This process is made the most seamless by leveraging our React package. Read on for a non-React implementation.
Initialize the React Provider
Call the createPasskeySession function
Use the passkey session for read and write requests
Note: getActiveClient()
is a helper method designed to abstract away the need to check if a passkey session is still valid. If it has expired, this will default to the passkeyClient
, in which case users will sign each request using their passkey.
Alternative Steps (non-React)
Initialize the Passkey Client
Call the createPasskeySession function
Use the passkey session for read and write requests