@open-e2ee/signal-protocol-sdk 0.1.0-alpha.9 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/ADAPTERS.md +12 -12
  2. package/ARCHITECTURE.md +3 -3
  3. package/CHANGELOG.md +374 -0
  4. package/README.md +25 -15
  5. package/SECURITY.md +1 -1
  6. package/client/README.md +2 -2
  7. package/device/README.md +3 -1
  8. package/dist/client/client.d.ts +6 -6
  9. package/dist/client/client.js +6 -6
  10. package/dist/client/compose.d.ts +2 -2
  11. package/dist/client/index.d.ts +2 -2
  12. package/dist/device/expo-metadata.d.ts +26 -0
  13. package/dist/device/expo-metadata.d.ts.map +1 -0
  14. package/dist/device/expo-metadata.js +33 -0
  15. package/dist/device/expo-metadata.js.map +1 -0
  16. package/dist/device/index.d.ts +1 -1
  17. package/dist/device/index.d.ts.map +1 -1
  18. package/dist/device/index.js +5 -1
  19. package/dist/device/index.js.map +1 -1
  20. package/dist/device/provisioning.d.ts +4 -12
  21. package/dist/device/provisioning.d.ts.map +1 -1
  22. package/dist/device/provisioning.js +4 -21
  23. package/dist/device/provisioning.js.map +1 -1
  24. package/dist/index.d.ts +5 -5
  25. package/dist/index.js +5 -5
  26. package/dist/internal/crypto/symmetric/aes.d.ts.map +1 -1
  27. package/dist/internal/crypto/symmetric/aes.js +27 -30
  28. package/dist/internal/crypto/symmetric/aes.js.map +1 -1
  29. package/dist/internal/encoding/proto/primitives.d.ts +261 -6
  30. package/dist/internal/encoding/proto/primitives.d.ts.map +1 -1
  31. package/dist/internal/encoding/proto/primitives.js +468 -6
  32. package/dist/internal/encoding/proto/primitives.js.map +1 -1
  33. package/dist/internal/encoding/proto/sender-key-message.d.ts +4 -3
  34. package/dist/internal/encoding/proto/sender-key-message.d.ts.map +1 -1
  35. package/dist/internal/encoding/proto/sender-key-message.js +97 -76
  36. package/dist/internal/encoding/proto/sender-key-message.js.map +1 -1
  37. package/dist/internal/encoding/proto/signal-message.d.ts +7 -2
  38. package/dist/internal/encoding/proto/signal-message.d.ts.map +1 -1
  39. package/dist/internal/encoding/proto/signal-message.js +194 -110
  40. package/dist/internal/encoding/proto/signal-message.js.map +1 -1
  41. package/dist/internal/manager/manager.d.ts +2 -2
  42. package/dist/internal/protocol/sealed-sender/proto/index.d.ts +50 -4
  43. package/dist/internal/protocol/sealed-sender/proto/index.d.ts.map +1 -1
  44. package/dist/internal/protocol/sealed-sender/proto/index.js +273 -151
  45. package/dist/internal/protocol/sealed-sender/proto/index.js.map +1 -1
  46. package/dist/internal/protocol/spqr/ml-kem-braid/serialize.d.ts +7 -1
  47. package/dist/internal/protocol/spqr/ml-kem-braid/serialize.d.ts.map +1 -1
  48. package/dist/internal/protocol/spqr/ml-kem-braid/serialize.js +334 -151
  49. package/dist/internal/protocol/spqr/ml-kem-braid/serialize.js.map +1 -1
  50. package/dist/layers.d.ts +2 -2
  51. package/dist/layers.d.ts.map +1 -1
  52. package/dist/layers.js +2 -2
  53. package/dist/layers.js.map +1 -1
  54. package/dist/local/store/index.d.ts +3 -3
  55. package/dist/local/store/index.d.ts.map +1 -1
  56. package/dist/local/store/index.js +4 -4
  57. package/dist/local/store/index.js.map +1 -1
  58. package/dist/local/store/{mock → memory}/adapter.d.ts +10 -10
  59. package/dist/local/store/memory/adapter.d.ts.map +1 -0
  60. package/dist/local/store/{mock → memory}/adapter.js +5 -5
  61. package/dist/local/store/memory/adapter.js.map +1 -0
  62. package/dist/local/store/{mock → memory}/failures.d.ts +6 -6
  63. package/dist/local/store/memory/failures.d.ts.map +1 -0
  64. package/dist/local/store/{mock → memory}/failures.js +6 -6
  65. package/dist/local/store/memory/failures.js.map +1 -0
  66. package/dist/local/store/memory/index.d.ts +11 -0
  67. package/dist/local/store/memory/index.d.ts.map +1 -0
  68. package/dist/local/store/memory/index.js +7 -0
  69. package/dist/local/store/memory/index.js.map +1 -0
  70. package/dist/local/store/react-native/adapter.d.ts.map +1 -1
  71. package/dist/local/store/react-native/adapter.js +69 -1
  72. package/dist/local/store/react-native/adapter.js.map +1 -1
  73. package/dist/local/store/react-native/backend-conformance.d.ts +66 -0
  74. package/dist/local/store/react-native/backend-conformance.d.ts.map +1 -0
  75. package/dist/local/store/react-native/backend-conformance.js +326 -0
  76. package/dist/local/store/react-native/backend-conformance.js.map +1 -0
  77. package/dist/local/store/react-native/index.d.ts +9 -4
  78. package/dist/local/store/react-native/index.d.ts.map +1 -1
  79. package/dist/local/store/react-native/index.js +2 -0
  80. package/dist/local/store/react-native/index.js.map +1 -1
  81. package/dist/local/store/react-native/reference-backend.d.ts +42 -0
  82. package/dist/local/store/react-native/reference-backend.d.ts.map +1 -0
  83. package/dist/local/store/react-native/reference-backend.js +177 -0
  84. package/dist/local/store/react-native/reference-backend.js.map +1 -0
  85. package/dist/local/store/react-native/storage.d.ts +9 -0
  86. package/dist/local/store/react-native/storage.d.ts.map +1 -1
  87. package/dist/local/store/web/adapter.d.ts +11 -1
  88. package/dist/local/store/web/adapter.d.ts.map +1 -1
  89. package/dist/local/store/web/adapter.js +196 -33
  90. package/dist/local/store/web/adapter.js.map +1 -1
  91. package/dist/local/store/web/index.d.ts +3 -2
  92. package/dist/local/store/web/index.d.ts.map +1 -1
  93. package/dist/local/store/web/index.js.map +1 -1
  94. package/dist/local/vault/index.d.ts +5 -1
  95. package/dist/local/vault/index.d.ts.map +1 -1
  96. package/dist/local/vault/index.js +1 -1
  97. package/dist/local/vault/index.js.map +1 -1
  98. package/dist/remote/relay/convex/component/certificates.d.ts.map +1 -1
  99. package/dist/remote/relay/convex/component/certificates.js +26 -31
  100. package/dist/remote/relay/convex/component/certificates.js.map +1 -1
  101. package/dist/remote/relay/index.d.ts +1 -1
  102. package/dist/remote/relay/index.d.ts.map +1 -1
  103. package/dist/remote/relay/index.js +2 -2
  104. package/dist/remote/relay/index.js.map +1 -1
  105. package/dist/remote/relay/{mock → memory}/adapter.d.ts +17 -17
  106. package/dist/remote/relay/memory/adapter.d.ts.map +1 -0
  107. package/dist/remote/relay/{mock → memory}/adapter.js +17 -17
  108. package/dist/remote/relay/memory/adapter.js.map +1 -0
  109. package/dist/remote/relay/{mock → memory}/failures.d.ts +5 -5
  110. package/dist/remote/relay/memory/failures.d.ts.map +1 -0
  111. package/dist/remote/relay/{mock → memory}/failures.js +1 -1
  112. package/dist/remote/relay/memory/failures.js.map +1 -0
  113. package/dist/remote/relay/{mock → memory}/group-server.d.ts +1 -1
  114. package/dist/remote/relay/memory/group-server.d.ts.map +1 -0
  115. package/dist/remote/relay/{mock → memory}/group-server.js +1 -1
  116. package/dist/remote/relay/memory/group-server.js.map +1 -0
  117. package/dist/remote/relay/memory/index.d.ts +11 -0
  118. package/dist/remote/relay/memory/index.d.ts.map +1 -0
  119. package/dist/remote/relay/memory/index.js +7 -0
  120. package/dist/remote/relay/memory/index.js.map +1 -0
  121. package/dist/types/errors.d.ts +33 -0
  122. package/dist/types/errors.d.ts.map +1 -1
  123. package/dist/types/errors.js +36 -0
  124. package/dist/types/errors.js.map +1 -1
  125. package/docs/ASSURANCE.md +49 -14
  126. package/docs/CLIENT_COMPOSITION.md +3 -3
  127. package/docs/GETTING_STARTED.md +11 -11
  128. package/docs/PACKAGE_SURFACE.md +10 -8
  129. package/docs/RECIPES.md +12 -12
  130. package/local/store/README.md +95 -8
  131. package/local/store/{mock → memory}/README.md +8 -8
  132. package/local/store/react-native/README.md +34 -2
  133. package/local/store/web/README.md +30 -3
  134. package/package.json +13 -10
  135. package/remote/README.md +7 -7
  136. package/remote/relay/README.md +5 -5
  137. package/remote/relay/{mock → memory}/README.md +8 -8
  138. package/dist/local/store/mock/adapter.d.ts.map +0 -1
  139. package/dist/local/store/mock/adapter.js.map +0 -1
  140. package/dist/local/store/mock/failures.d.ts.map +0 -1
  141. package/dist/local/store/mock/failures.js.map +0 -1
  142. package/dist/local/store/mock/index.d.ts +0 -11
  143. package/dist/local/store/mock/index.d.ts.map +0 -1
  144. package/dist/local/store/mock/index.js +0 -7
  145. package/dist/local/store/mock/index.js.map +0 -1
  146. package/dist/remote/relay/mock/adapter.d.ts.map +0 -1
  147. package/dist/remote/relay/mock/adapter.js.map +0 -1
  148. package/dist/remote/relay/mock/failures.d.ts.map +0 -1
  149. package/dist/remote/relay/mock/failures.js.map +0 -1
  150. package/dist/remote/relay/mock/group-server.d.ts.map +0 -1
  151. package/dist/remote/relay/mock/group-server.js.map +0 -1
  152. package/dist/remote/relay/mock/index.d.ts +0 -11
  153. package/dist/remote/relay/mock/index.d.ts.map +0 -1
  154. package/dist/remote/relay/mock/index.js +0 -7
  155. package/dist/remote/relay/mock/index.js.map +0 -1
