23 Commits (d09fd56842568d64775aecdf1101c43620a30ac0)

Author SHA1 Message Date
Nick Zana d09fd56842 fido-common: Add Clone, Eq traits to attestation::Statement 1 year ago
Nick Zana d5a4a03c0d fido-common: derives comparison traits for several types
Derives PartialOrd and Ord for credential::public_key::Parameters
Derives PartialEq, Eq, PartialOrd and Ord for credential::public_key::UserEntity

Also derives clone and copy for some types.
2 years ago
Nick Zana 03fb2f1eb6 fido-common: Derive ordering for credential::Type 2 years ago
Nick Zana 7f98c2779a fido-common: Fix serde_with version to support serde fork 2 years ago
Nick Zana cfc7856894 Patch serde to github.com/AndrewScull/serde fork
serde_derive does not currently support using integer values as map
keys. CTAP uses integer values for various CBOR map keys. In order to
properly serialize and deserialize types for the CTAP protocol, a forked
version of serde from a pull request that adds support for renaming
field keys as integer types is used.

Tracked in <https://github.com/serde-rs/serde/pull/2209>
2 years ago
Nick Zana 6ef8cee4de fido-common: Add attestation::Statement data type
Attestation statements are returned as part of the CBOR maps returned by
authenticators in response to authenticatorMakeCredential and
authenticatorGetAssertion commands.

The attestation statements defined by WebAuthn come in various formats.
However, the format identifier is not part of the attestation statement
field in the CBOR map (0x03 attStmt), but rather as a distinct format
field (fmt 0x01).

Normally, this could be worked around with an externally tagged enum,
but using integer tags is not currently supported by serde. By marking
the enum instead as untagged, this should ideally mean that serde can
differentiate between the enum variants by the fields of the attestation
statement, which is itself a CBOR map.

Otherwise, we could always revert to just raw byte sequences for the
attestation statements during (de)serialization and push validating
these statements onto another part of the code.
2 years ago
Nick Zana a0bd1c9e01 fido-common: De/serialize credential::public_key::UserEntity::id as bytes
Uses serde_with to serialize and deseriailze the UserEntity::id field as
a byte string instead of a sequence (array) of bytes.
2 years ago
Nick Zana 42044f2a46 fido-common: Implement serde for credential::public_key::Descriptor
Adds serde_with as a dependency in order to serialize Descriptor::id as
bytes instead of as a sequence.

Enables cfg_eval feature to enable conditional usage of serde_with
behind the "serde" feature flag for the fido-common crate.
2 years ago
Nick Zana 576addac1f fido-common: Implement Deserialize for authenticator::Data
Requires bitflags to parse CTAP "flags" field of AuthenticatorData.

Implements Deserialize for custom CTAP format for authenticator::Data
byte layout.
2 years ago
Nick Zana 90f75b88d8 fido-common: Implement Deserialize for attestation::CredentialData
Relies on ciborium as a dependency because coset requires one of
ciborium's error types. It should be possible to remove this type's
dependence on ciborium.
2 years ago
Nick Zana ce4150d184 fido-common: Add new backup flags to authenticator::Data
As of the CTAP 2.2 revision, authenticator::Data now contains the
backup_eligibility and backup_state flags.
2 years ago
Nick Zana 6e7d134b6d fido-common: Replace authenticator data bools with enums
Replaces authenticator::Data's user_is_verified and user_is_present
boolean flags with clearer UserVerification and UserPresence enums.
2 years ago
Nick Zana e362a5c237 fido-common: Move attestation::enterprise to its own file 2 years ago
Nick Zana 39a5759d12 fido-common: fix credential::public_key::Parameters signature type
The credential::public_key::Parameters field algorithm designates the
public key algorithm represented by the parameter. This replaces the
incorrect registry::algorithms::Signature type with the correct
coset::iana::Algorithm type and adds Serialization/Deserialization
methods for this type.
2 years ago
Nick Zana 1e8a4f21cf fido_common: derive ordering for UserVerify
Necessary to include UserVerify in the BTreeSet specifying the available
user verification modalities.
2 years ago
Nick Zana 8e1b175136 remove bounded_vec from fido_common crate
bounded_vec crate was used to enforce constraints on size of various
fields as defined by webauthn or ctap specs. However, it does not
properly support zero-sized lower bounds.
2 years ago
Nick Zana c1c95bafc1 fido-common: Make extensions::Identifier de/serializable 2 years ago
Nick Zana 2bb574e62b fido-common: add enums for credential backup
Used in by the authenticator in authenticator::Data to convey
information about the backup state of credentials.
2 years ago
Nick Zana 9351d6ea6c format fido-common/Cargo.toml 2 years ago
Nick Zana 0fb2487154
Move several types from ctap2-proto to fido-common 2 years ago
Nick Zana 0b03bda84b
replace usage of Hash{Set, Map} with BTree 2 years ago
Nick Zana d5529827ed
fido-common: Apply minor formatting and docs fixes
Derive standard traits for several types.
Remove unecessary URLs in doc comments.
Apply rustfmt changes.
2 years ago
Nick Zana 1ea1e3b740
Add fido-common crate
fido-common contains data types used by all FIDO specifications.
2 years ago