[][src]Crate ctap_hmac

An implementation of the CTAP2 protocol over USB.

Example


use ctap_hmac::*;
let device_info = get_devices()?.next().expect("no device connected");
let mut device = FidoDevice::new(&device_info)?;

// This can be omitted if the FIDO device is not configured with a PIN.
let pin = "test";
device.unlock(pin)?;

// In a real application these values would come from the requesting app.
let cred_request = FidoCredentialRequestBuilder::default()
    .rp_id("rp_id")
    .user_name("user_name")
    .build().unwrap();
let cred = device.make_credential(&cred_request)?;
let cred = &&cred;
let assertion_request = FidoAssertionRequestBuilder::default()
    .rp_id("rp_id")
    .credential(cred)
    .build().unwrap();
// In a real application the credential would be stored and used later.
let result = device.get_assertion(&assertion_request);

Modules

extensions

Structs

AuthenticatorOptions
CborErrorCode
FidoAssertionRequest

Request an assertion from the authenticator for a given credential. client_data_hash SHOULD be a SHA256 hash of provided client_data, this is signed and verified as part of the attestation. When not implementing WebAuthN this can be any random 32-byte array.

FidoAssertionRequestBuilder

Builder for FidoAssertionRequest.

FidoCredential

A credential created by a FIDO2 authenticator.

FidoCredentialRequest

Request a new credential from the authenticator. The rp_id should be a stable string used to identify the party for whom the credential is created, for convenience it will be returned with the credential. user_id and user_name are not required when requesting attestations but they MAY be displayed to the user and MAY be stored on the device to be returned with an attestation if the device supports this. client_data_hash SHOULD be a SHA256 hash of provided client_data, this is only used to verify the attestation provided by the authenticator. When not implementing WebAuthN this can be any random 32-byte array.

FidoCredentialRequestBuilder

Builder for FidoCredentialRequest.

FidoDevice

An opened FIDO authenticator.

FidoError

Enums

FidoErrorKind

Functions

get_devices

Looks for any connected HID devices and returns those that support FIDO.

Type Definitions

FidoResult