Skip to content
diaryx-orgPublic

About

Opaque-ID minter

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

moid

CI crates.io docs.rs license

A cargo workspace for moid — minimal opaque ID: mint short, opaque identifiers over a configurable alphabet, with an optional NOID-style check character. Mint-only — binding and resolution are deliberately out of scope.

Layout

  • moid/ — the library (published to crates.io). Dependency-free core; getrandom is optional behind the os/js features. See moid/README.md for the full API and rationale.
  • moid-cli/ — a small command-line companion (the installed binary is moid). Published to crates.io: cargo install moid-cli.
  • moid-ts/ — a hand-written TypeScript port (published to npm as moid). Zero dependencies, ESM, no wasm. See moid-ts/README.md.
  • parity/ — the harness that keeps the two implementations honest. Never published.

Parity

The port is pinned to the crate in both directions, and CI fails on either. cargo run -p moid-parity records what the crate does into moid-ts/test/vectors.json, which is committed and which the TypeScript suite asserts against; npm run vectors:ts mints ids on the TypeScript side that cargo test -p moid-parity hands back to the crate to re-mint and validate. Regenerating either artifact must be a no-op — a diff means one side moved without the other.

Agreement alone would not prove much, so moid-ts/test/reference.test.ts also checks the port against check characters computed by hand from the prose definition and against a second naive implementation built on different primitives. Details in moid-ts/README.md.

CLI

$ cargo run -p moid-cli -- mint --seed 42
0hscptb
$ cargo run -p moid-cli -- mint --prefix dx --seed 7   # an ARK-style shoulder
dx0vn4188
$ cargo run -p moid-cli -- validate 0hscptb
valid
$ cargo run -p moid-cli -- alphabets
noid-xdigit  radix 29  0123456789bcdfghjkmnpqrstvwxz  (default)
betanumeric  radix 28  bcdfghjkmnpqrstvwxyz23456789
crockford32  radix 32  0123456789ABCDEFGHJKMNPQRSTVWXYZ

mint (with --len, --no-check, --prefix, --alphabet/--chars, --seed, -n), validate, check, and alphabets.

License

MIT OR Apache-2.0.

About

Opaque-ID minter

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages