All checks were successful
docs / build-and-deploy (push) Successful in 2s
Crypto (#19): add the OS cryptographically-secure random surface (random_bytes/random_hex/random_u32, reading /dev/urandom) and a standard base64 encoder, completing the library alongside the existing SHA-256/ HMAC-SHA256/verify_hmac/hex/ct_equal. All pure integer IR, C-free. Uuid (#16): a new namespace for stable, collision-free IDs — v4 (random) and v7 (time-ordered) generation, plus parse/is_valid/to_text/equals/nil. UUIDs are canonical lowercase 36-char strings; v4 and v7's random tail draw from the crypto CSPRNG, so both carry the documented determinism caveat (mint at the edges, never inside lockstep simulation). Reuses the crypto prelude's fn_secure_bytes / fn_hex_encode. - examples/library/{crypto,uuid}.ludic: known-answer vectors (SHA-256, HMAC, base64 per RFC 4231/4648) and structural invariants (uuid version/variant bits, parse/equals), wired into `x test` (now 51 passed). - docs: per-symbol pages for every new method + a new Uuid section; inventory and impl-vs-docs coverage check pass. - seed regenerated; `x bootstrap-cfree` fixpoint holds. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1.2 KiB
1.2 KiB
| id | name | category | kind | tokens | sig | tip | order | ns | member |
|---|---|---|---|---|---|---|---|---|---|
| uuid-parse | Uuid.parse | uuid | namespace-method | Uuid.parse | Uuid.parse(s) -> string | Normalise an untrusted string to a lowercase UUID, or the nil UUID. | 5 | Uuid | parse |
Normalises an untrusted string: if s is a well-formed UUID it returns the same value in canonical lowercase form; if it is not, it returns the nil UUID. This never faults on garbage, so it is safe to call on data that arrived from a file, a network peer, or a mod. When you need to reject bad input rather than fold it to nil, gate on Uuid.is_valid first.
Parsing accepts either case and yields the lowercase canonical form, which is what the rest of the library produces — so a parsed ID compares equal (with ==) to a freshly generated one of the same value.
Parameters:
s— the string to validate and normalise
program Parse {
entry {
let id = Uuid.parse("550E8400-E29B-41D4-A716-446655440000")
print(id[0..8]) # 550e8400 — lowercased
if Uuid.parse("nope") == Uuid.nil() { print(1) }
}
}