fido-common: Apply minor formatting and docs fixes

Derive standard traits for several types.
Remove unecessary URLs in doc comments.
Apply rustfmt changes.
dev
Nick Zana 2 years ago
parent 0186b2ee40
commit d5529827ed
No known key found for this signature in database
GPG Key ID: 936524EE913D6538

@ -1,5 +1,5 @@
#[cfg(feature = "serde")] #[cfg(feature = "serde")]
use serde::{Serialize, Deserialize}; use serde::{Deserialize, Serialize};
/// > Attestation statement formats are identified by a string, called an /// > Attestation statement formats are identified by a string, called an
/// > attestation statement format identifier, chosen by the author of the /// > attestation statement format identifier, chosen by the author of the
@ -69,4 +69,3 @@ pub enum FormatIdentifier {
#[cfg_attr(feature = "serde", serde(rename = "none"))] #[cfg_attr(feature = "serde", serde(rename = "none"))]
None, None,
} }

@ -9,7 +9,7 @@ use serde::{Deserialize, Serialize};
/// > enumeration are used for versioning the Authentication /// > enumeration are used for versioning the Authentication
/// > Assertion and attestation structures according to the type of /// > Assertion and attestation structures according to the type of
/// > the authenticator. /// > the authenticator.
#[derive(Debug, Clone, Copy)] #[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[non_exhaustive] #[non_exhaustive]
pub enum Type { pub enum Type {

@ -8,7 +8,7 @@ use serde::{Deserialize, Serialize};
/// > This dictionary is used to supply additional parameters when /// > This dictionary is used to supply additional parameters when
/// > creating a new credential. /// > creating a new credential.
#[derive(Debug)] #[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub struct Parameters { pub struct Parameters {
/// > This member specifies the type of credential to be /// > This member specifies the type of credential to be
@ -57,7 +57,6 @@ pub struct UserEntity {
// Justfication for type from WebAuthn Specs: // Justfication for type from WebAuthn Specs:
// > The user handle of the user account. A user handle is an opaque byte sequence with a // > The user handle of the user account. A user handle is an opaque byte sequence with a
// > maximum size of 64 bytes, and is not meant to be displayed to the user. // > maximum size of 64 bytes, and is not meant to be displayed to the user.
// > <https://w3c.github.io/webauthn/#dom-publickeycredentialuserentity-id/>
// //
// CTAP says that "while an empty account identifier is valid, it has known // CTAP says that "while an empty account identifier is valid, it has known
// interoperability hurdles in practice and platforms are RECOMMENDED to avoid sending // interoperability hurdles in practice and platforms are RECOMMENDED to avoid sending
@ -70,7 +69,6 @@ pub struct UserEntity {
/// > only for display, i.e., aiding the user in determining the /// > only for display, i.e., aiding the user in determining the
/// > difference between user accounts with similar displayNames. For /// > difference between user accounts with similar displayNames. For
/// > example, "alexm", "alex.mueller@example.com" or "+14255551234". /// > example, "alexm", "alex.mueller@example.com" or "+14255551234".
// TODO: Figure out the String metadata encoding per https://w3c.github.io/webauthn/#sctn-strings-langdir
pub name: Option<String>, pub name: Option<String>,
/// > A human-palatable name for the user account, intended only for /// > A human-palatable name for the user account, intended only for
/// > display. For example, "Alex Müller" or "田中倫". The Relying Party /// > display. For example, "Alex Müller" or "田中倫". The Relying Party
@ -89,5 +87,5 @@ pub struct RelyingPartyEntity {
/// > it is a human-palatable identifier for the Relying Party, intended /// > it is a human-palatable identifier for the Relying Party, intended
/// > only for display. For example, "ACME Corporation", "Wonderful /// > only for display. For example, "ACME Corporation", "Wonderful
/// > Widgets, Inc." or "ОАО Примертех". /// > Widgets, Inc." or "ОАО Примертех".
pub name: String, pub name: Option<String>,
} }

@ -383,7 +383,7 @@ pub mod algorithms {
/// > Each constant has a case-sensitive string representation (in quotes), /// > Each constant has a case-sensitive string representation (in quotes),
/// > which is used in the authoritative metadata for FIDO authenticators. /// > which is used in the authoritative metadata for FIDO authenticators.
#[repr(u16)] #[repr(u16)]
#[derive(Debug)] #[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))] #[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
pub enum Signature { pub enum Signature {
#[cfg_attr(feature = "serde", serde(rename = "secp256r1_ecdsa_sha256_raw"))] #[cfg_attr(feature = "serde", serde(rename = "secp256r1_ecdsa_sha256_raw"))]

Loading…
Cancel
Save