@@ -1,38 +1,68 @@
1
1
  /**
2
2
  * Shared Protobuf Encoding Primitives
3
3
  *
4
- * Low-level protobuf wire format encoding/decoding used for binary formats
5
- * that aren't full protobuf messages (MAC headers, safety number fingerprints,
6
- * sealed sender envelope framing).
4
+ * Low-level protobuf wire format encoding/decoding. Two kinds of caller use it:
5
+ * binary formats that aren't full protobuf messages (MAC headers, safety number
6
+ * fingerprints, sealed sender envelope framing), and the hand-written static
7
+ * codecs for the message schemas in this package.
7
8
  *
8
9
  * Implements a subset of the Protocol Buffers encoding spec:
9
- * - Varint encoding (wire type 0)
10
- * - Length-delimited fields (wire type 2)
10
+ * - Varint encoding (wire type 0), 32-bit and 64-bit
11
+ * - Fixed 64-bit fields (wire type 1)
12
+ * - Length-delimited fields (wire type 2): bytes, strings, embedded messages
11
13
  * - Field tags (field_number << 3 | wire_type)
12
14
  * - Unknown field skipping
13
15
  *
16
+ * The subset is chosen by what the schemas here actually use. Deliberately
17
+ * absent: groups (wire types 3 and 4, deprecated and used by nothing here),
18
+ * packed repeated scalars (no schema here repeats a scalar), sint/zigzag, and
19
+ * negative enum values — each of which would need sign-extended 10-byte
20
+ * varints. `ProtoReader` rejects rather than misreads what it does not cover.
21
+ *
14
22
  * @see https://protobuf.dev/programming-guides/encoding/
15
23
  * @internal
16
24
  */
