Files
amethyst/quartz
Claude 1569b45671 fix: align Marmot implementation with MIP specs for interop with MDK
Brings Amethyst's Marmot code into wire-level interoperability with the
reference MDK (Rust) implementation by resolving four spec violations and
tightening the epoch lookback window:

- MIP-01 (NostrGroupData extension): switch to QUIC-style VarInt length
  prefixes (RFC 9000 §16) instead of fixed uint16. MIP-01 mandates this
  encoding (the one produced by the Rust `tls_codec` crate v0.4+), so
  Amethyst's previous uint16 framing could not round-trip with any MDK
  peer. admin_pubkeys, relays (outer + each inner), name, description,
  image_*, and disappearing_message_secs now all use VarInt prefixes.

- MIP-01: enforce "admin_pubkeys MUST NOT contain duplicates" in the
  MarmotGroupData constructor.

- MIP-05 (Push Notifications): token plaintext padded size was 220 (→ 280
  encrypted); spec MUSTs are exactly 1024 bytes plaintext (1084 encrypted).
  A server expecting MIP-05 tokens would reject Amethyst's frames outright.

- MIP-05: HKDF IKM was sha256(shared_point); spec requires the raw 32-byte
  ECDH x-coordinate. The extra sha256 produced a different PRK, so token
  ciphertext authenticated only within Amethyst. Removed the hash; ECDH
  already returns the x-only compact form via pubKeyTweakMulCompact.

- MIP-03: bump EPOCH_RETENTION_WINDOW from 2 to 5 to match MDK's
  DEFAULT_EPOCH_LOOKBACK, so late-arriving GroupEvents whose ChaCha20
  outer key was derived from a prior epoch's exporter secret can still
  be decrypted after a Commit advances the group.

Hand-crafted MarmotGroupData test blobs were updated to emit VarInt
length prefixes.
2026-04-20 17:06:51 +00:00
..