Skip to main content

coz_rs/
lib.rs

1//! # Coz
2//!
3//! A Rust implementation of the [Coz](https://github.com/Cyphrme/Coz)
4//! cryptographic JSON messaging specification.
5//!
6//! ## Example
7//!
8//! ```ignore
9//! use coz::{SigningKey, ES256, PayBuilder};
10//!
11//! let key = SigningKey::<ES256>::generate();
12//! let coz = PayBuilder::new()
13//!     .msg("Hello, Coz!")
14//!     .sign(&key)?;
15//! ```
16
17#![warn(missing_docs)]
18#![warn(rust_2018_idioms)]
19#![forbid(unsafe_code)]
20
21pub mod alg;
22pub mod b64;
23pub mod canon;
24pub mod coz;
25pub mod error;
26#[cfg(test)]
27mod golden;
28pub mod key;
29pub mod revoke;
30
31pub use alg::{Alg, Algorithm, ES256, ES384, ES512, Ed25519, HashAlg};
32// Re-export crypto primitives for downstream crates
33pub use base64ct;
34pub use canon::{
35    CZD_CANON, Cad, Czd, KEY_CANON, canon, canonical, canonical_hash, canonical_hash_for_alg,
36    czd_for_alg,
37};
38pub use coz::{Coz, CozJson, Pay, PayBuilder, sign_json, verify_json};
39pub use error::{Error, Result};
40pub use key::{
41    KeyPair, SigningKey, Thumbprint, VerifyingKey, compute_thumbprint_for_alg,
42    signing_key_from_bytes,
43};
44pub use revoke::{RVK_MAX_SIZE, is_valid_rvk, revoke, revoke_json, validate_revoke_size};
45pub use {digest, sha2};