moid — minimal opaque ID
Mint short, opaque identifiers over a configurable alphabet, with an optional NOID-style check character for typo detection. That's the whole crate.
use ;
// 6 random betanumeric symbols + 1 check character = a 7-char id.
let minter = new;
let id = minter.mint_seeded;
assert!;
Scope: mint only
moid mints and validates. It deliberately does not do the other two things the NOID tool bundles:
- Binding (id → value/metadata) — a stateful store; keep it in your own registry/index.
- Resolution (id → target over HTTP) — a resolver/proxy.
Both require persistent state and platform-specific storage, which would forfeit the dependency-free core that lets moid link into WASM and Extism guests. Out of scope by design.
Configurable alphabet
The radix (and the check-character arithmetic) follows the alphabet's length, so any alphabet works. Presets:
| Preset | Radix | Notes |
|---|---|---|
Alphabet::betanumeric() |
28 | no vowels, no 0/1/l, includes y |
Alphabet::noid_xdigit() |
29 | canonical NOID set — check chars match a standard NOID minter |
Alphabet::crockford32() |
32 | Crockford base32 |
Or Alphabet::new(b"...") with your own.
Entropy
Every mint takes caller-supplied bytes, so the core has no dependencies and runs anywhere. Conveniences:
SeededRng— deterministicxorshift64(dependency-free; tests, reproducibility). Not cryptographic — uniqueness comes from rejection against your taken-set, not entropy.Minter::mint_os()— ambient OS/browser entropy viagetrandom.
Features
std(default) — implementsstd::error::ErrorforMoidError. That's the only thing it gates: the rest of the crate is#![no_std], needing justallocfor theStringit mints. Build withdefault-features = falseto link into ano_stdtarget.os— enablesmint_osviagetrandom(native + WASI).js— browserwasm32-unknown-unknownentropy (impliesos).
Leave os/js off (the default) on Extism guests and exotic wasm hosts, and
supply bytes yourself via mint.
# no_std: dependency-free core, bring-your-own entropy.
= { = "1", = false }
Prefix / shoulder
Minter::with_prefix("dx") prepends a fixed prefix; the check character covers
it, so a corrupted prefix is detected. (This is how an ARK "shoulder" is
built.) It returns Result<Minter, MoidError>, erroring if the prefix has a
character outside the minter's alphabet — such a prefix would let the minter
mint ids that its own validate always rejects.
License
MIT OR Apache-2.0