The library uses MeraError for its documented failure modes. It carries a stable, machine-readable code alongside the usual message and optional cause. The codes are the contract; the message text is free to change between versions.
type MeraErrorCode ="PASSKEY_OPERATION_FAILED"|"CRYPTO_UNAVAILABLE"|"PRF_UNAVAILABLE"|"SESSION_ENDED"|"DECRYPT_FAILED"|"INPUT_INVALID"|"VAULT_FORMAT_INVALID"
Stable error codes thrown by this package.
PASSKEY_OPERATION_FAILED: WebAuthn failed, was cancelled, returned an unexpected credential, or the credential API is unavailable.
CRYPTO_UNAVAILABLE: the runtime lacks a needed Web Crypto primitive. The passkey APIs need crypto.getRandomValues; the secret-vault APIs also need crypto.subtle.
PRF_UNAVAILABLE: the authenticator did not enable or return a usable 32-byte WebAuthn PRF output.
SESSION_ENDED: a signing call was made after end().
DECRYPT_FAILED: AES-GCM authentication failed (wrong key or tampered nonce/ciphertext).
INPUT_INVALID: a caller-supplied value at a public boundary did not satisfy a length, range, encoding, or curve (scalar or point) constraint.
VAULT_FORMAT_INVALID: untrusted vault data (JSON or object) was malformed, missing required fields, used a non-canonical encoding, or declared an unsupported version.
MeraErrorCode;
}
name is always "MeraError". When a lower-level failure triggered the error (a WebAuthn rejection, a Web Crypto failure), it is attached as cause.
Requests a passkey PRF evaluation and returns the first output.
@param ― options - Passkey PRF request inputs.
@returns ― The selected credential ID and first WebAuthn PRF output.
@remarks ―
Runs one assertion ceremony and shows one user-verification prompt.
The WebAuthn challenge is generated internally.
The default salt is sha256("mera.prf.salt.v1") and will not change across
library versions. The PRF output is a deterministic function of the
credential, rpId, and salt; a different salt yields an unrelated output.
The assertion requires user verification, and the requirement is not
configurable. User verification is the authenticator's local check; the
gesture depends on the platform (a biometric, a device PIN, or a password).
Authenticators built on CTAP's hmac-secret keep two PRFs per credential,
one for user-verified requests and one for the rest; WebAuthn exposes only
the user-verified PRF and overrides a weaker userVerification setting
when evaluating it, so a configurable setting could neither change the PRF
output nor skip the check.
Requests a passkey PRF evaluation and returns the first output.
@param ― options - Passkey PRF request inputs.
@returns ― The selected credential ID and first WebAuthn PRF output.
@remarks ―
Runs one assertion ceremony and shows one user-verification prompt.
The WebAuthn challenge is generated internally.
The default salt is sha256("mera.prf.salt.v1") and will not change across
library versions. The PRF output is a deterministic function of the
credential, rpId, and salt; a different salt yields an unrelated output.
The assertion requires user verification, and the requirement is not
configurable. User verification is the authenticator's local check; the
gesture depends on the platform (a biometric, a device PIN, or a password).
Authenticators built on CTAP's hmac-secret keep two PRFs per credential,
one for user-verified requests and one for the rest; WebAuthn exposes only
the user-verified PRF and overrides a weaker userVerification setting
when evaluating it, so a configurable setting could neither change the PRF
output nor skip the check.
WebAuthn failed, was cancelled, returned an unexpected credential, or the credential API is unavailable. Cancellation is the everyday case: the person dismissed the prompt.
A Web Crypto primitive is unavailable. The passkey APIs need crypto.getRandomValues; the secret-vault APIs also need crypto.subtle (requires HTTPS or localhost during development).
A caller-supplied value at a public boundary did not satisfy a length, range, encoding, or curve constraint (a private key that is not a valid scalar, a public key that is not a valid point). Each function’s Errors section lists its specific conditions.
Untrusted vault data (JSON text or an object) was malformed, missing required fields, used a non-canonical encoding, or declared an unsupported version.