Weave documentation
Strand Id Encoding

Usage

Encode and decode 32-byte Strand keys with the actual public functions.

Round-trip a Strand key

use strand_id_encoding::{decode, encode, decode_identity, encode_identity, EntityType};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let key = [42u8; 32]; // Public test fixture, not a signing secret.
    assert_eq!(decode(&encode(&key))?, key);
    let qualified = encode_identity(&key, EntityType::Strand, "l1fe");
    assert_eq!(decode_identity(&qualified)?, key);
    Ok(())
}

encode/decode use z-base32. Use encode_hex/decode_hex when the boundary explicitly requires hexadecimal. Qualifying bytes as an agent or organization does not create, authenticate or register that entity.

Source reference

Exact declarations and source provenance · Package features and manifest.

On this page