← All packages

@lacspace/webauthn

v1.1.1Security Kit0 deps

Passkeys / biometric (FaceID, fingerprint, security keys) — browser ceremony helpers + server challenge, options and assertion verification (ES256/RS256) over Web Crypto. Zero-dependency, isomorphic.

npm i @lacspace/webauthn

Usage

webauthn.ts
// --- server: create options ---
import { generateRegistrationOptions, generateChallenge } from "@lacspace/webauthn";
const challenge = generateChallenge();               // store in the session
const options = generateRegistrationOptions({ rpName: "Lacspace", rpID: "lacspace.com", userID, userName, challenge });

// --- browser ---
import { startRegistration } from "@lacspace/webauthn";
const response = await startRegistration(options);   // FaceID / fingerprint prompt → JSON

// --- server: verify + store ---
import { verifyRegistration } from "@lacspace/webauthn";
const { credentialId, publicKey, algorithm, counter } = await verifyRegistration({
  attestationObject: response.attestationObject,
  clientDataJSON: response.clientDataJSON,
  expectedChallenge: challenge, expectedOrigin: "https://lacspace.com", expectedRPID: "lacspace.com",
});
// store { credentialId, publicKey (JWK), al

Exports 11

fromBase64urlgenerateAuthenticationOptionsgenerateChallengegenerateRegistrationOptionsisPlatformAuthenticatorAvailableisWebAuthnSupportedstartAuthenticationstartRegistrationtoBase64urlverifyAuthenticationverifyRegistration

Keywords

webauthnpasskeyfido2biometricfaceidfingerprint

More in Security Kit