ctap2-proto: Derive common traits for credential::{make, get}

Derives Debug and other common traits for the credential::{make, get}
types.
main
Nick Zana 2 years ago
parent 754fc51510
commit 12d6f7fe51

@ -3,6 +3,7 @@ use crate::{authenticator::client_pin::AuthProtocolVersion, extensions};
use fido_common::credential::public_key;
use std::{collections::BTreeMap, usize};
#[derive(Debug)]
pub enum Error {
OperationDenied,
PinNotSet,
@ -20,6 +21,7 @@ pub enum Error {
/// > The following option keys are defined for use in
/// > [`assertion::get::Request`]'s `options` parameter.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub enum OptionKey {
/// > user presence: Instructs the authenticator to require user consent
/// > to complete the operation.
@ -31,7 +33,7 @@ pub enum OptionKey {
}
/// Request parameters for [`Ctap2Device::get_assertion`] operation.
#[derive(Clone, Copy)]
#[derive(Debug, Clone, Copy)]
pub struct Request<'a> {
/// > relying party identifier
pub relying_party_id: &'a str,
@ -54,6 +56,7 @@ pub struct Request<'a> {
}
/// Response structure for [`Ctap2Device::get_assertion`] operation.
#[derive(Debug, Clone)]
pub struct Response {
/// > PublicKeyCredentialDescriptor structure containing the credential
/// > identifier whose private key was used to generate the assertion.

@ -5,6 +5,7 @@ use crate::{
use fido_common::{attestation, credential::public_key};
use std::collections::BTreeMap;
#[derive(Debug)]
pub enum Error {
OperationDenied,
PinNotSet,
@ -24,7 +25,7 @@ pub enum Error {
/// > The following option keys are defined for use in
/// > `authenticatorMakeCredential`'s `options` parameter.
#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub enum OptionKey {
/// > Specifies whether this credential is to be discoverable or
/// > not.
@ -40,7 +41,7 @@ pub enum OptionKey {
}
/// Input parameters for [`Ctap2Device::make_credential`] operation.
#[derive(Clone, Copy)]
#[derive(Debug, Clone, Copy)]
pub struct Request<'a> {
/// > Hash of the ClientData contextual binding specified by host.
pub client_data_hash: &'a Sha256Hash,
@ -84,6 +85,7 @@ pub struct Request<'a> {
pub enterprise_attestation: Option<attestation::enterprise::Kind>,
}
#[derive(Debug)]
pub struct Response {
pub format: fido_common::attestation::FormatIdentifier,
pub authenticator_data: authenticator::Data,

Loading…
Cancel
Save