@open-e2ee/signal-protocol-sdk 0.4.0 → 1.0.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 (220) hide show
  1. package/CHANGELOG.md +63 -5
  2. package/README.md +10 -7
  3. package/SECURITY.md +2 -2
  4. package/THIRD_PARTY_NOTICES.md +1 -1
  5. package/device/README.md +7 -5
  6. package/dist/client/client.d.ts +3 -2
  7. package/dist/client/client.d.ts.map +1 -1
  8. package/dist/client/client.js +58 -25
  9. package/dist/client/client.js.map +1 -1
  10. package/dist/client/config.d.ts +46 -7
  11. package/dist/client/config.d.ts.map +1 -1
  12. package/dist/client/config.js +2 -2
  13. package/dist/client/config.js.map +1 -1
  14. package/dist/client/group-outbox.d.ts +38 -0
  15. package/dist/client/group-outbox.d.ts.map +1 -0
  16. package/dist/client/group-outbox.js +221 -0
  17. package/dist/client/group-outbox.js.map +1 -0
  18. package/dist/client/group-sealed-sender.d.ts +28 -0
  19. package/dist/client/group-sealed-sender.d.ts.map +1 -0
  20. package/dist/client/group-sealed-sender.js +74 -0
  21. package/dist/client/group-sealed-sender.js.map +1 -0
  22. package/dist/client/hosted-push.d.ts +77 -0
  23. package/dist/client/hosted-push.d.ts.map +1 -0
  24. package/dist/client/hosted-push.js +90 -0
  25. package/dist/client/hosted-push.js.map +1 -0
  26. package/dist/client/hosted.d.ts +207 -0
  27. package/dist/client/hosted.d.ts.map +1 -0
  28. package/dist/client/hosted.js +505 -0
  29. package/dist/client/hosted.js.map +1 -0
  30. package/dist/client/index.d.ts +4 -2
  31. package/dist/client/index.d.ts.map +1 -1
  32. package/dist/client/index.js +2 -0
  33. package/dist/client/index.js.map +1 -1
  34. package/dist/client/relay-subscription.d.ts.map +1 -1
  35. package/dist/client/relay-subscription.js +34 -7
  36. package/dist/client/relay-subscription.js.map +1 -1
  37. package/dist/client/{sealed-sender-ops.d.ts → sealed-sender.d.ts} +39 -22
  38. package/dist/client/sealed-sender.d.ts.map +1 -0
  39. package/dist/client/sealed-sender.js +296 -0
  40. package/dist/client/sealed-sender.js.map +1 -0
  41. package/dist/client/signal-service-cipher.d.ts +23 -26
  42. package/dist/client/signal-service-cipher.d.ts.map +1 -1
  43. package/dist/client/signal-service-cipher.js +465 -706
  44. package/dist/client/signal-service-cipher.js.map +1 -1
  45. package/dist/client/types.d.ts +18 -3
  46. package/dist/client/types.d.ts.map +1 -1
  47. package/dist/client/types.js +6 -0
  48. package/dist/client/types.js.map +1 -1
  49. package/dist/device/index.d.ts +2 -2
  50. package/dist/device/index.d.ts.map +1 -1
  51. package/dist/device/index.js +1 -1
  52. package/dist/device/index.js.map +1 -1
  53. package/dist/device/transfer.d.ts +7 -43
  54. package/dist/device/transfer.d.ts.map +1 -1
  55. package/dist/device/transfer.js +31 -150
  56. package/dist/device/transfer.js.map +1 -1
  57. package/dist/device/types.d.ts +6 -47
  58. package/dist/device/types.d.ts.map +1 -1
  59. package/dist/device/types.js +1 -1
  60. package/dist/device/types.js.map +1 -1
  61. package/dist/index.d.ts +5 -4
  62. package/dist/index.d.ts.map +1 -1
  63. package/dist/index.js +2 -1
  64. package/dist/index.js.map +1 -1
  65. package/dist/internal/encoding/proto/pq-ratchet-serialize.js +1 -1
  66. package/dist/internal/encoding/proto/pq-ratchet-serialize.js.map +1 -1
  67. package/dist/internal/encoding/proto/primitives.js +1 -1
  68. package/dist/internal/encoding/proto/primitives.js.map +1 -1
  69. package/dist/internal/groups/manager.d.ts +3 -3
  70. package/dist/internal/groups/manager.d.ts.map +1 -1
  71. package/dist/internal/groups/manager.js +5 -4
  72. package/dist/internal/groups/manager.js.map +1 -1
  73. package/dist/internal/protocol/sealed-sender/certificate.d.ts +10 -4
  74. package/dist/internal/protocol/sealed-sender/certificate.d.ts.map +1 -1
  75. package/dist/internal/protocol/sealed-sender/certificate.js +64 -7
  76. package/dist/internal/protocol/sealed-sender/certificate.js.map +1 -1
  77. package/dist/internal/protocol/sealed-sender/decryption.d.ts +34 -47
  78. package/dist/internal/protocol/sealed-sender/decryption.d.ts.map +1 -1
  79. package/dist/internal/protocol/sealed-sender/decryption.js +95 -182
  80. package/dist/internal/protocol/sealed-sender/decryption.js.map +1 -1
  81. package/dist/internal/protocol/sealed-sender/encryption.d.ts +49 -64
  82. package/dist/internal/protocol/sealed-sender/encryption.d.ts.map +1 -1
  83. package/dist/internal/protocol/sealed-sender/encryption.js +120 -123
  84. package/dist/internal/protocol/sealed-sender/encryption.js.map +1 -1
  85. package/dist/internal/protocol/sealed-sender/index.d.ts +5 -7
  86. package/dist/internal/protocol/sealed-sender/index.d.ts.map +1 -1
  87. package/dist/internal/protocol/sealed-sender/index.js +4 -12
  88. package/dist/internal/protocol/sealed-sender/index.js.map +1 -1
  89. package/dist/internal/protocol/sealed-sender/{v2-helpers.d.ts → multi-recipient-crypto.d.ts} +1 -1
  90. package/dist/internal/protocol/sealed-sender/multi-recipient-crypto.d.ts.map +1 -0
  91. package/dist/internal/protocol/sealed-sender/{v2-helpers.js → multi-recipient-crypto.js} +1 -1
  92. package/dist/internal/protocol/sealed-sender/multi-recipient-crypto.js.map +1 -0
  93. package/dist/internal/protocol/sealed-sender/{v2-binary.d.ts → multi-recipient-message.d.ts} +3 -2
  94. package/dist/internal/protocol/sealed-sender/multi-recipient-message.d.ts.map +1 -0
  95. package/dist/internal/protocol/sealed-sender/{v2-binary.js → multi-recipient-message.js} +16 -8
  96. package/dist/internal/protocol/sealed-sender/multi-recipient-message.js.map +1 -0
  97. package/dist/internal/protocol/sealed-sender/proto/index.d.ts +3 -0
  98. package/dist/internal/protocol/sealed-sender/proto/index.d.ts.map +1 -1
  99. package/dist/internal/protocol/sealed-sender/proto/index.js +25 -2
  100. package/dist/internal/protocol/sealed-sender/proto/index.js.map +1 -1
  101. package/dist/internal/protocol/sealed-sender/trust-root.d.ts +11 -1
  102. package/dist/internal/protocol/sealed-sender/trust-root.d.ts.map +1 -1
  103. package/dist/internal/protocol/sealed-sender/trust-root.js +13 -1
  104. package/dist/internal/protocol/sealed-sender/trust-root.js.map +1 -1
  105. package/dist/internal/protocol/sealed-sender/types.d.ts +20 -135
  106. package/dist/internal/protocol/sealed-sender/types.d.ts.map +1 -1
  107. package/dist/internal/protocol/sealed-sender/types.js +15 -6
  108. package/dist/internal/protocol/sealed-sender/types.js.map +1 -1
  109. package/dist/internal/protocol/sender-keys/manager.d.ts +22 -1
  110. package/dist/internal/protocol/sender-keys/manager.d.ts.map +1 -1
  111. package/dist/internal/protocol/sender-keys/manager.js +39 -4
  112. package/dist/internal/protocol/sender-keys/manager.js.map +1 -1
  113. package/dist/internal/protocol/spqr/braid-serialize.js +1 -1
  114. package/dist/internal/protocol/spqr/braid-serialize.js.map +1 -1
  115. package/dist/internal/protocol/spqr/ml-kem-braid/state-machine.js +4 -4
  116. package/dist/internal/protocol/spqr/ml-kem-braid/state-machine.js.map +1 -1
  117. package/dist/internal/protocol/zk/groups/index.d.ts +1 -1
  118. package/dist/internal/protocol/zk/groups/index.d.ts.map +1 -1
  119. package/dist/internal/protocol/zk/groups/index.js +1 -1
  120. package/dist/internal/protocol/zk/groups/index.js.map +1 -1
  121. package/dist/internal/protocol/zk/groups/profile-key-credential.d.ts +37 -12
  122. package/dist/internal/protocol/zk/groups/profile-key-credential.d.ts.map +1 -1
  123. package/dist/internal/protocol/zk/groups/profile-key-credential.js +104 -31
  124. package/dist/internal/protocol/zk/groups/profile-key-credential.js.map +1 -1
  125. package/dist/local/store/expo/adapter.d.ts +1 -0
  126. package/dist/local/store/expo/adapter.d.ts.map +1 -1
  127. package/dist/local/store/expo/adapter.js +3 -0
  128. package/dist/local/store/expo/adapter.js.map +1 -1
  129. package/dist/local/store/expo/key-storage.d.ts +1 -0
  130. package/dist/local/store/expo/key-storage.d.ts.map +1 -1
  131. package/dist/local/store/expo/key-storage.js +4 -0
  132. package/dist/local/store/expo/key-storage.js.map +1 -1
  133. package/dist/local/store/memory/adapter.d.ts +1 -0
  134. package/dist/local/store/memory/adapter.d.ts.map +1 -1
  135. package/dist/local/store/memory/adapter.js +4 -0
  136. package/dist/local/store/memory/adapter.js.map +1 -1
  137. package/dist/local/store/node/adapter.d.ts +1 -0
  138. package/dist/local/store/node/adapter.d.ts.map +1 -1
  139. package/dist/local/store/node/adapter.js +3 -0
  140. package/dist/local/store/node/adapter.js.map +1 -1
  141. package/dist/local/store/node/database.d.ts +1 -0
  142. package/dist/local/store/node/database.d.ts.map +1 -1
  143. package/dist/local/store/node/database.js +5 -0
  144. package/dist/local/store/node/database.js.map +1 -1
  145. package/dist/local/store/react-native/adapter.d.ts +1 -0
  146. package/dist/local/store/react-native/adapter.d.ts.map +1 -1
  147. package/dist/local/store/react-native/adapter.js +4 -0
  148. package/dist/local/store/react-native/adapter.js.map +1 -1
  149. package/dist/local/store/react-native/reference-backend.js +1 -1
  150. package/dist/local/store/react-native/reference-backend.js.map +1 -1
  151. package/dist/local/store/reliability.d.ts +63 -0
  152. package/dist/local/store/reliability.d.ts.map +1 -0
  153. package/dist/local/store/reliability.js +219 -0
  154. package/dist/local/store/reliability.js.map +1 -0
  155. package/dist/local/store/web/adapter.d.ts +1 -0
  156. package/dist/local/store/web/adapter.d.ts.map +1 -1
  157. package/dist/local/store/web/adapter.js +5 -0
  158. package/dist/local/store/web/adapter.js.map +1 -1
  159. package/dist/remote/relay/convex/backend.d.ts +4 -14
  160. package/dist/remote/relay/convex/backend.d.ts.map +1 -1
  161. package/dist/remote/relay/convex/backend.js +11 -20
  162. package/dist/remote/relay/convex/backend.js.map +1 -1
  163. package/dist/remote/relay/convex/component/_generated/component.d.ts +7 -14
  164. package/dist/remote/relay/convex/component/_generated/component.d.ts.map +1 -1
  165. package/dist/remote/relay/convex/component/certificates.d.ts.map +1 -1
  166. package/dist/remote/relay/convex/component/certificates.js +14 -5
  167. package/dist/remote/relay/convex/component/certificates.js.map +1 -1
  168. package/dist/remote/relay/convex/component/messages.d.ts +0 -13
  169. package/dist/remote/relay/convex/component/messages.d.ts.map +1 -1
  170. package/dist/remote/relay/convex/component/messages.js +13 -47
  171. package/dist/remote/relay/convex/component/messages.js.map +1 -1
  172. package/dist/remote/relay/convex/component/schema.d.ts +3 -1
  173. package/dist/remote/relay/convex/component/schema.js +1 -0
  174. package/dist/remote/relay/convex/component/schema.js.map +1 -1
  175. package/dist/remote/relay/convex/component/zkAuth.d.ts +7 -1
  176. package/dist/remote/relay/convex/component/zkAuth.d.ts.map +1 -1
  177. package/dist/remote/relay/convex/component/zkAuth.js +29 -14
  178. package/dist/remote/relay/convex/component/zkAuth.js.map +1 -1
  179. package/dist/remote/relay/convex/relay.d.ts +2 -5
  180. package/dist/remote/relay/convex/relay.d.ts.map +1 -1
  181. package/dist/remote/relay/convex/relay.js +17 -47
  182. package/dist/remote/relay/convex/relay.js.map +1 -1
  183. package/dist/remote/relay/memory/adapter.d.ts +4 -10
  184. package/dist/remote/relay/memory/adapter.d.ts.map +1 -1
  185. package/dist/remote/relay/memory/adapter.js +31 -34
  186. package/dist/remote/relay/memory/adapter.js.map +1 -1
  187. package/dist/remote/relay/types.d.ts +6 -19
  188. package/dist/remote/relay/types.d.ts.map +1 -1
  189. package/dist/types/api.d.ts +2 -0
  190. package/dist/types/api.d.ts.map +1 -1
  191. package/dist/types/errors.d.ts +3 -1
  192. package/dist/types/errors.d.ts.map +1 -1
  193. package/dist/types/errors.js +4 -2
  194. package/dist/types/errors.js.map +1 -1
  195. package/dist/types/protocol-config.d.ts +1 -1
  196. package/dist/username/link.d.ts.map +1 -1
  197. package/dist/username/link.js +1 -1
  198. package/dist/username/link.js.map +1 -1
  199. package/docs/ASSURANCE.md +5 -5
  200. package/docs/DEVIATIONS.md +32 -61
  201. package/docs/GETTING_STARTED.md +7 -0
  202. package/docs/SECURITY.md +6 -0
  203. package/package.json +1 -1
  204. package/remote/relay/convex/component/README.md +20 -14
  205. package/scripts/oe-groups.mjs +5 -1
  206. package/dist/client/sealed-sender-ops.d.ts.map +0 -1
  207. package/dist/client/sealed-sender-ops.js +0 -203
  208. package/dist/client/sealed-sender-ops.js.map +0 -1
  209. package/dist/internal/protocol/sealed-sender/decryption-v2.d.ts +0 -46
  210. package/dist/internal/protocol/sealed-sender/decryption-v2.d.ts.map +0 -1
  211. package/dist/internal/protocol/sealed-sender/decryption-v2.js +0 -198
  212. package/dist/internal/protocol/sealed-sender/decryption-v2.js.map +0 -1
  213. package/dist/internal/protocol/sealed-sender/encryption-v2.d.ts +0 -56
  214. package/dist/internal/protocol/sealed-sender/encryption-v2.d.ts.map +0 -1
  215. package/dist/internal/protocol/sealed-sender/encryption-v2.js +0 -163
  216. package/dist/internal/protocol/sealed-sender/encryption-v2.js.map +0 -1
  217. package/dist/internal/protocol/sealed-sender/v2-binary.d.ts.map +0 -1
  218. package/dist/internal/protocol/sealed-sender/v2-binary.js.map +0 -1
  219. package/dist/internal/protocol/sealed-sender/v2-helpers.d.ts.map +0 -1
  220. package/dist/internal/protocol/sealed-sender/v2-helpers.js.map +0 -1
