Expand description
The c255b3 signature scheme: deterministic Schnorr signatures with Curve25519 and Blake3.
Example Usage
Generating
To sign a message you first need a SecretKey.
use c255b3::SecretKey;
use rand::{RngCore,rngs::OsRng};
// Generate 256 random bits.
let mut csprng = OsRng;
let mut raw_key = [0u8; 32];
csprng.fill_bytes(&mut raw_key);
// Create a secret key from those bits.
let secret_key = SecretKey::from_bits(&raw_key);
Signing
Once generated, the secret key can produce a Signature for a messages:
use c255b3::{Domain,Signature};
let msg: &[u8] = b"Did gyre and gimble in the wabe:";
let domain = Domain(b"test domain for documentation...");
let sig: Signature = secret_key.sign_domain(domain, msg);
Verifying
Then we can derive the PublicKey, and check the signature.
use c255b3::PublicKey;
let public_key: PublicKey = secret_key.derive_public();
assert!(public_key.verify_domain(domain, &sig, msg).is_ok());
Structs
- A signature domain.
- A c25519 keypair, to sign or verify messages.
- A c25519 public key to verify signatures.
- A c255b3 secret key to sign messages with.
- A c255b3 signature.
Enums
- The errors we can encounter while working with c255b3 keys and signatures.