Virto Signer API / authenticators/webauthn/src / WebAuthn
Class: WebAuthn
Defined in: authenticators/webauthn/src/index.ts:43
Browser‑side Authenticator that wraps the WebAuthn API.
The generic type parameter <number> indicates that the context carried inside attestations and assertions is the block number that originated the challenge.
Implements
Implements
Authenticator<number>
Constructors
Constructor
new WebAuthn(
userId,getChallenge,handler?,addressGenerator?):WebAuthn
Defined in: authenticators/webauthn/src/index.ts:62
Creates a new WebAuthn helper.
Parameters
userId
string
Logical user identifier (e‑mail, DID, etc.)..
getChallenge
Challenger<number>
An implementation of the generate method used in the challenger,
handler?
CredentialsHandler = ...
addressGenerator?
AddressGenerator = kreivoPassDefaultAddressGenerator
Returns
WebAuthn
Properties
addressGenerator
readonlyaddressGenerator:AddressGenerator=kreivoPassDefaultAddressGenerator
Defined in: authenticators/webauthn/src/index.ts:66
Implementation of
Authenticator.addressGenerator
getChallenge
readonlygetChallenge:Challenger<number>
Defined in: authenticators/webauthn/src/index.ts:64
An implementation of the generate method used in the challenger,
Implementation of
Authenticator.getChallenge
hashedUserId
hashedUserId:
Uint8Array
Defined in: authenticators/webauthn/src/index.ts:48
SHA‑256 hash of userId. Filled once by setup and reused for all WebAuthn operations.
Implementation of
Authenticator.hashedUserId
userId
readonlyuserId:string
Defined in: authenticators/webauthn/src/index.ts:63
Logical user identifier (e‑mail, DID, etc.)..
Methods
authenticate()
authenticate(
context,xtc):Promise<TPassAuthenticate>
Defined in: authenticators/webauthn/src/index.ts:174
Signs an arbitrary challenge with the pass‑key and produces a TPassAuthenticate payload understood by PassSigner.
Parameters
context
number
Block number (or any numeric context expected by the pallet).
xtc
Uint8Array
Returns
Promise<TPassAuthenticate>
SCALE‑encoded authentication payload.
Throws
Error If no credential id is available.
Implementation of
Authenticator.authenticate
register()
register(
blockNumber,displayName?):Promise<TAttestation<number>>
Defined in: authenticators/webauthn/src/index.ts:119
Registers a new resident credential (pass‑key) with the user’s authenticator and returns a SCALE‑ready attestation.
Parameters
blockNumber
number
The number of the block whose hash seeds the challenge.
displayName?
string = ...
Friendly name shown by the authenticator.
Returns
Promise<TAttestation<number>>
SCALE‑encoded attestation object.
Throws
Error If this instance already has a credential id.
setup()
setup():
Promise<WebAuthn>
Defined in: authenticators/webauthn/src/index.ts:84
Pre‑computes hashedUserId.
Must be awaited once before any other interaction. Returns this for fluent chaining.
Returns
Promise<WebAuthn>