DigestCodec
DigestCodec<
Brand> =object
Defined in: src/codecs/digest/index.ts:57
Codec returned by createDigestId.
Maps caller material to a stable public ID under one Digest key: the same material always yields the same ID, and the material cannot be recovered from the ID (equality leakage is the intended property).
digestis async (WebCrypto HMAC).is,parse,safeParse,toJsonSchema, and~standardare synchronous and require no key material — they validate prefix and base32 shape only.- There is no reverse method (
unwrap,verify,extractTimestamp) — the codec is one-way by definition.
Type Parameters
Section titled “Type Parameters”Brand extends string
Properties
Section titled “Properties”~standard
Section titled “~standard”
readonly~standard:StandardSchemaProps<Brand>
Defined in: src/codecs/digest/index.ts:74
Standard Schema validate entry point.
Methods
Section titled “Methods”digest()
Section titled “digest()”digest(
material):Promise<Id<Brand>>
Defined in: src/codecs/digest/index.ts:64
Digest material into a stable canonical Id.
The same (brand, ns, key, material) tuple always returns the same ID.
Strings are UTF-8 encoded; byte arrays are used as-is.
Parameters
Section titled “Parameters”material
Section titled “material”string | Uint8Array<ArrayBufferLike>
Returns
Section titled “Returns”Promise<Id<Brand>>
fromUUID()
Section titled “fromUUID()”fromUUID(
value):Id<Brand>
Defined in: src/codecs/digest/index.ts:86
Parses a UUID string into an Id<Brand>. Accepts case-insensitive 8-4-4-4-12
hyphenated form only. Throws IdsError with code: "invalid_id" on bad input.
See ADR-0024.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Id<Brand>
is(
value):value is Id<Brand>
Defined in: src/codecs/digest/index.ts:66
Strict type guard: true only for already-canonical Id<Brand> strings.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”value is Id<Brand>
parse()
Section titled “parse()”parse(
value):Id<Brand>
Defined in: src/codecs/digest/index.ts:68
Normalise to canonical form, or throw on parse failure.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”Id<Brand>
safeFromUUID()
Section titled “safeFromUUID()”safeFromUUID(
value):ParseResult<Brand>
Defined in: src/codecs/digest/index.ts:91
Non-throwing UUID parse. Returns { ok: true, id } or
{ ok: false, error: "not_string" | "invalid_uuid" }. See ADR-0024.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”ParseResult<Brand>
safeParse()
Section titled “safeParse()”safeParse(
value):ParseResult<Brand>
Defined in: src/codecs/digest/index.ts:70
Normalise to canonical form, or return { ok: false, error }.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”ParseResult<Brand>
toJsonSchema()
Section titled “toJsonSchema()”toJsonSchema():
JsonSchema
Defined in: src/codecs/digest/index.ts:72
JSON Schema for the canonical wire form (pattern is canonical-only).
Returns
Section titled “Returns”toUUID()
Section titled “toUUID()”toUUID(
id):string
Defined in: src/codecs/digest/index.ts:80
Converts a trusted Id<Brand> to an RFC 9562 canonical (lowercase, hyphenated)
UUID string by reinterpreting the 16-byte payload verbatim. Total — cannot fail.
Returns a plain string (brand is shed). See ADR-0024.
Parameters
Section titled “Parameters”Id<Brand>
Returns
Section titled “Returns”string