passkey_types/lib.rs
1//! # Passkey Types
2//!
3//! [![github]](https://github.com/1Password/passkey-rs/tree/main/passkey-types)
4//! [![version]](https://crates.io/crates/passkey-types)
5//! [![documentation]](crate)
6//!
7//! This crate contains the types defined in both the [WebAuthn Level 3] and [CTAP 2.0]
8//! specifications for the operations they define. They are each separated in their own modules.
9//!
10//! ## Webauthn
11//!
12//! In [this](webauthn) module the type names mirror exactly those in the specifications for ease of
13//! navigation. They are defined in a way that allows interoperability with the web types directly
14//! as well as the [JSON encoding] for over network communication.
15//!
16//! ## CTAP 2
17//!
18//! In [this](ctap2) module, since the method inputs are not given explicit names, the `Request` and
19//! `Response` types are defined in separate modules for each operation. These types make use of the
20//! same data structures from the [`webauthn`] module. In some cases though, the types have
21//! different constraits regarding required and optional fields, in which case it is re-defined in
22//! the [`ctap2`] module along with a [`TryFrom`] implementation in either direction.
23//!
24//! [github]: https://img.shields.io/badge/GitHub-1Password%2Fpasskey--rs%2Fpasskey--types-informational?logo=github&style=flat
25//! [version]: https://img.shields.io/crates/v/passkey-types?logo=rust&style=flat
26//! [documentation]: https://img.shields.io/docsrs/passkey-types/latest?logo=docs.rs&style=flat
27//! [WebAuthn Level 3]: https://w3c.github.io/webauthn/
28//! [CTAP 2.0]: https://fidoalliance.org/specs/fido-v2.0-ps-20190130/fido-client-to-authenticator-protocol-v2.0-ps-20190130.html
29//! [JSON encoding]: https://w3c.github.io/webauthn/#typedefdef-publickeycredentialjson
30
31#[macro_use]
32mod utils;
33
34mod passkey;
35
36pub mod ctap2;
37pub mod u2f;
38pub mod webauthn;
39
40// Re-exports
41pub use self::{
42 passkey::{CredentialExtensions, Passkey, StoredHmacSecret},
43 utils::{
44 bytes::{Bytes, NotBase64Encoded},
45 crypto, encoding, rand,
46 },
47};
48
49pub use coset::CoseKey;
50
51#[cfg(feature = "testable")]
52pub use self::passkey::PasskeyBuilder;