mailio_id (mailio v0.2.0)
Identifier generation.
Two families of ids:
- Allocated ids (account, mailbox, thread, identity, ...) are ULIDs: lexicographically sortable, 128-bit, time-ordered.
- Content-addressed ids (email, blob, msgid lookup) are derived from a SHA-256 of the content so the same bytes always map to the same id, making ingestion idempotent.
Summary
Functions
Lowercase base32 (Crockford) of an arbitrary binary, no padding.
Lowercase hex SHA-256, used as the blob/<hex> doc id segment.
Public blob id: sha256-<hex> of the content.
Email id: lowercase base32 of SHA-256(raw message), truncated to 26 chars (130 bits). Same raw bytes -> same email id.
Hash of a Message-ID header value for the msgid/<hash> lookup doc.
Generate a ULID: 48-bit millisecond timestamp + 80 bits of randomness, Crockford base32, 26 chars, sortable by creation time.
Functions
-spec account_id() -> binary().
Lowercase base32 (Crockford) of an arbitrary binary, no padding.
Lowercase hex SHA-256, used as the blob/<hex> doc id segment.
Public blob id: sha256-<hex> of the content.
Email id: lowercase base32 of SHA-256(raw message), truncated to 26 chars (130 bits). Same raw bytes -> same email id.
-spec grant_id() -> binary().
-spec identity_id() -> binary().
-spec job_id() -> binary().
-spec mailbox_id() -> binary().
Hash of a Message-ID header value for the msgid/<hash> lookup doc.
-spec rule_id() -> binary().
-spec submission_id() -> binary().
-spec thread_id() -> binary().
-spec ulid() -> binary().
Generate a ULID: 48-bit millisecond timestamp + 80 bits of randomness, Crockford base32, 26 chars, sortable by creation time.