Open source ยท Public domain
That's the only way in. No passwords, no security keys, no QR codes and no phone-to-computer sign-in. Your device keeps the key; the website keeps only the public half.
On a device you're already signed in to, make a one-time "Add a device" link. It lasts 10 minutes and works once. Open it on the new device and touch your fingerprint.
The device makes its own key, locked behind its reader. The website stores only the public key.
Only this device's built-in reader is allowed, so the browser goes straight to your fingerprint or face. Nothing else is offered.
Remove a lost device from any other device you've enrolled. It can never sign in again.
The server checks every sign-in and turns away anything that isn't the device's own reader:
Built on the W3C Web Authentication standard, using only its built-in reader part. No new cryptography: Ed25519, P-256 and RSA signatures only.
Two files, no dependencies. The server part runs anywhere with Web Crypto: Cloudflare Workers, Deno, Bun, Node 20+ and browsers.
import { registrationOptions, verifyRegistration, signInOptions, verifySignIn,
makeDeviceInvite, readDeviceInvite } from './server.js';
// 1. On a signed-in device: make a one-time "Add a device" link.
const token = await makeDeviceInvite({ secret: env.INVITE_SECRET, accountId });
// 2. On the new device: read the link and send enroll options.
const { accountId } = await readDeviceInvite({ secret: env.INVITE_SECRET, token });
const options = registrationOptions({ rpId: 'example.com', rpName: 'Example', userId, userName });
// 3. Check it and store the record for the account.
const record = await verifyRegistration({ credential, expectedChallenge,
expectedOrigin: 'https://example.com', rpId: 'example.com' });
// 4. Sign in with the IDs this device enrolled.
const opts = signInOptions({ rpId: 'example.com', deviceCredentialIds });
// 5. Check it and save the new counter.
const { counter } = await verifySignIn({ credential, stored: record, expectedChallenge,
expectedOrigin: 'https://example.com', rpId: 'example.com' });
In the browser:
import { hasBuiltInReader, enrollThisDevice, signIn, enrolledOnThisDevice } from './client.js';
const enrolled = await enrollThisDevice(optionsFromServer); // touch your fingerprint
const login = await signIn(signInOptionsFromServer); // straight to the fingerprint
Get server.js and client.js, or clone the repo: git clone https://branchwell.ai/biolock/source.git