//! The building blocks of atproto spaces, as `spec/SPACES.md` specifies //! them: P-256 `did:key`s and the KEM shared secret, HPKE's secret export //! (`key`), LtHash (`lthash`), the space repo's commit (`commit`), the MACs //! of commits and records and the `Accept-Signature` asking for them //! (`mac`), a space credential's HTTP Message Signature (`signature`), and //! STAR archives with the `atproto-space-repo` profile (`star`). Pure: it //! does no I/O. //! //! `sf` reads and writes the RFC 9651 structured fields the headers are. #![forbid(unsafe_code)] pub mod commit; pub mod key; pub mod lthash; pub mod mac; pub mod sf; pub mod signature; pub mod space_ref; pub mod star; pub use commit::Commit; pub use key::{KemKey, PublicKey, SharedSecret}; pub use lthash::LtHash; pub use mac::{MacHeaders, Profile}; pub use space_ref::SpaceRef; /// Why an input was refused: a key that is no P-256 key, a signature that /// does not verify, an archive with a fault. The text says which. #[derive(Clone, Debug, PartialEq, Eq)] pub struct Error(String); impl Error { pub(crate) fn new(why: impl Into) -> Error { Error(why.into()) } } impl std::fmt::Display for Error { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.write_str(&self.0) } } impl std::error::Error for Error {}