17
25
  export const WIRE_TYPE_VARINT = 0;
26
+ /** Protobuf wire type 1: fixed 64-bit, little-endian (fixed64, sfixed64, double) */
27
+ export const WIRE_TYPE_FIXED64 = 1;
18
28
  /** Protobuf wire type 2: length-delimited (bytes, strings, embedded messages) */
19
29
  export const WIRE_TYPE_LENGTH_DELIMITED = 2;
30
+ /** Protobuf wire type 5: fixed 32-bit, little-endian (fixed32, sfixed32, float) */
31
+ export const WIRE_TYPE_FIXED32 = 5;
20
32
  // ============================================================================
21
33
  // Varint Encoding/Decoding
22
34
  // ============================================================================
35
+ /** Largest value a protobuf uint32 field can carry. */
36
+ export const UINT32_MAX = 0xffffffff;
23
37
  /**
24
38
  * Encode an unsigned integer as a varint.
25
39
  *
26
40
  * Each byte uses 7 bits for data and 1 bit (MSB) as continuation flag.
27
41
  * Supports values 0 to 2^32-1 (uint32 range).
28
42
  *
29
- * @param value - Non-negative integer to encode
43
+ * Anything outside that range is rejected rather than coerced into it. The
44
+ * shift this loop uses is a 32-bit operation, so a larger value used to be
45
+ * truncated to its low 32 bits and emitted as a non-canonical encoding —
46
+ * 2^32 came out as `80 00`, which `decodeVarint64` then refuses, leaving the
47
+ * package writing bytes it cannot read back. A non-integer was worse still:
48
+ * `NaN` encoded as 0 and `1.5` as 1, silently. protobufjs coerced all of
49
+ * these with `>>> 0` and said nothing; nothing in this package has ever had a
50
+ * reason to hand any of them over, so the coercion only ever hid a defect at
51
+ * the call site. Values above uint32 belong in `encodeVarint64`.
52
+ *
53
+ * @param value - Integer in the uint32 range
30
54
  * @returns Varint-encoded bytes
31
55
  */