@@ -9,6 +9,7 @@ import { determineRetryReason, isRetryableDecryptionError } from './retry-utils.
9
9
  import { checkRetryRateLimit, RETRY_REQUEST_WINDOW_MS } from './retry.js';
10
10
  import { callHook } from './event-hooks.js';
11
11
  import { base64ToBytes } from '../internal/crypto/index.js';
12
+ import { hasProcessedEnvelope, storeProcessedEnvelope, withProcessedEnvelopeLock, } from '../local/store/reliability.js';
12
13
  import { isImplicitContentType } from './constants.js';
13
14
  export const RECEIPT_BATCH_DELAY_MS = 3_000;
14
15
  export const RECEIPT_BATCH_MAX = 100;
@@ -61,6 +62,23 @@ async function markDeliveredSilently(relay, envelopeId, logger) {
61
62
  * - No schema validation or domain routing needed for these
62
63
  */
63
64
  export async function handleRelayMessage(ctx, envelope, state, callbacks, config) {
65
+ if (!envelope.id) {
66
+ return handleRelayMessageLocked(ctx, envelope, state, callbacks, config);
67
+ }
68
+ return withProcessedEnvelopeLock(ctx.storage, envelope.id, () => handleRelayMessageLocked(ctx, envelope, state, callbacks, config));
69
+ }
70
+ async function handleRelayMessageLocked(ctx, envelope, state, callbacks, config) {
71
+ if (envelope.id && (await hasProcessedEnvelope(ctx.storage, envelope.id))) {
72
+ ctx.logger.debug('Acknowledging previously processed relay envelope', {
73
+ category: 'E2EE',
74
+ data: {
75
+ envelopeId: envelope.id,
76
+ behavior: 'PERSISTENT_DUPLICATE_DISCARD',
77
+ },
78
+ });
79
+ await markDeliveredSilently(ctx.relay, envelope.id, ctx.logger);
80
+ return;
81
+ }
64
82
  try {
65
83
  // Delegate decryption to SignalProtocolServiceCipher
66
84
  // Pass sealed sender config for unidentified_sender envelope handling
@@ -71,7 +89,11 @@ export async function handleRelayMessage(ctx, envelope, state, callbacks, config
71
89
  catch (error) {
72
90
  // ERROR: Handle decryption failure
73
91
  await handleDecryptionError(ctx, envelope, error, state, callbacks, config);
92
+ return;
74
93
  }
94
+ if (envelope.id)
95
+ await storeProcessedEnvelope(ctx.storage, envelope.id);
96
+ await markDeliveredSilently(ctx.relay, envelope.id, ctx.logger);
75
97
  }
76
98
  /**
77
99
  * Handle successful message decryption
@@ -99,8 +121,6 @@ async function handleDecryptionSuccess(ctx, envelope, decryptedEnvelope, state,
99
121
  }
100
122
  }
101
123
  }
102
- // Mark as delivered on relay
103
- await markDeliveredSilently(ctx.relay, envelope.id, ctx.logger);
104
124
  }
105
125
  // ════════════════════════════════════════════════════════════════════════════
106
126
  // DELIVERY RECEIPT BATCHING
@@ -157,8 +177,7 @@ async function handleDecryptionError(ctx, envelope, error, state, callbacks, con
157
177
  // An at-least-once relay may redeliver the same envelope. The session layer
158
178
  // has already rejected the replay, so acknowledge it without asking the
159
179
  // sender to create a fresh ciphertext for plaintext already delivered.
160
- if (error instanceof EncryptionError &&
161
- error.code === EncryptionErrorCode.MESSAGE_DUPLICATE) {
180
+ if (error instanceof EncryptionError && error.code === EncryptionErrorCode.MESSAGE_DUPLICATE) {
162
181
  ctx.logger.debug('Discarding duplicate relay envelope without retry', {
163
182
  category: 'E2EE',
164
183
  data: {
@@ -259,7 +278,10 @@ async function sendRetryRequest(ctx, envelope, error, state, callbacks, config)
259
278
  if (!checkRetryRateLimit(state, envelope.senderUserId)) {
260
279
  ctx.logger.warn('Retry rate limit exceeded for sender', {
261
280
  category: 'E2EE',
262
- data: { senderId: envelope.senderUserId, windowMs: RETRY_REQUEST_WINDOW_MS },
281
+ data: {
282
+ senderId: envelope.senderUserId,
283
+ windowMs: RETRY_REQUEST_WINDOW_MS,
284
+ },
263
285
  });
264
286
  await markDeliveredSilently(ctx.relay, envelope.id, ctx.logger);
265
287
  return;
@@ -301,13 +323,18 @@ async function sendRetryRequest(ctx, envelope, error, state, callbacks, config)
301
323
  catch (markError) {
302
324
  ctx.logger.warn('Failed to mark message as delivered after retry', {
303
325
  category: 'E2EE',
304
- data: { envelopeId: envelope.id, error: markError.message },
326
+ data: {
327
+ envelopeId: envelope.id,
328
+ error: markError.message,
329
+ },
305
330
  });
306
331
  }
307
332
  }
308
333
  }
309
334
  else {
310
- ctx.logger.debug('Relay does not support retry requests', { category: 'E2EE' });
335
+ ctx.logger.debug('Relay does not support retry requests', {
336
+ category: 'E2EE',
337
+ });
311
338
  }
312
339
  }
313
340
  catch (retryError) {
@@ -1 +1 @@
1
- {"version":3,"file":"relay-subscription.js","sourceRoot":"","sources":["../../client/relay-subscription.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAe,MAAM,UAAU,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AACvE,OAAO,EAAE,QAAQ,EAA0B,MAAM,eAAe,CAAC;AAIjE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAqBpD,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,CAAC;AAC5C,MAAM,CAAC,MAAM,iB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C;YAEH,MAAM,SAAS,CAAC,mBAAmB,EAAE,CAAC;YACtC,KAAK,CAAC,sBAAsB,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC5C,CAAC;QAAC,OAAO,aAAa,EAAE,CAAC;YACvB,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,iCAAiC,EAAE;gBACjD,QAAQ,EAAE,MAAM;gBAChB,IAAI,EAAE,EAAE,KAAK,EAAG,aAAuB,CAAC,OAAO,EAAE;aAClD,CAAC,CAAC;QACL,CAAC;IACH,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,sDAAsD,EAAE;YACvE,QAAQ,EAAE,MAAM;YAChB,IAAI,EAAE,EAAE,uBAAuB,EAAE,qBAAqB,EAAE;SACzD,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
@@ -1,33 +1,49 @@
1
1
  /**
2
- * Sealed Sender Operations
2
+ * Sealed Sender Client Boundary
3
3
  *
4
4
  * Provides seal/unseal wrapping for the message send/receive pipeline.
5
5
  * Called by SignalProtocolServiceCipher when sealed sender is enabled.
6
6
  *
7
7
  * @see https://signal.org/blog/sealed-sender/
8
8
  */
9
- import type { SealedSenderConfig } from './config.js';
10
- import type { Envelope } from '../remote/relay/types.js';
9
+ import type { SealedSenderConfig, SealedSenderDeliveryMode } from './config.js';
10
+ import type { Envelope, SealedSenderAuth } from '../remote/relay/types.js';
11
11
  import { type ILogger } from '../logger.js';
12
+ import type { ISignalProtocolLocalStore } from '../types/index.js';
13
+ import type { EndorsementManager } from './endorsement-manager.js';
14
+ import { type ContactProfileStateStore } from '../profile/contact-state.js';
12
15
  import { SealedSenderContentType } from '../internal/protocol/sealed-sender/types.js';
13
- /**
14
- * Wrap an encrypted ciphertext with sealed sender encryption.
15
- *
16
- * Takes the already-encrypted Signal Protocol message and wraps it with
17
- * an additional layer that hides the sender's identity from the server.
18
- *
19
- * @param ciphertextBase64 - Base64-encoded Signal Protocol ciphertext
20
- * @param senderCertificateBase64 - Base64-encoded serialized SenderCertificate
21
- * @param senderIdentityPrivate - Sender's X25519 identity private key
22
- * @param recipientIdentityPublic - Recipient's X25519 identity public key
23
- * @param config - Sealed sender config with trust roots
24
- * @param contentType - How the recipient should decrypt the inner ciphertext.
25
- * The outer envelope is `unidentified_sender` for every sealed message, so
26
- * this is the only signal that a payload is a framed SenderKeyMessage.
27
- * @returns Base64-encoded sealed sender message
28
- */
29
16
  export {};
30
- export declare function sealMessage(ciphertextBase64: string, senderCertificateBase64: string, senderIdentityPrivate: Uint8Array, recipientIdentityPublic: Uint8Array, _config: SealedSenderConfig, _providedLogger?: ILogger, contentType?: SealedSenderContentType): Promise<string>;
17
+ export type SealedSenderProvider = () => Promise<{
18
+ senderCertificateBase64: string;
19
+ senderIdentityPrivate: Uint8Array;
20
+ senderIdentityPublic: Uint8Array;
21
+ config: SealedSenderConfig;
22
+ }>;
23
+ export interface ResolvedSealedSenderContext {
24
+ senderCertificateBase64: string;
25
+ senderIdentityPrivate: Uint8Array;
26
+ senderIdentityPublic: Uint8Array;
27
+ recipientIdentityPublic: Uint8Array;
28
+ config: SealedSenderConfig;
29
+ auth: SealedSenderAuth;
30
+ }
31
+ export interface SealedSenderResolutionContext {
32
+ storage: ISignalProtocolLocalStore;
33
+ deliveryMode: SealedSenderDeliveryMode;
34
+ relaySupportsUnidentified: boolean;
35
+ provider?: SealedSenderProvider;
36
+ contactProfileStateStore?: ContactProfileStateStore;
37
+ endorsementManager?: EndorsementManager;
38
+ groupSecretParamsProvider?: (groupId: string) => Promise<import('../internal/protocol/zk/groups/group-params.js').GroupSecretParams | null>;
39
+ logger: Required<ILogger>;
40
+ useIdentifiedDeliveryOrThrow(recipientUserId: string, reason: string): null;
41
+ }
42
+ export declare function serializeDirectSealedSenderMessage(msg: {
43
+ recipientUserId: string;
44
+ recipientDeviceId: number;
45
+ }, ciphertextBase64: string, messageType: 'prekey_bundle' | 'ciphertext' | 'sender_key', recipientRegistrationId: number | undefined, sealedSender: ResolvedSealedSenderContext): Promise<string>;
46
+ export declare function resolveSealedSenderContext(context: SealedSenderResolutionContext, recipientUserId: string, groupId?: string): Promise<ResolvedSealedSenderContext | null>;
31
47
  /**
32
48
  * Unseal a sealed sender message to reveal the sender and inner ciphertext.
33
49
  *
@@ -40,9 +56,10 @@ export declare function sealMessage(ciphertextBase64: string, senderCertificateB
40
56
  * @param recipientUuid - Recipient's user ID (for self-send detection)
41
57
  * @param recipientDeviceId - Recipient's device ID
42
58
  * @param config - Sealed sender config with trust roots
59
+ * @param relayEnqueueTime - Immutable time when Relay accepted the message
43
60
  * @returns Unsealed envelope info with sender identity and inner ciphertext
44
61
  */
45
- export declare function unsealMessage(sealedCiphertextBase64: string, recipientIdentityPrivate: Uint8Array, recipientUuid: string, recipientDeviceId: number, config: SealedSenderConfig, providedLogger?: ILogger): Promise<{
62
+ export declare function unsealMessage(sealedCiphertextBase64: string, recipientIdentityPrivate: Uint8Array, recipientUuid: string, recipientDeviceId: number, config: SealedSenderConfig, relayEnqueueTime: number | undefined, providedLogger?: ILogger): Promise<{
46
63
  senderUserId: string;
47
64
  senderDeviceId: number;
48
65
  innerCiphertextBase64: string;
@@ -84,4 +101,4 @@ export declare function reconstructEnvelope(originalEnvelope: Envelope, unsealed
84
101
  * than silently decrypting as something it is not.
85
102
  */
86
103
  export declare function envelopeTypeForContent(contentType: SealedSenderContentType): Envelope['messageType'];
87
- //# sourceMappingURL=sealed-sender-ops.d.ts.map
104
+ //# sourceMappingURL=sealed-sender.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sealed-sender.d.ts","sourceRoot":"","sources":["../../client/sealed-sender.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAC7E,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACxE,OAAO,EAA+B,KAAK,OAAO,EAA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sealed Sender Client Boundary
3
+ *
4
+ * Provides seal/unseal wrapping for the message send/receive pipeline.
5
+ * Called by SignalProtocolServiceCipher when sealed sender is enabled.
6
+ *
7
+ * @see https://signal.org/blog/sealed-sender/
8
+ */
9
+ import { resolveSignalProtocolLogger } from '../logger.js';
10
+ import { ProtocolAddress } from '../types/address.js';
11
+ import { base64ToBytes } from '../internal/crypto/index.js';
12
+ import { UnidentifiedAccessMode } from '../profile/contact-state.js';
13
+ import { SealedSenderContentType, SEALED_SENDER_V2_SERVICE_ID_VERSION, SEALED_SENDER_V2_UUID_VERSION, } from '../internal/protocol/sealed-sender/types.js';
14
+ export async function serializeDirectSealedSenderMessage(msg, ciphertextBase64, messageType, recipientRegistrationId, sealedSender) {
15
+ const { sealMultiRecipient, deserializeSenderCertificate } = await import('../internal/protocol/sealed-sender/index.js');
16
+ const { serializeSentMessage } = await import('../internal/protocol/sealed-sender/multi-recipient-message.js');
17
+ const { base64ToBytes: b64ToBytes, bytesToBase64: bytesToB64 } = await import('../internal/crypto/index.js');
18
+ const senderCertificate = deserializeSenderCertificate(b64ToBytes(sealedSender.senderCertificateBase64));
19
+ const sealed = await sealMultiRecipient({
20
+ senderCertificate,
21
+ senderIdentityPrivate: sealedSender.senderIdentityPrivate,
22
+ senderIdentityPublic: sealedSender.senderIdentityPublic,
23
+ recipients: [
24
+ {
25
+ serviceId: msg.recipientUserId,
26
+ deviceId: msg.recipientDeviceId,
27
+ registrationId: recipientRegistrationId ?? 0,
28
+ identityPublic: sealedSender.recipientIdentityPublic,
29
+ },
30
+ ],
31
+ signalProtocolMessage: b64ToBytes(ciphertextBase64),
32
+ contentType: messageType === 'sender_key'
33
+ ? SealedSenderContentType.SENDERKEY_MESSAGE
34
+ : messageType === 'prekey_bundle'
35
+ ? SealedSenderContentType.PREKEY_MESSAGE
36
+ : SealedSenderContentType.MESSAGE,
37
+ });
38
+ const recipient = sealed.recipients[0];
39
+ if (!recipient)
40
+ throw new Error('Sealed sender produced no direct recipient');
41
+ return bytesToB64(serializeSentMessage([
42
+ {
43
+ serviceId: recipient.serviceId,
44
+ devices: [
45
+ {
46
+ deviceId: recipient.deviceId,
47
+ registrationId: recipient.registrationId,
48
+ },
49
+ ],
50
+ encryptedMessageKey: b64ToBytes(recipient.encryptedMessageKey),
51
+ authenticationTag: b64ToBytes(recipient.authenticationTag),
52
+ },
53
+ ], [], b64ToBytes(sealed.ephemeralPublic), b64ToBytes(sealed.messageCiphertext)));
54
+ }
55
+ export async function resolveSealedSenderContext(context, recipientUserId, groupId) {
56
+ if (context.deliveryMode === 'disabled')
57
+ return null;
58
+ if (!context.provider || !context.relaySupportsUnidentified) {
59
+ return context.useIdentifiedDeliveryOrThrow(recipientUserId, 'anonymous relay capability is not configured');
60
+ }
61
+ if (groupId && context.endorsementManager) {
62
+ const groupSecretParams = context.groupSecretParamsProvider
63
+ ? await context.groupSecretParamsProvider(groupId)
64
+ : null;
65
+ const endorsementToken = await context.endorsementManager.getTokenForRecipient(groupId, recipientUserId, groupSecretParams ?? undefined);
66
+ if (endorsementToken) {
67
+ const { senderCertificateBase64, senderIdentityPrivate, senderIdentityPublic, config } = await context.provider();
68
+ const recipientIdentityRecord = await context.storage.getContactIdentity(ProtocolAddress.create(recipientUserId, 1));
69
+ if (recipientIdentityRecord) {
70
+ return {
71
+ senderCertificateBase64,
72
+ senderIdentityPrivate,
73
+ senderIdentityPublic,
74
+ recipientIdentityPublic: base64ToBytes(recipientIdentityRecord.identity.x25519PublicKey),
75
+ config,
76
+ auth: {
77
+ type: 'groupSendToken',
78
+ groupSendToken: endorsementToken.token,
79
+ recipientAciBytes: new Map([[recipientUserId, endorsementToken.aciBytes]]),
80
+ },
81
+ };
82
+ }
83
+ }
84
+ }
85
+ const contactStateStore = context.contactProfileStateStore;
86
+ if (!contactStateStore) {
87
+ context.logger.debug('No contact profile state store configured, using identified delivery', {
88
+ category: 'E2EE',
89
+ data: { recipientUserId, groupId },
90
+ });
91
+ return context.useIdentifiedDeliveryOrThrow(recipientUserId, 'recipient capability store is not configured');
92
+ }
93
+ const mode = await contactStateStore.getUnidentifiedAccessMode(recipientUserId);
94
+ if (mode === UnidentifiedAccessMode.DISABLED) {
95
+ context.logger.debug('Sealed sender disabled for recipient, using identified delivery', {
96
+ category: 'E2EE',
97
+ data: { recipientUserId, mode },
98
+ });
99
+ return context.useIdentifiedDeliveryOrThrow(recipientUserId, 'recipient disabled anonymous access');
100
+ }
101
+ const { deriveAccessKey } = await import('../internal/protocol/sealed-sender/delivery-token.js');
102
+ const { bytesToBase64 } = await import('../internal/crypto/index.js');
103
+ let auth;
104
+ switch (mode) {
105
+ case UnidentifiedAccessMode.UNRESTRICTED:
106
+ auth = {
107
+ type: 'accessKey',
108
+ unidentifiedAccessKey: bytesToBase64(new Uint8Array(16)),
109
+ };
110
+ break;
111
+ case UnidentifiedAccessMode.ENABLED: {
112
+ const recipientProfileKey = await contactStateStore.getContactProfileKey(recipientUserId);
113
+ if (!recipientProfileKey) {
114
+ context.logger.debug('No profile key for ENABLED recipient, using identified delivery', {
115
+ category: 'E2EE',
116
+ data: { recipientUserId },
117
+ });
118
+ return context.useIdentifiedDeliveryOrThrow(recipientUserId, 'recipient access key is unavailable');
119
+ }
120
+ auth = {
121
+ type: 'accessKey',
122
+ unidentifiedAccessKey: bytesToBase64(await deriveAccessKey(recipientProfileKey)),
123
+ };
124
+ break;
125
+ }
126
+ case UnidentifiedAccessMode.UNKNOWN:
127
+ default: {
128
+ const recipientProfileKey = await contactStateStore.getContactProfileKey(recipientUserId);
129
+ auth = {
130
+ type: 'accessKey',
131
+ unidentifiedAccessKey: bytesToBase64(recipientProfileKey ? await deriveAccessKey(recipientProfileKey) : new Uint8Array(16)),
132
+ };
133
+ break;
134
+ }
135
+ }
136
+ const { senderCertificateBase64, senderIdentityPrivate, senderIdentityPublic, config } = await context.provider();
137
+ const recipientIdentityRecord = await context.storage.getContactIdentity(ProtocolAddress.create(recipientUserId, 1));
138
+ if (!recipientIdentityRecord) {
139
+ context.logger.debug('No identity key for recipient, using identified delivery', {
140
+ category: 'E2EE',
141
+ data: { recipientUserId },
142
+ });
143
+ return context.useIdentifiedDeliveryOrThrow(recipientUserId, 'recipient identity key is unavailable');
144
+ }
145
+ return {
146
+ senderCertificateBase64,
147
+ senderIdentityPrivate,
148
+ senderIdentityPublic,
149
+ recipientIdentityPublic: base64ToBytes(recipientIdentityRecord.identity.x25519PublicKey),
150
+ config,
151
+ auth,
152
+ };
153
+ }
154
+ /**
155
+ * Unseal a sealed sender message to reveal the sender and inner ciphertext.
156
+ *
157
+ * Called when an incoming envelope has messageType === 'unidentified_sender'.
158
+ * Validates the certificate chain, reveals sender identity, and returns
159
+ * the inner Signal Protocol ciphertext for normal decryption.
160
+ *
161
+ * @param sealedCiphertextBase64 - Base64-encoded sealed sender message
162
+ * @param recipientIdentityPrivate - Recipient's X25519 identity private key
163
+ * @param recipientUuid - Recipient's user ID (for self-send detection)
164
+ * @param recipientDeviceId - Recipient's device ID
165
+ * @param config - Sealed sender config with trust roots
166
+ * @param relayEnqueueTime - Immutable time when Relay accepted the message
167
+ * @returns Unsealed envelope info with sender identity and inner ciphertext
168
+ */
169
+ export async function unsealMessage(sealedCiphertextBase64, recipientIdentityPrivate, recipientUuid, recipientDeviceId, config, relayEnqueueTime, providedLogger) {
170
+ if (typeof relayEnqueueTime !== 'number' ||
171
+ !Number.isSafeInteger(relayEnqueueTime) ||
172
+ relayEnqueueTime <= 0) {
173
+ throw new Error('Sealed sender verification requires an immutable Relay enqueue time');
174
+ }
175
+ const logger = resolveSignalProtocolLogger(providedLogger);
176
+ const { base64ToBytes, bytesToBase64 } = await import('../internal/crypto/index.js');
177
+ // Decode the only supported sealed-sender transport format.
178
+ const sealedBytes = base64ToBytes(sealedCiphertextBase64);
179
+ const versionByte = sealedBytes[0];
180
+ if (versionByte === SEALED_SENDER_V2_UUID_VERSION ||
181
+ versionByte === SEALED_SENDER_V2_SERVICE_ID_VERSION) {
182
+ return unsealReceivedMessage(sealedBytes, recipientIdentityPrivate, recipientUuid, recipientDeviceId, config, relayEnqueueTime, logger);
183
+ }
184
+ throw new Error('Unsupported sealed sender transport version');
185
+ }
186
+ /**
187
+ * Unseal a multi-recipient sealed sender message (per-device view).
188
+ *
189
+ * The server constructs a per-device view: [0x22][C_i(32)][AT_i(16)][e_pub(32)][ciphertext]
190
+ * We deserialize this, build a sealed message, and call unseal().
191
+ */
192
+ async function unsealReceivedMessage(sealedBytes, recipientIdentityPrivate, recipientUuid, recipientDeviceId, config, relayEnqueueTime, logger) {
193
+ const { deserializeReceivedMessage } = await import('../internal/protocol/sealed-sender/multi-recipient-message.js');
194
+ const { unseal } = await import('../internal/protocol/sealed-sender/decryption.js');
195
+ const { bytesToBase64 } = await import('../internal/crypto/index.js');
196
+ const { x25519 } = await import('@noble/curves/ed25519.js');
197
+ // 1. Deserialize per-device ReceivedMessage
198
+ const deserialized = deserializeReceivedMessage(sealedBytes);
199
+ // 2. Derive recipient public key from private
200
+ const recipientIdentityPublic = x25519.getPublicKey(recipientIdentityPrivate);
201
+ // 3. Build the sealed message with one recipient entry.
202
+ const message = {
203
+ version: SEALED_SENDER_V2_UUID_VERSION,
204
+ ephemeralPublic: bytesToBase64(deserialized.ephemeralPublic),
205
+ recipients: [
206
+ {
207
+ serviceId: recipientUuid,
208
+ deviceId: recipientDeviceId,
209
+ registrationId: 0, // Not needed for unseal. Only used in send path
210
+ encryptedMessageKey: bytesToBase64(deserialized.encryptedMessageKey),
211
+ authenticationTag: bytesToBase64(deserialized.authenticationTag),
212
+ },
213
+ ],
214
+ messageCiphertext: bytesToBase64(deserialized.messageCiphertext),
215
+ };
216
+ // 4. Build trust roots as Base64 strings
217
+ const trustRoots = config.trustRoots.map((root) => bytesToBase64(root));
218
+ const certificatePolicy = {
219
+ expectedRelayScopeId: bytesToBase64(config.relayScopeId),
220
+ revokedIssuerKeyIds: config.revokedIssuerKeyIds,
221
+ };
222
+ // 5. Unseal and validate the sender credential.
223
+ const content = await unseal({
224
+ sealedMessage: message,
225
+ recipientIdentityPrivate,
226
+ recipientIdentityPublic,
227
+ recipientServiceId: recipientUuid,
228
+ recipientDeviceId,
229
+ trustRoots,
230
+ currentTime: relayEnqueueTime,
231
+ certificatePolicy,
232
+ });
233
+ logger.debug('Sealed sender message unsealed', {
234
+ category: 'E2EE',
235
+ data: {
236
+ senderUuid: content.senderCertificate.senderUuid,
237
+ senderDeviceId: content.senderCertificate.senderDeviceId,
238
+ },
239
+ });
240
+ return {
241
+ senderUserId: content.senderCertificate.senderUuid,
242
+ senderDeviceId: content.senderCertificate.senderDeviceId,
243
+ innerCiphertextBase64: content.signalProtocolMessage,
244
+ contentType: content.contentType,
245
+ };
246
+ }
247
+ /**
248
+ * Reconstruct an Envelope from an unsealed message.
249
+ *
250
+ * Takes the original sealed sender envelope (with empty sender fields)
251
+ * and fills in the sender identity revealed by unsealing.
252
+ *
253
+ * @param originalEnvelope - The incoming envelope with messageType 'unidentified_sender'
254
+ * @param unsealed - The unsealed sender info and inner ciphertext
255
+ * @returns A new envelope with real sender info and the inner ciphertext
256
+ */
257
+ export function reconstructEnvelope(originalEnvelope, unsealed) {
258
+ return {
259
+ ...originalEnvelope,
260
+ senderUserId: unsealed.senderUserId,
261
+ senderDeviceId: unsealed.senderDeviceId,
262
+ ciphertext: unsealed.innerCiphertextBase64,
263
+ messageType: envelopeTypeForContent(unsealed.contentType),
264
+ };
265
+ }
266
+ /**
267
+ * Map a sealed envelope's content type onto the envelope type the decrypt
268
+ * path routes on.
269
+ *
270
+ * Exported because both receive paths need it. `SignalProtocolServiceCipher`
271
+ * via `reconstructEnvelope`, and `SignalProtocolClient.processIncomingEnvelope`
272
+ * directly. Two copies of this mapping would drift.
273
+ *
274
+ * `SENDERKEY_MESSAGE` is the only case that matters here. It is what keeps
275
+ * group routing working now that no group identifier travels on an envelope,
276
+ * sealed or otherwise. Both `PREKEY_MESSAGE` and `MESSAGE` decrypt as pairwise
277
+ * ratchet messages, and the ratchet distinguishes them from the payload
278
+ * itself.
279
+ *
280
+ * The default is unreachable: `isSealedSenderContentType` rejects every other
281
+ * value at the parse, so nothing arrives here that this function cannot map.
282
+ * It exists so that adding an enum member without a route fails loudly rather
283
+ * than silently decrypting as something it is not.
284
+ */
285
+ export function envelopeTypeForContent(contentType) {
286
+ switch (contentType) {
287
+ case SealedSenderContentType.SENDERKEY_MESSAGE:
288
+ return 'sender_key';
289
+ case SealedSenderContentType.PREKEY_MESSAGE:
290
+ case SealedSenderContentType.MESSAGE:
291
+ return 'ciphertext';
292
+ default:
293
+ throw new Error('Unsupported sealed sender content type');
294
+ }
295
+ }
296
+ //# sourceMappingURL=sealed-sender.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sealed-sender.js","sourceRoot":"","sources":["../../client/sealed-sender.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAAE,2BAA2B,EAAgB,MAAM,WAAW,CAAC;AAEtE,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,sBAAsB,EAAiC,MAAM,0BAA0B,CAAC;AACjG,OAAO,EACL,uBAAuB,EACvB,mCAAmC,EACnC,6BAA6B,GAC9B,MAAM,0CAA0C,CAAC;AAkClD,MAAM,CAAC,KAAK,UAAU,kCAAkC,CACtD,GAA2D,EAC3D,gBAAwB,EACxB,WAA0D,EAC1D,uBAA2C,EAC3C,YAAyC;IAEzC,MAAM,EAAE,kBAAkB,EAAE,4BAA4B,EAAE,GACxD,MAAM,MAAM,CAAC,oCAAoC,CAAC,CAAC;IACrD,MAAM,EAAE,oBAAoB,EAAE,GAC5B,MAAM,MAAM,CAAC,4DAA4D,CAAC,CAAC;IAC7E,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,GAC5D,MAAM,MAAM,CAAC,oBAAoB,CAAC,CAAC;IAErC,MAAM,iBAAiB,GAAG,4BAA4B,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