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

Crypto.WebAuthn.Encoding.WebAuthnJson

Description

This module contains functions and types for encoding CredentialOptions and decoding Credentials, based on intermediate types that implement the ToJSON and FromJSON types respectively, matching the serialization used by webauthn-json.

Synopsis

Registration

wjEncodeCredentialOptionsRegistration :: CredentialOptions 'Registration -> WJCredentialOptionsRegistration Source #

Encodes a CredentialOptions Registration, which is needed for the registration ceremony. The resulting type from this function can be encoded using toJSON, sent as a response, received by the Relying Party script, passed directly as the publicKey field in the argument to webauthn-json's create() (or equivalent) function. The result of that function can then be decoded using wjDecodeCredentialRegistration.

newtype WJCredentialOptionsRegistration Source #

The intermediate type returned by wjEncodeCredentialOptionsRegistration, equivalent to the PublicKeyCredentialCreationOptions dictionary

wjDecodeCredentialRegistration' Source #

Arguments

:: SupportedAttestationStatementFormats

The attestation statement formats that should be supported. The value of allSupportedFormats can be passed here, but additional or custom formats may also be used if needed

-> WJCredentialRegistration 
-> Either Text (Credential 'Registration 'True) 

Decodes the intermediate WJCredentialRegistration type which can be parsed with fromJSON from the result of webauthn-json's create() (or equivalent) function, to a Credential Registration. This is the continuation of wjEncodeCredentialOptionsRegistration.

Authentication

wjEncodeCredentialOptionsAuthentication :: CredentialOptions 'Authentication -> WJCredentialOptionsAuthentication Source #

Encodes a CredentialOptions Authentication, which is needed for the authentication ceremony. The resulting type from this function can be encoded using toJSON, sent as a response, received by the Relying Party script, parsed as JSON, and passed directly as the publicKey field in the argument to the navigator.credentials.get() function.

newtype WJCredentialOptionsAuthentication Source #

The intermediate type returned by wjEncodeCredentialOptionsAuthentication, equivalent to the PublicKeyCredentialRequestOptions dictionary

wjDecodeCredentialAuthentication :: WJCredentialAuthentication -> Either Text (Credential 'Authentication 'True) Source #

Decodes a RequestedPublicKeyCredential result, corresponding to the PublicKeyCredential interface as returned by the get() method while Verifying an Authentication Assertion

| Decodes the intermediate WJCredentialAuthentication type which can be parsed with fromJSON from the result of webauthn-json's get() (or equivalent) function, to a Credential Authentication True. This is the continuation of wjEncodeCredentialOptionsAuthentication