diff options
| author | Alex Gleason <alex@alexgleason.me> | 2026-03-17 15:33:00 -0500 |
|---|---|---|
| committer | Alex Gleason <alex@alexgleason.me> | 2026-03-17 15:33:00 -0500 |
| commit | ac2f6a6cf9c2368f1c6a87c1716751fdf7496707 (patch) | |
| tree | a873560e18da7ab6a6c5750d0fb75eb0622d6111 /EE.md | |
| parent | 3492eb1affa5e93e658224a81bb832d2b6090ecd (diff) | |
nip44: allow encryption of payloads larger than 65535 bytes
Extend the v2 padding format with a backwards-compatible sentinel:
when the first 2 bytes of the length prefix are zero, the next 4
bytes encode the plaintext length as a big-endian u32. This raises
the maximum from 65535 bytes to 2^32-1 bytes without requiring a
version bump.
Fixes from nostr-protocol/nips#1907:
- Fix off-by-one: use >= 65536 (not > 65536) for the extended path,
since u16 can only represent 0..65535
- Fix padding validation: use dynamic prefix_len (2 or 6) instead of
hardcoded 2 in the unpad() size check
- Fix len(d) typo in decode_payload (should be len(data))
- Remove upper-bound size checks in decode_payload that would reject
large payloads
- Add write_u32_be, read_uint16_be, read_uint32_be to function list
- Add extended_prefix_threshold constant
- Update size range comments for both small and large payload paths
Diffstat (limited to 'EE.md')
0 files changed, 0 insertions, 0 deletions