commonware_cryptography/ed25519/mod.rs
1//! Ed25519 implementation of the [crate::Verifier] and [crate::Signer] traits.
2//!
3//! # Validation Rules (ZIP215)
4//!
5//! This crate follows the [ZIP215](https://zips.z.cash/zip-0215) specification
6//! for Ed25519 signature validation. You can read more about the rationale for
7//! this [here](https://hdevalence.ca/blog/2020-10-04-its-25519am).
8//!
9//! # Example
10//! ```rust
11//! use commonware_cryptography::{ed25519, PrivateKey, PublicKey, Signature, Verifier as _, Signer as _};
12//! use commonware_math::algebra::Random;
13//! use rand::rngs::OsRng;
14//!
15//! // Generate a new private key
16//! let mut signer = ed25519::PrivateKey::random(&mut OsRng);
17//!
18//! // Create a message to sign
19//! let namespace = b"demo";
20//! let msg = b"hello, world!";
21//!
22//! // Sign the message
23//! let signature = signer.sign(namespace, msg);
24//!
25//! // Verify the signature
26//! assert!(signer.public_key().verify(namespace, msg, &signature));
27//! ```
28
29pub mod certificate;
30pub(in crate::ed25519) mod core;
31mod scheme;
32
33pub use scheme::{Batch, PrivateKey, PublicKey, Signature};