A lean, type-safe, fetch
-based API client for the Hanko Passkey API
@teamhanko/passkeys-sdk
package lets you call the Hanko Passkey API from JavaScript/TypeScript that supports fetch
.
This includes Node.js, Browsers, Deno, Bun, and frameworks like Next.js, Astro, and SvelteKit.
tenant
is an API client instance for one tenant of the Hanko Passkey API.
See multitenancy
/login/initialize
, you can omit the apiKey
.baseUrl
as well.Install the SDK
Get your tenant ID and API key
.env
file.Allow users to register passkeys as a login method
tenant({ ... }).registration.initialize()
and registration.finalize()
to create and store a passkey.registerPasskey()
function handles the passkey registration process. It first sends a request to the server to initiate the registration process and receives the response for creating a new passkey.It then uses the @github/webauthn-json
library to create a new passkey credential based on the received options from the response. Finally, it sends another request to the server with the newly created credential to complete the registration process.Allow users to log in with passkeys