Skip to content

Protocol

Ondřej Misák edited this page Nov 23, 2026 · 7 revisions

Nylzo protocol v3

This page specifies Nylzo protocol v3 for people who implement a compatible client or server. Clients and servers speak only this version; §15 says how they answer the formats of earlier versions. Three wire details are marked [detail]: the canonical encoding of meta, the content of X-Nylzo-Policy, and the proof-of-work token format.

The key words MUST, MUST NOT, SHOULD and MAY are to be read as in RFC 2119.

Test vectors for every client-side construction live in spec/vectors.json, including a negative case for every check a reader makes. Both reference cores (internal/core in Go, web/core in TypeScript) MUST pass them, and both MUST pass the ristretto255 test vectors of RFC 9807 Appendix C for the OPAQUE steps they run (§2.1).

1. Primitives

Symbol Definition
h(x) SHA-256(x), 32 bytes
HKDF HKDF-SHA-256 (RFC 5869); Extract(salt, IKM) and Expand(PRK, info, L)
AEAD AES-256-GCM, 96-bit IV, 128-bit tag (NIST SP 800-38D)
scrypt RFC 7914
HMAC HMAC-SHA-256 (RFC 2104)
Ed25519 EdDSA over edwards25519 (RFC 8032), 32-byte seed, 32-byte public key, 64-byte signature
HPKE RFC 9180 base mode with the KEM MLKEM768-X25519 (X-Wing) of draft-ietf-hpke-pq, HKDF-SHA256 and AES-256-GCM, only to wrap the expiry share in transit (§5.6)
OPAQUE OPAQUE-3DH (RFC 9807) over ristretto255 (RFC 9496) with the OPRF ristretto255-SHA512 of RFC 9497, configured in §2.1
CSPRNG crypto.getRandomValues in browsers, crypto/rand in Go
a || b byte concatenation
u8(n), u16be(n), u32be(n), u64be(n) unsigned integers of 1 byte and big-endian integers of 2, 4 and 8 bytes

Clients use no other cryptographic construction. Ed25519 only signs requests (§5.5), HPKE only carries the expiry share (§5.6), and OPAQUE only checks the passphrase and gives the key P (§2.1); SHA-512, HKDF-SHA-512 and HMAC-SHA-512 run only inside OPAQUE. Content encryption stays symmetric, and flags bit 0 is reserved for a future HPKE recipient mode.

1.1 base64url

All binary values carried in URLs, headers and JSON use base64url (RFC 4648 §5) without padding and in canonical form: a decoder MUST reject a string that is not the exact encoding of its decoded bytes. The unused low bits of the final character MUST be zero, and the length MUST match the expected byte length exactly.

Value Bytes Characters Allowed final characters
id 16 22 A Q g w
S, H, L, public keys, hashes 32 43 A E I M Q U Y c g k o s w 0 4 8
id token (§5.4) 44 59 A E I M Q U Y c g k o s w 0 4 8
challenge (§5.5) 36 48 any
signature, registration response, KE3 (§2.1) 64 86 A Q g w
share key after its suite (§5.6) 1216 1622 A Q g w
wrapped share (§5.6) 1168 1558 A Q g w
KE1 (§2.1) 96 128 any
registration record (§2.1) 192 256 any
KE2 (§2.1) 320 427 A E I M Q U Y c g k o s w 0 4 8

A registration request (§2.1) is 32 bytes, like a public key. A canonical 43-character encoding of 32 bytes never ends in - or _.

1.2 Identifiers and secrets

  • id: 16 bytes from the server CSPRNG, issued together with an id token by GET /api/v1/instance (§5.4, §6.6). In a link it is part of the fragment, so the browser never puts it in the address of a page it requests. It appears in API paths and never in logs.
  • S: 32 bytes from the client CSPRNG. Appears only in the URL fragment. The server MUST never receive S.
  • H: the SHA-256 commitment to the stored object (§3), in the URL fragment. It tells the reader which object the sender made.
  • E: the expiry share, 32 bytes that the server derives from the epoch key of the last minute before the message's deadline (§5.6). The server never stores it and erases the epoch key at the deadline, the instant at which the message also expires. It travels only sealed to a one-time hybrid post-quantum key of the client.
  • M: 32 bytes from the client CSPRNG, the seed of the manage key. The client sends the public key pk_M at creation and signs cancel and status with M; M never leaves the client. A browser client lets WebCrypto generate the manage key pair as non-extractable, so M never exists as bytes in the page, and keeps it only as that CryptoKey.
  • L: 32 bytes from the server CSPRNG (lease token), issued by claim.

2. Key derivation (client)

Inputs: id (16 raw bytes), S (32 bytes), kdf_id (from the URL fragment, §4), optional passphrase, the export_key of OPAQUE (§2.1) and E (from the server, §5.6).

hsalt   = SHA-256("nylzo/v3/hkdf-salt" || id)                            32 bytes
PRK_S   = HKDF-Extract(salt = hsalt, IKM = S)
R       = HKDF-Expand(PRK_S,   "nylzo/v3/read",       32)               seed of the read key
salt_pw = HKDF-SHA-256(salt = empty, IKM = S, info = "nylzo/v3/pw-salt", 32)    passphrase salt (§2.1)
P       = export_key of the OPAQUE registration or handshake (§2.1)     64 bytes
PRK_SPE = HKDF-Extract(salt = hsalt, IKM = S || P || E)
K       = HKDF-Expand(PRK_SPE, "nylzo/v3/content",    32)               content key
K_c     = HKDF-Expand(PRK_SPE, "nylzo/v3/commitment", 32)               commitment key
pk_X    = Ed25519 public key of seed X (RFC 8032 §5.1.5), for X in R, M
  • P comes from OPAQUE for every message, also without a passphrase, so K and K_c need the server's OPRF answer and the share E besides S (§5.6).
  • salt_pw depends on S alone, because a sender sends its registration request with the instance request that issues the id (§6.6), before it knows the id. S is fresh for every message, and so is salt_pw.
  • pw is the passphrase with every space separator replaced by the space U+0020, then normalised to Unicode NFC and encoded as UTF-8. The space separators are the 17 code points of general category Zs in Unicode 15.1: U+0020, U+00A0, U+1680, U+2000 to U+200A, U+202F, U+205F and U+3000, so a reader may type any of them where the sender typed another. Leading, trailing and repeated spaces stay as they are, and so do tabs, line breaks and zero-width characters. Derivation accepts any well-formed passphrase of at most 65,503 bytes after normalisation, so a recipient can always open a message and the vectors stay valid. The limit leaves room for salt_pw in the OPRF input, whose length Finalize encodes in two bytes (RFC 9497 §3.3.1); a client refuses a longer passphrase before it sends anything. A client MUST refuse to create a message with a passphrase that fails any of the checks below. Folding maps the ASCII capitals A to Z to their lowercase letters and nothing else; separators are space, -, _ and .. Check 1 reads the passphrase as given and the others read it after normalisation. The checks run in this order, so both cores name the same problem:
    1. every code point is assigned in Unicode 15.1 (property Age of the Unicode Character Database at most 15.1), because normalisation is stable only for assigned characters and a client of an older Unicode version could otherwise derive another key. Both cores carry the same table of the assigned ranges; spec/vectors.json holds its SHA-256;
    2. at least 15 characters (Unicode code points);
    3. at least 6 distinct characters after folding;
    4. not a repetition of a shorter part: there is no u with 1 <= u <= n/2 such that every character at position i >= u equals the one at i - u, where n is the length after folding;
    5. after folding and removing separators, not a contiguous part of abcdefghijklmnopqrstuvwxyz, 01234567890123456789, qwertyuiopasdfghjklzxcvbnm or qwertzuiopasdfghjklyxcvbnm, read forwards or backwards;
    6. at least 15 characters left after folding and removing every nylzo;
    7. after folding, not in the list of common passwords: the 328 passwords of at least 15 characters from the UK NCSC list of the 100,000 most used passwords (Open Government Licence v3.0), lowercased, one per line in rank order, whose SHA-256 the vectors carry. A client SHOULD warn unless the passphrase has at least 16 characters and at least 4 words, where words are separated by whitespace or -. Both cores expose this check and a generator that writes words of the client's language: en, cs, de, es, fr, id, it, ja, pl, pt-BR, sk or zh-Hans. Each language has a list of 2048 distinct words. Both cores carry the same lists (the files in internal/core/keys/words, whose sources and licenses SOURCES.md there names), and spec/vectors.json holds the SHA-256 of each list, taken over its words joined by line feeds with a final line feed. For each word the generator reads two bytes from the CSPRNG and takes the word at the index of their big-endian value modulo 2048, so each word adds 11 bits. A passphrase is 5 words joined by - (55 bits). Japanese joins its 5 hiragana words with the ideographic space U+3000, which pw turns into U+0020. Simplified Chinese joins 6 two-character words with a space (66 bits), the fewest that reach 15 characters. The words of the other lists use only the letters a to z. A generated passphrase passes every check above; a generator that drew one that does not draws again. A client offers the generated passphrase as its default whenever a sender protects a message; a passphrase the sender types instead must pass the checks.
  • The passphrase MUST be well-formed Unicode. A core rejects invalid UTF-8 or a lone surrogate before it derives anything, so two cores never derive different keys from the same input.
  • The string literals are ASCII without a terminating NUL. info strings are passed to HKDF-Expand verbatim.
  • S || P || E has 128 bytes for every profile, so the concatenation is unambiguous.
  • Profile 3 stretches the OPRF output with scrypt N = 2^18, r = 8, p = 1 (§2.1), which needs 256 MiB. A reader whose device cannot run the derivation is told so and can open the link on another device.
  • kdf_id 1 is retired and MUST NOT be assigned again. A link or envelope with kdf_id 1 is invalid.
  • kdf_id 2 is reserved and MUST NOT be assigned again. A client MUST NOT derive anything for kdf_id 2 (§4).
  • kdf_id 4 is reserved for Argon2id through Web Crypto. A client MUST NOT use it before this document assigns its parameters.
  • A reader that offers to burn a message it has read keeps password (§2.1) in memory until the message can no longer be burned or the page is left, because every burn needs a handshake of its own; like every secret here, it never goes to browser storage.
  • K and K_c MUST never leave the client. In the browser the client MUST derive them as non-extractable CryptoKeys (deriveKey, extractable = false), K for AES-GCM and K_c for HMAC, and use deriveBits only for R and salt_pw. A reader keeps S and P as bytes until the claim response brings E, and wipes them once K and K_c exist.
  • pk_R and pk_M are sent at creation. R and M never leave the client; every authenticated request carries a public key and a signature over a single-use server challenge instead (§5.5), so a recorded request cannot be replayed.
  • Every creation carries a registration record and every claim and every burn follows a handshake, also for kdf_id 0, so neither the requests nor the server's work show whether a message has a passphrase; the time a client spends on scrypt between them can (§13).
  • kdf_id for derivation MUST come from the URL fragment. A client MUST NOT run OPAQUE with a profile supplied by the server; when the server reports a different profile for a live message (metadata in state available or opened, or X-Nylzo-Policy), the client MUST stop and MUST NOT send KE3. Metadata of an ended message whose blob is gone reports kdf_id 0, which is no profile; a client MUST NOT compare it.

2.1 Passphrase check (OPAQUE)

The sender registers every message with OPAQUE before it creates it, and every claim and every burn follows an OPAQUE login, the handshake (§6.4). The server never receives the passphrase or a value that tests it: each guess at a passphrase takes one handshake, which the server counts (§6.4), and a recorded request tests nothing (§13).

configuration = OPAQUE-3DH (RFC 9807 §6.4) with OPRF ristretto255-SHA512 (RFC 9497 §4.1, modeOPRF),
                KDF HKDF-SHA-512, MAC HMAC-SHA-512, Hash SHA-512, Group ristretto255
password      = salt_pw || pw                                pw is empty for kdf_id 0
Stretch(m)    = kdf_id 0: m
                kdf_id 3: scrypt(m, salt = 16 zero bytes, N = 2^18, r = 8, p = 1, dkLen = 64)
context       = "nylzo/v3/opaque" || id || u8(kdf_id)        32 bytes
identities    = none: client_identity and server_identity default to the public keys (RFC 9807 §4)
credential_identifier = id || E                              E is the expiry share (§5.6)
oprf_seed and the server key pair come from the pepper (§5.1)
Step Computed with (RFC 9807) Travels in
registration request CreateRegistrationRequest(password) by the sender X-Nylzo-Registration of GET /api/v1/instance (§6.6)
registration response CreateRegistrationResponse by the server, for the new id create.registration of the instance response
registration record and P FinalizeRegistrationRequest by the sender; P is its export_key registration in X-Nylzo-Create (§6.2)
KE1 GenerateKE1(password) by the reader X-Nylzo-KE1 of the handshake (§6.4)
KE2 GenerateKE2 by the server ke2 of the handshake response
KE3 and P GenerateKE3 by the reader; P is its export_key X-Nylzo-KE3 of the claim (§6.4) or burn (§6.6)
  • password starts with salt_pw, so testing a guess against the registration record needs the link, also for the running server or a copy of it with its pepper and seeds.
  • credential_identifier carries E, so the OPRF key of a message exists only while the server holds the epoch key of its deadline (§5.6). Once that key is erased, not even the pepper, the link and a copy of the record test a passphrase.
  • The stretching function runs on the client, after the OPRF answer, at registration and at every handshake. Without a passphrase it is the identity, so such a message costs no scrypt; its OPAQUE run is otherwise the same, which keeps the requests, the server's work and the counting of §6.4 the same for both profiles.
  • context binds a handshake to the message and its profile.
  • A client rejects a registration response or KE2 of the wrong length, and an evaluated element, server public key or server keyshare that does not decode as a ristretto255 element other than the identity (RFC 9497 §4.1, RFC 9807 §10.7). A KE2 whose server_mac does not verify fails as ServerAuthenticationError: the answer did not come from the server that holds the registration. An envelope that does not open (EnvelopeRecoveryError) means a wrong passphrase: the client sends no KE3 and tells the reader with the attempts_left and retry_after of the handshake response, since the handshake already counted the attempt (§6.4). Blind fails (InvalidInputError) only for an input that hashes to the identity, which nobody can find.
  • session_key is not used. The blind, the client's keyshare and private key, randomized_password and the keys derived from it never leave the client and are wiped once P exists or the run fails.
  • Both cores implement the client steps; the Go core also implements the server steps. Each passes the ristretto255 vectors of RFC 9807 Appendix C (real vector 1, whose stretching function is the identity) for the steps it implements, and spec/vectors.json adds runs with this configuration for both profiles.

3. Envelope

header     = version (1 byte, 0x03) || kdf_id (1 byte) || flags (1 byte) || iv (12 bytes)      15 bytes
policy     = u16be(opens_max) || u32be(ttl_s) || u32be(deadline)                                 10 bytes
commitment = HMAC-SHA-256(K_c, "nylzo/v3/commitment" || header || id || policy)                 32 bytes
aad        = header || commitment || id || policy                                               73 bytes
plaintext  = u32be(len_meta) || meta || file_bytes || padding
ciphertext = AES-256-GCM-Encrypt(K, iv, plaintext, aad)                                         plaintext + 16 bytes
object     = header || commitment || ciphertext
H          = SHA-256("nylzo/v3/object" || object)                                               32 bytes, in the link (§4)

A reader checks in this order and stops at the first failure, before it decrypts anything:

  1. H of the object it received equals the H of the link (constant-time comparison); otherwise the object is not the one the sender made (integrity error).
  2. The header: version 3, flags 2 and the kdf_id of the fragment.
  3. The length: a multiple of 65536 bytes and at most the protocol maximum.
  4. It derives K and K_c with E and verifies commitment in constant time (integrity error on a mismatch, which is also what a wrong share produces; a wrong passphrase already fails in OPAQUE, §2.1).
  5. AES-GCM authentication, then the plaintext.
  • version MUST be 0x03. A decoder rejects every other value.
  • kdf_id MUST be 0 or 3 and MUST equal the profile in the URL fragment.
  • flags: bit 0 is reserved for the HPKE mode and MUST be 0. Bit 1 (deadline, value 2) says that the policy carries the deadline, and every envelope sets it. All other bits MUST be 0. A decoder MUST reject any other flags than 2, and the server refuses a create of such an object (400 bad_request, §6.2).
  • iv: 12 bytes from the CSPRNG, fresh per message. One K encrypts exactly one envelope.
  • commitment makes the envelope key-committing, which AES-GCM alone is not: without it, someone who knows S could build one object whose tag verifies under keys from several passphrases (partitioning oracles). Two different keys that accepted the same object would need two equal HMAC-SHA-256 outputs under different keys.
  • H pins the object to the link. The sender computes it over the object it uploads, after sealing and before it shows the link. Whoever holds the link and can also write to the stored object, or mints an id token with a stolen pepper and stores new content under an old id, cannot give later readers other content without a second preimage of SHA-256.
  • opens_max and ttl_s are the sender's policy. deadline is the absolute instant at which the message expires, in Unix seconds: the server fixes it when it issues the id, as the end of the epoch whose key makes the share (§5.6), and the sender's client takes it from the instance response. The recipient obtains all three from X-Nylzo-Policy (§6.4) and the metadata response and decrypts with them; any change by the server or an intermediary fails the commitment, so the server cannot report another deadline. A reader refuses a reported policy without deadline.
  • len_meta is the byte length of meta.
  • file_bytes are present exactly when meta.file is present. Their length is meta.file.size for metadata v1, or meta.file.encoded_size for compressed attachments (§3.2).
  • padding is zero bytes. The object length (15 + 32 + 4 + len_meta + len(file_bytes) + len(padding) + 16) MUST be a multiple of 65536 bytes, for a text and a file alike, so the length shows neither whether a message carries a file nor its size to less than 64 KiB. The decoder MUST derive the content length from len_meta and the stored file length (§3.2), MUST NOT depend on the padding content, and MAY ignore it.
  • Limits: meta.text at most 102400 bytes of UTF-8; meta.file.size at most 5242880; len_meta at most 104448; object at most 5410880 bytes (5 MiB + 100 KiB + 64 KiB + 64 B). These are protocol maxima that both reference cores enforce. An instance MAY report lower limits in /api/v1/instance and MUST NOT report higher ones. An instance derives max_object_bytes from its file limit as the largest object a valid meta and file can produce: min(5410880, pad65536(15 + 32 + 4 + 104448 + max_file_bytes + 16)), where pad65536 rounds up to a multiple of 65536. With the default file limit that is 5373952.

3.1 meta [detail]

meta is a JSON object:

{"v":1,"text":"…","file":{"name":"…","mime":"…","size":N}}
  • v MUST be 1 for uncompressed content or 2 for compressed attachments (§3.2). text and file are each optional in v1; at least one MUST be present.
  • file.name: 1 to 255 bytes of UTF-8, no /, \, C0 control characters (U+0000 to U+001F) or DEL (U+007F). Clients MUST additionally sanitise the name before display and download, and display only the sanitised name, isolated from the direction of the surrounding text. The reference clients remove every control, format and default-ignorable character (Cc, Cf, Zl, Zp and Default_Ignorable_Code_Point, which takes in variation selectors, Hangul fillers and tag characters), so two names that look the same are the same. They cut a sanitised name that is longer than 255 bytes, keep its extension only when the extension has at most 16 bytes, and drop the dots and spaces the cut leaves at its end. spec/file-name-vectors.json holds the cases both check.
  • file.mime: 0 to 255 bytes. file.size: non-negative integer equal to the original file length, including when its stored bytes are compressed.
  • A client that writes the text or the file to disk MUST mark each file as downloaded from the internet before the file holds content, wherever the system has such a mark, and the mark MUST NOT hold the link's fragment. The CLI writes on Windows a Zone.Identifier stream of [ZoneTransfer], ZoneId=3 and HostUrl=about:internet. On macOS it writes the attribute com.apple.quarantine as 0081;{Unix time in lowercase hex};; and keeps a mark the system has already set. Neither names the instance. Linux has no such mark. A browser marks its downloads itself and may record the instance's origin. The web client removes the fragment from the page address before it opens a message and saves a file from a blob: address, so the addresses a browser stores with the download hold no part of the fragment; a clicked link still stays in the browser history (§4).
  • Encoders MUST produce the canonical form so both cores emit identical bytes: UTF-8, no whitespace, keys in the order v, text, file (and name, mime, size inside file), absent keys omitted, integers in decimal without sign, exponent or fraction. String escaping: " → \", \ → \\, U+0008 → \b, U+0009 → \t, U+000A → \n, U+000C → \f, U+000D → \r, every other code point below U+0020 → \u00XX with lowercase hex, every other code point literal UTF-8 (including /, U+2028 and U+2029).
  • Decoders MUST accept any RFC 8259 JSON object that satisfies the constraints above, MUST ignore unknown keys, and take the last occurrence of a duplicated key. They MUST reject meta nested deeper than 32 levels; the top-level object is level 1 and brackets inside strings do not count.

The sender chooses file.name and file.mime. A client MUST NOT treat a file as safe to open because of either, and MUST NOT render or run the file itself; a web client hands it to the browser only as a download and never shows it in a frame, object or image or navigates to it. A browser or operating system may still open a downloaded file because of its name, so the reference web client asks before every attachment download.

3.2 Compressed attachments

Compression is the sender's decision and off by default. A client compresses an attachment only when its sender asked for it for this message (nylzo create --compress; the web client offers no such option and never compresses), never because of anything the server says, and never compresses text. The server stores opaque ciphertext and MUST NOT decompress it.

Compressed attachments use metadata v2:

{"v":2,"text":"…","file":{"name":"rows.csv","mime":"text/csv","size":220000,"encoding":"gzip","encoded_size":489}}

file.size is the original byte length and remains bounded by 5242880. file.encoding MUST be gzip. file.encoded_size MUST be a positive integer smaller than file.size and within the decrypted plaintext. The gzip frame occupies exactly that many bytes; padding follows it. Encoders append encoding, then encoded_size, after size in the canonical file object. All fields, including both lengths and the encoding, are protected by the envelope.

Compression MUST use a fresh gzip context for that file alone. Message text, names, MIME types, passphrases, keys and other messages MUST NOT enter that context.

The length of a compressed object follows this rule, so that it shows how well a file compresses only to a factor of two. Let U be the object length without compression. The sender picks the smallest length of the form pad65536(ceil(U / 2^k)) with k ≥ 1 that holds the compressed content, metadata v2 and the envelope overhead, and pads the plaintext to it. When even pad65536(ceil(U / 2)) cannot hold it, the sender keeps metadata v1 and the original bytes at length U. A file therefore needs at least 128 KiB of object before compression can change anything.

Compression makes the length depend on the content, and no padding removes that. Someone who can put chosen bytes into a file that is sent repeatedly together with a secret, and who sees each object's length, can learn about the secret one class boundary at a time, as in CRIME (RFC 7457 §2.6; RFC 8878 §8). Clients therefore compress only on request and tell the sender that compression lets the server see roughly how compressible the file is.

A decoder MUST authenticate the entire envelope before decompression. It MUST enforce the original-size limit before allocating output, stop if output exceeds the declared original size, and reject a shorter result, invalid gzip checksums, truncation, additional gzip members, trailing bytes inside encoded_size, and a member whose reserved FLG bits (bits 5 to 7) are set (RFC 1952 §2.3.1.2). It MUST NOT use gzip filenames or timestamps. Shared Go and Node gzip frames in spec/compression-vectors.json check interoperability, including a frame with a reserved flag that both cores reject; compressors need not produce identical gzip bytes.

4. Link

https://{host}/r#3.{kdf_id}.{id}.{S}.{H}
  • Path /r, the same for every message, so the request for the page names no message and the server serves every reader the same page. The first API request still carries the id (§6).
  • Fragment: fragment version 3, then kdf_id (0 or 3), id (22 characters), S (43 characters) and H (43 characters), all in canonical base64url and separated by ., 114 characters in all. With https://nylzo.com/r# a link has 134 characters.
  • The fragment never leaves the browser in any request. A web client MUST remove the fragment from the address bar as soon as it has read it into memory and before its first request, also when the link is invalid.
  • The reference client does this in a small inline script at the start of every page, before the page loads any other resource, and hands the fragment to the application in memory. On any path other than /r, /m/{id} with an id of 22 base64url characters and /open, the script also removes a fragment that starts with a digit or is longer than 40 characters (not counting #), at load and whenever the fragment changes later on that page, so a mangled link such as /r/#3.… or /#3.… does not leave its key in the address bar either; it keeps in-page anchors such as #napsat. In the local client it writes nothing to session storage (§14.1).
  • A browser client MUST NOT write S, the fragment, the passphrase or a key derived from them to browser storage (session storage, local storage, IndexedDB or the Cache API), in clear or encrypted under a key that browser storage also holds, because a browser profile on disk keeps such data after the tab closes.
  • To finish an interrupted open without spending another, a client MAY keep the lease in session storage while the lease lives, since the lease authorizes nothing without the read key. The reference client stores it next to the first 16 bytes of SHA-256("nylzo/v3/lease-tag" || S) instead of the message id, and its mark of a running scrypt derivation holds that tag too, never the message id. After a reload the client asks the reader to open the link again and then finishes from the lease.
  • Showing the message, a terminal message state or acknowledgement MUST remove the lease from storage. The reference client removes it once the message is on the screen, before it sends the ack, and sends the ack with keepalive, so neither leaving the page nor a lost ack lets a reload show the message again.
  • A browser that navigates to a link records the full address, fragment included, in its history, sync and session stores before the page runs, and removing the fragment from the address bar does not change these records. The local client (§14) takes the link from a prompt and never puts the fragment in an address. The reference web client offers no paste field; it tells senders that a clicked link stays in the reader's browser history and suggests a passphrase.
  • A client MUST reject an unknown fragment version, an unknown kdf_id, a kdf_id that the version does not allow, or a non-canonical field.
  • A command takes a link only from stdin, a file, NYLZO_LINK or a prompt without echo, never from an argument, and refuses an argument that looks like a link with its key. This holds for nylzo open too (§14).
  • A client builds the links it creates on the instance's public address (§9), never on the address it was loaded from, so a link made in the local client (§14) names the instance.
  • A newer fragment version gets its own error, so that the client can say the link needs a newer client instead of calling it damaged. The version label is the text after # up to the first ., or the whole fragment without a .. It is newer when it is a decimal integer without a leading zero, at most 9 digits, and greater than 3. The client checks this before the path and the rest of the fragment, because a later version may change both, but only after the text before # passes the scheme and authority rules below with any path that starts with /. Fragment versions 2 and 1 are handled as §15 says. Every other label, such as 0, 03 or v3, is an invalid link.
  • A link or fragment that would be valid but carries the reserved kdf_id 2 (§2) gets its own error too, so that the client can say the link uses a passphrase profile Nylzo does not support instead of calling it damaged. The client sends no request for such a link.
  • A client parses a link without URL normalisation. The text before the first # MUST match scheme "://" authority path ["?" query]: scheme is http or https in any letter case, authority contains only ASCII letters, digits, ., -, :, [ and ], path is exactly /r for fragment versions 3 and 2 (and /m/{id} for version 1, §15), and the query is ignored. The fragment is everything after the first #, so a link with ## carries an unknown fragment version and is invalid. In the scheme, authority and path, relative references, dot segments, backslashes, userinfo, percent-encoding and leading or trailing whitespace are therefore rejected; the query may contain any character except #. Both reference cores accept the same set of links.
  • A client MUST accept a link that a user pastes, so that someone who does not want to load the page from the instance can open the link in a client of their own.

5. Server-side tokens and secrets

5.1 Pepper and purpose keys

  • pepper: 32 bytes in the file named by NYLZO_PEPPER_FILE, never stored in the database. The server reads it only from that file and refuses to start when NYLZO_PEPPER or NYLZO_PEPPER_PREVIOUS is set, because a variable stays readable in /proc/<pid>/environ and in docker inspect. It refuses a pepper whose 32 bytes are all equal.
  • k_purpose = HKDF-SHA-256(salt = empty, IKM = pepper, info = "nylzo/v1/mac/" || purpose, 32) for purpose in lease, pow, id, challenge, opaque-server. The purpose verifier is retired.
  • mac_purpose(x) = HMAC-SHA-256(k_purpose, x).
  • OPAQUE (§2.1): oprf_seed = HKDF-SHA-256(salt = empty, IKM = pepper, info = "nylzo/v3/opaque/oprf-seed", 64), so the OPRF key of a message is DeriveKeyPair(Expand(oprf_seed, id || E || "OprfKey", 32), "OPAQUE-DeriveKeyPair") (RFC 9807 §5.2.2 with credential_identifier = id || E; the instance request computes E when it issues the id, the handshake recomputes it, §5.6), and its server key pair is DeriveDiffieHellmanKeyPair(mac_opaque-server(id)) (RFC 9807 §6.4.1.1). Both are computed when they are needed and never stored, and each message has its own.
  • k_records = HKDF-SHA-256(salt = empty, IKM = pepper, info = "nylzo/v1/records", 32) seals the read and manage wraps of every row (§5.2). It is a key of its own and makes no mac.
  • pepper_id = SHA-256("nylzo/v1/pepper-id" || pepper)[0:8] (8 bytes), so a second rotation within 7 days takes the pepper_id of the pepper before the previous one with a chance of 1 in 2^64 only; such a registration would fail every passphrase instead of answering 503. Every mac in a sealed record (§5.2) carries the pepper_id of the key that produced it, and so does the registration, for the pepper whose OPAQUE keys made it.
  • Rotation: the file named by NYLZO_PEPPER_PREVIOUS_FILE holds the previous pepper. The server writes with the current pepper and verifies each mac with the pepper whose pepper_id matches it; a mac whose pepper_id matches neither verifies as invalid (with the same work as a valid one). A handshake uses the OPAQUE keys of the pepper that the registration names; when neither pepper matches, it counts nothing and answers 503 (§6.4). The server MUST refuse to start when both peppers share a pepper_id. The maximum TTL is 7 days, so no mac or registration needs rewriting. serve reseals the wraps of every row under k_records of the current pepper when it starts, before it takes a request (§5.2), and then erases the records key of the previous pepper from its memory. A row that no configured pepper opens stays as it is and answers like an unknown id; serve logs rows-unopenable at every start until the sweep purges it, and configuring the pepper that sealed it as the previous pepper opens it again. Resealing does not revoke a record key that someone already took from a copy with the old pepper and a public key. Operations describes a rotation.
  • sweep-once does not need a pepper and never creates the schema. Like serve, it adds the counter index to a database that lacks it (§12) and refuses a database with an older or newer user_version; it also refuses versions 7 and 5, which only serve upgrades (§15).

5.2 What the server stores

§13 lists everything the server keeps and what each item reveals.

The server keeps every message as one row that it can read only with its pepper and only while someone who holds the link or the manage key makes a request. A copy of the database, the configuration included, shows no message id, no policy, no counter and no time other than two cleanup times.

locator     = SHA-256("nylzo/v1/locator" || id)                                  32 bytes, the key of the row
record_key  = 32 bytes from the server CSPRNG, one per message
kek_read    = HKDF-SHA-256(salt = locator, IKM = pk_R, info = "nylzo/v1/record/read", 32)
kek_manage  = HKDF-SHA-256(salt = locator, IKM = pk_M, info = "nylzo/v1/record/manage", 32)
k_layer     = HKDF-SHA-256(salt = locator, IKM = k_records, info = "nylzo/v2/record/pepper", 32)
wrap(k, x, label) = nonce (12 bytes) || AES-256-GCM(k, nonce, x, aad = locator || label)
read_wrap   = wrap(k_layer, wrap(kek_read, record_key, "read"), "pepper-read")              88 bytes
manage_wrap = wrap(k_layer, wrap(kek_manage, record_key, "manage"), "pepper-manage")        88 bytes
k_fields    = HKDF-SHA-256(salt = locator, IKM = record_key, info = "nylzo/v2/record/fields", 32)
k_blob      = HKDF-SHA-256(salt = locator, IKM = record_key, info = "nylzo/v2/record/blob", 32)
record      = wrap(k_fields, fields || zeros, "record")                          1024 bytes
blob_key    = 32 bytes from the server CSPRNG, one per message
erase_salt  = 32 bytes from the server CSPRNG, one per message, kept only in the blob file
erase_block = erase_salt || zeros                                                4096 bytes, one file system block
stream_key  = HKDF-SHA-256(salt = erase_salt, IKM = blob_key, info = "nylzo/v1/blob", 32)
k_register  = HKDF-SHA-256(salt = locator, IKM = erase_salt, info = "nylzo/v3/record/registration", 32)
registration_wrap = wrap(k_register, registration record (§2.1), "registration")   220 bytes, in the fields
encrypted   = AES-256-CTR(stream_key, counter block 0, object || zeros)          padme(len(object)) bytes
stored blob = erase_block || encrypted                                           4096 + padme(len(object)) bytes
tag_key     = HKDF-SHA-256(salt = erase_salt, IKM = blob_key, info = "nylzo/v2/blob/tag", 32)
blob_tag    = HMAC-SHA-256(tag_key, erase_salt || encrypted)                     32 bytes
salt_key    = HKDF-SHA-256(salt = none, IKM = blob_key, info = "nylzo/v2/blob/salt", 32)
salt_tag    = HMAC-SHA-256(salt_key, erase_salt)                                 32 bytes
blob_wrap   = wrap(k_blob, blob_key || blob_tag || salt_tag, "blob")             124 bytes
  • The id has 128 random bits, so the locator does not reveal it; whoever has the link computes it.
  • pk_R and pk_M reach the server only at creation and in signed requests (§5.5), and the server never stores them. It therefore opens a record only while it handles such a request. A successful unwrap with the key derived from the presented public key takes the place of a stored mac.
  • A public key is no secret from whoever sees the requests that carry it (the TLS-terminating edge, the h2c hop behind it, a log that keeps headers), so each wrap has a second layer under k_layer, which comes from the pepper and differs for every row. Opening a record takes both the public key and the pepper. A request accepts no wrap without the pepper layer.
  • When serve starts, before it takes a request, it reseals with the current pepper the wraps that the previous pepper sealed (§5.1), in batches of 100 rows with one write transaction for each batch that changed. At every start it then rebuilds the tables and scrubs the whole log (below), also when no wrap changed, and it refuses to start when the rebuild or the scrub cannot finish, for example while another process holds a read transaction on the log for several seconds.
  • The fields of a record are the envelope version and kdf_id, created_at, expires_at, ttl_s, opens_max, opens_remaining, size, registration_wrap with the pepper_id of the OPAQUE keys that made it (§5.1), fail_count_total, next_attempt_at, first_opened_at, the recorded ending and its time, the active leases (mac_lease(L), pepper_id, lease_expires_at, downloads), and the expiry epoch e and the id of the generation that made its share (§5.6). Their binary layout is internal to the server. A message holds at most 8 active leases (§6.4), so the fields fit in one 1024-byte record, and every record is exactly 1024 bytes. Every change that a request makes drops the leases that have expired.
  • Every message has a registration, also without a passphrase (§2.1). It is sealed under a key from erase_salt, which only the blob file holds, so once the blob is erased no copy of a record, not even one with the pepper and the link, can test a guessed passphrase.
  • padme(L) is the Padmé length (Nikitin et al., PETS 2019, algorithm 1): with E = ⌊log2 L⌋, S = ⌊log2 E⌋ + 1 and z = E − S, it rounds L up to a multiple of 2^z. The counter stream makes the padding look like the rest of the stored blob. A reader receives the object, size bytes, never the erase block or the padding.
  • AES-256-CTR has no integrity of its own, so blob_tag authenticates the salt and every encrypted byte, the padding included, under a key of its own, and blob_wrap holds it, so only a request that opens the record can read or replace it. Before a claim or a download spends anything, the server reads the stored blob up to 4096 + padme(size) bytes, compares its tag in constant time and then serves the object from the same open file. A blob that fails the check, has another length, has its salt zeroed or is missing while the message lives answers 500, spends no open and no download and is counted as the error blob-changed (§6.4, §6.5). When the check fails, the server reads the row again first, so a message that an ending changed meanwhile answers 410 with its end state. The filler of the erase block after the salt carries nothing and is not covered.
  • A handshake (§6.4) needs only erase_salt, which seals the registration. It checks salt_tag before it counts an attempt, so a changed salt costs no attempt, while changed object bytes do not stop a burn from deleting the message (§6.6); a blob of another length answers 500 to a handshake as to a claim. The handshake and the burn read only the erase block.
  • Every blob_wrap holds both tags, and the server refuses one of any other length, so no stored blob is served without the check.
  • In the clear a row holds only the locator, the three wraps, the record, a random blob reference and two cleanup times (§7, §12): blob_purge_at, when the sweep deletes the blob, rounded up to the quarter hour, and purge_at, when it deletes the row, rounded up to the full hour.
  • Deleting a blob starts by setting blob_wrap to null. The server then overwrites the erase block with zeros where it lies, syncs it and only then unlinks the file and syncs the directory. It does the same for a stale temporary file, an orphan and a failed upload. The salt existed only in that block, so neither the link nor an older row version with blob_wrap nor the freed blocks of the ciphertext can rebuild stream_key afterwards.
  • No blob lives in a file created for its own upload: uploads write into empty pool files in blobs/tmp that the server creates ahead of time, so a file's birth time and inode number never date an upload. An upload that finds the pool empty answers 503 with Retry-After: 5, stores nothing and returns its cap slot.
  • A blob file's modification and access time are its blob_purge_at, set once the content is synced, and created_at is the moment the content was stored, so the file carries no upload time.
  • The server refuses to start, also for sweep-once and takedown, when the data directory, the blob directory or its temporary directory is on a file system that may write an overwrite to new blocks. It accepts ext2, ext3 and ext4 in data=ordered or data=writeback, XFS, and tmpfs while no swap is active, and refuses btrfs, ZFS, bcachefs, F2FS, NILFS2, overlayfs, NFS, CIFS, FUSE, virtiofs, every other type and every system other than Linux. For ext4 it reads the effective options in /proc/fs/ext4/<device>/options, which name data=journal also when it is the superblock default, and refuses to start when it cannot read them. It also refuses when the data directory, a blob directory, a database file or a blob file journals its data (chattr +j), and tmpfs while /proc/swaps lists active swap. NYLZO_ALLOW_UNERASABLE_STORAGE=1 starts anyway and logs storage-not-erasable, for a development machine only.
Client sends Server stores or checks
read_key = pk_R at creation stores read_wrap
registration (record of §2.1) at creation stores registration_wrap in the record
manage_key = pk_M at creation stores manage_wrap
pk_R and a signature with R at metadata, handshake, claim, blob, ack, burn unwraps read_wrap with k_layer and kek_read and opens the record, then checks the signature (§5.5)
KE1 at the handshake opens registration_wrap with the erase salt and answers KE2 (§6.4)
KE3 at claim, burn compares it with the client_mac that its handshake expects (§6.4)
pk_M and a signature with M at cancel, status unwraps manage_wrap with k_layer and kek_manage and opens the record, then checks the signature
(server issues L at claim) stores mac_lease(L) in the record

All comparisons MUST be constant-time. A lookup for a signed request makes one database read that finds a row and one that finds none, whatever the id: a known locator is followed by a read of an absent locator (SHA-256("nylzo/v1/absent-row")), an unknown one reads the dummy row that the database keeps under SHA-256("nylzo/v1/dummy-row"). The dummy row has the shape of a live row and is sealed under random keys, with its wraps under the current pepper like every other row (serve seals them when it starts). Every row is read in one shape with fixed fillers for its nulls, and the server then derives the keys, opens both layers of the wrap and the record the same way for all of them, even after a layer failed, so a live, an ended and an unknown id cost the same work. Every refused signed request also answers no earlier than 5 ms after it arrived.

No time in the record is more precise than the minute: created_at, first_opened_at and the end of a message are rounded down, expires_at and lease_expires_at up to the next full minute, so a message and a lease live 0 to 60 s longer than requested.

Deleted rows and older row versions leave no readable trace in the store:

  • SQLite runs with secure_delete, so it overwrites deleted content and freed pages with zeros, and keeps its WAL, whose frames are always overwritten where they lie.
  • After every write transaction that put pages into the log, at every sweep and when the store closes, the server checkpoints the log into the database and overwrites every frame of it in place with the zero pages of the table wal_scrub (§12).
  • A page split leaves copies of the cells it moved in the free space of a page, where secure_delete never reaches. So once rows changed, in this process or another one, the sweep and the close rebuild messages and rate_counters into fresh tables and then scrub the log. Between sweeps an older copy of a row can sit in free space for up to one sweep interval.
  • messages and rate_counters are tables without rowid, keyed by the locator and by the counter key, so no table reveals the order or the number of events. No row ties a message to an address bucket.
  • The layers below the file system, such as thin provisioning or an SSD that remaps blocks, may keep a block that the file system overwrote; the encrypted volume of the deployment (§13) keeps those copies unreadable.

5.3 Address buckets

Addresses never reach a persistent log, the database or any file. For rate limits the server derives a 24-bit bucket in memory:

addr      = canonical IP (netip.ParseAddr; IPv4-mapped IPv6 unmapped to IPv4)
prefix    = addr masked to /32 or /24 (IPv4), /64 or /48 (IPv6)
input     = family (0x04 or 0x06) || prefix_len (1 byte) || masked address bytes (4 or 16)
bucket    = HMAC-SHA-256(k_addr, input)[0:3]

k_addr is 32 random bytes that every process draws when it starts and again at the start of every UTC day, and never writes anywhere; it does not come from the pepper. Every per-address token bucket and counter (§8) lives only in the memory of that process. At every minute boundary the process drops token buckets that have refilled, counters whose window has ended, the pacing state of ranges no longer active (§8) and released stream slots, and when it draws a new k_addr it drops every bucket. A Go map keeps the bytes of a deleted key, so the process copies the entries that remain into new maps and drops the old ones in secret mode. Token buckets record their last refill to the second. Per-address limits therefore count per instance and start from zero when a process restarts. The global daily cap, PoW (§8) and passphrase backoff (§6.4) are kept in the database and never per address, so they hold across instances and restarts.

While at least one passkey of the admin area exists (§6.8), the process keeps two more tables about addresses, both in memory only, both emptied at every UTC day boundary and at restart, and never written to a log, the database or a file:

visitor   = HMAC-SHA-256(k_visit, addr (4 or 16 bytes) || 0x00 || User-Agent)[0:8]
  • Visit counting (§6.7) keys each visitor by visitor. k_visit is 32 random bytes that the process draws at start and at every UTC day boundary, separate from k_addr. The table holds at most 200,000 visitors and 50,000 pairings of a page report with its person signal. The process looks the address up in an IP-to-country table embedded in the binary and counts only the country code; neither the address nor the User-Agent is kept.
  • Refused clients: when a token bucket of the source or the range, an hourly read counter or a create limit refuses a request (§8), or the admin area refuses a sign-in or an enrollment (§6.8), the process keeps the /32 or /64 of the client in the clear, with the reasons (requests, create, read, read-bytes, admin), their counts and the first and last refusal, for one hour after the last refusal and for at most 256 clients, the oldest dropped first. This is the one table that holds addresses in the clear. A refusal by the instance bucket alone does not list the client.

A server without a passkey keeps neither table.

5.4 Id tokens

The server issues every message id, so nobody can choose the id of an earlier message and publish new content under its old link once its row is gone, and a create cannot test whether an arbitrary id exists. The token also authenticates the deadline of the message: it names the expiry epoch whose share the server handed out with the id, the TTL that the deadline came from and the generation whose seed made that share (§5.6).

id_token = base64url( u32be(expires_at) || u32be(e) || u32be(ttl_s) || generation_id || HMAC-SHA-256(k_id, id || u32be(expires_at) || u32be(e) || u32be(ttl_s) || generation_id)[0:16] )      44 bytes, 59 characters
  • expires_at is the issue time plus 600 s, in Unix seconds. The id is 16 bytes from the server CSPRNG. e is the epoch of §5.6, ttl_s the TTL of the instance request and generation_id the 16-byte id of the generation that made the share. A create MUST carry the same epoch and ttl_s in X-Nylzo-Create, so the message the server stores expires at the deadline of its share and its policy names the TTL that deadline came from.
  • When the server has lost its seed file since it issued the token (§5.6), the share of the id can no longer be made. A create whose token names a generation the server no longer holds answers 409 share_lost, before the body is read and again before the row is stored; the client fetches a new id and creates again. A token issued in an earlier hour stays valid: its generation lasts far longer than the token.
  • A token is valid when the tag verifies in constant time under the current pepper, 0 ≤ expires_at − now ≤ 605 s (5 s for clock differences between instances) and the deadline of e lies after now. A pepper rotation invalidates tokens issued before it; the client fetches a new one.
  • The server keeps no record of issued ids. A token is not single-use, but its id can be stored only once: a second create with the same id answers 409.

5.5 Request signatures

Every request that proves possession of a link or of the manage key carries a signature over a fresh server challenge, so a recorded request cannot be sent again.

challenge = base64url( u32be(expires_at) || nonce (16 bytes) || HMAC-SHA-256(k_challenge, u32be(expires_at) || nonce)[0:16] )     36 bytes, 48 characters
message   = "nylzo/v3/request" || 0x00 || purpose || 0x00 || method || 0x00 || path || 0x00 || challenge (36 raw bytes) || SHA-256(body)
            || component(share_key) || component(lease) || component(ke1) || component(ke3)
component(value) = u64be(len(UTF-8(value))) || UTF-8(value)
Authorization:    Nylzo-Sig {pk}.{challenge}.{signature}          signature = Ed25519(seed, message), purpose "read", "manage" or "admin"
  • GET /api/v1/challenge answers {"challenge":"…","expires_at":"…"}. expires_at is 60 s after issue, in RFC 3339 in the JSON and in Unix seconds inside the challenge. A challenge is valid when its tag verifies in constant time under the current pepper, 0 ≤ expires_at − now ≤ 65 s (905 s for the challenge of a handshake, §6.4) and the process that checks it issued it and still holds it (below).
  • purpose is ASCII read or manage, or admin for the operator's session (§6.8); method is the uppercase HTTP method; path is the request path without query, as sent (/api/v1/messages/{id}/claim), except for admin, whose path includes the query (/api/v1/admin/overview?range=24h); body is the raw request body, empty for GET. An admin request carries none of the four components, names no message, and fails with 401 as §6.8 says instead of the 404 below.
  • Transcript v3 binds share_key, lease, ke1 and ke3 to the exact values of X-Nylzo-Share-Key, X-Nylzo-Lease, X-Nylzo-KE1 and X-Nylzo-KE3, in that fixed order. A missing or empty field is encoded as a zero length. Values are not decoded, normalized or joined; each header may occur at most once. Repeated fields fail authorization with the same 404 as a bad signature, except a repeated X-Nylzo-KE1 or X-Nylzo-KE3 on the route that requires it, which is malformed and answers 400 before the signature check. Header-name casing and the order of distinct headers do not matter. A client generates the attempt's share key and assembles the lease header before signing; a retry signs the new values with its fresh challenge.
  • The server accepts only transcript v3, also for requests without any of these headers. The authorization-header syntax is as above.
  • The server parses the header, checks the challenge, loads the row by its locator, derives the keys from the pepper and from pk, unwraps the record key through both layers and opens the record (§5.2), checks pk by the rule for creation (canonical encoding, not of small order, §6.2) and verifies the signature. It does all of this for every request, with a dummy row for an unknown id and a dummy key (a valid point of full order) for a malformed one or one that fails the key check, so every failure takes the same work and answers the same 404 no earlier than 5 ms after the request arrived (§5.2). Only a request that passed may then finish an interrupted ending or release a blob that is no longer reachable (§6.3).
  • Every signed request has an empty body. A body, or a malformed X-Nylzo-KE1 or X-Nylzo-KE3, answers 400 before the signature is checked. A claim or burn with X-Nylzo-Verifier answers 400 client_outdated (§15).
  • After the browser cross-origin gate (§9), the first request that presents a challenge with a valid tag that the process holds uses it up in the memory of the process, before any remaining check and whatever the answer, also when its window is not open: a 429 from a token bucket or a counter, a 503, a 400, a 404 and a success all leave it used. A second request with the same challenge fails like a wrong key. Challenges never reach the database.
  • A process accepts only challenges that it issued itself and still holds. It holds each challenge it issues until a request presents it or a purge finds that its window can no longer open: it expired more than 5 s ago, or it lies more than 65 s ahead because the clock stepped back. A process that starts holds none, so a restart refuses every earlier challenge. A client therefore sends the signed request to the instance that issued its challenge; serve locks its data directory, so one process serves it at a time (§6.2).
  • A handshake (§6.4) answers with a challenge of its own that also holds its login state: the locator of the message, the client_mac that RFC 9807 calls expected_client_mac, and the values that taking back its attempt needs. A claim or a burn MUST present such a challenge, issued by a handshake for the same message; any other challenge, also a valid one from GET /api/v1/challenge, fails like a wrong key. Using the challenge up clears its login state, so a KE3 is checked once. Every other signed request accepts both kinds; it checks no KE3, but one that carries the handshake's challenge and a matching KE3 still takes the attempt back (§6.4).
  • The process purges its challenges every minute into a new table in secret mode, so the old one is erased (§5.3). Issuing a challenge goes through the token buckets, so with the default instance bucket the process holds at most the 484,000 challenges issued in the last 966 s, the longest a handshake's challenge stays: about 25 MiB, and about 98 MiB if every one of them came from a handshake, twice that while a purge copies the table. Any other challenge goes within 126 s. The table has room for twice what the instance bucket can issue in 966 s, and for at least 131,072 challenges. A challenge request that finds it full purges it first, at most once a second, and answers 503 with Retry-After: 60 if it is still full.
  • A client fetches a fresh challenge for every request. A 404 can also come from a challenge that expired on the way or was issued before a pepper rotation or a restart of the server, so a client may retry once with a fresh challenge before it reports the link as unknown.
  • Pepper rotation invalidates challenges issued before it; the client fetches a new one.

5.6 Expiry shares

The content key depends on a share E that only the server's seed file can make and that stops existing at the message's deadline, the instant at which the server also ends the message (§7). Once the deadline has passed, the server can no longer open the message, and neither can a copy of the object or of the server taken after the deadline or without the seed file, even together with the link and the passphrase. A copy that includes the seed file opens, together with the link, every message that was live when it was taken and every message whose id the server issued later in the same hour. It predicts no share of an id issued in a later hour, because every hour starts a generation of seeds from fresh entropy (below).

m                = ⌊unix_time / 60⌋                                            the current minute, h = ⌊m / 60⌋ its hour
seed[g, g]       = 32 bytes from the server CSPRNG                              generation g starts in hour g
seed[g, h + 1]   = HKDF-Expand(seed[g, h], "nylzo/v2/epoch/next", 32)           chain of hours, forward only
minute[g, 60h]   = HKDF-Expand(seed[g, h], "nylzo/v2/epoch/minute", 32)         first minute of hour h
minute[g, m + 1] = HKDF-Expand(minute[g, m], "nylzo/v2/epoch/minute-next", 32)  while m + 1 lies in the hour of m
epoch_key[g, m]  = HKDF-Expand(minute[g, m], "nylzo/v2/epoch/minute-key", 32)
E                = HMAC-SHA-256(epoch_key[g, e], locator)                      32 bytes, g the generation that issued the id
  • An epoch is one minute, and the server fixes the deadline when it issues the id. GET /api/v1/instance with X-Nylzo-Ttl: {ttl} sets deadline = ⌈(now + ttl) / 60⌉ · 60 and e = deadline / 60 − 1, the last minute in which the message lives, and answers both with the share (§6.6). The TTL therefore runs from the instance response, and the message lives ttl seconds from then plus less than a minute of rounding. The server stores the message with expires_at = deadline (§6.2), the id token authenticates e and the TTL (§5.4) and the policy of the envelope authenticates deadline (§3), so the end of the share and the end of the message are one instant that neither the server nor a client can move apart.
  • In minute m of hour h the server keeps, for each generation, seed[g, h + 1] and minute[g, m]. Neither yields the key of an earlier minute: the chain of hours only goes forward and starts the minutes of later hours, and the chain of minutes only goes forward within its hour. A share takes at most 168 steps of the chain of hours, the step into the minutes of its hour and 59 steps of the chain of minutes.
  • Every hour starts a generation. When the ratchet enters hour h, it draws a random 16-byte generation id and seed[h, h] from the CSPRNG; only this generation issues shares in hour h, so every id issued in hour g takes its share from generation g. Its last epoch is minute 60 · (g + 169) − 1: a deadline set in hour g with the longest TTL of seven days falls at the latest at the start of hour g + 169, when the server drops the generation with its seeds, so it holds at most 169 of them.
  • The server keeps only the seeds of the current minute. When a minute begins, it moves every generation forward, drops those whose last epoch has passed, starts the generation of a new hour and writes the file over the old one in place, with the in-place erase that deletes blobs (§7): the same blocks are overwritten and synced, on a file system the server has checked to overwrite in place. epoch_key[g, m] for a minute that has begun, and every share made from it, can then no longer be computed from anything the server holds.
  • serve advances the ratchet at startup, at the start of every minute while it runs (it waits for the next minute of the wall clock each time, so a suspend or a clock step delays it by a minute at most), before it computes a share, and at every sweep, including nylzo sweep-once. After a failed write it writes the file again at the next advance, also within the same minute, and keeps only the new seeds in memory meanwhile. It issues no share until the file holds the generation of the hour, so a crash never loses a generation that made a share. It also issues none while the wall clock is more than a minute behind the minute of the ratchet, which never goes back, so after a backward clock step no generation issues outside its own hour. Where serve does not run, the seeds of the minute in which the ratchet last moved stay until the next sweep-once erases them.
  • A share is computed in Go's runtime/secret mode where the release build enables it, so the registers and stack that held a copy of a seed are erased, and serve locks its memory, so no seed reaches swap (§13). To make E for a later minute the server moves a copy forward in memory and wipes it. It never stores E; a claim and a download compute it again from e and the locator.
  • The seeds live in their own file, NYLZO_EPOCH_DIR/seed (default {NYLZO_DATA_DIR}/epoch), 24576 bytes, six blocks so ext4 never keeps it inline in the inode. It starts with a 128-byte header, the format nylzo-e3 and zero bytes, followed by 191 slots of 128 bytes. A slot holds one generation: its id (16 bytes), its kind (one byte, always 1), 3 zero bytes, u32be(g), u32be of its last epoch, u32be(m), its hour seed and its minute seed (32 bytes each), 24 zero bytes and a CRC-32C of the first 124 bytes; an empty slot is zero bytes. The hour seed is seed[g, h + 1] and the minute seed minute[g, m]. A generation keeps its slot for its whole life, and no slot crosses a 512-byte sector, so a write that a crash cuts short leaves each slot old or new, never mixed.
  • When the server reads the file it brings a slot that is behind forward to the newest minute among the slots and rewrites the file. A ratchet writes its first file with the generation of its hour and always keeps one, so the server refuses a file without any generation, as well as a slot that fails its checksum or has an unknown kind or non-zero padding, two slots of one generation, two generations that start in the same hour, a minute outside the life of its generation, or a generation that lives longer than 169 hours. Every read writes the file back and syncs it, also when nothing changed, because bytes that another process wrote may not have reached the disk yet. A file that the server cannot read or parse is never replaced from memory. Several server processes may share the file; each takes an exclusive lock on it to advance it, and the first to enter an hour starts the generation that the others then read. A process that does not find a generation in memory reads the file again before it treats the share as lost, and nylzo store-check reads it under a shared lock.
  • Like the pepper file, the seed file must belong to the user that runs the server and give group and others no access; the server refuses a seed file that is a symbolic link, belongs to another user or is readable by others, refuses such an epoch directory, and narrows a directory of its own user to mode 0700.
  • The server refuses a tmpfs for the seed while any swap is active, unless it is mounted with noswap (Linux 6.4 or later). While serve runs on Linux it locks the pages of the seed file in memory, and every sweep logs epoch-storage-not-erasable once the epoch directory would fail the start check. serve logs epoch-seed-on-disk at start whenever the epoch directory is not on a tmpfs. Where to keep the seed is described in Operations.
  • At start the server refuses an epoch directory that does not exist; only the default directory inside the data directory is created. When NYLZO_EPOCH_DIR names another directory, serve and store-check also refuse to start while the data directory still has an epoch directory. In a directory without a seed file, as a tmpfs is after a reboot, the server starts a new ratchet with a new generation and logs epoch-seed-created once. The shares of messages created under the old ratchet are then lost, and those messages end as lost (§7). A file that does not parse stops the server with an error.
  • The share travels sealed with HPKE to a one-time hybrid post-quantum key of the client, so neither the TLS-terminating edge nor an observer of the plain HTTP hop behind it learns E from recorded traffic:
share_key = "1." || base64url(pk_c)                                    share suite 1; (sk_c, pk_c) is a key pair the client draws for this request
wrapped   = enc || ct = HPKE.SealBase(pk_c, info = "nylzo/v2/share", aad = "", E)      1120 + 48 bytes, 1558 characters

Share suite 1 is HPKE (RFC 9180) in base mode, single-shot, with the KEM MLKEM768-X25519 (0x647a, draft-ietf-hpke-pq revision 05), the KDF HKDF-SHA256 (0x0001) and the AEAD AES-256-GCM (0x0002). The KEM is X-Wing: it combines ML-KEM-768 (FIPS 203) and X25519 with SHA3-256, so E stays hidden while either of them holds. pk_c is the 1216-byte public key, the ML-KEM half followed by the X25519 half, and sk_c the 32-byte seed that derives both halves. The client opens wrapped with HPKE.OpenBase(sk_c, …) and refuses a share that does not open. A share key is never used twice: every claim, download and instance request draws a new key pair. The web client holds sk_c as bytes in the page's memory and erases it once it has opened the share or given up the request. The CLI's key stays in its process memory until the process exits or the collector reuses it, under the process protection of the CLI guide. The server refuses as malformed (§6.1) a share key whose X25519 half has small order, because its shared secret would be zero, and one whose ML-KEM half fails the modulus check of FIPS 203 §7.2. A share key without a suite answers 400 client_outdated (§15); a suite other than 1 answers 400 bad_request. A wrapped share changed in transit fails the AEAD. The claim and download signatures cover the share key (§5.5), so nobody on the path can replace it there without the read seed. The instance request carries no signature at all. An active attacker on the path, the TLS-terminating edge included, can therefore replace the sender's share key with its own, open E and seal it again to the sender's key, and the sender cannot notice. The wrapping covers recorded traffic; an active edge learns the E of every message whose creation it relays.

  • §13 lists what stays outside this protection. Every expiry rule also depends on the server's clock. A clock stepped forward, for example through unauthenticated NTP, makes the ratchet start the generation of the hour it reaches before that hour has come, and a copy of the seed file taken then would predict the shares that generation issues once the clock is back. So while the wall clock runs more than 5 minutes behind the minute of the ratchet, every advance at startup, at the start of a minute and at a sweep replaces the generation of the ratchet's hour with a new one from the CSPRNG in the same slot, with a new id and the same hours, and logs epoch-generation-replaced. The ids that the old generation issued lose their shares and end as lost (§7). The advance before a share never replaces one, because its request may have read the clock minutes earlier. A replacement whose write failed is made again at the next write. Before it issues an id, every process reads the file again when the file names another generation of the hour than its memory, because another process may have replaced it. While serve runs throughout, the generation that issues once the clock is back started at most 6 minutes before the clock reached the minute of the ratchet. A clock that stays ahead issues from generations that start with their hour by that clock, so a copy predicts no more than one taken in that hour. Processes that share the seed file keep their generation while their clocks differ by up to 5 minutes. The Hetzner profile starts nylzo.service only after the host clock is synchronised.

6. HTTP API

Base path /api/v1. Request and response bodies are JSON (application/json; charset=utf-8) except where noted. Timestamps are RFC 3339 in UTC. Binary values use canonical base64url (§1.1). "Signed with R" means an Authorization: Nylzo-Sig header made with the seed R (§5.5).

Browser requests using methods other than GET, HEAD and OPTIONS MUST carry X-Requested-With: XMLHttpRequest. The web and CLI clients add it to every mutation. Supplied Origin and Referer values must each match the configured public origin, including scheme and effective port; duplicate, empty, opaque or conflicting values are rejected. The server also applies Go's native cross-origin protection to Fetch Metadata. It does not enable CORS or trust a forwarded host as its target. Without NYLZO_PUBLIC_URL, browser mutations are limited to literal loopback hosts and localhost. Every request under /api/, including GET and HEAD, whose Sec-Fetch-Site is present and is neither same-origin nor none is refused too (Fetch Metadata resource isolation), so an image or a link on another site cannot make its visitors' browsers spend their read budget or the instance bucket; native clients send no Fetch Metadata. Rejected requests receive 403 {"error":"cross_origin"} before the server reads a body, uses up a challenge or counts the request.

Missing origin information is not a credential: a request without browser context headers, as native clients send it, still needs the mandatory X-Nylzo-Create or a fresh signed Authorization. Neither client uses ambient cookies, and neither does the operator's admin session (§6.8): no response of the server sets a cookie. A custom request marker does not authorize a mutation and does not protect against same-origin malicious JavaScript. The local client (§14.1) relays the requests of its browser as such a native client. A mutation whose Origin has the chrome-extension, moz-extension or safari-web-extension scheme is refused like any other foreign origin.

Method and path Auth Consumes an open
POST /api/v1/messages none (rate limit, PoW under load) no
GET /api/v1/messages/{id} signed with R no
POST /api/v1/messages/{id}/handshake signed with R + X-Nylzo-KE1 no; counts a passphrase attempt until a valid KE3
POST /api/v1/messages/{id}/claim signed with R over the handshake's challenge + X-Nylzo-KE3 yes
GET /api/v1/messages/{id}/blob signed with R + X-Nylzo-Lease no
POST /api/v1/messages/{id}/ack signed with R + X-Nylzo-Lease no
POST /api/v1/messages/{id}/burn signed with R over the handshake's challenge + X-Nylzo-KE3 ends the message
POST /api/v1/messages/{id}/cancel signed with M ends the message
GET /api/v1/messages/{id}/status signed with M no
GET /api/v1/instance none (+ X-Nylzo-Registration when it issues an id) no
GET /api/v1/challenge none no
POST /api/v1/visits none; counted only while a passkey exists (§6.7) no
POST /api/v1/visits/documents a trusted proxy as the peer (§6.7) no
GET /api/v1/admin, POST /api/v1/admin/enrollment/options, POST /api/v1/admin/enrollment, POST /api/v1/admin/session/options, POST /api/v1/admin/session none, enrollment token or passkey assertion in the body (§6.8) no
GET /api/v1/admin/overview, GET /api/v1/admin/live, DELETE /api/v1/admin/session signed with the session key, purpose admin (§6.8) no

No endpoint accepts or returns plaintext, S, K, P or a passphrase, or a value from which someone without the OPRF key could test a passphrase.

6.1 Errors

Status Body When
400 {"error":"bad_request"} malformed X-Nylzo-Create (including the id inside it or a registration record whose public key is not a ristretto255 element other than the identity), request body, X-Nylzo-Registration, X-Nylzo-KE1, X-Nylzo-KE3 or X-Nylzo-Share-Key (a share key with a small-order X25519 half or an ML-KEM half that fails the modulus check, or of a suite other than 1, included, §5.6), a handshake without X-Nylzo-KE1 or a claim or burn without X-Nylzo-KE3, a claim or download without X-Nylzo-Share-Key, an instance request with only some of X-Nylzo-Ttl, X-Nylzo-Share-Key and X-Nylzo-Registration, or one repeated or malformed, a body on a signed request (§5.5), policy outside instance limits, size ≠ Content-Length, an envelope version above 3, envelope flags other than 2, a kdf mismatch
400 {"error":"client_outdated"} a request of an earlier protocol version (§15): an instance request with X-Nylzo-Ttl and X-Nylzo-Share-Key but without X-Nylzo-Registration, a create whose X-Nylzo-Create has no epoch, or verifier_key without registration, or whose envelope version is below 3, a claim or burn with X-Nylzo-Verifier, or an X-Nylzo-Share-Key without a suite (§5.6); the client must be updated
401 {"error":"unauthorized"} an admin request (§6.8) without a valid signature of a live session, over a challenge it did not use up, and a refused enrollment or sign-in: a wrong, used or expired token, an unknown passkey or an assertion that fails a check; only the admin routes answer 401
403 {"error":"passphrase","retry_after":N,"attempts_left":N} a handshake while the backoff or the lifetime cap holds, and a claim or burn whose KE3 does not match its handshake (§6.4); no open consumed, nothing deleted
403 {"error":"pow"} PoW required and missing, invalid or already used
403 {"error":"id_token"} create with an id token that is missing, invalid or expired, whose epoch or ttl_s differs from the token, or whose deadline (§5.6) has passed before the upload was stored; the client fetches a new id from GET /api/v1/instance
404 {"error":"not_found"} unknown id, a key that does not match, a missing, malformed, expired or used challenge, one the server has not issued since it last started, a claim or burn whose challenge no handshake of the same message issued, a bad signature, and a malformed id in the path (indistinguishable)
409 {"error":"share_lost"} a create whose id token names a generation the server no longer holds (§5.4); the client fetches a new id and retries once
409 {"error":"conflict"} a row for the id's locator exists, live or ended (identical for both)
410 {"error":"gone","state":"opened|expired|cancelled|deleted|lost"} message ended
410 {"error":"gone","state":"available|opened"} blob or ack with a lease that is not active while the message is still live; state is the message's current state, read again after the lease check, so a message that ended meanwhile answers its end state
411 {"error":"length_required"} create without Content-Length
413 {"error":"too_large"} Content-Length above the instance limit
429 {"error":"rate_limited","retry_after":N} + Retry-After header bucket limit, source, prefix or instance token bucket, 4th blob download in a lease
500 {"error":"internal"} storage or blob failure; the body never carries details. A request whose client went away answers 400 instead. A claim whose transaction committed always answers 200 and sends X-Nylzo-Lease before the body, so a client whose download breaks resumes through /blob without spending another open. A live, unexpired message whose blob is missing without a recorded ending (§7) answers 500 and stays live; a claim checks this before it spends an open
503 {"error":"unavailable"} + Retry-After global creation cap, Sec-Purpose requests, PoW verifier saturated, no free file in the upload pool (§5.2), all stream slots busy for a claim or download (§9), a challenge request while the table of challenges is full (§5.5), an instance request with X-Nylzo-Ttl while the clock runs more than a minute behind the epoch ratchet (Retry-After: 60, §5.6)

The 404 response (status, headers, body bytes) MUST be byte-identical for an unknown id, a key that does not match the row and every failed signature or challenge. The 409 response MUST be identical for a live message and an ended one, and for a conflict found before the body is read or while storing it.

6.2 Create

POST /api/v1/messages
Content-Type: application/octet-stream
Content-Length: {size}
X-Nylzo-Create: base64url(JSON {id, id_token, epoch, read_key, registration, manage_key, kdf_id, opens_max, ttl_s, size})
X-Nylzo-Pow: {token}            only when the instance reports pow.required
body: object (§3)

Server order of checks, each before reading the body: (1) parse the header and the id syntax, then verify the id token with the epoch and ttl_s of the header and check that its deadline has not passed (§5.4, 403 id_token), and check that the server still holds the generation it names (409 share_lost); (2) Content-Length present (411), equal to size (400), below the limit (413); (3) free disk space for this upload and the uploads in progress (503 with Retry-After: 60, §9), before any counter, so a client refused for disk space keeps its budget; (4) the per-address counters in memory (§8), counting the attempt even if it fails later (429 when over); (5) the global daily cap: 503 when the counter has reached the cap, PoW when it is at or above 50 % (403, §8.1), then one conditional increment reserves a slot (503 when none is left by then). A request that reserved a slot at or above 50 % without a verified PoW returns the slot and answers 403 pow; (6) no row for the id's locator, live or ended (409, same for both).

The body may take max(120 s, size / 16000 s) to arrive, which is 128 kbit/s for the whole object. The server then streams the body through a size-bounded reader, reads the 15-byte header, answers client_outdated for a version below 3 and 400 for one above it, rejects flags other than 2 (§3) and a kdf_id that differs from the header field, and stores the blob under a fresh random reference with its own blob_key and Padmé padding (§5.2). It stores the row with the registration sealed under a key from the new erase salt and the current pepper_id (§5.2), created_at taken when the upload has been stored, rounded down to the minute, and expires_at = the deadline of the id token's epoch (§5.6). It refuses an upload stored at or after the deadline (403 id_token, after which the client fetches a new id), checks the generation again (409 share_lost), and answers:

201 {"id":"…","expires_at":"…"}
  • id and id_token MUST come from one GET /api/v1/instance response (§5.4). A client never generates an id.
  • read_key and manage_key are pk_R and pk_M (§2). registration is the registration record of §2.1, made with the registration response that came with the id. Every create carries one, also for kdf_id 0. The server rejects (400) a registration whose client_public_key does not decode as a ristretto255 element other than the identity (RFC 9807 §10.7); nothing else in it can be checked, and a broken one only keeps the sender's own readers out. epoch is the e of the instance response that issued the id (§5.6). A header with verifier_key and without registration answers client_outdated (§15).
  • The server rejects (400) a read_key or manage_key that is not the canonical encoding of a curve point, one of small order (8 times the point is the identity) and two equal keys, because anyone could forge signatures for a small-order key without the seed. The check uses filippo.io/edwards25519, and every signed request repeats it for the keys it carries (§5.5).
  • opens_max MUST be between 1 and the instance maximum; ttl_s between 60 and the instance maximum, and equal to the TTL of the instance request that issued the id (§5.4). The server MUST NOT clamp a policy; it rejects with 400.
  • The TTL runs from the instance response, so the time a client spends on its key derivation, proof of work and upload counts against it. expires_at in the response equals the deadline of the instance response, which the client sealed into the policy (§3); a client MUST refuse a response with another value. A client whose work takes longer than the TTL gets 403 id_token; the reference clients ask for a new id at most twice more.
  • The header JSON MUST NOT contain unknown keys. A header with an unknown or repeated member answers 400.
  • size MUST be a positive multiple of 65536 (§3). The server rejects (400) any other size with the header, before it reads the body.
  • Only stored messages keep their slot in the global cap. Every failure after the reservation, including a conflict, a bad body, a storage error and a client that disconnects, returns the slot, so concurrent creates never exceed the cap. While uploads are in flight the counter includes their slots. A second counter holds stored messages only: when it has reached the cap, the 503 carries a Retry-After until the next UTC day, otherwise 60 s. A process that crashes or is killed while uploads run leaves their slots taken, so serve sets the first counter to the second before it listens. serve holds an exclusive lock on the data directory while it runs and refuses to start while another serve holds it; it skips the reset when it finds another process, such as sweep-once, with the database open.

6.3 Metadata (non-consuming)

GET /api/v1/messages/{id}
Authorization: Nylzo-Sig {pk_R}.{challenge}.{signature}
200 {"state":"available|opened|expired|cancelled|deleted|lost","created_at":"…","expires_at":"…","opens_max":N,"opens_remaining":N,"ttl_s":N,"kdf_id":N,"size":N,"first_opened_at":"…"?,"ended_at":"…"?}
404 for an unknown id and for any failed signature

Metadata never changes opens_remaining. It changes the state only of an available message whose generation the server no longer holds, which it ends as lost like any authorized request (§7); while the server cannot read its seed file, metadata reports the stored state and ends nothing. After the signature check passed, it MAY complete the deletion of a blob that is already unreachable (an ended message, or opens_remaining == 0 with no active lease), and it finishes an ending recorded in the record (§7).

Once the blob of an ended message is gone, metadata answers 200 with the state, first_opened_at (rounded to the minute, absent when the message was never opened) and ended_at, and nothing else: created_at and expires_at are absent, opens_max, opens_remaining, ttl_s, kdf_id and size are 0. The response carries no passphrase_required; a client takes the profile from its link, and kdf_id 0 on an ended message is not a profile (§2). While an ending is recorded but its blob is not yet deleted (§7), metadata and status already report the ended state but keep the live fields and carry no ended_at; they switch to the ended shape once the blob is gone. A message the operator removed (§6.6) carries no ended_at, because the server removes it without opening its record.

6.4 Handshake and claim

A reader proves the passphrase with an OPAQUE login (§2.1) in two requests: the handshake, which answers KE2, and the claim or burn, which carries KE3.

POST /api/v1/messages/{id}/handshake
Authorization: Nylzo-Sig {pk_R}.{challenge}.{signature}
X-Nylzo-KE1: {KE1}
body: empty
200 {"ke2":"…","challenge":"…","expires_at":"…","attempts_left":N,"retry_after":N}
403 {"error":"passphrase","retry_after":N,"attempts_left":N}
410 {"error":"gone","state":"…"}

A handshake without a well-formed X-Nylzo-KE1, or whose blinded element or client keyshare does not decode as a ristretto255 element other than the identity, answers 400 before the signature check. After the signature check a message that has ended answers 410 (§7). One whose last open is spent while a lease is active has not ended, so a burn (§6.6) and a reader who resumes from its lease (§6.5) can still run a handshake; such a reader sends its lease in X-Nylzo-Lease, which the transcript binds, and a lease that is no longer active answers 410 as a download with it would, before anything is counted.

The server then computes E as a claim does, which the OPRF key needs (§5.1); when the share is gone it ends the message as deleted and answers 410. When the pepper that made the registration's OPAQUE keys (§5.1) is not configured, it counts nothing, logs registration-pepper-missing and answers 503. It reads the erase salt from the blob as a claim does (a missing blob answers like one), opens the registration (§5.2) and takes a challenge for the answer from its table, which expires 15 minutes after issue so that the client can stretch its passphrase before it presents it, also when the browser froze its tab meanwhile; a handshake that is then refused gives its challenge back, answering 503 with Retry-After: 60 when the table is full (§5.5). In one storage transaction it reads now, loads the row and opens the record (410 for a message that has ended meanwhile), and then:

  1. If the message has 100 failed attempts over its whole life, it answers 403 with retry_after until expires_at and attempts_left = 0; if next_attempt_at is in the future, 403 with that retry_after.
  2. Otherwise it counts the attempt: fail_count_total += 1, and from the 6th attempt it sets next_attempt_at to now + min(2^(fail_count_total − 5), 3600) seconds rounded up to the next full minute.

Once the transaction has committed, the server computes KE2 with GenerateKE2 and the OPAQUE keys of the registration's pepper_id (§5.1), puts the login state into the challenge (§5.5) and answers 200 with KE2, the challenge and its expiry, attempts_left = max(0, 5 − fail_count_total) and retry_after, the seconds until next_attempt_at or 0. The counters belong to the message, not to an address, so a wait applies to every reader. Every handshake counts, for a message with or without a passphrase, because KE2 lets its client test one passphrase (RFC 9807 §9.2); the attempt stays counted unless a matching KE3 arrives. Any signed request that carries the handshake's challenge and a matching KE3 takes the attempt back, also a claim, burn or download that the server refuses for load before its signature is checked (429, 503). A handshake that fails after counting and sends no KE2 takes its attempt back as well.

POST /api/v1/messages/{id}/claim
Authorization: Nylzo-Sig {pk_R}.{challenge}.{signature}     the challenge of the handshake
X-Nylzo-KE3: {KE3}
X-Nylzo-Share-Key: {share_key}                a fresh share key of suite 1 (§5.6); always sent
body: empty
200
  X-Nylzo-Lease: {L}
  X-Nylzo-Share: {wrapped}                    (§5.6)
  X-Nylzo-Policy: base64url(JSON {"opens_max":N,"ttl_s":N,"kdf_id":N,"deadline":N})      [detail]
  Content-Type: application/octet-stream
  body: object
403 {"error":"passphrase","retry_after":N,"attempts_left":N}
410 {"error":"gone","state":"…"}

A claim without a well-formed X-Nylzo-KE3 answers 400 before the signature check. X-Nylzo-Policy carries deadline, the message's expires_at in Unix seconds; the reader seals it into the policy it checks (§3). A claim or a download without a well-formed X-Nylzo-Share-Key answers 400 after the signature check and before anything else, the read rate limits included, so it spends no open and no read budget. Right after this check the server compares KE3 in constant time with the client_mac that the challenge holds (ServerFinish). A KE3 that does not match answers 403 with the counters of the record: the handshake already counted the attempt, so the claim counts nothing more, and the reader starts again with a handshake. A matching KE3 takes back the attempt that its handshake counted: fail_count_total −= 1, and next_attempt_at gets back the value it had before the handshake if it still holds the value that the handshake set; once fail_count_total is 5 or less, next_attempt_at is cleared, also when a concurrent handshake set it. The server does this in a transaction of its own right after the check, so it stands whatever the claim then answers.

The server computes E from the record's epoch (§5.6) before the transaction. When the ratchet has passed that epoch while it still holds the generation, the share went with the deadline: the message has expired, also when another instance or a clock step reached the deadline before this clock did. The server then answers 410 with the state the message has at its deadline and, while its own clock is still before the deadline, records and deletes nothing. When the server no longer holds the record's generation and the deadline has not passed by the ratchet, the share is lost, and the server ends the message as lost and answers 410; a message that seals its deadline and whose epoch the ratchet has passed counts as expired, as above, also when its generation is gone.

After it has checked that the request body is empty, and before the transaction, the server opens the blob, reads its erase block, checks blob_tag over the rest of the file (§5.2) and keeps the file open for the response. A blob whose size differs from 4096 + padme(size) or whose bytes do not give blob_tag answers 500 and spends no open; an erase block that a concurrent deletion has already overwritten counts as a missing blob. Before it opens the blob, the server answers from the row it loaded a claim that the transaction would refuse: an ended message (410) or 8 active leases (503), so such a claim reads no blob; the transaction checks both again. A missing blob on a message that has ended (a recorded ending, or expires_at ≤ now) answers 410 with the end state and finishes the ending; on any other message it answers 500 and spends no open.

In one storage transaction:

  1. Read now from the process clock, after the transaction holds the write lock, load the row and open the record. A recorded ending, opens_remaining == 0, expires_at ≤ now or a missing blob_wrap → 410. While 8 leases are active → 503 with Retry-After until the first of them ends; no open is spent.
  2. opens_remaining −= 1; add a lease (mac_lease(L), lease_expires_at = now + max(120 s, size / 16000 s) rounded up to the next full minute, downloads = 0) to the record and drop the leases that have expired. When opens_remaining == 0 the state becomes opened, and the row's blob_purge_at moves to the end of the last lease or to expires_at, whichever comes first, because no lease downloads after the expiry, and purge_at to 7 days after that, both rounded up (§5.2).
  3. Return the object with the lease and the policy.

A lease is active while now < lease_expires_at. After the last open, the instance that served the claim schedules the release of the blob at lease_expires_at + 1 s (§7); it keeps the record key in memory until then. A claim or blob response may take as long as its lease: the write deadline is max(120 s, size / 16000 s) from the start of the response, so a recipient on a 128 kbit/s link still receives the largest object.

Anyone who holds the link but not the passphrase can keep this backoff running with handshakes that send no matching KE3, for a burn (§6.6) as well as a claim, and after 100 of them the message stays locked until it expires. A message without a passphrase counts the same way. This costs availability only. The protocol has no reset of the counter, neither with the manage key nor by PoW; the sender restores availability by cancelling the message and sending a new link through another channel. Handshakes of honest readers count too until their KE3 arrives, so when more than five readers start one in the same moment, the sixth sets a wait that turns away the next reader until it takes its attempt back.

Definition of one open: one successful atomic release of the envelope by the server after proof of the link and the passphrase. Loading the page, metadata, a handshake, a decryption attempt or a wrong passphrase never count.

6.5 Blob, ack

GET  /api/v1/messages/{id}/blob    signed with R, X-Nylzo-Lease: {L}, X-Nylzo-Share-Key: {share_key} [, X-Nylzo-KE3: {KE3}]
  200 object (also X-Nylzo-Policy), 410 when the lease is not active (§6.1) or the message ended, 429 from the 4th download in one lease
POST /api/v1/messages/{id}/ack     signed with R, X-Nylzo-Lease: {L}
  204; ends the lease early and releases the blob when it was the last one (§7)
  • A download answers X-Nylzo-Share like a claim, wrapped to the share key of that request. A download that resumes from a lease after a handshake (§6.4) carries its KE3 and signs the handshake's challenge: a matching KE3 takes back that handshake's attempt, one that does not match answers 403, and a challenge that no handshake of the message issued fails like a wrong key. A download without X-Nylzo-KE3 takes any challenge.
  • Blob downloads and acks count in the read rate limit, and downloads are capped at 3 per lease. A download whose lease already shows its 3 downloads when the request arrives answers 429 without reading the blob. Any other download opens and checks the blob like a claim, so a blob that fails the check answers 500 and spends none of the 3; the transaction that then counts the download refuses a message that has ended by then, its expiry included.
  • The blob is deleted as soon as opens_remaining == 0 and no lease is active. A claim or download that finds the blob already deleted by a concurrent ending, including an expiry, answers 410 without X-Nylzo-Lease and with the end state (§7), finishing that ending first if it was interrupted. A missing blob on an unexpired message without a recorded ending is a storage fault: the server answers 500, keeps the row and counts the error blob-changed (§5.2). A download that finds an ending already recorded answers 410 with that state and finishes the ending.
  • HEAD on any /api/ route, including instance and challenge, answers 404 like any other unsupported method, so it never spends a download, mints no id token or challenge and never reaches a signed handler.
  • A stream that ends early is logged as blob-stream, without the number of bytes sent or the object size.
  • The server finds a lease by mac_lease(L) in the record of the message, so a stale lease token never touches a lease of another claim or message. An ack that finds an ending recorded, or a lease that a concurrent ending already removed, answers 410 with the end state and finishes the ending, like a download.

6.6 Burn, cancel, status, instance

POST /api/v1/messages/{id}/burn     signed with R over the challenge of a handshake, X-Nylzo-KE3 → 204; state = deleted, blob deleted
                                    403 {"error":"passphrase","retry_after":N,"attempts_left":N}
POST /api/v1/messages/{id}/cancel   signed with M → 204; state = cancelled, blob deleted
GET  /api/v1/messages/{id}/status   signed with M → 200 {"state":"…","opens_used":N,"opens_max":N,"created_at":"…","expires_at":"…","first_opened_at":"…"?,"ended_at":"…"?,"failed_passphrase_attempts":N}
GET  /api/v1/instance  [X-Nylzo-Ttl: {ttl}, X-Nylzo-Share-Key: {share_key}, X-Nylzo-Registration: {registration request}] → 200 {"limits":{"max_file_bytes":N,"max_text_bytes":N,"max_object_bytes":N,"max_ttl_s":N,"default_ttl_s":N,"max_opens":N},"pow":{"required":bool,"difficulty":N,"challenge":"…"?},"create":{"id":"…","id_token":"…","expires_at":"…","epoch":N,"deadline":"…","share":"…","registration":"…"}?,"versions":{"api":1,"envelope":3,"fragment":3,"share":1,"server":"…"},"build":{"version":"…","commit":"…","date":"…","dirty":bool}}
GET  /api/v1/challenge              → 200 {"challenge":"…","expires_at":"…"} (§5.5)

build gives the version, commit, date (the source commit time in UTC) and dirty flag of the running server, and the well-known client and transparency documents (§9) carry the same object. versions.server and the well-known server fields also identify the running server; the protocol and API version fields are independent of them. The web client embeds its own build identity in /assets/build-info.json, which the client file hashes cover. None of these identifiers is a signature: authenticity requires the release checksums, Sigstore signatures and provenance of the exact release tag.

  • GET /api/v1/instance answers the create object only when the request carries X-Nylzo-Ttl (the TTL in seconds as a canonical decimal, between 60 and the instance maximum), X-Nylzo-Share-Key (a share key of suite 1, §5.6) and X-Nylzo-Registration (a registration request of §2.1: a canonical 32-byte ristretto255 element other than the identity), each once. With only some of them, a repeated or a malformed one, it answers 400; a share key without a suite, and the first two headers without X-Nylzo-Registration, answer 400 client_outdated (§15). epoch is e, deadline the deadline of §5.6 in RFC 3339, share the wrapped share for the new id, and registration the registration response (CreateRegistrationResponse, §2.1) for the new id, made with the OPAQUE keys of the current pepper (§5.1). expires_at is the expiry of the id token.
  • A client seals deadline into the policy (§3) and sends epoch back unchanged. It MUST refuse a deadline that is not a whole minute, whose minute before is not epoch, or that does not lie between ttl and ttl + 61 seconds after the issue time, which is the token's expires_at minus 600 s. The server computes it from the same clock reading, so the check needs no correct client clock.
  • Without the headers the response leaves out create, for clients that only read the limits. They are headers and not a query, so the TTL a sender chose stays out of the URL that a provider in front of the instance logs, and the local client (§14.1) relays the request unchanged. Compression is the sender's decision (§3.2); the instance response says nothing about it.
  • A client MUST refuse an instance that reports a proof-of-work difficulty above 7 or below 0 (§8.1) before it derives any key.
  • failed_passphrase_attempts is cumulative over the message lifetime (fail_count_total), not per day.
  • Status, cancel and the handshake of a burn end an available message whose generation the server no longer holds as lost, like metadata (§6.3): status reports it, and a burn or cancel answers 410 lost. While the server cannot read its seed file, status reports the stored state and a cancel, which needs no share, goes ahead as usual; a burn needs the share for its handshake and answers 500.
  • Once an ended message's blob is gone, status answers the ended shape: only state, first_opened_at and ended_at are meaningful; created_at and expires_at are absent and the counters are 0 (§6.3).
  • first_opened_at and ended_at are rounded down to the minute.
  • A burn needs the passphrase of a message that has one. It follows a handshake and carries X-Nylzo-KE3 over the handshake's challenge, like a claim (§6.4), also for kdf_id 0. A malformed or missing X-Nylzo-KE3 answers 400 before the signature check. A KE3 that does not match answers 403 and records no ending, and a matching one takes back the attempt of its handshake before the burn records the ending. Claims and burns share the counters, so burning tests no more passphrases than claiming does, and wrong guesses from anyone with the link hold back a burn as they hold back a claim. Only the sender's cancel with M is sure to end such a message before it expires.
  • A failed manage signature on cancel or status answers the same 404 as an unknown id. Handshake, burn, cancel and status count in the hourly read budget of the address (§8), like metadata, claim, blob and ack, so a probe for whether an id exists gets 300 attempts an hour per /32 or /64 on every route.
  • The operator ends a message with nylzo takedown on the server host, which reads message ids from stdin, refuses the whole input when a line is not an id, and removes each message. It has no key to open the record, so it deletes the blob the way §7 does, starting with blob_wrap, and sets purge_at 7 days ahead. It reports deleted, already ended when the row had no blob_wrap or its blob_purge_at had passed (it still deletes such a blob), or no message; a burn or cancel whose delete is still pending can report deleted. The reader and the sender's status then see deleted as after a burn, without ended_at, so a client describes deleted as deleted by a recipient or removed by the operator.

6.7 Visit signal

POST /api/v1/visits            {"signal":"person"|"automation","page":"home"|"sent"|"transparency"|"terms"|"agents"|"other"} → 200 {}
POST /api/v1/visits/documents  {"signal":"document","page":"home"|"sent"|"transparency"|"terms"|"agents","navigation":bool?} → 200 {"counted":bool}

The server counts visits of the public pages for the operator's admin area (§6.8), first-party and without keeping an address (§5.3). It counts only while at least one passkey exists, and transparency.json reports that as visits.counted (§9).

  • POST /api/v1/visits takes the signals of a page's script. The answer is 200 {} whatever came of the signal, also while the server counts nothing and for a signal it drops; a document signal on this route counts nothing. A body that is not JSON or is longer than 256 bytes answers 400 bad_request. The route passes the token buckets of §8 and the cross-origin guard of §6 like every other mutation.
  • person comes from the page's script, once per document, after the first trusted pointerdown, pointermove, keydown, scroll, touchstart or wheel event. A page whose navigator.webdriver is true sends automation at load instead. The script reads nothing else from the device.
  • page names the counted pages: / and /{language}/ (home), /sent, /transparency, /terms and /agents. The page that tells a reader an address does not exist sends other. A page that shows a message, /r and /m/{id}, MUST NOT be counted: its screen sends no signal, the server records no document for it, and a signal whose page is none of the six names counts nothing. /admin is not counted either.
  • A document comes only from whoever served a counted page with its content; a client cannot report one. A server that serves the page itself records it without a request. A frontend that serves the pages reports each to POST /api/v1/visits/documents as a request of its own, which carries only the peer address (as the proxy's X-Forwarded-For), the page request's User-Agent and the JSON body. navigation is true when the page request carried Sec-Fetch-Mode: navigate and Sec-Fetch-Dest: document.
  • POST /api/v1/visits/documents answers only when NYLZO_EDGE_REPORTS is set and the peer is among the trusted proxies (§8); anyone else gets the 404 of an unknown address. An instance behind another reverse proxy, which passes every API address on, MUST leave NYLZO_EDGE_REPORTS unset. The reports pass no token bucket of the visitor they are about; they share one budget of 50 reports per second with a burst of 200, and a report beyond it counts nothing. counted tells whether the instance counts visits.

6.8 Admin session

GET    /api/v1/admin                     → 200 {"enrolled":bool}
POST   /api/v1/admin/enrollment/options  {"token":"…"} → 200 {"public_key":{creation options}}
POST   /api/v1/admin/enrollment          {"token","credential_id","client_data","authenticator_data","public_key","algorithm"} → 201 {"enrolled":true}
POST   /api/v1/admin/session/options     {"key":"…"} → 200 {"public_key":{request options}}
POST   /api/v1/admin/session             {"key","credential_id","client_data","authenticator_data","signature"} → 200 {"challenge":"…","expires_at":N}
GET    /api/v1/admin/overview?range=24h|7d|30d|90d|12m   signed, purpose admin → 200
         {"challenge","range","from","resolution_s","series":{metric:[N…]},"totals":{metric:N},"previous":{metric:N}?,
          "countries":[{"name","value"}],"pages":[…],"robots":[…],"stored":N,
          "storage":{"free_bytes","total_bytes","reserve_bytes","database_bytes"},
          "security":{"passkeys","last_sign_in","session_expires_at"},
          "source":{"countries","attribution","attribution_url"},"version"}
GET    /api/v1/admin/live[?since=N&refused=N]   signed, purpose admin → 200
         {"challenge","online":N,"people":[30 × N],"robots":[30 × N],"session_expires_at":N,"usage_supported":bool,
          "usage":[{"at","processor","load","memory_used","memory_total","process_bytes"}],
          "refused":[{"client","country","reasons":{reason:N},"count","first","last"}]?,"refused_version":N}
DELETE /api/v1/admin/session             signed, purpose admin → 200 {}

The admin area belongs to the operator of an instance; visitors still need no account. Its page is /admin (§9). It signs in with passkeys only and has no password.

  • Enrollment: nylzo admin-enroll on the server host draws a 24-byte token, stores its SHA-256 with an expiry of 15 minutes in admin.db (§12) and prints {public URL}/admin#enroll={token}. The token travels in the fragment, so no request target carries it; the page removes it from the address bar and sends it in the body of both enrollment requests. One enrollment is open at a time, and a newer token replaces an older one. The enrollment that stores a passkey deletes the token in the same transaction, so a token enrolls one passkey once. An instance holds at most 8 passkeys. nylzo admin-reset removes every passkey and the open enrollment.
  • Ceremonies follow WebAuthn Level 3. The relying party id is the host of NYLZO_PUBLIC_URL, and the expected origin is that URL without a default port (443 for https, 80 for http), as a browser reports it; without it only a loopback Host stands in, with whatever port it names, and any other host answers 400. An instance that anyone but its operator can reach MUST set NYLZO_PUBLIC_URL. Creation asks for a discoverable credential, user verification and attestation none, excludes the enrolled passkeys and offers ML-DSA-65, ML-DSA-87, ML-DSA-44 (COSE −49, −50, −48), Ed25519 (−8) and ES256 (−7). The page sends the public key as the SubjectPublicKeyInfo from getPublicKey().
  • The server MUST check the client data type, challenge and origin and refuse a ceremony in a frame, the relying party id hash, the user-present and user-verified flags, the backup flags, the signature and, on sign-in, a signature counter that did not increase: the sign-in stores the new counter only where the stored one is lower (or both are 0), in one statement, so two sign-ins with the same counter cannot both pass. It verifies with the Go standard library only.
  • A ceremony challenge is 32 bytes and lives 5 minutes. An enrollment challenge is random, held in memory and used up by its first answer, whatever comes of it; only the holder of an open token can ask for one, and a process holds at most 16. A sign-in challenge is held nowhere: it is 12 random bytes, the second it runs out and the first 16 bytes of an HMAC-SHA-256 over both and the session key, under a key the process draws at start. A sign-in challenge opens one session: the process remembers it from then for 5 minutes and 5 seconds by its monotonic clock, and it refuses a challenge that runs out more than 5 minutes and 5 seconds ahead of its wall clock.
  • Session: the page creates a non-extractable Ed25519 key pair in memory and sends the public key to session/options, which binds the ceremony challenge to it, and again with the assertion to session. A passkey assertion over a challenge of that key opens a session for it. Every later request is signed with it in the format of §5.5 with purpose admin, over the method, the path with its query, a server-issued challenge and the empty body; a signed request that carries or announces a body answers 400 bad_request, and an overview whose range is none of the five answers 400 as well. The server answers 401 for a session that ended and for a challenge that ran out alike, so after a 401 over a challenge it had kept, the page asks once more over a fresh one before it treats the session as ended. expires_at and session_expires_at name the end at the latest, 12 hours after sign-in. The challenge is used up like any other (§5.5); every answer carries the next one, and GET /api/v1/challenge supplies one when an answer had none. Nothing goes into a cookie or into browser storage.
  • A session ends after 15 minutes without a request, 12 hours after sign-in, on sign-out, on a restart of the server, within a minute after its passkey was removed (admin-reset), and in effect on a reload of the page, which loses the key. A process holds at most 4 sessions and drops the oldest for a fifth.
  • A request without a valid signature of a live session answers 401 unauthorized. A failed enrollment or sign-in (a wrong, malformed, used or expired token, a ninth passkey, a passkey the instance already holds, an unknown passkey, or an assertion that is incomplete or fails a check) also answers 401, puts the client on the list of refused clients with reason admin (§5.3) and counts as the held event admin-sign-in-refused or admin-enrollment-refused without an address (§10).
  • No session credential is ambient, and the cross-origin guard of §6 applies to these routes as well. Every answer is application/json.
  • previous holds the totals of the span before the chosen one, cut to the part the running span has had: the period that matches the running one counts in proportion to how much of the running period has passed. 12m has none.
  • The page asks for live every five seconds and sends what it holds: since, the at of its newest usage sample, and refused, the refused_version of its list of refused clients. The answer then carries only the samples taken after since, or every sample when none of them was taken at since, as after a gap or a clock step, and refused only when the list changed; the version changes with every change of the list. A parameter that is not a decimal number answers 400.
  • When admin.db cannot be opened or read, the server runs without the admin area and answers its routes with 404. No admin route reads or changes a message.

7. Lifecycle, leases, sweep

 create ──▶ available ──claim──▶ available (opens_remaining > 0) | opened (opens_remaining == 0)
               │                                    │
               │ expires_at ≤ now | burn | cancel    │ last lease ended (ack or expiry)
               │ | operator removal | lost seed      │
               ▼                                    ▼
           ended: blob deleted, the record keeps the state, first_opened_at and ended_at
               │ sweep after purge_at (7 days after the end, rounded up to the hour)
               ▼
            unknown id (404)

The state of a message follows from its record and its row, checked in this order: a recorded ending (deleted, cancelled or lost); opened when opens_remaining == 0; expired when expires_at ≤ now; deleted when blob_wrap is null, which only an operator removal leaves on an unexpired message with opens left (§6.6); otherwise available. A message has ended when its state is not available, except that the holder of an active lease on an opened message may still download and ack. A message whose generation the server no longer holds, because the seed file was lost (§5.6), can no longer be opened: the first authorized request that finds it available, whether metadata, status, a handshake, claim, download, burn or cancel, records the ending lost and deletes its blob, and its ended_at is the minute of that request; an opened message whose lease is still active ends as lost at its next download. A message whose epoch the ratchet has passed went with its deadline instead (§6.4).

  • Every request checks the state, and an authorized request finishes an ended message whose blob still exists (lazy sweep).
  • Deleting a blob takes three steps, each safe to repeat: (1) one transaction sets blob_wrap to null; a request that ends a message (the ack of the last lease, burn, cancel, a release) does this in the transaction that records the end, and an operator removal in the one that removes it; (2) Blobs.Delete, which overwrites the erase block in place, syncs it, unlinks the file and syncs the directory, and treats a missing object as success; (3) one transaction clears blob_ref and blob_purge_at and asks for a scrub of the WAL (§5.2). A request runs them as soon as a message has ended. The row keeps blob_purge_at until step 3, so after a failure the sweep repeats them.
  • Burn and cancel record their state and the minute in the record in one transaction, set blob_purge_at to now and purge_at to 7 days later, both rounded up (§5.2), and then delete the blob. The first recorded ending wins, so a later burn, cancel or expiry reports the recorded state. An expired message records nothing, because expires_at ≤ now already ends it durably; it ends as opened when no opens remain and as expired otherwise, with ended_at = expires_at. While a failed delete leaves the blob in place, claims, downloads, acks, burns and cancels answer 410 with the state, metadata and status report it, and every later request on the id and every sweep repeats the delete. A failure to finish is logged and never changes the response to a wrong key, which stays the uniform 404. Once burn or cancel has recorded its ending, the server deletes the blob even if the client disconnects. A burn or cancel that recorded the first ending answers 204 even when a concurrent release deletes the blob first.
  • When opens_remaining == 0 and no lease is active, the blob is released: by the ack of the last lease, by the timer that the instance which served the last claim sets for lease_expires_at + 1 s with the record key it keeps in memory until then, by any authorized request on the id, or by the sweep at blob_purge_at. A request or timer that releases it records the minute as ended_at; after a release by the sweep, ended_at is the end of the last lease.
  • Sweep (built-in goroutine every NYLZO_SWEEP_INTERVAL, default 5 min; or nylzo sweep-once from an external scheduler) never opens a record. It deletes the blobs whose blob_purge_at has passed (one Blobs.DeleteBatch call per page, which syncs the blob directory once, with the two transactions around it), deletes the rows whose purge_at has passed and purges expired rate_counters, in batches of 100 message rows and 1000 counters paged by key, so rows that keep failing never hide the rows after them, and then rebuilds the tables whose rows changed (§5.2).
  • Every sweep also refills the upload pool (§5.2), shreds temporary upload files older than 15 minutes, scrubs the WAL (§5.2) and sets the times of every blob file, pool file and their directories again, so each ctime shows the sweep, not the upload. A blob file carries its blob_purge_at as its modification time.
  • Once per UTC day the sweep lists the blob store and shreds objects whose modification time has passed and whose ref no row holds. A counter in rate_counters records the day once a reconcile has listed both the rows and the blob store, so later sweeps that day, including separate sweep-once runs, skip it. A reconcile whose listing failed runs again on the next sweep; objects that failed to delete wait for the next day. The built-in sweeper also runs once at startup. Two sweeps that overlap may both reconcile, which is harmless. One failing item never stops the remaining steps, and sweep-once exits non-zero when any step failed.
  • Clocks: every comparison of times (expiry, leases, backoff, counter windows, PoW windows) uses the clock of the process that handles the request or runs the sweep. All instances and sweep jobs MUST run with synchronised clocks; the reference store does not read a clock of its own. A claim passes its clock to the store, which reads it after the transaction holds the write lock, so a claim that waited for the writer never starts a lease after expires_at.
  • Ids are never reused. The server issues every id from its CSPRNG with a short-lived token (§5.4), so after a row is purged nobody can create a message under the old id, and the server keeps no trace of a message longer than 7 days and one hour after it ends.
  • Guarantees: access ends immediately (every request checks the state, expiry and leases). A message also ends cryptographically at the same instant: its expires_at is the deadline of its share, and serve erases the epoch key of that share when the deadline's minute begins (within a minute while it runs, at the next sweep-once otherwise); from then on no copy of its object opens unless the attacker also holds a seed copied before the deadline (§5.6). Content becomes unreadable and is deleted immediately on burn, cancel, operator removal and the ack of the last lease, and at the end of the last lease on a best-effort timer; otherwise at the latest by the first sweep after blob_purge_at, at most 15 minutes after the expiry or the end of the last lease plus one sweep interval.

8. Rate limits, caps, proof of work

  • In-memory token buckets in front of the database for /api/*, checked in order: one per source, keyed by the /32 or /64 address bucket (§5.3; NYLZO_RATE_SOURCE_RPS default 10 requests per second, NYLZO_RATE_SOURCE_BURST default 20); one per prefix, keyed by the /24 or /48 bucket, with half the instance rate and burst; and one per instance (NYLZO_RATE_BUCKET_RPS default 500 requests per second, NYLZO_RATE_BUCKET_BURST default 1000). A request that an earlier bucket refuses takes no token from the later ones, so one /64 or /32 source, or one /48 or /24 range, cannot take more than half of the instance bucket.
  • While the instance bucket is less than half full it paces ranges: a /24 or /48 gets one request every (n + 1) / rate seconds, where n counts the ranges seen in the last 10 seconds or still waiting for their next turn, and a range whose turn has come but finds no token loses that turn. A range that asks for no more than its share therefore gets through. The bucket still never admits more than its rate and burst. The pacing table tracks at most 65536 ranges; when a new range finds it full it drops the ranges that no longer count, then a random eighth, and a dropped range starts with its turn due. Each per-source and per-prefix table tracks at most 65536 entries; when full it drops entries that have refilled, then a random eighth. /m/* never queries the database and is not throttled. The id syntax is checked before any query.
  • Counters per address bucket (§5.3), kept in the memory of each process with hourly and daily windows by the server clock. The /32 or /64 counters come first. A request over one limit is not counted against the limits after it, so a refused source does not use up its /24 or /48 budget. A refused request gets a Retry-After of at least 1 s. Each process tracks at most 65536 buckets per counter; when the table is full it drops buckets whose window has ended, then a random eighth, and a dropped bucket starts from zero. These limits count per instance and restart with the process (§5.3):
Limit /32 or /64 /24 or /48
create per hour 20 100
create per day 100 500
create bytes per day 50 MB 250 MB
metadata, handshake, claim, blob, ack, burn, cancel, status per hour 300 1500
object bytes of claims and downloads per hour 256 MiB 1280 MiB

A claim or download counts the size of its object after the signature check and before it spends an open or a download (NYLZO_RATE_READ_BYTES_HOUR, 0 = off), so a few clients cannot fill the uplink that every reader shares.

  • Global daily creation cap (NYLZO_GLOBAL_DAILY_CREATES, 0 = off): it counts stored messages plus creates still uploading (§6.2). From 50 % of the cap PoW is required for creation; at 100 % creation answers 503 while reading continues. With a cap, each /24 or /48 may create at most a twentieth of it a day and each /16 or IPv6 /32 a fifth, but at least 10, with a 429 until the end of the UTC day, so filling the cap takes at least 20 independent ranges. These shares are counted in each process like the address counters above. /api/v1/instance reads the shared counter, so every instance reports the same state.
  • The database keeps only counters without an address: the global daily counters, used PoW nonces and the daily reconcile marker. A daily row expires 24 hours after its window. A PoW nonce row has window_start = 0 and expires 240 s after its challenge was issued, rounded up to the full minute. The sweep deletes expired rows in batches of 1000.
  • While a passkey of the admin area exists, a refusal by the source or range bucket, an hourly read counter or a create limit also puts the client on the list of refused clients for an hour, in memory only (§5.3), and adds one to the hourly refusals count of admin.db (§12), as does a refused sign-in or enrollment (§6.8). The list never reaches a log, the database or a file, and it changes no limit.

8.1 Proof of work [detail]

The proof-of-work algorithm uses scrypt with N = 2^14, r = 8, p = 1 over a server-issued nonce bound to the message id and a 2-minute window.

challenge = base64url( u32be(window_start) || nonce (16 bytes) || HMAC-SHA-256(k_pow, u32be(window_start) || nonce || u8(difficulty))[0:16] )
token     = challenge || "." || u64be(counter) as 16 lowercase hex digits
valid     = HMAC tag verifies for some difficulty from 0 to 7, −5 s ≤ now − window_start ≤ 120 s,
            and scrypt(password = nonce || id, salt = u64be(counter), N = 2^14, r = 8, p = 1, dkLen = 32)
            has its first `difficulty` bits equal to zero
  • GET /api/v1/instance returns pow.required, pow.difficulty and, when required, a fresh pow.challenge issued with that difficulty. The difficulty is NYLZO_POW_DIFFICULTY (default 4, at most 7) plus one for each tenth of the global cap taken past half, at most 7: with a cap of 250 it is 4 up to 149 creates, 5 from 150, 6 from 175 and 7 from 200. At 7, 95 % of solves need at most 3 · 2^7 scrypt evaluations, which a device that takes 285 ms for one evaluation finishes within the client's 110 s. The tag binds the difficulty, so a token must meet the difficulty its challenge was issued with. A client needs about 2^difficulty scrypt evaluations on average and solves at the difficulty of the answer that carried the challenge.
  • A challenge is single-use. After the tag and window checks pass, the server records the nonce in rate_counters, then waits up to 10 s for a verifier slot and runs scrypt. A second token for the same challenge answers 403 without running scrypt. A failed create after that point, including a 503 because no slot freed up in time, needs a fresh challenge.
  • The counter MUST be lowercase hex; a token with A to F in the counter is invalid.
  • The server verifies with one scrypt call and bounds concurrent verifications (NYLZO_POW_CONCURRENCY, default 4, at most 4, since each one holds 16 MiB). The 5 s tolerance before window_start absorbs small clock differences between instances. A verification above that bound waits up to 10 s for a slot and then answers 503 with Retry-After.
  • Clients that do not implement PoW receive 403 {"error":"pow"} while it is required.
  • A client SHOULD fetch the challenge right before it starts solving, after its own key derivation, by calling GET /api/v1/instance again and ignoring the create part of that answer. It SHOULD stop solving shortly before 120 s after it fetched the challenge and fetch a new one, since the server refuses a token after the window.

9. Transport and headers

  • The server speaks plain HTTP and HTTP/2 without TLS and expects a TLS-terminating proxy or edge in front of it. It listens on 127.0.0.1:8080 unless NYLZO_LISTEN names another address; PORT, the convention of hosting platforms, means all interfaces on that port. When the listen address is not a loopback address, the server logs plain-http-listener at warning level once at startup.
  • http.Server timeouts: ReadHeaderTimeout 5 s, ReadTimeout 10 s, WriteTimeout 120 s, IdleTimeout 30 s. Request headers are limited through MaxHeaderBytes of 8 KiB and to 64 header values, which leaves a signed request with its 1624-character share key (§5.6) room for the headers that a browser and a proxy add. Over HTTP/1.1, net/http adds 4 KiB of read buffer, so headers up to 12 KiB pass and larger ones answer 431. Over h2c, Go's HTTP/2 server allows a header list of 8512 bytes (8 KiB plus 10 × 32), counted as RFC 9113 §6.5.2 counts it, and answers a larger list with its own 431.
  • A create body and its response, and a claim or blob response, get max(120 s, size / 16000 s) in total instead (§6.2, §6.4), and within that every 64 KiB must move within 14 s (64 KiB at 16000 bytes per second, plus 10 s), so a peer that stops sending or reading loses its upload slot, its disk reservation or its stream slot within seconds; the create response deadline starts after the body has arrived. Every early answer to an HTTP/1.x request whose body has not been read to its end closes the connection. Signed routes answer a declared body with 400 without reading it and give a body of unknown length, which a proxy such as Caddy sends for an HTTP/3 request without Content-Length, one second to end before they answer 400; every other body must arrive within the 10 s read timeout.
  • The 400, 431 and 501 that net/http writes over HTTP/1.1 before any handler runs carry the same security headers as every other response. The h2c 431 is framed inside Go's HTTP/2 server and carries none; its body is a fixed text with nothing from the request.
  • Unencrypted HTTP/2 (h2c) buffers at most 64 KiB of unread body per stream and 1 MiB per connection, accepts frames of at most 16 KiB, allows 32 concurrent streams per connection and ignores the priority signals of RFC 9218.
  • At most NYLZO_MAX_STREAMS claim and blob responses (default 256) stream at the same time per instance. A claim or download beyond that answers 503 with Retry-After: 5 after the rate limits, the body check and the syntax of X-Nylzo-KE3, and before the signature check, the same for every id, so it spends no open and a malformed request never holds a slot. Each /32 or /64 address bucket may hold at most 2 of these slots and each /24 or /48 bucket at most 4.
  • Bodies are bounded by a size-limited reader at the instance object limit. The server never decompresses request bodies. A create answers 503 with Retry-After: 60, before the per-address counters and the global cap count it, when the free space of the data directory minus the declared sizes of the uploads in progress and of this one would fall below NYLZO_MIN_FREE_BYTES (default 1 GiB), so a full disk never stops the writes that burn and cancel need. An upload holds its reservation until its handler returns.
  • Client address: taken from the connection. X-Forwarded-For is honoured only when the connection comes from NYLZO_TRUSTED_PROXIES (CIDR list), taking the rightmost value that is not a trusted proxy. X-Real-IP and Forwarded never set the client address. Without NYLZO_TRUSTED_PROXIES the connection address always counts. When a request carries X-Forwarded-For, X-Real-IP or Forwarded and the server still takes the connection address as the client address, it counts a forwarded-header-ignored warning with the name of the first such header as its category, written with the other held events (§10). A trusted proxy that passes a client's own X-Real-IP or Forwarded along does not cause it, because the address then comes from X-Forwarded-For.
  • Every response carries: Referrer-Policy: no-referrer, Integrity-Policy: blocked-destinations=(script), Cache-Control: no-store (except the scripts and stylesheets under /assets/, see below), X-Robots-Tag: noindex, nofollow (except what the official instance lets search engines index, see below), X-Content-Type-Options: nosniff, Cross-Origin-Opener-Policy: same-origin, Cross-Origin-Embedder-Policy: require-corp, Cross-Origin-Resource-Policy: same-origin, Strict-Transport-Security: max-age=63072000; includeSubDomains; preload, Permissions-Policy: accelerometer=(), autoplay=(), bluetooth=(), browsing-topics=(), camera=(), captured-surface-control=(), ch-ua-high-entropy-values=(), clipboard-read=(), clipboard-write=(self), compute-pressure=(), deferred-fetch=(), deferred-fetch-minimal=(), digital-credentials-create=(), digital-credentials-get=(), display-capture=(), encrypted-media=(), fullscreen=(), gamepad=(), geolocation=(), gyroscope=(), hid=(), identity-credentials-get=(), idle-detection=(), keyboard-map=(), language-detector=(), language-model=(), local-fonts=(), local-network=(), local-network-access=(), loopback-network=(), magnetometer=(), media-playback-while-not-visible=(), microphone=(), midi=(), on-device-speech-recognition=(), otp-credentials=(), payment=(), picture-in-picture=(), private-state-token-issuance=(), private-state-token-redemption=(), publickey-credentials-create=(), publickey-credentials-get=(), screen-wake-lock=(), serial=(), speaker-selection=(), storage-access=(), summarizer=(), sync-xhr=(), translator=(), unload=(), usb=(), web-app-installation=(), web-share=(self), window-management=(), xr-spatial-tracking=().
  • On the official instance, whose NYLZO_PUBLIC_URL is https://nylzo.com (port 443 may be written), the home pages (GET / and GET /{language}/ for every other language, and HEAD on them) and its images (/favicon.ico and the .png, .jpg and .svg files under /assets/, which the favicon, the Organization logo and the Open Graph image name) carry no X-Robots-Tag, so search engines may index them; the rule follows the address, so a 404 for such an address carries none either. Every other response keeps noindex, nofollow, and so does every response of any other instance, because it serves the same text. The web client's HTML has no robots meta tag.
  • Responses other than HTML carry Content-Security-Policy: default-src 'none'; frame-ancestors 'none'; base-uri 'none'; form-action 'none'; sandbox, so a JSON, SVG or Markdown response opened on its own runs in an opaque origin.
  • HTML responses carry Content-Security-Policy: default-src 'none'; script-src 'self' {script hashes}; style-src 'self' {style hashes}; connect-src 'self'; img-src 'self'; font-src 'self'; worker-src blob:; object-src 'none'; frame-ancestors 'none'; base-uri 'none'; form-action 'none'; require-trusted-types-for 'script'; trusted-types nylzo-kdf. {script hashes} lists 'sha384-…' (standard base64) of the text of each inline <script> of the page, which in the built client are the import map and the script that takes the fragment out of the address bar (§4); a JSON-LD block (type="application/ld+json") is data that never runs and gets no hash. {style hashes} does the same for each inline <style>, also one inside <noscript>. A list keeps the order of the page without repeats, and an empty list leaves 'self' alone. The server computes both lists at startup from the page it serves. The policy carries no nonce, so every response for an address has the same header and the same bytes, and anyone can compare a received page with a published hash.
  • worker-src blob: admits only the module worker in which the web client runs scrypt for profile 3 and proof of work, one worker per derivation, terminated after it. No browser checks integrity for new Worker(), so the client fetches the worker script once, before its first API request, with fetch and the SHA-384 value that the import map lists for it, keeps the verified bytes in memory as a Blob, and starts each worker from a new blob: URL that it revokes when the worker stops. trusted-types admits only the policy nylzo-kdf, which accepts only the blob: URL the client has just created for the worker. The client's entry module creates it when it loads, before the rest of the client runs, so no later code can claim the name. The Svelte runtime builds component templates element by element (fragments: 'tree'), so it creates no policy and passes no string to an HTML sink. A worker started from a blob: URL runs under the policy of the page that created the URL and has no base URL that a relative import could use, so the worker script MUST be a single file without imports.
  • Every page, the status pages included, carries Connection-Allowlist: (response-origin "https://github.com/misaon/nylzo" "https://github.com/misaon/nylzo/*"{contact}), where {contact} is empty without NYLZO_CONTACT, "mailto\\:{address}?#" for an email address and "https://{host}{path}?{query}#" for an https address, with every URL pattern syntax character escaped and port 443 left out. Each pattern admits exactly the address the transparency page links: no other recipient, path, query or fragment. An https contact is therefore one of letters, digits and _.~:/?@!&+,;=%-, with a DNS name or an IPv4 address as host, a port from 1 to 65535, valid percent escapes and no user, fragment or dot segment. A page may then connect and navigate only to its own origin, the repository it links to and the operator's contact, and every redirect and WebRTC connection is refused, which CSP does not cover; no page is left out. A link of the client therefore names an address that answers without a redirect. Chromium enforces the header; Firefox and Safari ignore it. Local URLs such as the blob: URLs of the worker and of a download need no entry. Responses other than pages do not carry it.
  • No page loads third-party analytics JavaScript, including the home pages of https://nylzo.com. Every instance and the local client use the policy, allowlist and integrity headers above. There is no external analytics script, collection endpoint or Trusted Types policy in the allowlists, and high-entropy client hints stay disabled. The only measurement is the server's own visit count (§6.7): it sets no cookie and reads nothing from the device beyond what a request carries and navigator.webdriver, and the pages that show a message are never counted.
  • Permissions-Policy denies every policy-controlled feature that Chromium recognises and the client does not use; it allows clipboard-write and web-share only for the page's own origin; ch-ua-high-entropy-values is denied on every page. /admin is the one page whose header has publickey-credentials-create=(self), publickey-credentials-get=(self), so only it can create or use a passkey; the rest of its header is the same.
  • GET /, GET /{language}/, GET /sent, GET /transparency, GET /terms, GET /agents, GET /r (§4) and GET /m/{id} (§15) serve the page of the embedded web client with the HTML CSP above; GET /{language} without the slash, such as GET /cs, and a tag written with its capitals, with or without the slash, such as GET /pt-BR/ or GET /zh-Hans, answer 308 with Location: /{language}/ in lowercase. The client chooses the screen by path: create, the sender's list of remembered messages, what the instance stores, logs and limits (§10, §13), the terms of use, the guide for AI agents, and reading, which /r and /m/{id} share. The create screen has one address per language: English on /, and cs, de, es, fr, id, it, ja, pl, pt-BR, sk and zh-Hans on their tag in lowercase, such as /cs/, /pt-br/ or /zh-hans/. Each comes prerendered in its language from the template home.{tag}.html of the build; the other pages get the template index.html, whose body is empty, and choose their language in the browser. Any other GET path, and /m/{id} with an id that does not parse, answers 404 with the page of /sent; the client then shows its page for an unknown address, because it reads only /r and /m/{id} with a valid id as read pages.
  • When Accept-Encoding accepts gzip (by the same rule as assets below), a page response is gzip-compressed with Content-Encoding: gzip; every page response carries Vary: Accept-Encoding. The server renders and compresses each page once at startup, so two responses for the same address and encoding are byte for byte the same, and a page reflects nothing from the request.
  • GET /admin serves the operator's page (§6.8) from the template admin.html of the build, with the HTML CSP and headers above, a Connection-Allowlist that admits "https://db-ip.com/" as its one further address (the attribution link the licence of the country table asks for), X-Robots-Tag: noindex, nofollow and the Permissions-Policy that admits passkeys; a build without the template answers 404. It is not among the pages of client.json, whose templates still list admin.html with its hash; the local client (§14.1) does not serve it.
  • Every template carries <meta name="nylzo-instance" content="__NYLZO_PUBLIC_URL__"> in a public block. A web client builds the links it creates on that origin when the element is present and holds an https:// origin or an http:// origin on localhost, 127.0.0.0/8 or [::1]; otherwise on its own origin. On an instance without a public URL the element is absent.
  • NYLZO_PUBLIC_URL, when set, is the address of the instance as visitors reach it: https:// with a host and an optional port and nothing after it, or http:// with the host localhost or a loopback address (127.0.0.0/8 or [::1]) for development; the host is lowercase ASCII. The server refuses to start with any other value. The templates mark the parts that need an absolute address (canonical link, hreflang links, og:url, og:image, structured data) with <!--nylzo:public--> and <!--/nylzo:public-->; at startup the server replaces every __NYLZO_PUBLIC_URL__ in them with the public URL and drops the markers, or without a public URL drops those parts with their markers.
  • GET /agents.md answers the guide for AI agents from the /agents page in English as text/markdown; charset=utf-8, with the headers of an asset below. The build writes it as agents.md next to the templates; a build without it answers 404.
  • GET /llms.txt answers a summary for AI assistants in the format of llmstxt.org, in English, as text/plain; charset=utf-8, with the headers of an asset below: the description of the home page, links to the public pages and the documentation, and the questions of the home page with their answers. The build writes it as llms.txt next to the templates; a build without it answers 404.
  • GET /favicon.ico answers the site icon at 16, 32 and 48 pixels as image/vnd.microsoft.icon, with the headers of an asset below. The pages name their own icons under /assets/. The build writes it as favicon.ico next to the templates; a build without it answers 404.
  • GET /robots.txt answers text/plain; charset=utf-8 with User-agent: *, Disallow: /api/ and, on the official instance, Sitemap: {public URL}/sitemap.xml. It does not disallow /m/, so a crawler that meets a message link sees its noindex. GET /sitemap.xml answers, only on the official instance, application/xml; charset=utf-8 listing every home page with xhtml:link alternates for every language and x-default (/); every other instance answers 404.
  • GET /.well-known/security.txt answers text/plain; charset=utf-8 in the format of RFC 9116: Contact with the operator contact when one is set (mailto: for an email address), then Contact: https://github.com/misaon/nylzo/security/advisories/new for vulnerabilities in Nylzo itself, Expires one year after the source commit time of the build, Policy: https://github.com/misaon/nylzo/blob/main/SECURITY.md, Preferred-Languages: en, cs and, with a public URL, Canonical: {public URL}/.well-known/security.txt. A build without a source commit time answers 404.
  • GET /assets/{name} serves the files of the embedded web client by exact name: .js as text/javascript; charset=utf-8, .css as text/css; charset=utf-8, .woff2 as font/woff2, the icons .svg as image/svg+xml and .png as image/png, and the Open Graph image .jpg as image/jpeg. An SVG opened on its own is a non-HTML response with default-src 'none', so it runs no script and loads nothing. Any other name, including one that decodes to a path, answers 404. The server refuses to start when the embedded build holds a file of another type, a directory or a precompressed variant without its file, or when one of its templates (index.html and home.{tag}.html for every language) is missing, holds unbalanced public markers or references an asset that is not embedded; without a build it serves a placeholder page on every page address and logs that.
  • When Accept-Encoding accepts gzip, the server sends the gzip variant of an asset from the build with Content-Encoding: gzip; every asset response carries Vary: Accept-Encoding. Scripts and stylesheets carry Cache-Control: max-age=31536000, immutable: their names hold a hash of their content and every page loads them with Subresource Integrity. Every other asset keeps Cache-Control: no-store, because fonts and images load without integrity metadata. The server checks at startup that every gzip variant unpacks to its file, and the build carries no other encoding. Assets pass no token bucket, since they never reach the database (§8).
  • The build also holds the status pages error.{tag}.html and maintenance.{tag}.html for every language, which load only the stylesheet and fonts and run no application code. They carry no import map and their own Content-Security-Policy: default-src 'none'; script-src {script hashes}; style-src 'self' {style hashes}; img-src 'self'; font-src 'self'; object-src 'none'; frame-ancestors 'none'; base-uri 'none'; form-action 'none'; require-trusted-types-for 'script'; trusted-types 'none', where {script hashes} admits only the script that takes the fragment out of the address bar ('none' without it). The server checks them like the other templates when they are present. They answer only a navigation (Sec-Fetch-Dest: document, or without fetch metadata an Accept with text/html), in the reader's language by Accept-Language and in English when it names none of them; a build without them answers with the bare status.
  • GET /.well-known/nylzo/client.json answers the manifest of the embedded web client: {"build":{…},"server":"…","built":bool,"public_url":"…","pages":["/","/cs/",…,"/zh-hans/","/sent","/transparency","/terms","/agents","/r","/m/{id}"],"files":[{"path":"/","sha256":"…"},{"path":"/cs/","sha256":"…"},…,{"path":"/sent","sha256":"…"},{"path":"/assets/{name}","sha256":"…"},…],"templates":[{"name":"home.cs.html","sha256":"…"},…,{"name":"index.html","sha256":"…"}]} with the assets and the templates sorted by name; public_url is NYLZO_PUBLIC_URL or empty. The hash of each home page and /sent is the SHA-256 of the uncompressed page exactly as this server sends it, with its public URL filled in; /transparency, /terms, /agents and /m/{id} send the page of /sent. The hash of an asset is the SHA-256 of its uncompressed file. templates gives the SHA-256 of each template file as built, which is the hash that the signed checksums.txt of the release lists for that file name: home.en.html renders /, home.{tag}.html renders the home page of that language, such as home.cs.html for /cs/, and index.html renders every other page. Without a build built is false and files and templates are empty.
  • The manifest is the server's own claim and proves nothing on its own: a client checks the served files against a source it trusts, the release or its own embedded copy (nylzo verify-client), which finds a swap that does not avoid the verifier, not a server that hides one on purpose (§14).
  • GET /.well-known/nylzo/transparency.json answers {"build":{…},"server":"…","operator":{"name":"…"?,"contact":"…"?,"hosting":"…"?}?,"limits":{as in GET /api/v1/instance},"rates":{"create_per_hour":N,"create_per_day":N,"create_bytes_per_day":N,"read_per_hour":N,"read_bytes_per_hour":N,"coarse_multiplier":N,"global_daily_creates":N,"pow_difficulty":N},"retention":{"tombstone_s":N,"daily_counter_s":N},"visits":{"counted":bool,"hourly_s":1296000,"daily_s":34560000}} from the configuration and the constants the server uses; 0 for a rate means no limit. visits.counted is true while the server counts visits (§6.7), and hourly_s and daily_s are how long admin.db keeps the hourly and the daily counts (§12). operator appears only when at least one of NYLZO_OPERATOR, NYLZO_CONTACT and NYLZO_HOSTING is set. The server refuses to start when one of them is longer than 200 bytes or holds invalid UTF-8, a control or a format character, or when the contact matches neither ^[A-Za-z0-9_%+-]+(\.[A-Za-z0-9_%+-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)+$ (an email address) nor ^https://[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(:[0-9]{1,5})?(/[A-Za-z0-9_.~:/?@!&+,;=%-]*)?$ (an https address without user information or fragment) with the further rules of the Connection-Allowlist above; a client links the contact only when it matches the same expressions, as mailto: or as the address itself. Both documents carry the headers of non-HTML responses, need no database and pass no token bucket, like the assets.
  • A request for a page or a file of the web client with Sec-Fetch-Site: cross-site or same-site and a Sec-Fetch-Dest other than document answers 403 with the headers above, so another site can load no page or file of the client as a script, style, image or frame; a link from another site still opens the page.
  • Requests with a Sec-Purpose header to /r, /m/* or /api/* answer 503. Known link-preview user agents receive, for /r and /m/*, minimal HTML without script, with the same Open Graph title and description for every message, in the language Accept-Language ranks highest among those of the web client and in English when it names none of them (with Vary: Accept-Language), and, with a public URL, the Open Graph image of the build, so a chat preview says nothing about the message, its sender or its expiry.

10. Logging

The server writes no line per request. It counts requests and writes the counts in windows:

  • A window starts at startup or at the previous write and ends at the start of the first hour after it has run for an hour, to the minute, so a window spans one to two hours; the monotonic clock keeps a clock step from ending one early, and the open window is dropped at shutdown. For each window it writes one requests line per combination with its count, sorted by route, method and status, so neither the timestamps that the collecting platform adds nor the order of the lines tell when a request ended or how long it took.
  • The message routes (metadata, claim, blob, ack, burn, cancel, status and their HEAD variants) count together as route message by status class (2xx, 4xx, 5xx) without method; other routes keep method, route pattern and status. A request that wrote no status counts as 200. A method the server does not route is logged as OTHER. Requests that a middleware answers before routing (token-bucket 429s and Sec-Purpose 503s) are counted without route.
  • It logs no latency and never the size of a response or of an object, never a message id and never the raw path, so a mangled link whose fragment reached the path is not logged.
  • Every line about a request or a message, such as a handler error, a failed settle, a lost share, a lease timer, a failed deletion, a full disk and a WAL scrub failure, is held instead of written: the server counts it by level, message and category, keeps the first sanitized error text of the window, drops every other attribute and writes one line per kind with its count together with the request counts. Internal net/http errors are held the same way under a fixed message with a category (accept, panic, tls-handshake, http2, superfluous-write-header, other; HTTP/2 handler panics count as panic) and without their text, because that text can carry a peer address. The counts of the last window before a restart are lost.
  • Lines that carry no message time are written at once: the startup and shutdown lines, configuration and fatal errors and epoch-advance. A successful sweep writes nothing; a failed one writes only its first error, without counts.
  • Storage errors are logged as the failing step, operation and system error only (for example delete blob: remove: read-only file system), never with a file path.
  • The server MUST NOT log Authorization, X-Nylzo-Create, X-Nylzo-Lease, X-Nylzo-Registration, X-Nylzo-KE1, X-Nylzo-KE3, X-Nylzo-Pow, X-Nylzo-Ttl, X-Nylzo-Share-Key, X-Nylzo-Share, request or response bodies, query strings, or client addresses. Addresses exist only in process memory (§5.3). The forwarded-header-ignored line (§9) holds only the header name.
  • Every component that terminates TLS or relays requests to the server, such as a proxy, load balancer, CDN, WAF or tracing agent, MUST NOT record Authorization, any X-Nylzo-* header of a request or a response, or the request path either: with the link, a recorded X-Nylzo-Lease downloads the blob without spending an open (§13).
  • GODEBUG=http2debug=1 or =2 makes Go's HTTP/2 code print every header past any logger configuration, so every nylzo command that handles a secret, serve included, refuses to start with it.
  • The visit and message counts of the admin area (§6.7, §12) go to admin.db, never to the log, and the visit route counts in the requests lines like any other route. The admin area's own lines are held events with no attribute: admin-signed-in, admin-passkey-enrolled, admin-sign-in-refused and admin-enrollment-refused; none names an address or a passkey.

11. Versioning

Envelope version in the first byte, fragment version before the first dot, share suite before the first dot of X-Nylzo-Share-Key, API under /api/v1, kdf_id in the envelope header and the fragment. A client MUST reject an unknown version or flags that §3 does not allow. A new KDF profile, a new share suite or the HPKE recipient mode is a new value in an existing field, not a new format. A retired value stays reserved and is never reused (kdf_id 1 and 2, §2). The API path stays /api/v1 across protocol versions, and a server answers a request of an earlier protocol version with client_outdated (§6.1, §15).

12. Data model (reference)

messages(locator BLOB PK, read_wrap BLOB, manage_wrap BLOB, record BLOB, blob_ref TEXT NULL, blob_wrap BLOB NULL,
         blob_purge_at INTEGER NULL, purge_at INTEGER)   WITHOUT ROWID
rate_counters(key TEXT, window_start, count, bytes, purge_at)   WITHOUT ROWID, INDEX rate_counters_purge_at(purge_at)
wal_scrub(slot INTEGER PK, generation INTEGER, filler BLOB)        3000 zero bytes per row, one row per page (§5.2)

messages also holds the dummy row under SHA-256("nylzo/v1/dummy-row") with cleanup times in the year 2200 (§5.2); serve adds it to a database that lacks it.

The database records its schema version in PRAGMA user_version, currently 9. Its counters have an index on purge_at, so a purge never scans every counter; serve, sweep-once and takedown add the index where it is missing and keep every row. The server creates the schema only in an empty database and refuses to open a database with any other version, older or newer, with an error that names the version, except versions 7 and 5, which serve upgrades as §15 says.

Blob store: one object per message under blob_ref, a random 16-byte reference in base64url that says nothing about the message. On disk the file name is the lowercase hex of the ref bytes (data/blobs/{hex(ref)}), so case-insensitive file systems cannot merge two refs. Every object starts with its 4096-byte erase block (§5.2). Publishing an object never replaces an existing one.

The admin area (§6.8) keeps a second SQLite database, admin.db in the data directory, with secure_delete, PRAGMA user_version 1 and a persistent rollback journal (admin.db-journal) in place of a WAL. SQLite keeps that file between writes, and the store overwrites it with zeros after every write and when it opens, under the write lock. serve creates it, and admin-enroll, admin-passkeys and admin-reset open it:

passkeys(credential_id BLOB PK, public_key BLOB, algorithm, sign_count, backup_eligible, backed_up,
         created_at, last_used_at)   WITHOUT ROWID
enrollment(slot INTEGER PK CHECK (slot = 1), token_hash BLOB, expires_at)        SHA-256 of the token, one row at most
counts(resolution, period_start, metric TEXT, value, PK (resolution, period_start, metric))   WITHOUT ROWID
carried(period_start, metric TEXT, value, PK (period_start, metric))                          WITHOUT ROWID
  • counts holds hourly counts for 15 days and daily counts (UTC) for 400 days. Its metrics are views.people, views.robots, views.unconfirmed, visitors, page.{page}, country.{code} and robot.{family} (§6.7), messages.created, messages.opened (acknowledged claims), messages.ended (burns and cancels), messages.expired (blobs the sweep deleted) and refusals (§8).
  • The server adds counts in memory and writes a count to counts only after its period has ended: an hourly metric after its hour, visitors and country.{code} after their UTC day. While the server runs, the disk therefore never tells when within an hour something happened, and visitors and country.{code} exist per UTC day only.
  • At shutdown the server sets the counts of the periods that still run aside in carried, by the hour for an hourly metric and by the UTC day for visitors and country.{code}, and the next start takes them back into memory and empties the table, however long the stop was. A start that fails before it listens sets them aside again. A change that is stored although its journal could not be overwritten is not written a second time; the next write overwrites the journal. A process that ends without shutting down loses the counts of its running hour and day; a count that could not be written waits for the next minute, for two days after its period at most.
  • No row holds an address, an id, a size or anything about one message.

13. What a stolen server reveals

This section lists everything the server keeps, so an operator, an auditor or an attacker who copies the server sees the same picture. "Stolen" means a copy of the data directory (SQLite database with its WAL, the blob directory with its temporary uploads), the epoch seed file, the logs and the configuration including the pepper. TestStolenServerRevealsNothing runs every flow (with and without passphrase, with a file, opened, leased, expired, burned, cancelled, removed by the operator, with a wrong passphrase and an unfinished handshake), copies these files and the log, and checks that none of them contains S, K, K_c, P, E, H, a passphrase, salt_pw, plaintext, a file name, the seeds R or M, the public keys pk_R or pk_M, the registration request, response or record or any part of the record, KE1, KE2, KE3, L, a client address, a message id in any encoding, the envelope header or its commitment, a cleanup time in messages finer than its step or any time finer than the minute, and that rate_counters holds only the address-free keys listed below. It runs with PoW required for one create and with a failing blob delete, so the error paths are covered too.

Item Kept What it reveals Why it does not help
Pepper (NYLZO_PEPPER_FILE, previous pepper) the files the configuration names With it, id tokens and PoW challenges can be minted (a request challenge counts only in the process that issued it, §5.5), a record opened with a public key that a recorded request carried (§5.2), candidate keys checked against the lease macs of a record that the holder of a link has opened, and, with the epoch seeds, the OPRF key computed of every message whose deadline has not passed (§5.1); with the link and the erase salt of a live blob, that tests passphrase guesses against its registration (§2.1). A minted id token lets its holder create a message under any id whose row is gone, but a link pins its object by H, so the reader of an old link rejects such content. Address buckets do not come from it (§5.3) It opens no record alone: that also needs pk_R or pk_M, which the link and the manage key give and every signed request carries
Epoch seed (NYLZO_EPOCH_DIR/seed) two seeds per generation, at most 170 generations, overwritten in place every minute The shares of every message that is live or whose id the server issues in the current hour, so together with a link and its passphrase it opens such a message, as the live server can It makes no share of a minute that has begun, so a seed copied after a message's deadline opens nothing of it, and it makes no share of an id issued in a later hour. A disk image or backup that holds the seed opens every message that was live then (§5.6)
messages: locator until purge_at How many messages are live or ended in the last 7 days, plus the one dummy row (§12) SHA-256 of a random 128-bit id; without the link it names no message, and it orders the table at random
messages: read_wrap, manage_wrap, record, blob_wrap the wraps and the record until purge_at, blob_wrap until the blob is deleted Nothing: the read and manage wraps are 88 bytes, blob_wrap 124 and every record 1024 (§5.2) AES-256-GCM under a key from the pepper around AES-256-GCM under a key from pk_R or pk_M, so neither a public key from a recorded request nor the pepper opens a record alone; no policy, state, time, counter, registration or lease is in the clear, and the registration has a third layer under a key from the erase salt. Once the erase block is gone, blob_wrap gives a key that decrypts nothing
messages: blob_ref, blob_purge_at, purge_at until the blob is deleted, until the row is purged Whether a row still has a blob, the quarter hour in which the sweep will delete it and the hour in which the row goes (7 days after the end). For a live message that is about its expiry; once its opens are used up or it ended, about the end of the last lease or the ending, which for a message whose seed was lost is the first request about it afterwards (§7) No time enters a key; the sweep must find these blobs without a key
rate_counters 24 hours after a daily window; PoW nonces 4 to 5 minutes The global daily counters, used PoW nonces and the daily reconcile marker No row holds an address or a value derived from one, with or without the pepper (§5.3); request challenges never reach the database (§5.5)
nylzo.db-wal, nylzo.db-shm, wal_scrub the WAL keeps its size and blocks; the scrub rewrites it about 100 ms after every write, at every sweep and at close Between a write and the next scrub, the pages of the last transactions, which the database already holds; after the scrub, zero pages. The headers count the write transactions since serve started, so two copies taken at different times give the number of writes between them. The database header still counts changes since the database was created (change counter) and the schema cookie roughly counts the sweeps that rebuilt tables Its pages hold rows of the tables above. No block of the WAL is ever freed, so free space holds no older row version (§5.2)
admin.db: counts hourly counts 15 days, daily counts 400 days (§12) How busy the instance was: per hour for 15 days and per UTC day for 400 days, the views of people and robots, visitors, views per page, robots per family, and messages created, opened, ended by people and expired, and refused requests; visitors per country per UTC day only. With very little traffic an hourly count of creates or opens can still match one message No address, no message id, no size and no row about one visitor or one message
admin.db: passkeys, enrollment until admin-reset; a token until it is used, replaced or reset The public keys of the operator's passkeys, their algorithm, signature counter and backup flags, when each was added and last used, and the SHA-256 of an open enrollment token with its expiry A public key signs in nobody; the token itself is never stored, and 192 random bits cannot be found from its hash. admin.db runs with secure_delete and a journal the store overwrites after every write (§12), so a removed row stays neither in the database nor in free space
blobs/{hex(ref)}, blobs/tmp/* until the blob is deleted; a temporary file while its upload runs The Padmé class of the object's size (§5.2); after the erase block every byte looks random, the envelope header included Reading it needs blob_key from the record, the erase salt from the file, and then K, which needs S (and P and E). Deletion overwrites the salt where it lies before the file goes, so neither the link nor a disk image taken afterwards opens it, freed blocks included
Request log as long as the operator keeps it Per window of one to two hours, the count of requests by method, route pattern and status, the message routes together by status class, and held events by kind with their count and first error; no latency, no response size, no line per request No id, no address, no token, no body, no file path (§10). With very little traffic the hourly count of creates can match the hour in a row
File system metadata as long as the file exists A blob file's mtime is its blob_purge_at. Birth times and inode numbers show only when a pool file was created (startup, a sweep), never an upload; a blob's birth time is only a lower bound on its upload, on average about the longest TTL earlier. Every sweep sets the times of every blob and pool file and their directories again, so their ctime shows the last sweep; until the next sweep the newest file's ctime and the directory times show when the last upload or deletion happened The encrypted volume of the deployment hides the order of inodes and blocks from a disk thief; the server holds no clock time finer than the minute in any file content

At startup the server checks the data directory, the database with its -wal and -shm files, admin.db with its journal, and the blob directory: each MUST belong to the user of the process and grant no access to group or others. When the owner matches and the mode is wider, the server narrows it to 0700 for directories and 0600 for files and logs permissions-narrowed; when another user owns one, the server refuses to start. It also refuses to start when the pepper file (NYLZO_PEPPER_FILE, NYLZO_PEPPER_PREVIOUS_FILE) is readable by group or others, and it refuses a data directory on a file system that does not overwrite in place (§5.2).

Process protection on Linux:

  • serve, sweep-once, store-check and takedown mark their process as not dumpable, set the core file limit to 0 and refuse to run while a tracer holds any of their threads, before they read any secret. sweep-once, store-check and takedown also lock their memory when the memlock limit allows it and otherwise warn about unencrypted swap (CLI guide).
  • serve locks every page it maps into memory (mlockall with MCL_CURRENT, MCL_FUTURE and MCL_ONFAULT) and refuses to start when that fails, unless NYLZO_ALLOW_SWAP=1 is set, which it logs as memory-not-locked. The lock needs an unlimited memlock limit (systemd LimitMEMLOCK=infinity, docker run --ulimit memlock=-1:-1, Compose ulimits: memlock: -1) or CAP_IPC_LOCK in the initial user namespace. serve raises its soft memlock limit to the hard limit and refuses a finite limit without that capability before it calls mlockall, because MCL_FUTURE would make every later mapping past the limit fail under load.
  • serve runs the cryptography of each request in the secret mode of Go's runtime/secret, which erases the registers and stack it used on return and its heap allocations once they are unreachable. It refuses to start from a build where that mode erases nothing (one without GOEXPERIMENT=runtimesecret, or for a platform other than linux/amd64 and linux/arm64), unless NYLZO_ALLOW_UNERASED_MEMORY=1 is set, which it logs as memory-not-erased.

What goes beyond stolen data:

  • An attacker who controls the running server, the provider edge or a valid certificate for the instance's name can serve a modified web client to a chosen victim and read that victim's links, passphrases and plaintext. Only a verified client, whose code does not come from the instance, excludes it (§14). A published manifest of the client files, nylzo verify-client and an independent monitor find a swap that does not single out its victim, not a targeted one.
  • While a process runs, its memory holds the k_addr of the current UTC day and only the per-address buckets that still limit (§5.3); someone who controls the running process sees client addresses anyway. While a passkey exists it also holds the visitor hashes of the day under k_visit and, in the clear, the /32 or /64 of every client a limit refused in the last hour (§5.3).
  • Whoever holds a live admin session (§6.8), or controls the operator's passkey, sees the aggregates of §12, the server load, and the refused clients of the last hour. No admin route reads, opens or ends a message.
  • A copy of admin.db shows the counts of §12. On a day with a single visitor and a single created message, the day's country count tells the country that message most likely came from, and an hour with one created message tells its hour. A copy taken while the server is stopped also shows, in carried, the counts of the hour and the day that were running when it stopped.
  • While the server runs, it sees public keys, one-time signatures, L, ciphertext and the shares it computes; an observer of the unencrypted h2c hop between the edge and the container sees the same apart from the shares (§5.6). An active attacker at the edge or on that hop learns the share of every message whose creation it relays (§5.6). With a public key and the pepper, whoever controls the running server opens the record of every message whose reader or sender makes a request meanwhile (§5.2). The server clears record keys, blob keys and erase salts at the end of a request or lease timer and runs a collection every minute, but the request line and headers that net/http parses before the handler enters secret mode, the message id and Authorization among them, stay in ordinary heap memory and per-connection buffers until they are reused. A recorded request cannot be replayed (§5.5); such an observer can still drop or delay requests.
  • Someone who has a link and also steals the server before the message's deadline has passed, seed and pepper included, can guess the passphrase offline against the ciphertext or the registration at the cost of scrypt N = 2^18 per guess; the running server can do the same while it holds the blob. Every single-server aPAKE allows this (RFC 9807 §10.11). Only the strength of the passphrase protects it, which is why clients offer a generated passphrase of at least 55 bits by default and refuse weak ones (§2).
  • A recorded request tests no passphrase: the passphrase enters only the OPRF input, blinded by the client (§2.1), and the registration record and KE3 depend on the OPRF key, so a recording of every request and response of a message, together with its link, gives no test without the pepper. Each guess takes one handshake, which the server counts (§6.4). An active attacker at the TLS proxy while the message is created can answer the registration request with an OPRF key of its own and then test guesses offline against the record the sender returns; RFC 9807 §3.2 requires a server-authenticated channel for registration.
  • The time between a handshake and its claim or burn includes the client's scrypt for a message with a passphrase and nothing for one without, so whoever sees the timing of requests can tell the two apart. It learns nothing about the passphrase.
  • The provider in front of the public instance sees client addresses, request times and sizes in its own logs.
  • The TLS proxy on the same host keeps the certificate's private key and the ACME account key. A copy of the disk lets its holder impersonate the instance until the certificate expires, and order new certificates while the CA reuses the account's authorizations. The Hetzner profile can keep the data directory, the pepper, the proxy's keys and the journal on a LUKS2 volume that opens only while the operator's Tang servers answer, so a disk copied off the host reveals none of the items above; a running or rescue-booted host does not get this protection.
  • Expiry is cryptographic from the deadline (§5.6). A disk image or backup taken while a message lived holds the seed whenever the seed lives on the same disk, as it does by default. Before the deadline, and for the number of opens throughout, the rules are the server's: a server under an attacker's control while a message lives can keep its ciphertext, its share or the seed, and ignore the number of opens. Restoring an older copy of the database brings back opens that were already spent and messages that were burned or cancelled, and restoring an older seed file brings back the shares of every message that expired since.
  • Whoever changes a stored blob spends no open with it, because the server checks blob_tag before it spends one (§5.2). A process that writes the blob file while the server streams it still makes the reader's AEAD refuse the object after the open has been spent. Whoever can write the data directory can also delete blobs and put back older rows, and so restore or remove opens. The change reveals nothing; it denies the reader that message.
  • Anyone who holds the link can lock readers out (§6.4) and delete a message without a passphrase (§6.6), which costs availability, not confidentiality.
  • Ed25519 only authorizes requests while a message lives, at most 7 days. A quantum computer that sees pk_R (edge, h2c hop, running server) in that window could forge read signatures, claim opens or delete a message without a passphrase, but it learns no content, which needs S and stays under 256-bit symmetric keys and SHA-256. OPAQUE over ristretto255 is not post-quantum either: from a recorded registration or handshake, such a computer could compute the OPRF key of that message as a discrete logarithm and then, with the link, test passphrase guesses offline. RFC 9807 defines no post-quantum configuration.
  • The expiry share (§5.6) uses the hybrid KEM MLKEM768-X25519 of draft-ietf-hpke-pq revision 05, which is still a draft. Known-answer tests pin its current encoding: the share vectors in spec/vectors.json, which the Go generator opens with crypto/hpke and the web client with @noble/post-quantum, and an IETF vector that the web client's HPKE key schedule must reproduce. A Go or library upgrade that follows a later draft therefore fails the build instead of producing shares that the other client cannot open.

14. Client code integrity

The cryptography protects a message from the server only while the client code that holds S, the passphrase and the plaintext does what this specification says. The website gets its code from the instance on every visit, so a server under an attacker's control (§13) can send one sender or one reader a page that reads everything. A verified client runs code from a signed, publicly logged and reproducible release instead:

  • the nylzo command line;
  • the local client, nylzo web and nylzo open, below.

A message is safe from such a server only when its sender and its reader both use a verified client. Against such a client the server receives only the API calls of §6.

14.1 Local client

nylzo web --server {instance} and nylzo open serve the web client embedded in the binary to the user's own browser:

  • It holds one port, which the operating system picks at random, on both loopback addresses, 127.0.0.1 and [::1], or on 127.0.0.1 alone when the system has no IPv6 loopback. It never listens on a wildcard, so no other program can answer either address on that port while the session runs.
  • Each session has its own origin, http://{label}.localhost:{port}, where {label} is 130 random bits in lowercase base32 (crypto/rand.Text, 26 characters), so no service worker, cached page or stored data of an earlier program on that port or of an earlier session runs in it. Chromium and Firefox resolve every name under localhost to the loopback addresses themselves; Safari leaves it to the operating system, which does so from macOS 26. All three treat such an origin as a secure context. On macOS before 26 the commands open no browser and print the address with the advice to use Chrome, Edge or Firefox.
  • It answers every request whose Host is not exactly {label}.localhost:{port} with 421, also 127.0.0.1:{port}, localhost:{port} and another label, so neither an earlier page nor a page that rebinds a DNS name to the loopback address reaches it.
  • It serves the pages of §9 at the same paths, except /admin (§6.8) (and GET /open, below), rendered with the instance's origin as the public URL, the assets and its own /.well-known/nylzo/client.json, with the headers and the page policy of §9, so it loads nothing from another origin. It never takes a page, an asset or a worker from the instance.
  • It relays to the instance only requests for /api/v1/ paths, with any method, and GET /.well-known/nylzo/transparency.json. At start it reads that transparency document itself, once, for the operator's contact, which its pages' Connection-Allowlist admits (§9); without a valid answer within three seconds its pages admit no contact, and it says so. It runs only for an instance whose origin passes the rule of NYLZO_PUBLIC_URL (§9). It relays a request only when it carries exactly one Sec-Fetch-Site: same-origin, no Sec-Fetch-Mode: navigate, a Sec-Fetch-Dest of empty or none, and either an Origin equal to its own origin or, for GET and HEAD, no Origin; it answers anything else with 403 cross_origin. It refuses such a path with percent-encoding or a query with 404. Every other path answers 404 without a request to the instance.
  • A relayed request leaves as from the command line: over HTTPS, or plain HTTP only to a loopback instance, with only Authorization, Content-Type, Accept, X-Requested-With, the X-Nylzo-* headers and User-Agent: nylzo-cli, besides the length and encoding headers of HTTP itself. Cookies, Origin, Referer, Accept-Language and the Sec-* headers stay on the computer, so the instance sees the native client of §6.
  • A relayed answer keeps only Content-Length, Retry-After and the X-Nylzo-* headers. Its Content-Type is application/json; charset=utf-8 when the instance sent exactly that and application/octet-stream otherwise, and it carries the local headers of non-HTML responses, so nothing the instance sends can run in the local origin. Only a final answer passes: an informational answer (1xx), a protocol upgrade or a redirect answers 502, and trailers are dropped.
  • A web client served this way builds its links on the instance's origin from the nylzo-instance element (§9).
  • It keeps no key in browser storage. A web client whose nylzo-instance origin differs from its own origin tracks a sent message only in the memory of its tab and opens no browser storage, because the next session has another origin and could never remove what this one stored.

14.2 Handing a link to the local client

nylzo open reads the link like nylzo read (§4), checks it the same way and refuses one whose origin differs from the instance named by --server or NYLZO_SERVER, which the command requires. The handoff keeps S out of every process argument, out of every address the browser navigates to, and so out of the browser history:

  1. The local client keeps the text of the link after its origin, split into the path and the fragment, under a token of 130 random bits (crypto/rand.Text) for 2 minutes.
  2. nylzo open writes a page that refreshes to http://{label}.localhost:{port}/open#{token} into a new file of mode 0600 in a new directory of mode 0700, opens that file in the default browser, and deletes both once the token is used, expires or the command ends. On macOS both are created without the access control entries the temporary folder would pass on, and on Windows both get a protected access list that grants only the account that runs the command. With --no-browser it prints the address instead. When no browser takes the token within a twelfth of its lifetime (10 seconds), it also prints the address, for a browser that cannot read the file, such as one confined by snap or flatpak.
  3. GET /open serves the page of /sent. Before it starts, the web client reads the token from the fragment, removes it from the address, and sends it as the body of POST /open, under the same rules as a relayed mutation and with a 5-second timeout. It does so only when it runs in the local client (its nylzo-instance names another origin) and the fragment has the form of a token (26 characters of A to Z and 2 to 7), so on an instance a link key pasted after /open# is never sent. The first request with the token receives {"path":"/r","fragment":"3.{kdf_id}.{id}.{S}.{H}"} with Cache-Control: no-store; the token and the link are then erased, and every later request, a wrong token and an expired one answer 404 without saying which.
  4. The web client replaces the address with the path, without a fragment, and reads the message as in §4 with the fragment from memory. When the handoff fails it shows that the key is no longer available.
  5. When a request for a used token arrives, nylzo open warns that another program may have taken the link. When no browser takes the token in time, it stops with an error.

14.3 What stays impossible

  • An earlier program on the local client's port cannot take a link (§14.1), but a program that runs as the same user, or as an administrator, can read the browser's memory and profile and is out of reach of any client.
  • A visitor of the website in a browser without a verified client cannot exclude a modified page, on the first visit or later. The pages carry no nonce and the same bytes on every response (§9), which systems that check website code in the browser (WAICT, WEBCAT) require.
  • A verified client does not protect against malware or an administrator on the user's computer, another browser extension with access to the page, or a malicious recipient.
  • A compromised release or signing identity reaches every user of that release. It is visible in the transparency log and in a reproducible rebuild (Verify a release), not prevented.

15. Earlier protocol versions and the upgrades

A current client and server read no link, envelope, token or request of protocol v1 (links https://{host}/m/{id}#1.{kdf_id}.{S}) or v2 (links https://{host}/r#2.{kdf_id}.{id}.{S}.{H}, passphrase proved with X-Nylzo-Verifier). They recognise these formats only to answer them:

Earlier format Answer
A v2 link on the path /r with a kdf_id of 0 or 3, a valid id and a 32-byte S and H The client says that the message was deleted by the upgrade; it derives nothing and sends no request
A v1 link on its path /m/{id} with a valid id, a kdf_id of 0, 1 or 2 and a 32-byte S The same. GET /m/{id} still serves the page of the web client (§9), so the link opens that notice
Any other link of fragment version 1 or 2 An invalid link
An instance request with X-Nylzo-Ttl and X-Nylzo-Share-Key but without X-Nylzo-Registration 400 client_outdated
An X-Nylzo-Share-Key without a suite (a bare 43-character X25519 key) on an instance request, claim or download 400 client_outdated
A create whose X-Nylzo-Create has no epoch, or has verifier_key without registration 400 client_outdated
A create whose envelope version is below 3 400 client_outdated
A claim or burn with X-Nylzo-Verifier 400 client_outdated, before the signature check

The reference server also handles its own stored data of earlier releases:

  • The first start of serve on a database of user_version 7 (protocol v2) or 5 (protocol v1) erases every stored message before it creates the current schema: it overwrites every blob file in full and syncs it before it removes it, which also covers a v1 blob without an erase block (§5.2), deletes the rows and the rate counters in one transaction, overwrites the write-ahead log (§5.2), writes the new user_version last and logs one store-upgraded line. Every step can run again, so an interrupted upgrade finishes on the next start. sweep-once and takedown refuse such a database and leave the upgrade to serve.
  • serve overwrites a seed file of the format nylzo-e1 in place, removes it and starts a new ratchet (§5.6); a crash between the overwrite and the removal leaves 4096 zero bytes, which the next start removes the same way. sweep-once refuses such a file as damaged, and every server refuses the format nylzo-e2 as damaged.

Operations has the upgrade steps for an operator.


Edit this page through a pull request.

Clone this wiki locally