Crate ctap

source ·
Expand description

An implementation of the CTAP2 protocol over USB.

Example

let devices = ctap::get_devices()?;
let device_info = &devices[0];
let mut device = ctap::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 rp_id = "rp_id";
let user_id = [0];
let user_name = "user_name";
let client_data_hash = [0; 32];
let cred = device.make_credential(
    rp_id,
    &user_id,
    user_name,
    &client_data_hash
)?;

// In a real application the credential would be stored and used later.
let result = device.get_assertion(&cred, &client_data_hash);

Structs

A credential created by a FIDO2 authenticator.
An opened FIDO authenticator.

Enums

Functions

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

Type Definitions