@passwordless-id/webauthn
Version:
A small wrapper around the webauthn protocol to make one's life easier.
28 lines (27 loc) • 1.28 kB
TypeScript
import { AuthenticationJSON, NamedAlgo, RegistrationJSON, RegistrationInfo, AuthenticationInfo, Base64URLString, CredentialInfo } from "./types.js";
export declare function randomChallenge(): string;
interface RegistrationChecks {
challenge: string | Function;
origin: string | Function;
}
export declare function verifyRegistration(registrationJson: RegistrationJSON, expected: RegistrationChecks): Promise<RegistrationInfo>;
interface AuthenticationChecks {
challenge: string | Function;
origin: string | Function;
userVerified: boolean;
counter?: number;
domain?: string;
verbose?: boolean;
}
export declare function verifyAuthentication(authenticationJson: AuthenticationJSON, credential: CredentialInfo, expected: AuthenticationChecks): Promise<AuthenticationInfo>;
export declare function parseCryptoKey(algorithm: NamedAlgo, publicKey: string): Promise<CryptoKey>;
type VerifyParams = {
algorithm: NamedAlgo;
publicKey: Base64URLString;
authenticatorData: Base64URLString;
clientData: Base64URLString;
signature: Base64URLString;
verbose?: boolean;
};
export declare function verifySignature({ algorithm, publicKey, authenticatorData, clientData, signature, verbose }: VerifyParams): Promise<boolean>;
export {};