WebAuthnClient is the abstraction layer between mera’s passkey functions and a platform’s WebAuthn API. For each call, mera builds a request that the client converts to the platform’s format and sends to the API.
The built-in browser client calls navigator.credentials. Apps on other platforms can provide a client that implements createCredential and getCredential.
Runs the WebAuthn ceremonies behind mera's passkey functions.
@remarks ― A MeraError that a client rejects with reaches the caller unchanged. Any
other rejection surfaces as PASSKEY_OPERATION_FAILED with the original
error as its cause. The built-in clients reject with PASSKEY_CANCELLED
when the person dismisses the prompt, it times out, or no passkey answers.
MeraWebAuthnClient.
type WebAuthnClient.CreateCredentialRequest = {
rp:PasskeyRelyingParty;
user: {
id:Uint8Array<ArrayBuffer>;
name:string;
displayName:string;
};
challenge:Uint8Array<ArrayBuffer>;
algorithms:readonlynumber[];
prfSalt:Uint8Array<ArrayBuffer>;
residentKey:"required";
userVerification:"required";
attestation:"none";
timeout?:number|undefined;
}
Ceremony parameters for creating one passkey and evaluating its PRF.
CreateCredentialRequest,
) =>
interface Promise<T>
Represents the completion of an asynchronous operation
Promise<
(alias) namespace MeraWebAuthnClient
import MeraWebAuthnClient
Runs the WebAuthn ceremonies behind mera's passkey functions.
@remarks ― A MeraError that a client rejects with reaches the caller unchanged. Any
other rejection surfaces as PASSKEY_OPERATION_FAILED with the original
error as its cause. The built-in clients reject with PASSKEY_CANCELLED
when the person dismisses the prompt, it times out, or no passkey answers.
Runs the WebAuthn ceremonies behind mera's passkey functions.
@remarks ― A MeraError that a client rejects with reaches the caller unchanged. Any
other rejection surfaces as PASSKEY_OPERATION_FAILED with the original
error as its cause. The built-in clients reject with PASSKEY_CANCELLED
when the person dismisses the prompt, it times out, or no passkey answers.
Ceremony parameters for asserting a passkey and evaluating its PRF.
GetCredentialRequest,
) =>
interface Promise<T>
Represents the completion of an asynchronous operation
Promise<
(alias) namespace MeraWebAuthnClient
import MeraWebAuthnClient
Runs the WebAuthn ceremonies behind mera's passkey functions.
@remarks ― A MeraError that a client rejects with reaches the caller unchanged. Any
other rejection surfaces as PASSKEY_OPERATION_FAILED with the original
error as its cause. The built-in clients reject with PASSKEY_CANCELLED
when the person dismisses the prompt, it times out, or no passkey answers.
The relying party ID, challenge, optional allowed credential, PRF salt, and optional immediate flag for an assertion ceremony. A client without an immediate mode runs a normal assertion when immediate is set.
The credential ID that answered and its optional PRF output.
Requests and results use Uint8Array for binary values. When creation enables PRF but returns no output, mera calls getCredential with the same client and salt.
A PRF output that is not 32 bytes fails with PRF_UNAVAILABLE. A MeraError that a client throws reaches the caller unchanged, and anything else surfaces as PASSKEY_OPERATION_FAILED with the original error as its cause. The built-in clients reject a cancelled ceremony with PASSKEY_CANCELLED.
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.
With immediate, Chrome 148 and later (as of 2026-10) and the React Native
client show nothing when the device holds no passkey for rpId. Browsers
without immediate mode ignore the option and show their usual prompt.
Without a user gesture, or in Incognito, Chrome rejects an immediate request
with the same error even when a passkey exists.
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.
@throws ― MeraError with code PRF_UNAVAILABLE when the authenticator does not return a usable 32-byte PRF output.
@throws ― MeraError with code INPUT_INVALID when an explicit prfSalt is not 32 bytes, credential.credentialId is empty or not canonical base64url, or immediate is combined with credential.
@throws ― MeraError with code CRYPTO_UNAVAILABLE when crypto.getRandomValues is unavailable.
@throws ― MeraError with code PASSKEY_CANCELLED when the person dismisses the prompt, it times out, or no passkey answers, including an immediate request that finds none.
@throws ― MeraError with code PASSKEY_OPERATION_FAILED when WebAuthn is unavailable, fails for another reason, or returns an unexpected credential.
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.
With immediate, Chrome 148 and later (as of 2026-10) and the React Native
client show nothing when the device holds no passkey for rpId. Browsers
without immediate mode ignore the option and show their usual prompt.
Without a user gesture, or in Incognito, Chrome rejects an immediate request
with the same error even when a passkey exists.
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.
@throws ― MeraError with code PRF_UNAVAILABLE when the authenticator does not return a usable 32-byte PRF output.
@throws ― MeraError with code INPUT_INVALID when an explicit prfSalt is not 32 bytes, credential.credentialId is empty or not canonical base64url, or immediate is combined with credential.
@throws ― MeraError with code CRYPTO_UNAVAILABLE when crypto.getRandomValues is unavailable.
@throws ― MeraError with code PASSKEY_CANCELLED when the person dismisses the prompt, it times out, or no passkey answers, including an immediate request that finds none.
@throws ― MeraError with code PASSKEY_OPERATION_FAILED when WebAuthn is unavailable, fails for another reason, or returns an unexpected credential.
getPasskeyPrfOutput({
rpId: string
Relying party ID for the WebAuthn assertion.
rpId: "account.example.com",
webAuthnClient?: WebAuthnClient |undefined
Client that runs the WebAuthn ceremony. Defaults to the built-in browser
client, which calls navigator.credentials.
The React Native client requires react-native-passkey. It lives in a separate entry point, so the root package loads no React Native code.
The client rejects with PASSKEY_CANCELLED when react-native-passkey reports UserCancelled, TimedOut, or NoCredentials. In that error and in PASSKEY_OPERATION_FAILED, the cause is react-native-passkey’s PasskeyError.