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 commonware_utils::test_rng;
14//!
15//! let mut rng = test_rng();
16//!
17//! // Generate a new private key
18//! let mut signer = ed25519::PrivateKey::random(&mut rng);
19//!
20//! // Create a message to sign
21//! let namespace = b"demo";
22//! let msg = b"hello, world!";
23//!
24//! // Sign the message
25//! let signature = signer.sign(namespace, msg);
26//!
27//! // Verify the signature
28//! assert!(signer.public_key().verify(namespace, msg, &signature));
29//! ```
30
31pub mod certificate;
32pub(in crate::ed25519) mod core;
33mod scheme;
34
35pub use scheme::{Batch, PrivateKey, PublicKey, Signature};