Weave documentation
L1fe Crypto

Usage

Fallible key generation and byte-oriented signing with l1fe-crypto.

Sign and verify locally

The compatibility crate exports free functions. key_pair returns Result<KeyPair>; sign accepts message bytes and the 64-byte secret-key field. There is no KeyPair::generate constructor.

use l1fe_crypto::{key_pair, sign, verify};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let keys = key_pair(None)?;
    let message = b"local signature example";
    let signature = sign(message, &keys.secret_key);
    assert!(verify(message, &signature, &keys.public_key));
    Ok(())
}

encryption_key_pair, encrypt, decrypt, and random_bytes also return Result in this crate. Handle those errors rather than copying the infallible/optional return conventions from weave-crypto. Keep secret-key fields out of logs and serialized application responses.

Source reference

Exact declarations and source provenance · Package features and manifest.

On this page