WeaveDocs
Strand Id Encoding

Usage

Using `strand-id-encoding` — z-base-32 and hex encoding for strand identifiers with entity prefix handling.

Purpose

z-base-32 and hex strand identity encoding with entity prefixes and compatibility helpers.

This page follows the real source shape for Strand Id Encoding and explains the workflow a developer is likely to use first.

Developer workflow

Start from the smallest constructor or builder, perform one meaningful operation, inspect the returned state, then add the relevant policy, storage, or network integration. The examples below should be expanded whenever the crate API changes.

Primary types to know

  • StrandId — libs/strand-id-encoding/src/lib.rs
  • StrandIdentity — libs/strand-id-encoding/src/lib.rs
  • EntityType — libs/strand-id-encoding/src/lib.rs
  • StrandIdError — libs/strand-id-encoding/src/lib.rs

Example shape

use strand_id_encoding::{encode_id, decode_id};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let raw_id: [u8; 32] = [42u8; 32];
    let s = encode_id(&raw_id);
    println!("encoded: {s}");

    let round_trip = decode_id(&s)?;
    assert_eq!(round_trip, raw_id);
    Ok(())
}