PasskeyExtensions

Adds typed WebAuthn extensions to the options JSON your server produced, before you pass it to Passkeys.register or Passkeys.signIn. Read the outputs from PasskeyRegistration / PasskeyAssertion.

Usually your server adds extensions itself; use these helpers when the extension inputs are produced on the device (e.g. a PRF salt for client-side encryption that the server must never see).

Every helper returns new JSON: other extensions and fields are preserved, as is a {"publicKey": ...} envelope. They throw IllegalArgumentException if the JSON is not an options object, or is the wrong kind (creation options have rp / user; request options do not).

Extensions are best-effort, as in browsers: a provider or OS that does not support one ignores it, and its output is then null. PRF needs iOS 18+ (Android: provider-dependent, Google Password Manager supports it); largeBlob needs iOS 17+.

Functions

Link copied to clipboard
fun withLargeBlob(creationOptionsJson: String, support: LargeBlobSupport = LargeBlobSupport.Preferred): String

Asks the authenticator to create the passkey with large-blob storage; whether it did is PasskeyRegistration.largeBlobSupported. With LargeBlobSupport.Required, authenticators without large-blob storage are not offered.

Link copied to clipboard
fun withLargeBlobRead(requestOptionsJson: String): String

Reads the passkey's large blob while signing in; the bytes arrive in PasskeyAssertion.largeBlob.

Link copied to clipboard
fun withLargeBlobWrite(requestOptionsJson: String, blob: ByteArray): String

Stores blob in the passkey's large blob while signing in, replacing any previous blob; success is PasskeyAssertion.largeBlobWritten. Replaces a withLargeBlobRead request (read and write are exclusive).

Link copied to clipboard
fun withPrf(creationOptionsJson: String): String

Asks, at registration, whether the new passkey supports PRF; the answer is PasskeyRegistration.prfEnabled. Existing prf inputs (e.g. from withPrf) are kept.

fun withPrf(optionsJson: String, first: ByteArray, second: ByteArray? = null): String

Requests the prf extension evaluated with salts first and optional second.