32
56
  export function encodeVarint(value) {
33
57
  if (value < 0) {
34
58
  throw new Error('Varint value must be non-negative');
35
59
  }
60
+ if (value > UINT32_MAX) {
61
+ throw new Error('Varint value exceeds uint32 range');
62
+ }
63
+ if (!Number.isInteger(value)) {
64
+ throw new Error('Varint value must be an integer');
65
+ }
36
66
  const bytes = [];
37
67
  // Encode 7 bits at a time, setting high bit if more bytes follow
38
68
  while (value > 0x7f) {
@@ -70,6 +100,91 @@ export function decodeVarint(bytes, offset) {
70
100
  return { value: value >>> 0, bytesRead };
71
101
  }
72
102
  // ============================================================================
103
+ // 64-bit Varint Encoding/Decoding
104
+ // ============================================================================
105
+ /** Largest value a protobuf uint64 field can carry. */
106
+ export const UINT64_MAX = (1n << 64n) - 1n;
107
+ /** A uint64 varint never needs more than ceil(64 / 7) = 10 bytes. */
108
+ export const MAX_VARINT64_BYTES = 10;
109
+ /**
110
+ * Encode an unsigned 64-bit integer as a varint.
111
+ *
112
+ * Byte-compatible with `encodeVarint` over the uint32 range: both emit the
113
+ * minimal base-128 little-endian form, so a value below 2^32 encodes
114
+ * identically either way. Use this one wherever the schema says uint64 — the
115
+ * SPQR epoch is the case in this package.
116
+ *
117
+ * @param value - Non-negative integer, at most 2^64-1
118
+ * @returns Varint-encoded bytes (1 to 10)
119
+ */
120
+ export function encodeVarint64(value) {
121
+ if (value < 0n) {
122
+ throw new Error('Varint value must be non-negative');
123
+ }
124
+ if (value > UINT64_MAX) {
125
+ throw new Error('Varint value exceeds uint64 range');
126
+ }
127
+ const bytes = [];
128
+ // Encode 7 bits at a time, setting high bit if more bytes follow
129
+ while (value > 0x7fn) {
130
+ bytes.push(Number(value & 0x7fn) | 0x80); // 7 bits + continuation bit
131
+ value >>= 7n;
132
+ }
133
+ bytes.push(Number(value)); // Final byte (no continuation)
134
+ return new Uint8Array(bytes);
135
+ }
136
+ /**
137
+ * Decode a 64-bit varint from bytes at the given offset.
138
+ *
139
+ * Canonical encoding is required: a varint longer than one byte whose last
140
+ * byte is 0x00 encodes a value that fits in fewer bytes, and is rejected. The
141
+ * contract is stricter than protobufjs, which accepts the redundant forms and
142
+ * silently truncates a uint32 field to 32 bits. Two reasons to be strict here:
143
+ * these bytes are signed and MAC'd (SenderKeyMessage signing, sealed sender
144
+ * certificates), and accepting several encodings of one value makes the
145
+ * signed byte string malleable; and byte identity is only checkable when
146
+ * decode-then-encode is the identity function. Every encoder — protobufjs
147
+ * included — emits the canonical form, so nothing this package has ever
148
+ * written is rejected by it.
149
+ *
150
+ * @param bytes - Buffer containing varint
151
+ * @param offset - Starting offset in buffer
152
+ * @returns Decoded value and number of bytes consumed
153
+ */
154
+ export function decodeVarint64(bytes, offset) {
155
+ let value = 0n;
156
+ let shift = 0n;
157
+ let bytesRead = 0;
158
+ for (;;) {
159
+ if (offset + bytesRead >= bytes.length) {
160
+ throw new Error('Varint truncated');
161
+ }
162
+ const byte = bytes[offset + bytesRead];
163
+ bytesRead++;
164
+ // Nine bytes carry bits 0..62, so the tenth contributes bit 63 and no
165
+ // more: a payload above 0x01 would carry the value past 2^64-1. The
166
+ // continuation bit is not part of that judgement — a tenth byte that asks
167
+ // for an eleventh is too long, which the check at the foot of the loop
168
+ // reports instead.
169
+ if (bytesRead === MAX_VARINT64_BYTES && (byte & 0x7f) > 0x01) {
170
+ throw new Error('Varint value exceeds uint64 range');
171
+ }
172
+ value |= BigInt(byte & 0x7f) << shift;
173
+ shift += 7n;
174
+ // High bit clear means last byte
175
+ if ((byte & 0x80) === 0) {
176
+ if (bytesRead > 1 && byte === 0x00) {
177
+ throw new Error('Varint is not canonically encoded');
178
+ }
179
+ break;
180
+ }
181
+ if (bytesRead >= MAX_VARINT64_BYTES) {
182
+ throw new Error('Varint too long');
183
+ }
184
+ }
185
+ return { value, bytesRead };
186
+ }
187
+ // ============================================================================
73
188
  // Field Tag Encoding/Decoding
74
189
  // ============================================================================
75
190
  /**
@@ -133,12 +248,135 @@ export function encodeBytesField(fieldNumber, data) {
133
248
  result.set(data, tag.length + len.length);
134
249
  return result;
135
250
  }
251
+ /**
252
+ * Encode a uint64 protobuf field (tag + varint value).
253
+ *
254
+ * @param fieldNumber - Field number (1-based)
255
+ * @param value - Uint64 value
256
+ * @returns Encoded field bytes
257
+ */
258
+ export function encodeUint64Field(fieldNumber, value) {
259
+ return concatFields(encodeTag(fieldNumber, WIRE_TYPE_VARINT), encodeVarint64(value));
260
+ }
261
+ /**
262
+ * Encode a bool protobuf field (tag + varint 1 or 0).
263
+ *
264
+ * `false` is encoded, not omitted. Presence is the caller's decision — a
265
+ * schema with proto2 optional semantics distinguishes a set `false` from an
266
+ * absent field, so this helper never drops a value it was handed.
267
+ *
268
+ * @param fieldNumber - Field number (1-based)
269
+ * @param value - Bool value
270
+ * @returns Encoded field bytes
271
+ */
272
+ export function encodeBoolField(fieldNumber, value) {
273
+ return concatFields(encodeTag(fieldNumber, WIRE_TYPE_VARINT), encodeVarint(value ? 1 : 0));
274
+ }
275
+ /**
276
+ * Encode an enum protobuf field (tag + varint value).
277
+ *
278
+ * Enums are varints on the wire, so this is `encodeUint32Field` under a name
279
+ * that says what the schema means. Negative enum values are rejected: the
280
+ * wire form sign-extends them to 10 bytes, and no schema in this package
281
+ * declares one.
282
+ *
283
+ * @param fieldNumber - Field number (1-based)
284
+ * @param value - Enum value (non-negative)
285
+ * @returns Encoded field bytes
286
+ */
287
+ export function encodeEnumField(fieldNumber, value) {
288
+ if (!Number.isInteger(value) || value < 0) {
289
+ throw new Error('Enum value must be a non-negative integer');
290
+ }
291
+ return encodeUint32Field(fieldNumber, value);
292
+ }
293
+ /**
294
+ * Encode a fixed64 protobuf field (tag + 8 little-endian bytes).
295
+ *
296
+ * Unlike uint64 this is not a varint: fixed64 always occupies 8 bytes,
297
+ * least-significant byte first. The sealed sender certificate expiry uses it.
298
+ *
299
+ * @param fieldNumber - Field number (1-based)
300
+ * @param value - Uint64 value
301
+ * @returns Encoded field bytes
302
+ */
303
+ export function encodeFixed64Field(fieldNumber, value) {
304
+ if (value < 0n) {
305
+ throw new Error('Fixed64 value must be non-negative');
306
+ }
307
+ if (value > UINT64_MAX) {
308
+ throw new Error('Fixed64 value exceeds uint64 range');
309
+ }
310
+ const data = new Uint8Array(8);
311
+ let remaining = value;
312
+ for (let i = 0; i < 8; i++) {
313
+ data[i] = Number(remaining & 0xffn);
314
+ remaining >>= 8n;
315
+ }
316
+ return concatFields(encodeTag(fieldNumber, WIRE_TYPE_FIXED64), data);
317
+ }
318
+ /**
319
+ * Encode a string protobuf field (tag + length + UTF-8 bytes).
320
+ *
321
+ * @param fieldNumber - Field number (1-based)
322
+ * @param value - String value
323
+ * @returns Encoded field bytes
324
+ */
325
+ export function encodeStringField(fieldNumber, value) {
326
+ return encodeBytesField(fieldNumber, new TextEncoder().encode(value));
327
+ }
328
+ /**
329
+ * Encode an embedded-message protobuf field (tag + length + message bytes).
330
+ *
331
+ * A nested message is a length-delimited field whose payload is the encoded
332
+ * submessage, so this is `encodeBytesField` under a name that says so. Encode
333
+ * the child first, then hand its bytes here.
334
+ *
335
+ * @param fieldNumber - Field number (1-based)
336
+ * @param encodedMessage - Already-encoded submessage bytes
337
+ * @returns Encoded field bytes
338
+ */
339
+ export function encodeMessageField(fieldNumber, encodedMessage) {
340
+ return encodeBytesField(fieldNumber, encodedMessage);
341
+ }
342
+ /**
343
+ * Encode a repeated bytes field: one tag-length-value run per element.
344
+ *
345
+ * Length-delimited fields are never packed, so this is exactly what a
346
+ * protobuf encoder emits for `repeated bytes`. An empty list encodes to
347
+ * nothing, which is how an absent repeated field looks on the wire.
348
+ *
349
+ * @param fieldNumber - Field number (1-based)
350
+ * @param values - Elements in order
351
+ * @returns Encoded field bytes
352
+ */
353
+ export function encodeRepeatedBytesField(fieldNumber, values) {
354
+ // Concatenated from a list rather than by spreading it into `concatFields`:
355
+ // a repeated field's element count is bounded by the message, not by us,
356
+ // and a long list would spread into more arguments than a call accepts.
357
+ return concatAll(values.map((value) => encodeBytesField(fieldNumber, value)));
358
+ }
359
+ /**
360
+ * Encode a repeated embedded-message field: one tag-length-value run per
361
+ * element, each payload an already-encoded submessage.
362
+ *
363
+ * @param fieldNumber - Field number (1-based)
364
+ * @param encodedMessages - Already-encoded submessages in order
365
+ * @returns Encoded field bytes
366
+ */
367
+ export function encodeRepeatedMessageField(fieldNumber, encodedMessages) {
368
+ return encodeRepeatedBytesField(fieldNumber, encodedMessages);
369
+ }
136
370
  /**
137
371
  * Skip an unknown field in a protobuf message.
138
372
  *
139
373
  * Used during decoding to skip fields we don't recognize, enabling
140
374
  * forward compatibility with newer message versions.
141
375
  *
376
+ * Handles the two wire types the non-message binary formats use. The static
377
+ * message codecs skip through `ProtoReader.skipField`, which also covers the
378
+ * fixed-width wire types and bounds-checks against the buffer end.
379
+ *
142
380
  * @param wireType - Wire type of the field to skip
143
381
  * @param bytes - Buffer containing the field data
144
382
  * @param offset - Current offset (after the tag)
@@ -167,6 +405,15 @@ export function skipUnknownField(wireType, bytes, offset) {
167
405
  * @returns Single concatenated array
168
406
  */
169
407
  export function concatFields(...arrays) {
408
+ return concatAll(arrays);
409
+ }
410
+ /**
411
+ * Concatenate a list of Uint8Arrays into one.
412
+ *
413
+ * The same work as `concatFields` without spreading the list into arguments,
414
+ * for callers whose element count the message decides.
415
+ */
416
+ function concatAll(arrays) {
170
417
  const totalLength = arrays.reduce((sum, a) => sum + a.length, 0);
171
418
  const result = new Uint8Array(totalLength);
172
419
  let offset = 0;
@@ -176,4 +423,219 @@ export function concatFields(...arrays) {
176
423
  }
177
424
  return result;
178
425
  }
426
+ // ============================================================================
427
+ // Message Reader
428
+ // ============================================================================
429
+ /** `UINT32_MAX` in the width the reader decodes varints to. */
430
+ const UINT32_MAX_BIGINT = BigInt(UINT32_MAX);
431
+ /** Largest assignable protobuf field number (2^29-1). */
432
+ const MAX_FIELD_NUMBER = 536870911n;
433
+ /**
434
+ * Cursor over one encoded protobuf message.
435
+ *
436
+ * Every message decoder is the same loop — read a tag, dispatch on the field
437
+ * number, skip what it does not know — and this owns that loop's bookkeeping
438
+ * so seventeen hand-written codecs do not each repeat it:
439
+ *
440
+ * ```ts
441
+ * const reader = new ProtoReader(bytes);
442
+ * while (reader.hasMore()) {
443
+ * const { fieldNumber } = reader.readTag();
444
+ * switch (fieldNumber) {
445
+ * case 1: ratchetKey = reader.readBytes(); break;
446
+ * case 2: counter = reader.readUint32(); break;
447
+ * default: reader.skipField();
448
+ * }
449
+ * }
450
+ * ```
451
+ *
452
+ * The read methods check the tag's wire type against the type they are being
453
+ * asked to read and throw on a mismatch, so a field that arrives with the
454
+ * wrong wire type is rejected instead of misparsed. (protobufjs reads the
455
+ * declared type regardless and can silently produce nonsense.) That is why
456
+ * `readTag` must precede every read: the wire type it recorded is what the
457
+ * next read validates against.
458
+ *
459
+ * Every read is bounded by the buffer, so a length prefix that points past
460
+ * the end throws rather than allocating. Callers still apply their own
461
+ * message-size ceiling before constructing a reader.
462
+ */
463
+ export class ProtoReader {
464
+ bytes;
465
+ cursor;
466
+ wireType = null;
467
+ constructor(bytes) {
468
+ this.bytes = bytes;
469
+ this.cursor = 0;
470
+ }
471
+ /** Offset of the next unread byte. */
472
+ get offset() {
473
+ return this.cursor;
474
+ }
475
+ /** True while unread bytes remain. */
476
+ hasMore() {
477
+ return this.cursor < this.bytes.length;
478
+ }
479
+ /**
480
+ * Read the next field tag and remember its wire type for the read that
481
+ * follows.
482
+ *
483
+ * @returns Field number and wire type
484
+ */
485
+ readTag() {
486
+ const { value: tag, bytesRead } = decodeVarint64(this.bytes, this.cursor);
487
+ this.cursor += bytesRead;
488
+ const number = tag >> 3n;
489
+ const wireType = Number(tag & 0x07n);
490
+ // Neither 0 nor anything above 2^29-1 is an assignable field number, so a
491
+ // tag carrying one is a corrupt stream rather than an unknown field to be
492
+ // skipped. Checking the bound also keeps the conversion below exact.
493
+ if (number === 0n || number > MAX_FIELD_NUMBER) {
494
+ throw new Error(`Invalid protobuf field number: ${number}`);
495
+ }
496
+ const fieldNumber = Number(number);
497
+ this.wireType = wireType;
498
+ return { fieldNumber, wireType };
499
+ }
500
+ /** Read a uint32 field value. */
501
+ readUint32() {
502
+ const value = this.readVarintValue();
503
+ if (value > UINT32_MAX_BIGINT) {
504
+ throw new Error('Varint value exceeds uint32 range');
505
+ }
506
+ return Number(value);
507
+ }
508
+ /** Read a uint64 field value. */
509
+ readUint64() {
510
+ return this.readVarintValue();
511
+ }
512
+ /** Read a bool field value. Any non-zero varint is `true`, per the spec. */
513
+ readBool() {
514
+ return this.readVarintValue() !== 0n;
515
+ }
516
+ /**
517
+ * Read an enum field value.
518
+ *
519
+ * Enums are varints. Values outside the uint32 range are rejected — they can
520
+ * only be the sign-extended negatives this package's schemas never declare.
521
+ */
522
+ readEnum() {
523
+ return this.readUint32();
524
+ }
525
+ /** Read a fixed64 field value (8 little-endian bytes). */
526
+ readFixed64() {
527
+ this.expectWireType(WIRE_TYPE_FIXED64);
528
+ const end = this.cursor + 8;
529
+ if (end > this.bytes.length) {
530
+ throw new Error('Fixed64 field truncated');
531
+ }
532
+ let value = 0n;
533
+ for (let i = 7; i >= 0; i--) {
534
+ value = (value << 8n) | BigInt(this.bytes[this.cursor + i]);
535
+ }
536
+ this.cursor = end;
537
+ return value;
538
+ }
539
+ /**
540
+ * Read a bytes field value.
541
+ *
542
+ * The result is a copy, so the decoded message does not alias — and cannot
543
+ * be mutated through — the input buffer.
544
+ */
545
+ readBytes() {
546
+ this.expectWireType(WIRE_TYPE_LENGTH_DELIMITED);
547
+ const end = this.readLengthPrefix();
548
+ const data = this.bytes.slice(this.cursor, end);
549
+ this.cursor = end;
550
+ return data;
551
+ }
552
+ /** Read a string field value, decoded from UTF-8. */
553
+ readString() {
554
+ return new TextDecoder().decode(this.readBytes());
555
+ }
556
+ /**
557
+ * Read an embedded-message field value as its encoded bytes.
558
+ *
559
+ * Hand the result to the child message's decoder. Identical on the wire to
560
+ * `readBytes`; the name says which the schema meant.
561
+ */
562
+ readMessage() {
563
+ return this.readBytes();
564
+ }
565
+ /**
566
+ * Skip the field whose tag was just read.
567
+ *
568
+ * Groups (wire types 3 and 4) are rejected rather than skipped: they are
569
+ * deprecated, no schema here uses them, and skipping them correctly means
570
+ * matching nested end-group tags, which is machinery with no caller.
571
+ */
572
+ skipField() {
573
+ const wireType = this.takeWireType();
574
+ switch (wireType) {
575
+ case WIRE_TYPE_VARINT: {
576
+ const { bytesRead } = decodeVarint64(this.bytes, this.cursor);
577
+ this.cursor += bytesRead;
578
+ return;
579
+ }
580
+ case WIRE_TYPE_FIXED64:
581
+ this.advance(8, 'Fixed64 field truncated');
582
+ return;
583
+ case WIRE_TYPE_LENGTH_DELIMITED:
584
+ this.cursor = this.readLengthPrefix();
585
+ return;
586
+ case WIRE_TYPE_FIXED32:
587
+ this.advance(4, 'Fixed32 field truncated');
588
+ return;
589
+ default:
590
+ throw new Error(`Unsupported wire type: ${wireType}`);
591
+ }
592
+ }
593
+ /** Read a varint value after checking the tag said wire type 0. */
594
+ readVarintValue() {
595
+ this.expectWireType(WIRE_TYPE_VARINT);
596
+ const { value, bytesRead } = decodeVarint64(this.bytes, this.cursor);
597
+ this.cursor += bytesRead;
598
+ return value;
599
+ }
600
+ /**
601
+ * Consume the length prefix of a length-delimited field.
602
+ *
603
+ * @returns Offset one past the field's payload
604
+ */
605
+ readLengthPrefix() {
606
+ const { value: length, bytesRead } = decodeVarint64(this.bytes, this.cursor);
607
+ this.cursor += bytesRead;
608
+ // Compare in bigint: a length near 2^64 would lose precision as a Number
609
+ // and could compare as in-bounds.
610
+ const end = BigInt(this.cursor) + length;
611
+ if (end > BigInt(this.bytes.length)) {
612
+ throw new Error('Length-delimited field extends past the end of the message');
613
+ }
614
+ return Number(end);
615
+ }
616
+ advance(count, message) {
617
+ if (this.cursor + count > this.bytes.length) {
618
+ throw new Error(message);
619
+ }
620
+ this.cursor += count;
621
+ }
622
+ expectWireType(expected) {
623
+ const wireType = this.takeWireType();
624
+ if (wireType !== expected) {
625
+ throw new Error(`Expected wire type ${expected}, got ${wireType}`);
626
+ }
627
+ }
628
+ /**
629
+ * Take the wire type recorded by `readTag`, clearing it so a second read
630
+ * without an intervening tag fails loudly instead of reusing it.
631
+ */
632
+ takeWireType() {
633
+ if (this.wireType === null) {
634
+ throw new Error('No field tag has been read');
635
+ }
636
+ const wireType = this.wireType;
637
+ this.wireType = null;
638
+ return wireType;
639
+ }
640
+ }
179
641
  //# sourceMappingURL=primitives.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"primitives.js","sourceRoot":"","s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@
1
1
  /**
2
2
  * SenderKeyMessage Protobuf Encoding/Decoding
3
3
  *
4
- * Encodes and decodes SenderKeyMessage and SenderKeyDistributionMessage with
5
- * protobufjs.
4
+ * Hand-written static codecs for SenderKeyMessage and
5
+ * SenderKeyDistributionMessage, built on the shared wire primitives.
6
6
  *
7
7
  * This is the canonical signing format: Ed25519 signatures cover
8
8
  * `version_byte + protobuf_encode(SenderKeyMessage)`.
@@ -66,7 +66,8 @@ export interface SenderKeyMessageFields {
66
66
  * [field1: distribution_uuid] [field3: iteration] [field4: ciphertext]
67
67
  *
68
68
  * Fields are encoded in field-number order per protobuf convention.
69
- * Optional fields (distributionUuid) are omitted when undefined.
69
+ * Optional fields (distributionUuid) are omitted when undefined; presence, not
70
+ * value, decides, so a field the caller set is written even when it is zero.
70
71
  *
71
72
  * @param msg - Message fields to encode
72
73
  * @returns Protobuf-encoded bytes
@@ -1 +1 @@
1
- {"version":3,"file":"sender-key-message.d.ts","sourceRoot":"","sources":["../../../../internal/encoding/proto/sender-key-message.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAOH,OAAO,EAAE,CAAC;AA2EV;;;;;;;;GAQG;AACH,MAAM,WAAW,sBAAsB;IACrC,4DAA4D;IAC5D,gBAAgB,CAAC,EAAE,UAAU,CAAC;IAC9B,sEAAsE;IACtE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,UAAU,EAAE,UAAU,CAAC;CACxB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,sBAAsB,GAAG,UAAU,CAgB9E;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,UAAU,GAAG,sBAAsB,CAUhF;AAMD;;;;;;;;;GASG;AACH,MAAM,WAAW,kCAAkC;IACjD,4DAA4D;IAC5D,gBAAgB,CAAC,EAAE,UAAU,CAAC;IAC9B,sEAAsE;IACtE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sDAAsD;IACtD,SAAS,EAAE,MAAM,CAAC;IAClB,+BAA+B;IAC/B,QAAQ,EAAE,UAAU,CAAC;IACrB,2CAA2C;IAC3C,UAAU,EAAE,UAAU,CAAC;CACxB;AAED;;;;;GAKG;AACH,wBAAgB,kCAAkC,CAChD,GAAG,EAAE,kCAAkC,GACtC,UAAU,CAiBZ;AAED;;;;;GAKG;AACH,wBAAgB,kCAAkC,CAChD,KAAK,EAAE,UAAU,GAChB,kCAAkC,CAepC;AAMD;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,IAAI,CAAC;AAKnD;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,UAAU,EACzB,SAAS,EAAE,UAAU,GACpB,UAAU,CAUZ;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,UAAU,GAAG;IACxD,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,UAAU,CAAC;IAC1B,SAAS,EAAE,UAAU,CAAC;CACvB,CAYA"}
1
+ {"version":3,"file":"sender-key-message.d.ts","sourceRoot":"","sources":["../../../../internal/encoding/proto/sender-key-message.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAOH,OAAO,EAAE,CAAC;AA+BV;;;;;;;;GAQG;AACH,MAAM,WAAW,sBAAsB;IACrC,4DAA4D;IAC5D,gBAAgB,CAAC,EAAE,UAAU,CAAC;IAC9B,sEAAsE;IACtE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,UAAU,EAAE,UAAU,CAAC;CACxB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,sBAAsB,GAAG,U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