Developer

Tabtrax cryptography for reviewers: X-Wing, AES-256-GCM, and stream tags. Identity derivation and the packet board. The specification remains normative.

For how the pieces fit together, before the byte layout, see How the protocol works.

This page restates the cryptographic parts of the Tabtrax protocol for reviewers and implementers. The product repository’s docs/SPEC.md is the normative source. This site is not a client and does not speak the protocol.

For a shorter, non-technical account see Security. Record field layouts, HTTP routes, introduction state machines, and receive-path ordering stay in the specification.

The iOS app and server will be published in the product source repository. This marketing site is a separate repo.

Security model

Tabtrax stores shared expenses as fixed-size encrypted packets on a board. Each packet is filed under a 16-byte tag. Email authenticates writes. Cryptographic identity is the fingerprint of the X-Wing public key, not that email. Reads that ask for tags are not tied to an account.

Even if the server reads, changes, injects, reorders, replays, or withholds packets:

  • Expense content and stream keys remain confidential.
  • A packet opens only with the stream key for that slot. The tag is part of the authenticated data, so a copy filed under another tag does not open.
  • Replayed and reordered packets cannot roll local state back.
  • Cryptographic failures produce no explicit client response or detailed telemetry to the server.

These are not anonymity guarantees. While it handles an authenticated write, the server can see that account, the source IP, timing, and request order. The protocol does not detect withholding, equivocation, traffic analysis, or denial of service.

Algorithms

Primitives come from CryptoKit on iOS 26+. The BIP39 and PBKDF2 glue is frozen in the product repository. There is no algorithm negotiation.

PurposeAlgorithm
Hybrid KEM X-Wing (XWingMLKEM768X25519)
Invites HPKE base mode, X-Wing / HKDF-SHA-256 / AES-256-GCM
Stream tags HMAC-SHA-256 of the slot, under a key derived from the stream key
AEAD AES-256-GCM, 96-bit nonce, 128-bit tag
Hash SHA-256
KDF HKDF-SHA-256
Recovery phrase BIP39 English, 24 words, empty passphrase

Protocol labels are exact ASCII without a terminator. Record text is NFC-normalized UTF-8. Recovery-phrase processing uses NFKD as BIP39 requires. Lengths are checked before any cryptographic call. Comparisons of tags and commitments are constant time.

Sizes

ValueSize
X-Wing seed / public key / ciphertext / shared secret 32 / 1216 / 1120 / 32
AES-GCM nonce / tag 12 / 16
Identity fingerprint / stream key 32
Record ID / packet tag 16
Padded packet plaintext 2496
Stored blob (12 + 2496 + 16) 2524
Packets stored under one tag 4 packets
Identities on one record 16 people

Implementations must validate every length before invoking a cryptographic API. Token hashes and authentication values are compared in constant time in memory.

Identity

The app generates 256 random bits and encodes them as a 24-word BIP39 English phrase. The BIP39 passphrase is empty.

seed = PBKDF2-HMAC-SHA512(
         password = NFKD(phrase),
         salt = "mnemonic",
         iterations = 2048,
         length = 64)
root = HKDF-SHA-256(
         ikm = seed,
         salt = "trax-root",
         info = "",
         output = 32)
SecretDerivation
X-Wing seed KDF(root, "trax-xwing")
Self stream KDF(root, "trax-self")
Receive key for contact F HKDF(root, "", "trax-recv" || F, 32)

The phrase, root, and the X-Wing seed never leave the device. The public key is shared so someone can connect. A receive key is sent only inside a message sealed to that contact’s public key. A new phrase is a new identity.

Fingerprint

xwing_seed = KDF(root, "trax-xwing")
(dk, ek)   = X-Wing key pair from xwing_seed
fp         = SHA-256("trax-fp" || ek)
K_self     = KDF(root, "trax-self")
recv(F)    = HKDF-SHA-256(
               ikm = root,
               salt = "",
               info = "trax-recv" || F,
               output = 32)

fp is the stable participant identifier: SHA-256 of trax-fp followed by the X-Wing public key. Records name people by fingerprint. A server account id does not appear in a record.

Board

A server stores rows of (tag, blob). A tag is 16 bytes. A blob is 2524 bytes. A tag holds at most four blobs. Query returns the rows for the tags you ask for and does not require a session. A put requires a session. Rows are not updated or deleted.

row = (tag, blob)
len(tag)  = 16
len(blob) = 2524
tag holds at most 4 blobs

The server checks the lengths and must not parse a blob. It does not store an account, a time, or an address beside the row.

Stream slots

A stream is a numbered sequence of slots that share one secret key. The tag of a slot is the first 16 bytes of HMAC-SHA-256 under a key derived from that stream key. Only a holder of the stream key can find or open the slot.

tag(K, i) = HMAC-SHA-256(
             KDF(K, "trax-tag"),
             u64be(i))[0..16)

The self stream is readable only by you. It holds contacts, invites, your own records, and settlement include or exclude choices. Pair streams carry records between two connected people. Each direction has its own key.

A slot is filled when at least one blob under its tag opens with that stream key. It is poisoned when the tag holds four blobs and none of them open. The client skips a poisoned slot. One to three blobs that do not open still leave room for a later write.

Invite, HELLO, and reply messages use HPKE. Connection rules, including when two people who open each other’s invites connect without a separate accept, are normative in SPEC.md.

Packet

Every blob is the same length. The plaintext is padded to 2496 bytes before it is sealed. A fresh 12-byte nonce is used for every seal.

Padding

pad(x) = u32be(len(x)) || x || zero bytes
         total 2496 bytes
         len(x) ≤ 2492

Padding is a 4-byte length, then the payload, then zero bytes, totaling 2496 bytes. The payload is at most 2492 bytes. After opening, every unused padding byte must be zero.

Sealing

nonce = 12 random bytes
blob  = nonce || AES-256-GCM.Seal(
          key = KDF(K, "trax-enc"),
          nonce,
          plaintext = pad(payload),
          aad = "trax-packet" || tag(K, i))

The blob is the nonce, then AES-256-GCM of the padded plaintext. The key is derived from the stream key with the label trax-enc. The authenticated data is trax-packet followed by the slot tag. The blob is 2524 bytes.

Who can open it

self stream   key K_self     writer: you     reader: you
pair X→Y     key recv_Y(fp_X) writer: X      reader: Y

A reader opens a row only with the key of the stream it is reading. It does not try other keys. The server never receives that key.

What the server checks

BLOB_LEN = 12 + 2496 + 16 = 2524
The server rejects every other blob length.

Clients and the server reject every blob whose length is not 2524 bytes, and every tag whose length is not 16 bytes. The server does not parse the contents.

Safety number

Contacts compare a number derived from both fingerprints. It is symmetric and independent of display names. No message is sent.

(fp_low, fp_high) = the two fingerprints, ascending
number = SHA-256("trax-verify" || fp_low || fp_high)

The digest is SHA-256 of trax-verify followed by the two fingerprints in ascending byte order. Display uses the first 30 digest bytes as six 5-byte big-endian integers reduced modulo 100000 and zero-padded to five digits.

What this does not cover

  • Record schemas (expense, income, settlement, tombstone, echo)
  • HTTP routes, email sign-in, and exchange-rate history
  • The invite, HELLO, reply, and open handshake

Those belong in SPEC.md and API.md. A cryptographic or structural failure is one generic local rejection. Clients must not send failure details, plaintext, keys, fingerprints, or packet-specific crypto telemetry to the server.