webauthn-0.4.1.2: Relying party (server) implementation of the WebAuthn 2 specification
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

Crypto.WebAuthn.Encoding.Binary

Description

Certain parts of the specification require that data is decoded/encoded from/to a binary form. This module holds such functions.

Synopsis

CollectedClientData

encodeRawCollectedClientData :: forall (c :: CeremonyKind) raw. SingI c => CollectedClientData c raw -> CollectedClientData c 'True Source #

(spec) Encodes all raw fields of a CollectedClientData into ccdRawData using the JSON-compatible serialization of client data This function is useful for testing.

decodeCollectedClientData :: forall (c :: CeremonyKind). SingI c => ByteString -> Either Text (CollectedClientData c 'True) Source #

(spec) Decodes a CollectedClientData from a ByteString. This is needed to parse the clientDataJSON field in the AuthenticatorResponse structure, which is used for both attestation and assertion.

AttestedCredentialData

AuthenticatorData

encodeRawAuthenticatorData :: forall (c :: CeremonyKind) raw. SingI c => AuthenticatorData c raw -> AuthenticatorData c 'True Source #

(spec) Encodes all raw-containing fields of a AuthenticatorData, particularly adAttestedCredentialData, and the AuthenticatorData itself into adRawData. This function is needed for an authenticator implementation.

decodeAuthenticatorData :: forall (c :: CeremonyKind). SingI c => ByteString -> Either Text (AuthenticatorData c 'True) Source #

(spec) Decodes a AuthenticatorData from a ByteString. This is needed to parse a webauthn clients authenticatorData field in the AuthenticatorAssertionResponse structure.

AttestationObject

encodeAttestationObject :: AttestationObject 'True -> ByteString Source #

(spec) Encodes an AttestationObject as a ByteString. This is needed by the client side to generate a valid JSON response.

decodeAttestationObject :: SupportedAttestationStatementFormats -> ByteString -> Either Text (AttestationObject 'True) Source #

(spec) Decodes a AttestationObject from a ByteString. This is needed to parse a webauthn clients attestationObject field in the AuthenticatorAttestationResponse structure This function takes a SupportedAttestationStatementFormats argument to indicate which attestation statement formats are supported. structure.

AuthenticatorResponse

Credential

encodeRawCredential :: Credential c raw -> Credential c 'True Source #

Encodes all raw fields of an Credential.

stripRawCredential :: Credential c raw -> Credential c 'False Source #

Removes all raw fields of an Credential.