UNPKG

@virtonetwork/authenticators-webauthn

Version:

An Authenticator compatible with KreivoPassSigner that uses the WebAuthn standard

35 lines (34 loc) 1.31 kB
import { AuthorityId, DeviceId, HashedUserId } from "@virtonetwork/signer"; import { Binary, HexString } from "@polkadot-api/substrate-bindings"; import { Codec } from "scale-ts"; export type BlockHash = HexString; export type hashedUserId = (userId: string) => Promise<Uint8Array>; export interface CredentialsHandler { publicKeyCreateOptions(challenge: Uint8Array, user: PublicKeyCredentialUserEntity): Promise<CredentialCreationOptions["publicKey"]>; onCreatedCredentials(userId: string, credentials: PublicKeyCredential): Promise<void>; publicKeyRequestOptions(userId: string, challenge: Uint8Array): Promise<CredentialRequestOptions["publicKey"]>; } export type TAttestationMeta<Cx> = { authority_id: AuthorityId; device_id: DeviceId; context: Cx; }; export type TAttestation<Cx> = { meta: TAttestationMeta<Cx>; authenticator_data: Binary; client_data: Binary; public_key: Binary; }; export declare const Attestation: Codec<TAttestation<number>>; export type TAssertionMeta<Cx> = { authority_id: AuthorityId; user_id: HashedUserId; context: Cx; }; export type TAssertion<Cx> = { meta: TAssertionMeta<Cx>; authenticator_data: Binary; client_data: Binary; signature: Binary; }; export declare const Assertion: Codec<TAssertion<number>>;