0.2.1 • Published 1 year ago

@teamhanko/passkeys-sdk v0.2.1

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Hanko Passkeys JavaScript SDK

View docs on docs.hanko.io

The @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.

npm i @teamhanko/passkeys-sdk
yarn add @teamhanko/passkeys-sdk
bun add @teamhanko/passkeys-sdk
pnpm add @teamhanko/passkeys-sdk

Usage

A tenant is an API client instance for one tenant of the Hanko Passkey API.

👉 See multitenancy

Create a new tenant instance:

const passkeyApi = tenant({
	tenantId: "<your tenant id>",
	apiKey: "<your secret api key>",
});

Make sure the API key stays secret. It should never be exposed to the client/frontend. If you're using a framework that handles both frontend and backend (like Next.js, for example), create two separate tenant instances, each in their own file (e.g. tenant-server.ts and tenant-client.ts).

  • If you only use public API methods, like /login/initialize, you can omit the apiKey.
  • If you're self-hosting the Passkey API, make sure to pass the baseUrl as well.

Now you're ready to call the API. For example, to start the process of registering a new passkey:

const creationOptions = await tenant.registration.initialize({
	userId: "<id of the user in your database>",
	username: "<username of the user>",
});
0.2.1

1 year ago

0.2.0

1 year ago

0.1.9

1 year ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago