Skip to content

Protocol

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

Nylzo protocol v2

This document specifies Nylzo protocol v2, the only version that clients and servers speak. An instance that upgrades from protocol v1 deletes every message created before the upgrade (§15). 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.

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
X25519 RFC 7748, only to wrap the expiry share in transit (§5.6)
CSPRNG crypto.getRandomValues in browsers, crypto/rand in Go
a || b byte concatenation
u16be(n), u32be(n), u64be(n) unsigned big-endian integers of 2, 4 and 8 bytes

Clients use no other cryptographic construction. Ed25519 only signs requests (§5.5); content encryption stays symmetric, and flags bit 0 is reserved for a future HPKE mode. The server also seals abuse reports with HPKE (§6.6).

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. Concretely, 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, share keys, hashes 32 43 A E I M Q U Y c g k o s w 0 4 8
id token (§5.4) 40 54 any
challenge (§5.5) 36 48 any
signature, wrapped share (§5.6) 64 86 A Q g w

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 hour in which the message expires (§5.6). The server never stores it and erases the epoch key when that hour ends. It travels only wrapped to a one-time 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, and E (from the server, §5.6).

hsalt   = SHA-256("nylzo/v2/hkdf-salt" || id)                            32 bytes
PRK_S   = HKDF-Extract(salt = hsalt, IKM = S)
R       = HKDF-Expand(PRK_S,   "nylzo/v2/read",       32)               seed of the read key
salt_pw = HKDF-Expand(PRK_S,   "nylzo/v2/pw-salt",    32)               passphrase salt
P       = kdf_id 0: empty (0 bytes)
          kdf_id 3: scrypt(pw, salt_pw, N = 2^18, r = 8, p = 1, dkLen = 32)
PRK_SP  = HKDF-Extract(salt = hsalt, IKM = S || P)
V       = HKDF-Expand(PRK_SP,  "nylzo/v2/verifier",   32)               seed of the verifier key
PRK_SPE = HKDF-Extract(salt = hsalt, IKM = S || P || E)
K       = HKDF-Expand(PRK_SPE, "nylzo/v2/content",    32)               content key
K_c     = HKDF-Expand(PRK_SPE, "nylzo/v2/commitment", 32)               commitment key
pk_X    = Ed25519 public key of seed X (RFC 8032 §5.1.5), for X in R, V, M
  • V does not depend on E, because a reader signs its claim with V before the server sends E. K and K_c do, so nobody derives them without the share, and a copy of the object taken without the seed stops opening once the server has erased the epoch key that made the share (§5.6).
  • pw is the passphrase normalised to Unicode NFC and encoded as UTF-8. Derivation accepts any well-formed passphrase, so a recipient can always open a message and the vectors stay valid. A client MUST refuse to create a message with a passphrase that fails any of these checks, because a reader who has the link and a copy of the server has only the passphrase between them and the content. The minimum length (check 2) and the comparison with common passwords (check 7) follow NIST SP 800-63B-4 §3.1.1.2 for a memorized secret used alone. The other checks are Nylzo's own rules; check 6 looks at parts of the passphrase, while NIST compares the whole password with its list. Folding means mapping ASCII A–Z to a–z and nothing else; separators are space, -, _ and .. 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). Unicode normalisation is stable only for assigned characters, so a code point that a client of an older Unicode version does not know could normalise differently there and 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) after NFC;
    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: 16 characters drawn uniformly from the Crockford base32 alphabet 0123456789abcdefghjkmnpqrstvwxyz with the CSPRNG (byte & 31 of a random byte), written as four groups of four joined by - (80 bits). 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 and S || P || E have a fixed length per profile (32 or 64 bytes, and 64 or 96 bytes), so each concatenation is unambiguous within a profile. Across profiles S || E of profile 0 and S || P of profile 3 both have 64 bytes; their keys stay apart through the different info labels, and no two messages share an id, so they never share hsalt.
  • Profile 3 is scrypt with N = 2^18, r = 8, p = 1, which needs 256 MiB. Measured on 31 Oct 2026 on an Apple M4 Pro with the scrypt of @noble/hashes 2.4.0 that the web client runs: 429 to 443 ms in a worker of Chromium 156 and 378 to 396 ms in WebKit 27.2, with the renderer growing by about 275 MiB; 440 to 487 ms in Node 26. N = 2^17 took half as long and half the memory. Phones were not measured; 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. It named scrypt with N = 2^17 in protocol v1 (§15). A link or envelope with kdf_id 1 is invalid.
  • kdf_id 2 is reserved and MUST NOT be assigned again. It named PBKDF2-HMAC-SHA-256 with 600,000 iterations, which Nylzo dropped before its first release. 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, which it does once every target browser ships Argon2id in Web Crypto (in October 2026 it is only in the WICG Modern Algorithms draft).
  • 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, salt_pw and V. 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, pk_V and pk_M are sent at creation. R, V 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 sends pk_V and every claim a verifier signature, also for kdf_id 0, so the headers of a request do not show whether a message has a passphrase. The server checks the verifier only for a message whose kdf_id is not 0.
  • kdf_id for derivation MUST come from the URL fragment. A client MUST NOT derive V 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 any verifier signature. Metadata of an ended message whose blob is gone reports kdf_id 0, which is no profile; a client MUST NOT compare it.

3. Envelope

header     = version (1 byte, 0x02) || kdf_id (1 byte) || flags (1 byte) || iv (12 bytes)      15 bytes
policy     = u16be(opens_max) || u32be(ttl_s)                                                    6 bytes
commitment = HMAC-SHA-256(K_c, "nylzo/v2/commitment" || header || id || policy)                 32 bytes
aad        = header || commitment || id || policy                                               69 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/v2/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 2, flags 0 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 passphrase or a wrong share produces).
  5. AES-GCM authentication, then the plaintext.
  • version MUST be 0x02. 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; all other bits MUST be 0. A decoder MUST reject non-zero flags.
  • iv: 12 bytes from the CSPRNG, fresh per message. One K encrypts exactly one envelope.
  • commitment makes the envelope key-committing. AES-GCM alone is not: someone who knows S can build one object whose tag verifies under keys from several passphrases (partitioning oracles, Len, Grubbs and Ristenpart, USENIX Security 2021; Albertini et al., USENIX Security 2022). Two different keys that accepted the same object would need two equal HMAC-SHA-256 outputs under different keys. The commitment fits the AWS Encryption SDK pattern and the generic transforms of Bellare and Hoang (ePrint 2022/268). No committing AEAD is available in Web Crypto in October 2026.
  • 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, such as one recipient of a message with several opens together with a compromised server, can therefore no longer give the later readers other content: that would need a second preimage of SHA-256. The same holds for anyone who mints an id token with a stolen pepper and stores new content under an old id. The server learns nothing new from H, since it holds the object.
  • opens_max and ttl_s are the sender's policy. The recipient obtains them 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.
  • 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, until the content needs more than two blocks; a text can never need more. A text of 4 KiB costs 64 KiB to upload, store and download. 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, and they cut a sanitised name that is longer than 255 bytes and keep its extension only when the extension has at most 16 bytes; 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.
  • 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.

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, so no secret of the sender shares a context with bytes that someone else may have chosen.

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 (the server, its provider, or an observer of TLS record sizes), can still learn about the secret one class boundary at a time, as in CRIME (RFC 7457 §2.6; RFC 8878 §8). A one-off file shows at most its compressibility class. Clients therefore compress only on request, tell the sender in the option that compression lets the server see roughly how compressible the file is, and the CLI documentation tells automated senders not to compress files that mix attacker-influenced bytes with secrets.

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.

Gzip was selected for native support across the supported browsers and Go, without an added codec dependency. Zstandard has a better speed profile in its reference benchmarks, but native Compression Streams support remains incomplete; Brotli support also differs between browsers. Current browser compatibility data and the Compression Streams specification describe these differences.

4. Link

https://{host}/r#2.{kdf_id}.{id}.{S}.{H}
  • Path /r, the same for every message. The browser's request for the page names no message, so the server serves every reader the same page and cannot pick the reader of one message by the address. The first API request still carries the id (§6), so a server that wants to target one reader can wait for it; only a verified client (§14) closes that.
  • Fragment: fragment version 2, 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. No field can be shorter: the id has the 128 bits that keep ids unguessable, and S and H have 256 bits, which keeps 128 bits of security against a quantum attacker for the content key and for a second preimage or collision of the object.
  • 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. The script also removes a fragment that starts with a digit or is longer than 40 characters (not counting #) on any path other than /r, /m/{id} with an id of 22 base64url characters and /open, at load and whenever the fragment changes later on that page, so a mangled link such as /r/#2.… or /#2.… 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 and Chromium stores even non-extractable keys in clear. To finish an interrupted open without spending another, it 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/v2/lease-tag" || S) instead of the message id, so the stored value tells which message it belongs to only to someone who has the link, 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, before the page runs: in its history and history sync, session restore and tab sync, its favicon store and, in Chromium, the URL-keyed metrics it uploads to Google for users who allow that. Removing the fragment from the address bar does not change these records. A reader who wants to keep S out of them opens the link in the local client (§14), which 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 (AK14). 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 2. 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 /. Every other label, such as 0, 02 or v2, 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 no longer supports 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 version 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, the typical placeholder value.
  • k_purpose = HKDF-SHA-256(salt = empty, IKM = pepper, info = "nylzo/v1/mac/" || purpose, 32) for purpose in verifier, lease, pow, id, challenge.
  • mac_purpose(x) = HMAC-SHA-256(k_purpose, x).
  • pepper_id = SHA-256("nylzo/v1/pepper-id" || pepper)[0] (one byte). Every mac in a sealed record (§5.2) carries the pepper_id of the key that produced 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). The server MUST refuse to start when both peppers share a pepper_id. The maximum TTL is 7 days, so no rewriting is needed: after 7 days no live message carries a mac of the previous pepper. A message that ended keeps its record for 7 days more but needs no pepper to report its state, so the previous pepper can go 7 days after the 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, and it also refuses version 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 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. Those times and whether a row still has its blob show whether a message has ended or used up its opens, and roughly when (§13).

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)
wrap(k, x, label) = nonce (12 bytes) || AES-256-GCM(k, nonce, x, aad = locator || label)
read_wrap   = wrap(kek_read, record_key, "read")                                 60 bytes
manage_wrap = wrap(kek_manage, record_key, "manage")                             60 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")                          padded to a multiple of 512 bytes
blob_key    = 32 bytes from the server CSPRNG, one per message
blob_wrap   = wrap(k_blob, blob_key, "blob")                                     60 bytes
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)
stored blob = erase_block || AES-256-CTR(stream_key, counter block 0, object || zeros)    4096 + padme(len(object)) bytes
  • The id has 128 random bits, so the locator does not reveal it; whoever has the link computes it.
  • record_key serves two purposes, sealing the fields and wrapping the blob key, so each has its own key derived from 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, and a copy of the database opens none. A successful unwrap with the key derived from the presented public key takes the place of a stored mac.
  • The fields of a record are the envelope version, kdf_id and flags, created_at, expires_at, ttl_s, opens_max, opens_remaining, size, verifier_mac = mac_verifier(erase_salt || pk_V) with its pepper_id (passphrase only), 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 number of abuse reports stored for the message (§6.6), and for a v2 message the expiry epoch e and the id of the ratchet 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 every record is exactly 512 bytes and its length says nothing. Every change that a request makes drops the leases that have expired.
  • The verifier mac covers erase_salt, which only the blob file holds. Once the blob is erased (below), 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. It hides all but the top bits of the size and costs at most 12 % of disk space. 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.
  • 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 and an orphan; a failed upload has its erase block overwritten the same way and its file emptied and returned to the pool below. 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 (cryptographic erase, NIST SP 800-88 Rev. 2). A temporary name that still shares its file with a published blob after a crash is only unlinked.
  • No blob lives in a file created for its own upload, so a file's birth time and inode number never date an upload. Uploads write into a pool of empty pool-* files in blobs/tmp that the server creates ahead of time: a whole pool when none is left, at startup or when an upload found it empty, and a fixed batch at every sweep, whatever the uploads took, removing random pool files above the pool size. An upload claims a random pool file (crypto/rand) by renaming it before it writes, after it checked that the file is empty and has a single link, so no other upload and no sweep in any process takes the same file; a failed or refused upload gives the file back empty with the modification time it had in the pool. Each sweep creates a quarter more files than a sweep interval's share of NYLZO_GLOBAL_DAILY_CREATES (2000 a day without a cap, and a sweep every hour with an external scheduler), and the pool keeps as many as the sweeps of the longest TTL create, between 1024 and 65536 files, so a file waits about the longest TTL on average and its birth time bounds the TTL only loosely; above about 2300 creates a day the cap of 65536 files shortens that wait. An upload that finds the pool empty answers 503 with Retry-After: 5 at once, stores nothing and returns its cap slot, and one background task fills the pool again; a failed refill, and a pool file that an upload skips because it cannot open it, count as upload-pool. A pool file is unlinked when it goes; one that holds data is shredded whole and one with a second link only unlinked.
  • 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. At most 16 file operations per process run at once (writes, syncs, links and reads of blobs, which wait only as long as their request, and erasures, which wait until a slot frees up), so blocking file I/O cannot exhaust the threads of the process.
  • 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 (tune2fs -o journal_data) and the mount table does not show it, 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), an attribute that new files inherit from their directory. It refuses tmpfs while /proc/swaps lists active swap, since the kernel may write tmpfs pages there. NYLZO_ALLOW_UNERASABLE_STORAGE=1 starts anyway and logs storage-not-erasable; it is meant for a development machine only.
Client sends Server stores or checks
read_key = pk_R at creation stores read_wrap
verifier_key = pk_V at creation (passphrase only) stores verifier_mac in the record
manage_key = pk_M at creation stores manage_wrap
pk_R and a signature with R at metadata, claim, blob, ack, burn, abuse unwraps read_wrap with kek_read and opens the record, then checks the signature (§5.5)
pk_V and a signature with V at claim checks mac_verifier(pk_V) against the record, then the signature
pk_M and a signature with M at cancel, status unwraps manage_wrap with kek_manage and opens the record, then checks the signature
(server issues L at claim) stores mac_lease(L) in the record

The verifier mac keeps someone who has S and a copy of the database, but not the pepper, from testing guessed passphrases against the record once the blob is gone.

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"). Nobody can find an id that hashes to either. The dummy row has the shape of a live row and is sealed under random keys, every row is read in one shape with fixed fillers for its nulls, and the server then derives a key, unwraps and opens the record the same way for all of them, so a live, an ended and an unknown id cost the same work. Every refused signed request and abuse report also answers no earlier than 5 ms after it arrived, above the work of a refusal, so its answer time says nothing about the id.

The record rounds first_opened_at and the end of a message down to the minute. No time in the record is more precise than the minute: created_at is 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 with wal_autocheckpoint = 1, so every commit is checkpointed into the database at once and the next write starts the WAL over at its first frame. The WAL keeps its blocks: it runs in persistent mode (SQLITE_FCNTL_PERSIST_WAL) with journal_size_limit = -1, so SQLite never truncates or deletes it and frames are always overwritten where they lie. Frames beyond the last transaction would still hold older page images, so after every write transaction that put pages into the log (a background task waits 100 ms, so a burst of writes shares one scrub, and retries a busy one up to five times), at every sweep and when the store closes, the server scrubs the log (a scrub that a write asked for and that still fails after its retries counts the error wal-scrub, and the next sweep scrubs again): it runs wal_checkpoint(RESTART), which waits at most 250 ms for readers so it never holds the only writer connection for the full 5 s busy timeout, checks that the log starts over at frame 1 and counts the scrub as busy otherwise, and then rewrites rows of the table wal_scrub. Each row holds 3000 zero bytes and fills one page. When no write since the last scrub went past frame 32, it rewrites the first 32 rows, so every such scrub writes exactly 32 frames and its size tells nothing about the writes; otherwise, and after a rolled-back write that spilled pages into the log, it rewrites every row, and the table grows until it has at least as many pages as the WAL has frames, so the scrub writes a zero page over every frame. A checkpoint that could not finish because a reader held the WAL counts as a failed sweep step, so the next sweep tries again. Sweeps work in batches of 100 message rows and 1000 counters, which keeps the WAL and therefore each scrub small.

secure_delete zeroes deleted cells, but a page split leaves free space inside a page that may hold an older copy of a row. So when rows changed, through a write of this process or a commit of another one (PRAGMA data_version), and at the first sweep after the store opens, the sweep and the close rebuild messages and rate_counters in one write transaction: each table is copied into an in-memory temporary table, dropped, so secure_delete zeroes its pages, created again from the same definition, refilled in key order and given its index back, and the log is then scrubbed. After a sweep no database page holds a deleted row or an older row version; between sweeps such a copy can sit in free space for up to one sweep interval. When serve opens the store, it takes the database in exclusive locking mode, checkpoints every frame, checks that all were copied and then zeroes the -wal file, its header first, and the -shm file in place, so their headers count only the writes since that start; when another process has the database open it skips this and logs wal-reset-skipped. 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 creates, claims and other events. No row ties a message to an address bucket. SQLite keeps temporary tables and indices in memory (temp_store = MEMORY), so no copy of rows is ever written to a temporary directory outside the data directory. Reading a blob does not update the access time of its file (O_NOATIME on Linux). The layers below the file system, such as a provider's 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, so a copy of the database, a backup, the logs or the configuration, pepper included, holds no address and no value derived from one. Memory holds a bucket only while it still limits: 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 stream slots released, and when it draws a new k_addr it drops every bucket, so a memory image cannot test whether an address used the service on an earlier day. 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, which erases them once they are unreachable. Token buckets record their last refill to the second. The price is availability: per-address limits count per instance and start from zero when a process restarts, also when a scale-to-zero container wakes up. The global daily cap and PoW (§8), passphrase backoff (§6.4) and the abuse report cap (§6.6) are kept in the database and never per address, so they hold across instances and restarts.

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 names the expiry epoch whose share the server handed out with the id and the ratchet whose seed made that share (§5.6).

id_token = base64url( u32be(expires_at) || u32be(e) || ratchet_id || HMAC-SHA-256(k_id, id || u32be(expires_at) || u32be(e) || ratchet_id)[0:16] )      40 bytes, 54 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 and ratchet_id the 16-byte id of the ratchet that made the share.
  • When the server has started a new ratchet since it issued the token (§5.6), the share of the id can no longer be made. A create whose token names another ratchet than the current one answers 409 share_lost, before the body is read and again before the row is stored, so the server never stores a message that nobody can open; the client fetches a new id and creates again.
  • A token is valid when the tag verifies in constant time under the current pepper and 0 ≤ expires_at − now ≤ 605 s (5 s for clock differences between instances). 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. A recorded request is worthless: its challenge is spent and a new one needs a new signature, which only the holder of the seed can make.

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/v1/request" || 0x00 || purpose || 0x00 || method || 0x00 || path || 0x00 || challenge (36 raw bytes) || SHA-256(body)
Authorization:    Nylzo-Sig {pk}.{challenge}.{signature}          signature = Ed25519(seed, message), purpose "read" or "manage"
X-Nylzo-Verifier: {pk_V}.{signature}                               every claim, purpose "verifier", same challenge
  • 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 and 0 ≤ expires_at − now ≤ 65 s.
  • purpose is ASCII read, verifier or manage; method is the uppercase HTTP method; path is the request path without query, as sent (/api/v1/messages/{id}/claim); body is the raw request body, empty for GET.
  • The server parses the header, checks the challenge, loads the row by its locator, derives the key from pk, unwraps the record key 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; a claim checks pk_V against the record's verifier mac. 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), so a known id with a wrong key takes the same work as an unknown id.
  • Every signed request except POST /api/v1/abuse has an empty body. A body, or a malformed X-Nylzo-Verifier, answers 400 before the signature is checked.
  • After the browser cross-origin gate (§9), the first request that presents a challenge whose tag verifies inside its window spends it, before any remaining check and whatever the answer: a 429 from a token bucket or a counter, a 503, a 400, a 404 and a success all leave it spent, so no request that the server turned away can be sent again by someone who recorded it. The server records the nonce in rate_counters with window_start = 0 and purge_at = expires_at + 60 s rounded up to the full minute, so every instance, even with its clock 5 s off, has stopped accepting the challenge before the row is purged. A second request with the same challenge fails like a wrong key. A claim spends its challenge once for both signatures.
  • Spends that arrive together share one transaction. A process writes one batch of spends at a time, with a separate result for each nonce. A spend that arrives while no batch is being written is written at once; spends that arrive during a write wait for it and then go together in the next transaction, at most 256 per transaction. Every request waits until its batch has committed, so a spend is durable and visible to every instance before the request goes on. A request whose client goes away stops waiting; its spend is still written. An idle process adds no delay, and a burst of fresh challenges costs one write per batch instead of one per challenge.
  • Every process also remembers the nonces it has seen until they expire, so repeating a challenge costs no database write and the spend can run before the token buckets. The memory holds at most 65536 nonces; when it is full it drops expired ones, then a random eighth, and a dropped nonce costs one row again when it comes back. Only challenges that the server issued count, and issuing them goes through the token buckets, so the spends add at most one row per issued challenge.
  • When the store cannot record a batch, or the write fails in any other way, the server answers 500 to every request in it and that process refuses those challenges from then on. Another instance could still accept such a challenge until the store works again, at most until it expires.
  • 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, 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 can make and that stops existing at the end of the hour in which the message expires. Once that hour has passed, the server can no longer open the message, and neither can a copy of the object or of the server taken without the seed, even together with the link and the passphrase; a copy of anything taken after that hour opens nothing of it. A copy that includes the seed file is different: a disk image or backup that holds it opens every message that was live when it was taken, at any later time, together with the link. The seed therefore belongs on storage that no disk image or backup covers, such as a tmpfs (below).

h             = ⌊unix_time / 3600⌋                                   the current hour
seed[h + 1]   = HKDF-Expand(seed[h], "nylzo/v2/epoch/next", 32)       forward-only ratchet
epoch_key[h]  = HKDF-Expand(seed[h], "nylzo/v2/epoch/key", 32)
E             = HMAC-SHA-256(epoch_key[e], locator)                   32 bytes
  • e is fixed when the server issues the id. GET /api/v1/instance with X-Nylzo-Ttl: {ttl} sets e = ⌊(now + 605 + transfer + 120 + ttl) / 3600⌋, where transfer = max(120, max_object_bytes / 16000) seconds is the longest upload of §6.2 and 120 seconds cover rounding expires_at up to the minute and storing the upload: the latest instant at which a message created with this id and TTL can expire falls in hour e. The share therefore lives at most until the end of the hour after the expiry hour.
  • A create checks ⌊expires_at / 3600⌋ ≤ e ≤ ⌊expires_at / 3600⌋ + 1 for the expires_at it computes when the upload has arrived, and answers 403 id_token otherwise, so no message outlives its share and no share outlives its message by more than two hours. The record keeps e and the id of the ratchet that the id token names (§5.4, below).
  • The server keeps only seed[h] for the current hour. When an hour begins, it computes seed[h + 1] and writes it over the old seed 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[h] for an hour that has begun, and every share made from it, can then no longer be computed from anything the server holds. The server advances the ratchet at startup, within a minute of every full hour while it runs (it reads the wall clock every minute, 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 seed again at the next advance, also within the same hour, and keeps only the new seed in memory meanwhile. A host where neither runs keeps the seed of the hour it last ran, which still makes the shares of every message that expired since; run the sweep at least hourly.
  • To make E for a later hour the server ratchets 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 seed lives in its own file, NYLZO_EPOCH_DIR/seed (default {NYLZO_DATA_DIR}/epoch), 4096 bytes: the format nylzo-e1 (8 bytes), the ratchet id (16 random bytes), u64be(h), seed[h] and zero bytes up to one block, so ext4 never keeps it inline in the inode, whose changes pass through the journal. Several server processes may share it; each takes an exclusive lock on the file to advance it. Like the pepper file it 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.
  • Keep the seed out of every disk image and backup and never restore it: a copy of the seed for hour h makes the shares of every message that expires in hour h or later. A tmpfs keeps it out of both, at the cost that a reboot ends every live message, as a lost seed does (below); restarting or updating the server keeps it. A tmpfs page can go to swap, so such a host runs without swap or with encrypted swap. The default directory inside the data directory survives a reboot, and every image or backup of the data directory holds the seed.
  • At start the server refuses an epoch directory that does not exist, because a volume that failed to mount looks the same; only the default directory inside the data directory is created. In a directory without a seed file, as a tmpfs is after a reboot, the server starts a new ratchet with a new id and logs epoch-seed-created once. The shares of messages created under the old ratchet are then lost: such a message cannot be opened by anyone, so the first authorized request ends it as deleted (§7). A file that does not parse stops the server with an error; the operator moves it aside, which loses the live messages in the same way. Losing the seed costs availability, never confidentiality.
  • The share travels wrapped to a one-time X25519 key of the client, so neither the TLS-terminating edge nor an observer of the plain HTTP hop behind it learns E by recording traffic:
share_key = X25519 public key of a key pair the client draws for this request
z         = X25519(sk_s, share_key)                                   (sk_s, pk_s) drawn by the server per response; all-zero z is refused
mask      = HKDF-SHA-256(salt = share_key || pk_s, IKM = z, info = "nylzo/v2/share", 32)
wrapped   = pk_s || (E XOR mask)                                      64 bytes, 86 characters

The client computes z = X25519(sk_c, pk_s) and the same mask. In the browser the client's private key is a non-extractable CryptoKey. A share key is never used twice. A share key of small order would make every z zero, so the server refuses it as malformed (§6.1). Someone who only changes the share or the share key in transit makes the commitment check fail (§3). The share key is outside the request signature (§5.5), and the instance request carries no signature at all. An active attacker on the path, the TLS-terminating edge included, can therefore replace the client's share key with its own, unwrap E and wrap it again to the client's key, and the client cannot notice. The wrapping covers recorded traffic only; an active edge learns every E it relays.

  • What stays outside this protection: a server that is under an attacker's control while a message lives can keep E or the seed; an active edge learns every E it relays (above); someone who copies the seed file before a message expires, for example in a disk image or a backup of the default data directory, gets the shares of every message that expires later; an attacker who records the wrapped share and later breaks X25519, for example with a quantum computer, recovers E. The protection holds against a copy of the data or of the traffic taken without the seed, and against any copy once its hour has passed. Several independent share holders that each erase on time would also cover a server compromised before expiry (the idea of Vanish, Geambasu et al., USENIX Security 2009, with a fixed set of named holders instead of a DHT, which Wolchok et al. broke with Sybil nodes at NDSS 2010); an operator who can run separate holders could add them, and this version does not.

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 body reads, challenge spends or counters.

Native clients without browser context headers retain compatibility with the protocol's existing mandatory X-Nylzo-Create or signed Authorization checks. Missing origin information is not an authentication credential: these requests still need the exact creation token or a fresh signed challenge. Neither client uses ambient cookies. 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 until the browser extension (§14) is released with its own rule.

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}/claim signed with R (+ X-Nylzo-Verifier signed with V) 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 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 no
GET /api/v1/challenge none no
POST /api/v1/abuse signed with R (rate limit) no

No endpoint accepts or returns plaintext, S, K or a passphrase.

6.1 Errors

Status Body When
400 {"error":"bad_request"} malformed X-Nylzo-Create (including the id inside it), request body, X-Nylzo-Verifier or X-Nylzo-Share-Key (a share key of small order included), a claim or download without X-Nylzo-Share-Key, an instance request with one of X-Nylzo-Ttl and X-Nylzo-Share-Key but not both, or either repeated or malformed, a body on a signed request other than abuse (§5.5), policy outside instance limits, size ≠ Content-Length, an envelope version above 2, a kdf mismatch, an abuse report without Content-Type: application/json
400 {"error":"client_outdated"} a create from a client of protocol v1: an X-Nylzo-Create without epoch, or an envelope version below 2 (§15); the client must be updated
400 {"error":"contact"} an abuse report whose contact is not a plausible email address (§6.6)
403 {"error":"passphrase","retry_after":N,"attempts_left":N} wrong verifier or backoff active; no open consumed
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; 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 spent challenge, a bad signature, and a malformed id in the path (indistinguishable)
409 {"error":"share_lost"} a create whose id token names a ratchet the server no longer runs (§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"} 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), abuse report files full for a report that would be stored

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, verifier_key, 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 of the header (§5.4, 403 id_token) and compare the ratchet it names with the current one (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, rejects (400) a version other than 2 and a kdf_id that differs from the header field, stores the blob under a fresh random reference with its own blob_key and Padmé padding (§5.2) and the row with created_at and expires_at = created_at + ttl_s taken when the upload has been stored, so a slow upload does not use up the TTL (created_at rounded down, expires_at up to the full minute, §5.2), checks the epoch against that expires_at (§5.6, 403 id_token, after which the client fetches a new id) and the ratchet 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, verifier_key and manage_key are pk_R, pk_V and pk_M (§2). Every create carries verifier_key, also for kdf_id 0, so the length of the header does not show whether the message has a passphrase; the server stores verifier_mac only when kdf_id ≠ 0. epoch is the e of the instance response that issued the id (§5.6).
  • The server rejects (400) a key that is not the canonical encoding of a curve point, a key of small order (8 times the point is the identity) and two equal keys in one header. Correct clients never produce such keys; for a small-order key anyone could forge signatures without the seed, so a broken or hostile sender client must not be able to register one. 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. The server MUST NOT clamp a policy; it rejects with 400.
  • 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, so it never stores an unpadded object whose length would show its content size and which no reader could open.
  • 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. Concurrent creates therefore 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; one process serves a data directory at a time, so no upload is in flight then, and serve skips the reset when it finds another process 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","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 or the state. 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, whose true and false differ in length; kdf_id tells a v1 client the same, and a v2 client takes the profile from its link. 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 Claim

POST /api/v1/messages/{id}/claim
Authorization: Nylzo-Sig {pk_R}.{challenge}.{signature}
X-Nylzo-Verifier: {pk_V}.{signature}          over the same challenge; always sent, checked only when kdf_id ≠ 0
X-Nylzo-Share-Key: {share_key}                a fresh X25519 public key (§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,"flags":N})      [detail]
  Content-Type: application/octet-stream
  body: object
403 {"error":"passphrase","retry_after":N,"attempts_left":N}
410 {"error":"gone","state":"…"}

A claim or a download without a well-formed X-Nylzo-Share-Key answers 400 after the signature check and before anything else, so it spends no open. The server computes E from the record's epoch (§5.6) before the transaction; when the record's ratchet is not the current one or its epoch has passed, the share is gone, and the server ends the message as deleted and answers 410. After it has checked that the request body is empty, and before the transaction, the server opens the blob, reads its erase block and keeps the file open for the response. A blob whose size differs from 4096 + padme(size) answers 500 and spends no open; an erase block that a concurrent deletion has already overwritten counts as a missing blob. 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 and no passphrase attempt is counted.
  2. With a passphrase: if the message has 100 failed attempts over its whole life, every claim 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. Otherwise compare mac_verifier(erase_salt || pk_V) in constant time and require a valid verifier signature. On mismatch fail_count_total += 1; while fail_count_total ≤ 5 answer 403 with retry_after = 0 and attempts_left = 5 − fail_count_total; from the 6th failure set next_attempt_at to now + min(2^(fail_count_total − 5), 3600) seconds rounded up to the next full minute, and answer 403 with the resulting retry_after and attempts_left = 0. The counters belong to the message, not to an address, so a wait applies to every reader. No open is consumed. A claim without a verifier, with a verifier key that fails the key check (§5.5) or with a verifier signature that fails counts as a mismatch.
  3. 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).
  4. 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: every wrong attempt from the 6th on makes all readers wait, and after 100 failures the message stays locked until it expires. They learn nothing about the content or the passphrase, so this is a loss of availability only. The protocol has no reset of the counter, neither with the manage key nor by PoW for each attempt: the holder of the link sets the waits off again within minutes, a reset would hand out up to 100 further passphrase guesses each time, and PoW costs a real recipient on a phone as much as it costs the attacker. The sender restores availability by cancelling the message and sending a new link through another channel.

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 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}
  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. Blob downloads and acks count in the read rate limit, and downloads are capped at 3 per lease. 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 logs an error. 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, abuse

POST /api/v1/messages/{id}/burn     signed with R → 204; state = deleted, blob deleted
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}] → 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,"share":"…"}?,"versions":{"api":1,"envelope":2,"fragment":2,"server":"…"}}
GET  /api/v1/challenge              → 200 {"challenge":"…","expires_at":"…"} (§5.5)
POST /api/v1/abuse                  signed with R, {"id":"…","reason":"…"?,"contact":"…"?,"good_faith":bool?} → 202 {"status":"accepted"} for known, unknown, ended and malformed ids alike, 202 {"status":"limit"} for a report the daily cap drops (below); a malformed id is answered before any rate counter

Application builds additionally expose a build object with version, commit, date (the source commit time in UTC), and dirty on the instance response and the well-known client/transparency JSON. versions.server and the well-known server fields identify the running server; protocol/API version fields remain independent. The web client embeds its own build identity in /assets/build-info.json, included in the client file hashes. These identifiers are not a signature: authenticity requires verification of release checksums, Sigstore signatures, and provenance for 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) and X-Nylzo-Share-Key (a canonical 32-byte X25519 public key), each once; with only one of them, a repeated or a malformed one, it answers 400. epoch is e and share the wrapped share of §5.6 for the new id. expires_at is the expiry of the id token. 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. The instance response no longer carries file_compression: compression is the sender's decision (§3.2).
  • A client MUST refuse an instance that reports a proof-of-work difficulty above 8 or below 0 (§8.1) before it derives any key, instead of solving for minutes and then failing.
  • failed_passphrase_attempts is cumulative over the message lifetime (fail_count_total), not per day.
  • 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 failed manage signature on cancel or status answers the same 404 as an unknown id. 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.
  • Abuse reports are rate limited to 5 per hour per bucket, reviewed by a human, and never delete anything automatically. After review 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.
  • A report carries what Art. 16(2) of the Digital Services Act asks of a notice: the id locates the content, reason explains why it is illegal, contact is an email address the notifier chose to give, and good_faith is true when the notifier states the bona fide belief that the report is accurate and complete. contact is optional, because a notifier must be able to identify themselves but need not (recital 50). The operator uses it only to confirm receipt and to tell the decision (Art. 16(4) and (5)); the server sends no email. A missing good_faith counts as false. The server stores good_faith as sent and refuses no report for it; a client SHOULD ask the notifier for the statement before it sends a report.
  • The server trims white space at both ends of contact, and an empty result counts as no contact. A contact MUST then be at most 254 bytes and match ^[A-Za-z0-9_%+-]+(\.[A-Za-z0-9_%+-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)+$, the expression of the operator contact (§9), so it holds no shell or HTML metacharacter and no confusable letter, and an internationalised domain appears as its xn-- A-label. Its local part MUST NOT hold a run of 22 or more base64url characters, which could be an id or a link key. The server answers 400 {"error":"contact"} to any other value. It checks contact after it has parsed the body and before it looks at the id, so this answer never depends on the message. Apart from the trimming the server stores the contact as sent, without the redaction of reason. The web client applies the same rule before it sends a report.
  • A client MUST apply the redaction below to reason before it signs and sends a report, so a link or S pasted into the reason never reaches the server (§1.2); the server redacts again before storing.
  • An abuse report MUST carry Content-Type: application/json, so a cross-site page needs a CORS preflight, which the server never grants. Before storing reason, the server percent-decodes it up to three times, replaces control characters with spaces, drops format characters such as bidi controls, replaces every #… run and every run of 22 or more base64url characters with [redacted], then cuts it to 1000 bytes and further until its JSON encoding fits in 1200 bytes. A replacement character U+FFFD is dropped like an invalid UTF-8 sequence, so the client and the server redact the same text; the redact cases in spec/vectors.json pin this for both cores. It stores reports only for live messages: a report about an ended message answers the same 202 and stores nothing, so no report outlives the 7 days after the end of its message. It stores at most 3 reports per message over the whole life of the message, and it keeps that count in the message's record (§5.2), so nothing outside the record ties a report to a message. When the signature is valid, the message is live and its 3 reports are already stored, the server stores nothing and answers 202 {"status":"limit"}, so it never tells a notifier that a report it dropped was received. Only a holder of the link can make that signature, and metadata (§6.3) already tells them that the message is live; the answer adds that the message has 3 reports. Unknown, ended and malformed ids and failed signatures keep the uniform {"status":"accepted"}. The cap is per message only, so no row ties a message to a reporter's address; one reporter can therefore use up the budget of a message, and a sender cannot file more than 3 reports about each message of their own. The server counts a report in the record before it writes the report and takes the count back when the write fails; a failed write answers 500, or 503 when the report files are full (below).
  • The server seals every report to the operator. It encrypts the report with HPKE (RFC 9180, base mode) to the public key in NYLZO_REPORT_KEY, with the KEM MLKEM768-X25519 (draft-ietf-hpke-pq), HKDF-SHA-256 and AES-256-GCM and info = "nylzo/v1/abuse-report". The plaintext is one JSON object, without HTML escaping, with date (the UTC date), id, the redacted reason, good_faith and, when the notifier gave one, contact, padded with spaces to 1808 bytes, which holds the longest allowed report. Every sealed report is therefore 2944 bytes long. The server cannot read a stored report. The operator keeps the private key off the server, creates the key pair with nylzo report-key and reads reports with nylzo reports. The server refuses to start without a valid NYLZO_REPORT_KEY. Reports go to one file per UTC day, abuse/{YYYY-MM-DD}.sealed in the data directory, as sealed reports one after another, which the server only appends to and syncs after each report, so no report is ever rewritten. The server creates the empty day files of today and tomorrow at startup, at every sweep and when a UTC day begins, so a file's birth time shows when it was prepared, never a report; a report never creates a day file and answers 500 when its file is missing. A report is written over a tail that is not a whole report, which the server counts as abuse-tail-truncated; when a write or sync fails, it overwrites the failed part with zeros and syncs it before it cuts the file back to the reports before it. nylzo reports prints every report that opens and then names, on stderr, the positions of those that did not and a partial report at the end, and exits 1 in that case, so one damaged or foreign chunk hides no other report. The report files together hold 3 reports for every message that 15 days of the global cap admit, since a report stays 7 days, a message can be reported during its up to 7 days of life, and UTC days add one (3 × NYLZO_GLOBAL_DAILY_CREATES × 15 × 2944 bytes, 265 MB for 2000 a day), and at least 64 MiB, which is also their size without a cap. A valid report that would push them past that answers 503, and the server logs the error abuse-file-full; it warns with abuse-files-half-full once a day once they pass half. With a cap they have room for every report the caps admit, so reports about a sender's own messages cannot fill them; without one the operator sizes them by watching that warning. A report never holds the time of day or a client IP address. The server sets the modification time of the day file to the start of that UTC day after every write, and every sweep sets the times of the day files and their directory again, so their ctime shows the last sweep, not the last report. Reports older than 7 days are dropped by overwriting their day files in full and then deleting them, at every sweep including sweep-once and before every new report. The server refuses to start while the data directory holds unsealed reports of an unreleased build, abuse-reports.jsonl or abuse/*.jsonl; it does not convert them.

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                  │
               ▼                                    ▼
           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 or cancelled); 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 v2 message whose share the server can no longer make, because the seed file was lost (§5.6), is ended by the first claim or download that finds it, as deleted, like a burn.

  • 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 adds a batch of empty files to the upload pool and removes random ones above its size (§5.2), shreds temporary upload files older than 15 minutes (pool files excluded), creates the abuse report day files of today and tomorrow and deletes those older than 7 days (§6.6), scrubs the WAL (§5.2) and sets the times of every blob file, pool file, report day file and their directories again, so each ctime shows the sweep, not the upload, and a pool file an upload gave back looks like one nobody took; it leaves the files of uploads in progress alone. 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 end of the hour after its expiry hour at the latest, the server erases the epoch key of its share, and from then on no copy of its object opens unless the attacker also holds a seed copied before that hour (§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, so refused ranges cannot queue up for the tokens. A range that asks for no more than its share therefore gets through, also when the ranges outnumber the requests per second, and many ranges that each stay within their own limits cannot take the bucket from it. 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, so a flood of ranges cannot lock out a new one, 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, claim, blob, ack, burn, cancel, status per hour 300 1500
object bytes of claims and downloads per hour 256 MiB 1280 MiB
abuse reports per hour 5 25

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, spent request challenges 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.

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 8, −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 8) plus one for each tenth of the global cap taken past half, at most 8: with a cap of 250 it is 4 up to 149 creates, 5 from 150, 6 from 175, 7 from 200 and 8 from 225. The tag binds the difficulty, so a token must meet the difficulty its challenge was issued with, and filling the cap costs more the fuller it gets. A client needs about 2^difficulty scrypt evaluations on average, so operators should keep the base difficulty low enough for phones to finish within the 120 s window; the client never changes, since it 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–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 4 KiB and to 64 header values. Over HTTP/1.1, net/http adds 4 KiB of read buffer, so headers up to 8 KiB pass and larger ones answer 431. Over h2c, Go's HTTP/2 server allows a header list of 4416 bytes (4 KiB plus 10 × 32), counted as RFC 9113 §6.5.2 counts it, with 32 bytes added to every field, 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 the 16000 bytes per second the protocol assumes, 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, so a slow upload still receives its 201. Every early answer to an HTTP/1.x request whose body has not been read to its end closes the connection instead of waiting for the rest, 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, and 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, out of the listener's reach, 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, so a create that has not started reading its body cannot hold back the other streams on its connection, and accepts frames of at most 16 KiB, so a peer cannot make a connection hold a larger read buffer. It allows 32 concurrent streams per connection and ignores the priority signals of RFC 9218, so one connection cannot make the server track or reorder more work. 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-Verifier, 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, so holding every slot of the default instance takes 64 ranges that keep reading at the minimum rate. 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 challenge spends, burn and cancel need, even while many uploads run at once. 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. NYLZO_PROXY_MODE=scaleway reads X-Real-IP instead, only when the request carries exactly one such value and, if NYLZO_TRUSTED_PROXIES is set, only from a connection inside it; otherwise the connection address counts. Without NYLZO_TRUSTED_PROXIES the mode reads X-Real-IP only from a connection whose address is loopback, link-local, private (RFC 1918, RFC 4193) or in the shared CGNAT space 100.64.0.0/10, so a connection from a public address that bypasses the ingress cannot choose its bucket. This mode is safe only behind an ingress that sets the header and that every connection passes through. Without configuration both headers are ignored. 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). That covers a proxy that is not trusted, a trusted proxy that sends only X-Real-IP or Forwarded or an unreadable X-Forwarded-For, and NYLZO_PROXY_MODE=scaleway without X-Real-IP: in each case all clients share the proxy's bucket. A client that sends such a header on a connection that bypasses the trusted proxy, or to a server without a proxy, causes the line too, and so does the rare X-Forwarded-For that lists only trusted addresses. A trusted proxy that passes a client's own X-Real-IP or Forwarded along does not, 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, X-Robots-Tag: noindex, nofollow (except the home page, 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=().
  • The home pages (GET / and GET /cs/, and HEAD on both) carry no X-Robots-Tag, so search engines may index them; every other response keeps noindex, nofollow, and 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: anyone can compare a received page with a published hash, and the page meets the rules of WEBCAT and WAICT, which both refuse nonces.
  • 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. A modified worker therefore fails the integrity check and never runs. 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, so even injected code cannot send a secret elsewhere by a navigation, a DNS prefetch, a redirect or WebRTC, which CSP does not cover; no page is left out, because code on one page could otherwise carry a secret to it. A link of the client therefore names an address that answers without a redirect. Chromium enforces the header since version 152; 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.
  • 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. As of October 2026 Chromium reads this header, while Firefox reads it only behind a preference that is off by default and Safari reads only the allow attribute of frames.
  • GET /, GET /cs/, 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 /cs answers 308 with Location: /cs/. 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 Czech on /cs/, and both come prerendered in their language from the templates home.en.html and home.cs.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 a compressed page costs no compression work per request, two responses for the same address and encoding are byte for byte the same, and a page reflects nothing from the request.
  • 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 /robots.txt answers text/plain; charset=utf-8 with User-agent: *, Disallow: /api/ and, with a public URL, 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 with a public URL, application/xml; charset=utf-8 listing / and /cs/ with xhtml:link alternates for en, cs and x-default (/); without a public URL it 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, and the icons .svg as image/svg+xml and .png as image/png. 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, home.en.html, home.cs.html) 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. The build also holds the status pages error.en.html, error.cs.html, maintenance.en.html and maintenance.cs.html, 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. Only the Caddy of the deployment examples serves them: the error page for its own 5xx errors and the maintenance page while its maintenance file exists, each only to a navigation (Sec-Fetch-Dest: document, or without fetch metadata an Accept with text/html) and in English or Czech by Accept-Language. A build without them answers with the bare status. When Accept-Encoding accepts gzip, the server sends the gzip variant from the build with Content-Encoding: gzip; every asset response carries Vary: Accept-Encoding and, like every response, Cache-Control: no-store. The server checks at startup that every gzip variant unpacks to its file, and the build carries no other encoding, because the server could not check it. Assets pass no token bucket, since they never reach the database (§8).
  • GET /.well-known/nylzo/client.json answers the manifest of the embedded web client: {"build":{…},"server":"…","built":bool,"public_url":"…","pages":["/","/cs/","/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":"home.en.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 /, /cs/ 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.cs.html renders /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). verify-client checks the public URL against the same rule as the server, renders each page from its own templates the same way and requires the exact bytes, policy and Connection-Allowlist, for which it reads the operator's contact from /.well-known/nylzo/transparency.json. It sees only what the server sends to it; a server can recognise it by its headers and TLS fingerprint and send browsers something else, so the check finds a swap that does not avoid the verifier, such as one from a compromised build or a broken deployment, not a server that hides it on purpose (§14). It requires the exact headers of this version on every page and file, each once, including Vary: Accept-Encoding; a header this version never sends is a mismatch unless a proxy adds it (Date, Content-Length, Server, Via, Alt-Svc, Connection, Keep-Alive, or one the operator allows with --allow-header), and headers that change what a browser does (Refresh, Set-Cookie, Clear-Site-Data, Link, Content-Disposition, NEL, Report-To, Reporting-Endpoints, Speculation-Rules, Service-Worker-Allowed, Accept-CH, Critical-CH) can never be allowed.
  • GET /.well-known/nylzo/transparency.json answers {"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,"abuse_per_hour":N,"coarse_multiplier":N,"global_daily_creates":N,"pow_difficulty":N},"retention":{"tombstone_s":N,"abuse_report_s":N,"daily_counter_s":N}} from the configuration and the constants the server uses; 0 for a rate means no limit. 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 §9; 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 Czech when Accept-Language ranks Czech above English and in English otherwise (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, since the shutdown line would date its end. 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, their HEAD variants and the abuse report) count together as route message by status class (2xx, 4xx, 5xx) without method, so the counts do not show how many messages were opened, burned or reported; other routes keep method, route pattern and status. A request that wrote no status counts as 200, which is what net/http sends. A method the server does not route is logged as OTHER. It logs no latency and never the size of a response or of an object: for create, claim and blob the size is the object, and the length of a metadata or status answer follows the number of digits in its size, TTL and counters and whether a passphrase is required. It never logs a message id, so a log line names no message. With very little traffic the hourly count of creates can still match the window in which a message was created. A proxy that terminates TLS in front of the server logs by its own rules; the Compose example configures Caddy to log no requests and no errors with request details. 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, so a log line never names a blob. It never logs the raw path, so a mangled link whose fragment reached the path is not logged. Requests that a middleware answers before routing (token-bucket 429s and Sec-Purpose 503s) are counted without route. 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 or abuse file 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. An operator therefore sees a full disk or a panic up to two hours late, and 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 (among them wal-reset-skipped), configuration and fatal errors and epoch-advance. A successful sweep writes nothing; a failed one writes only its first error, without counts, since the number of failed items would count the blobs that came due. It MUST NOT log Authorization, X-Nylzo-Create, X-Nylzo-Lease, X-Nylzo-Verifier, 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.

11. Versioning

Envelope version in the first byte, fragment version before the first dot, API under /api/v1, kdf_id in the envelope header and the fragment. A client MUST reject an unknown version or non-zero flags. A new KDF profile or the HPKE mode is a new value in an existing field, not a new format. A retired value stays reserved and is never reused (kdf_id 2, §2).

Version 2 changed the link, the envelope, the key derivation and the creation API together, because each of its checks needs the others: the object hash in the link pins what the commitment protects, and the share enters the same keys. The API path stays /api/v1; its create and instance messages changed as §6 describes, and a server answers a create from a v1 client with client_outdated (§6.1).

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 7, whose records carry the expiry epoch (§5.6). 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, as in a database of Nylzo 0.3 to 0.8, and keep every row. The version stays 7, because those releases ignore the index and still open the database, so going back to one of them needs no conversion. Nylzo 0.1 and 0.2 wrote version 5, which serve upgrades once by deleting every message in it (§15). 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. Version 6 and versions below 5 come from development builds that no release used; the server does not convert them.

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.

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 abuse report files), the epoch seed file, the logs and the configuration including the pepper. TestStolenServerRevealsNothing runs every flow with v2 messages (with and without passphrase, with a file, opened, leased, expired, burned, cancelled, removed by the operator, reported with a contact), copies these files and the log, and checks that none of them contains S, K, K_c, P, E, H, a passphrase, plaintext, a file name, the seeds R, V or M, the public keys pk_R, pk_V or pk_M, L, a client address, a message id in any encoding, the envelope header or its commitment, a report's reason or contact, 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, request challenges and PoW challenges can be minted, and candidate keys checked against the lease macs of a record that the holder of a link has opened; the verifier mac also needs the erase salt, which only a live blob holds. A minted id token lets its holder create a message under any id whose row is gone, but a v2 link pins its object by H, so the reader of an old link rejects such content, and v1 links are gone with their messages (§15). Rotate the pepper after any suspected leak. Address buckets do not come from it (§5.3) It opens no record: that needs pk_R or pk_M, which only the link and the manage key give
NYLZO_REPORT_KEY configuration The operator's public key, which anyone may use to seal a report The private key never reaches the server
Epoch seed (NYLZO_EPOCH_DIR/seed) one seed, overwritten in place every hour The shares of every message that expires in the current hour or later, so together with a link and its passphrase it opens a live message, as the live server can It makes no share of an hour that has begun, so a seed copied after a message's expiry hour opens nothing of it. A disk image or backup that holds the seed opens every message that was live then and expires later; keep the seed on a tmpfs or out of every image and backup (§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: every wrap is 60 bytes and every record 512 (§5.2) AES-256-GCM under keys derived from pk_R and pk_M; no policy, state, time, counter, verifier mac, lease or report count is in the clear. 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. The sweep must find these blobs without a key, so the times stay readable No time enters a key
rate_counters 24 hours after a daily window; PoW nonces 4 to 5 minutes; spent request challenges 2 to 3 minutes The global daily counters, used PoW nonces, spent request challenges (one random nonce each, no id) and the daily reconcile marker No row holds an address or a value derived from one, with or without the pepper (§5.3); the challenge rows only show how many signed requests arrived in the last few minutes
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)
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). 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
abuse/{YYYY-MM-DD}.sealed 7 days, and never past the end of the reported message plus 7 days How many reports the server stored on each UTC day Each report is sealed with HPKE to the operator's public key and padded to one length (§6.6); the file's modification time is the start of its day and its ctime the last sweep
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 or report day file was created (startup, a sweep, a day change), never an upload or a report; 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, pool and report day 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, report 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, the blob directory and the abuse report 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. On Linux, serve, sweep-once and takedown mark their process as not dumpable and set the core file limit to 0 before they read any secret, so a crash leaves no core file with record keys or the pepper and another process of the same user cannot read their memory. serve also locks every page it maps into memory (mlockall with MCL_CURRENT, MCL_FUTURE and MCL_ONFAULT), so no key reaches swap, and refuses to start when that fails, unless NYLZO_ALLOW_SWAP=1 is set and logged 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. serve refuses a finite limit without CAP_IPC_LOCK before it calls mlockall: the call succeeds while the heap is small, but MCL_FUTURE then makes every later mapping past the limit fail, and the server would stop 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 and logged as memory-not-erased. It also refuses a data directory on a file system that does not overwrite in place (§5.2).

What goes beyond stolen data, stated plainly:

  • 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. No server design prevents this for the website, and in October 2026 no browser lets a visitor check a website's code before it runs. 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 the server runs, it sees public keys, one-time signatures, L, ciphertext and the shares it computes, and an observer of the unencrypted h2c hop between the provider edge and the container sees the same apart from the shares, which travel wrapped to a one-time key of the client (§5.6). An active attacker at the edge or on that hop can replace the client's share key and so learns every share it relays. With a public key it opens the record of that message (§5.2), so whoever controls the running server reads the metadata of every message whose reader or sender makes a request meanwhile. Every API request runs in the secret mode of Go's runtime/secret (the release build sets GOEXPERIMENT=runtimesecret; Linux on amd64 and arm64), which erases its registers and stack when it returns and its heap allocations once they are unreachable; 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, so a later look at the memory finds little of earlier requests. net/http reads and parses the request line and headers, which carry the message id and the Authorization header with the public key and signature, before the handler enters secret mode. The strings it makes from them are ordinary heap memory that stays readable until the collector reuses it, and the buffers it keeps per connection hold the headers of the last request on that connection until they are reused. A recorded request cannot be replayed, because its challenge is spent (§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 expiry hour has passed, seed included, can guess the passphrase offline against the ciphertext at the cost of scrypt N = 2^18 per guess. Only the strength of the passphrase protects it, which is why clients offer a generated 80-bit passphrase by default and refuse one shorter than 15 characters or repetitive, sequential or common (§2). Hashcat ran scrypt N = 2^14, r = 8 at about 7,760 guesses per second on an RTX 5090, so N = 2^18 costs about 16 times as much per guess, roughly 500 per second per card; a generated passphrase is out of reach, and a human one of 15 characters is a matter of its real entropy. An OPRF whose key stays in hardware would stop offline guessing even with the link and a copy of the server; the hosts Nylzo targets have no such store, and it is the path if one becomes available.
  • 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, which is 160 hours on the Hetzner profile, 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 of a message is cryptographic from the end of the hour after its expiry hour (§5.6): from then on the server holds nothing that opens it, and a copy of its object opens only together with a seed copied before that hour. A disk image or backup taken while the message lived holds that seed whenever the seed lives on the same disk, as it does by default. Before that, 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; someone who copies the seed file before a message expires can make the shares of every message that expires later. 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, so an operator restores neither.
  • A link pins its object by H (§3), so whoever holds the link and can write to the stored object cannot give a later reader other content, and the commitment stops one object from opening to different content under different keys.
  • Anyone who holds the link can delete the message with R, also when it is protected by a passphrase, and can lock readers out with wrong passphrases (§6.4). Both cost availability, not confidentiality.
  • Ed25519 only authorizes requests while a message lives, at most 7 days. A quantum computer that sees pk_R or pk_V (edge, h2c hop, running server) in that window could forge read and verifier signatures, claim opens, delete the message or skip the passphrase backoff, but it learns no content, which needs S and stays under 256-bit symmetric keys and SHA-256. The post-quantum signature ML-DSA is in Chromium 156's Web Crypto but not in WebKit 27.2 (checked on 31 Oct 2026), so a hybrid request signature cannot run in every target browser yet; it becomes the next step when it can. The abuse report seal uses the hybrid KEM MLKEM768-X25519 of draft-ietf-hpke-pq, which is still a draft (revision 05, no RFC on 31 Oct 2026); a known-answer test pins its current encoding, so a Go upgrade that follows a later draft fails the build instead of producing reports the operator 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. Whoever controls the code a client runs controls the message. 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, and no check by anyone else sees it. 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;
  • the browser extension, which is planned and not yet admitted by the cross-origin guard (§6).

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). An earlier program that held the port, and got the browser to register a service worker, cache a page or store data for http://127.0.0.1:{port}, http://localhost:{port} or an earlier session, can never have used this origin, so none of that runs in the session. 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, where Safari would ask the network's resolver, 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 (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. 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 one 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 §9.
  • 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 the browser. A web client whose nylzo-instance origin differs from its own origin offers no option to remember a sent message 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 Windows the file lies in the account's temporary folder, which by default only that account, administrators and the system can read. 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–Z and 2–7), so on an instance a link key pasted after /open# is never sent. The first request with the token receives {"path":"/r","fragment":"2.{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. Revisit this when a browser enforces WAICT by default, when WEBCAT leaves its alpha or reaches another browser, and when Isolated Web Apps install on unmanaged computers. The pages already carry no nonce and the same bytes on every response (§9), which both systems 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 (release:verify), not prevented.

15. Protocol v1 and the upgrade

Nylzo 0.1 and 0.2 used protocol v1, whose links have the form https://{host}/m/{id}#1.{kdf_id}.{S}. Protocol v2 has no transition period: no client or server reads a v1 envelope, and the upgrade deletes every message created before it.

  • The first start of serve on a database of version 5 (§12) erases every stored message before it creates the current schema. It overwrites every blob file in full and syncs it before it removes it, because a v1 blob has no erase block (§5.2). It then 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 a start that an interruption stopped at any point finishes the upgrade on the next start and never refuses the database.
  • A client recognises a v1 link only to tell its reader that the upgrade deleted the message. It accepts one only on its own path /m/{id}, with a valid id, a kdf_id of 0, 1 or 2 and a 32-byte S. It derives nothing from it and sends no request. Any other text is an invalid link.
  • GET /m/{id} still serves the page of the web client (§9), so an old link opens that notice.
  • A create from a v1 client answers 400 client_outdated (§6.1): its X-Nylzo-Create has no epoch, or its envelope version is 1. A v1 CLI usually fails one step earlier: its instance request carries neither X-Nylzo-Ttl nor X-Nylzo-Share-Key, so the answer has no create object (§6.6), and it reports a malformed response. Either way the sender has to update the client.
  • kdf_id 1 is retired (§2).

Edit this page through a pull request.

Clone this wiki locally