@open-e2ee/signal-protocol-sdk 13.2.0 → 13.3.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.
- package/CHANGELOG.md +73 -0
- package/README.md +1 -1
- package/SECURITY.md +2 -2
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/client.js +37 -4
- package/dist/client/client.js.map +1 -1
- package/dist/client/group-outbox.d.ts +2 -1
- package/dist/client/group-outbox.d.ts.map +1 -1
- package/dist/client/group-outbox.js +4 -1
- package/dist/client/group-outbox.js.map +1 -1
- package/dist/client/hosted-mailbox-subscription.d.ts +4 -2
- package/dist/client/hosted-mailbox-subscription.d.ts.map +1 -1
- package/dist/client/hosted-mailbox-subscription.js +4 -2
- package/dist/client/hosted-mailbox-subscription.js.map +1 -1
- package/dist/client/receive-work-seed.d.ts +6 -2
- package/dist/client/receive-work-seed.d.ts.map +1 -1
- package/dist/client/receive-work-seed.js +4 -0
- package/dist/client/receive-work-seed.js.map +1 -1
- package/dist/client/relay-subscription.js +1 -1
- package/dist/client/relay-subscription.js.map +1 -1
- package/dist/client/retry-family.d.ts +69 -13
- package/dist/client/retry-family.d.ts.map +1 -1
- package/dist/client/retry-family.js +104 -11
- package/dist/client/retry-family.js.map +1 -1
- package/dist/client/send-timestamp.d.ts +67 -0
- package/dist/client/send-timestamp.d.ts.map +1 -0
- package/dist/client/send-timestamp.js +82 -0
- package/dist/client/send-timestamp.js.map +1 -0
- package/dist/client/signal-service-cipher.d.ts +5 -0
- package/dist/client/signal-service-cipher.d.ts.map +1 -1
- package/dist/client/signal-service-cipher.js +31 -5
- package/dist/client/signal-service-cipher.js.map +1 -1
- package/dist/client/types.d.ts +9 -0
- package/dist/client/types.d.ts.map +1 -1
- package/dist/client/types.js.map +1 -1
- package/dist/local/store/reliability.d.ts +6 -3
- package/dist/local/store/reliability.d.ts.map +1 -1
- package/dist/local/store/reliability.js +6 -3
- package/dist/local/store/reliability.js.map +1 -1
- package/dist/local/store/sqlite/convert-plaintext.d.ts +1 -7
- package/dist/local/store/sqlite/convert-plaintext.d.ts.map +1 -1
- package/dist/local/store/sqlite/convert-plaintext.js +1 -9
- package/dist/local/store/sqlite/convert-plaintext.js.map +1 -1
- package/dist/local/store/sqlite/file-name.d.ts +5 -0
- package/dist/local/store/sqlite/file-name.d.ts.map +1 -0
- package/dist/local/store/sqlite/file-name.js +7 -0
- package/dist/local/store/sqlite/file-name.js.map +1 -0
- package/dist/local/store/sqlite/open-store.d.ts.map +1 -1
- package/dist/local/store/sqlite/open-store.js +2 -1
- package/dist/local/store/sqlite/open-store.js.map +1 -1
- package/dist/local/store/sqlite/web/file-name.d.ts +22 -0
- package/dist/local/store/sqlite/web/file-name.d.ts.map +1 -0
- package/dist/local/store/sqlite/web/file-name.js +72 -0
- package/dist/local/store/sqlite/web/file-name.js.map +1 -0
- package/dist/local/store/sqlite/web/worker.js +5 -12
- package/dist/local/store/sqlite/web/worker.js.map +1 -1
- package/dist/local/store/web-sqlite/adapter.d.ts +5 -4
- package/dist/local/store/web-sqlite/adapter.d.ts.map +1 -1
- package/dist/local/store/web-sqlite/adapter.js +7 -4
- package/dist/local/store/web-sqlite/adapter.js.map +1 -1
- package/dist/local/vault/indexed-db.d.ts +7 -3
- package/dist/local/vault/indexed-db.d.ts.map +1 -1
- package/dist/local/vault/indexed-db.js +25 -21
- package/dist/local/vault/indexed-db.js.map +1 -1
- package/dist/types/api.d.ts +25 -0
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/errors.d.ts +69 -1
- package/dist/types/errors.d.ts.map +1 -1
- package/dist/types/errors.js +77 -1
- package/dist/types/errors.js.map +1 -1
- package/docs/ASSURANCE.md +1 -1
- package/docs/DEVIATIONS.md +3 -3
- package/docs/ERROR_HANDLING.md +1 -0
- package/docs/GETTING_STARTED.md +10 -0
- package/local/store/README.md +16 -9
- package/local/store/web-sqlite/README.md +22 -6
- package/package.json +1 -1
package/dist/types/errors.d.ts
CHANGED
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
* ├── SealedSenderAuthError the rejected sealed-sender credential
|
|
16
16
|
* ├── PQXDHRequiredError which post-quantum key the peer is missing
|
|
17
17
|
* ├── StorageQuotaExceededError the store that ran out of room
|
|
18
|
-
*
|
|
18
|
+
* ├── SecureRandomUnavailableError the runtime has no secure random source
|
|
19
|
+
* └── InvalidSendTimestampError the refused send timestamp and the accepted window
|
|
19
20
|
* ```
|
|
20
21
|
*
|
|
21
22
|
* A code or a subclass belongs here only if production code can produce it. An
|
|
@@ -110,6 +111,16 @@ export declare enum EncryptionErrorCode {
|
|
|
110
111
|
DECRYPTION_FAILED = "DECRYPTION_FAILED",
|
|
111
112
|
/** Message encryption failed */
|
|
112
113
|
ENCRYPTION_FAILED = "ENCRYPTION_FAILED",
|
|
114
|
+
/**
|
|
115
|
+
* A new send carries an application-supplied `timestamp` that the SDK
|
|
116
|
+
* refuses, or a sync to linked devices carries an application-supplied time
|
|
117
|
+
* that the SDK refuses.
|
|
118
|
+
*
|
|
119
|
+
* The SDK accepts a safe positive integer at most 5 minutes ahead of its
|
|
120
|
+
* clock and at most 24 hours behind it. It throws `InvalidSendTimestampError`
|
|
121
|
+
* before it stores or posts anything for the send.
|
|
122
|
+
*/
|
|
123
|
+
INVALID_SEND_TIMESTAMP = "INVALID_SEND_TIMESTAMP",
|
|
113
124
|
/**
|
|
114
125
|
* Duplicate message detected (replay attack).
|
|
115
126
|
*
|
|
@@ -520,6 +531,63 @@ export declare class SecureRandomUnavailableError extends EncryptionError {
|
|
|
520
531
|
readonly name = "SecureRandomUnavailableError";
|
|
521
532
|
constructor(message: string);
|
|
522
533
|
}
|
|
534
|
+
/** Why the SDK refused an application-supplied send timestamp. */
|
|
535
|
+
export type InvalidSendTimestampReason = 'not_safe_positive_integer' | 'too_far_ahead' | 'too_old';
|
|
536
|
+
/**
|
|
537
|
+
* Error thrown when a new send carries an application-supplied `timestamp`
|
|
538
|
+
* that the SDK refuses.
|
|
539
|
+
*
|
|
540
|
+
* The timestamp of a send is its operation epoch, and each retry of the send
|
|
541
|
+
* keeps it. The SDK accepts a safe positive integer at most 5 minutes ahead
|
|
542
|
+
* of its clock and at most 24 hours behind it. From the Relay release that
|
|
543
|
+
* follows v2026.10.25, the Relay admits a mailbox delivery epoch and a new
|
|
544
|
+
* group fan-out operation in the same window. Earlier Relay releases admit a
|
|
545
|
+
* new operation only within 5 minutes of its epoch. On an earlier Relay
|
|
546
|
+
* release, a time 5 minutes to 24 hours old passes the SDK check but gets
|
|
547
|
+
* `OPERATION_EXPIRED`. The SDK check uses the same bounds, so the SDK refuses
|
|
548
|
+
* an application-supplied time before it stores the send or posts anything.
|
|
549
|
+
* A sync to linked devices whose epoch is an application-supplied time, such
|
|
550
|
+
* as `deletedAt`, gets the same check before it posts.
|
|
551
|
+
*
|
|
552
|
+
* The SDK stored nothing for the refused send. The application can send the
|
|
553
|
+
* content again with a timestamp in the window, or with no timestamp, and the
|
|
554
|
+
* SDK then uses its clock. A send that repeats a stored `clientMessageId`
|
|
555
|
+
* with its stored timestamp keeps that timestamp, and the SDK does not check
|
|
556
|
+
* it again. With another timestamp, the check applies.
|
|
557
|
+
*
|
|
558
|
+
* @example
|
|
559
|
+
* ```typescript
|
|
560
|
+
* try {
|
|
561
|
+
* await signal.send(recipientId, { body, timestamp });
|
|
562
|
+
* } catch (error) {
|
|
563
|
+
* if (isInvalidSendTimestampError(error)) {
|
|
564
|
+
* await signal.send(recipientId, { body });
|
|
565
|
+
* }
|
|
566
|
+
* }
|
|
567
|
+
* ```
|
|
568
|
+
*/
|
|
569
|
+
export declare class InvalidSendTimestampError extends EncryptionError {
|
|
570
|
+
readonly name = "InvalidSendTimestampError";
|
|
571
|
+
/** The refused timestamp. */
|
|
572
|
+
readonly timestamp: number;
|
|
573
|
+
/** Why the SDK refused the timestamp. */
|
|
574
|
+
readonly reason: InvalidSendTimestampReason;
|
|
575
|
+
/** The earliest timestamp that the check accepted, in milliseconds since the epoch. */
|
|
576
|
+
readonly earliest: number;
|
|
577
|
+
/** The latest timestamp that the check accepted, in milliseconds since the epoch. */
|
|
578
|
+
readonly latest: number;
|
|
579
|
+
constructor(timestamp: number, reason: InvalidSendTimestampReason, window: {
|
|
580
|
+
earliest: number;
|
|
581
|
+
latest: number;
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Type guard to check if an error is an InvalidSendTimestampError.
|
|
586
|
+
*
|
|
587
|
+
* @param error - Error to check
|
|
588
|
+
* @returns true if error is InvalidSendTimestampError
|
|
589
|
+
*/
|
|
590
|
+
export declare function isInvalidSendTimestampError(error: unknown): error is InvalidSendTimestampError;
|
|
523
591
|
/**
|
|
524
592
|
* Type guard to check if an error is a SecureRandomUnavailableError.
|
|
525
593
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../types/errors.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../types/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAE9D;;;;;GAKG;AACH,OAAO,EAAE,CAAC;AACV,MAAM,WAAW,sBAAsB;IACrC,iEAAiE;IACjE,OAAO,CAAC,EAAE,eAAe,CAAC;IAE1B,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,gEAAgE;IAChE,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAE/B,wCAAwC;IACxC,aAAa,CAAC,EAAE,KAAK,CAAC;IAEtB,uCAAuC;IACvC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;;;;;;;;;;;;GAcG;AACH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F;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,kBAAkB,CAEhF;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,sBAAsB,CAExF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,eAAe,CAE1E"}
|
package/dist/types/errors.js
CHANGED
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
* ├── SealedSenderAuthError the rejected sealed-sender credential
|
|
16
16
|
* ├── PQXDHRequiredError which post-quantum key the peer is missing
|
|
17
17
|
* ├── StorageQuotaExceededError the store that ran out of room
|
|
18
|
-
*
|
|
18
|
+
* ├── SecureRandomUnavailableError the runtime has no secure random source
|
|
19
|
+
* └── InvalidSendTimestampError the refused send timestamp and the accepted window
|
|
19
20
|
* ```
|
|
20
21
|
*
|
|
21
22
|
* A code or a subclass belongs here only if production code can produce it. An
|
|
@@ -106,6 +107,16 @@ export var EncryptionErrorCode;
|
|
|
106
107
|
EncryptionErrorCode["DECRYPTION_FAILED"] = "DECRYPTION_FAILED";
|
|
107
108
|
/** Message encryption failed */
|
|
108
109
|
EncryptionErrorCode["ENCRYPTION_FAILED"] = "ENCRYPTION_FAILED";
|
|
110
|
+
/**
|
|
111
|
+
* A new send carries an application-supplied `timestamp` that the SDK
|
|
112
|
+
* refuses, or a sync to linked devices carries an application-supplied time
|
|
113
|
+
* that the SDK refuses.
|
|
114
|
+
*
|
|
115
|
+
* The SDK accepts a safe positive integer at most 5 minutes ahead of its
|
|
116
|
+
* clock and at most 24 hours behind it. It throws `InvalidSendTimestampError`
|
|
117
|
+
* before it stores or posts anything for the send.
|
|
118
|
+
*/
|
|
119
|
+
EncryptionErrorCode["INVALID_SEND_TIMESTAMP"] = "INVALID_SEND_TIMESTAMP";
|
|
109
120
|
/**
|
|
110
121
|
* Duplicate message detected (replay attack).
|
|
111
122
|
*
|
|
@@ -554,6 +565,71 @@ export class SecureRandomUnavailableError extends EncryptionError {
|
|
|
554
565
|
});
|
|
555
566
|
}
|
|
556
567
|
}
|
|
568
|
+
/**
|
|
569
|
+
* Error thrown when a new send carries an application-supplied `timestamp`
|
|
570
|
+
* that the SDK refuses.
|
|
571
|
+
*
|
|
572
|
+
* The timestamp of a send is its operation epoch, and each retry of the send
|
|
573
|
+
* keeps it. The SDK accepts a safe positive integer at most 5 minutes ahead
|
|
574
|
+
* of its clock and at most 24 hours behind it. From the Relay release that
|
|
575
|
+
* follows v2026.10.25, the Relay admits a mailbox delivery epoch and a new
|
|
576
|
+
* group fan-out operation in the same window. Earlier Relay releases admit a
|
|
577
|
+
* new operation only within 5 minutes of its epoch. On an earlier Relay
|
|
578
|
+
* release, a time 5 minutes to 24 hours old passes the SDK check but gets
|
|
579
|
+
* `OPERATION_EXPIRED`. The SDK check uses the same bounds, so the SDK refuses
|
|
580
|
+
* an application-supplied time before it stores the send or posts anything.
|
|
581
|
+
* A sync to linked devices whose epoch is an application-supplied time, such
|
|
582
|
+
* as `deletedAt`, gets the same check before it posts.
|
|
583
|
+
*
|
|
584
|
+
* The SDK stored nothing for the refused send. The application can send the
|
|
585
|
+
* content again with a timestamp in the window, or with no timestamp, and the
|
|
586
|
+
* SDK then uses its clock. A send that repeats a stored `clientMessageId`
|
|
587
|
+
* with its stored timestamp keeps that timestamp, and the SDK does not check
|
|
588
|
+
* it again. With another timestamp, the check applies.
|
|
589
|
+
*
|
|
590
|
+
* @example
|
|
591
|
+
* ```typescript
|
|
592
|
+
* try {
|
|
593
|
+
* await signal.send(recipientId, { body, timestamp });
|
|
594
|
+
* } catch (error) {
|
|
595
|
+
* if (isInvalidSendTimestampError(error)) {
|
|
596
|
+
* await signal.send(recipientId, { body });
|
|
597
|
+
* }
|
|
598
|
+
* }
|
|
599
|
+
* ```
|
|
600
|
+
*/
|
|
601
|
+
export class InvalidSendTimestampError extends EncryptionError {
|
|
602
|
+
name = 'InvalidSendTimestampError';
|
|
603
|
+
/** The refused timestamp. */
|
|
604
|
+
timestamp;
|
|
605
|
+
/** Why the SDK refused the timestamp. */
|
|
606
|
+
reason;
|
|
607
|
+
/** The earliest timestamp that the check accepted, in milliseconds since the epoch. */
|
|
608
|
+
earliest;
|
|
609
|
+
/** The latest timestamp that the check accepted, in milliseconds since the epoch. */
|
|
610
|
+
latest;
|
|
611
|
+
constructor(timestamp, reason, window) {
|
|
612
|
+
const problem = reason === 'not_safe_positive_integer'
|
|
613
|
+
? 'is not a safe positive integer'
|
|
614
|
+
: reason === 'too_far_ahead'
|
|
615
|
+
? 'is more than 5 minutes ahead of the SDK clock'
|
|
616
|
+
: 'is more than 24 hours behind the SDK clock';
|
|
617
|
+
super(`The send timestamp ${String(timestamp)} ${problem}. A new send accepts ${window.earliest} through ${window.latest}`, EncryptionErrorCode.INVALID_SEND_TIMESTAMP, { operation: 'send', timestamp, reason, earliest: window.earliest, latest: window.latest });
|
|
618
|
+
this.timestamp = timestamp;
|
|
619
|
+
this.reason = reason;
|
|
620
|
+
this.earliest = window.earliest;
|
|
621
|
+
this.latest = window.latest;
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* Type guard to check if an error is an InvalidSendTimestampError.
|
|
626
|
+
*
|
|
627
|
+
* @param error - Error to check
|
|
628
|
+
* @returns true if error is InvalidSendTimestampError
|
|
629
|
+
*/
|
|
630
|
+
export function isInvalidSendTimestampError(error) {
|
|
631
|
+
return error instanceof InvalidSendTimestampError;
|
|
632
|
+
}
|
|
557
633
|
/**
|
|
558
634
|
* Type guard to check if an error is a SecureRandomUnavailableError.
|
|
559
635
|
*
|
package/dist/types/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../types/errors.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../types/errors.ts"],"names":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ED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,OAAO,KAAK,YAAY,eAAe,CAAC;AAC1C,CAAC"}
|
package/docs/ASSURANCE.md
CHANGED
|
@@ -124,7 +124,7 @@ The simulator does not enforce Data Protection. These results do not show the pr
|
|
|
124
124
|
| Without `'wasm-unsafe-eval'`, the open fails with `SQLITE_ENGINE_UNAVAILABLE` and writes no key. | Browser storage job: Chromium and Firefox on Linux. WebKit store job: WebKit and Safari on macOS | A page under a policy without `'wasm-unsafe-eval'`. |
|
|
125
125
|
| When the origin quota is full, a write and an atomic commit reject with `STORAGE_QUOTA_EXCEEDED` and leave no partial state. The store stays open, and after the clamp is removed, the same commit succeeds. A first open under a full quota rejects with `STORAGE_QUOTA_EXCEEDED`, writes no key and no database file, and succeeds after the clamp is removed. A store with two pool files opens, reads, and writes under a quota that has no room for a new pool. | Browser storage job: Chromium on Linux | A DevTools protocol call clamps the origin quota, and the store fills its real file in OPFS. Firefox and WebKit have no such call, so they do not run this check. |
|
|
126
126
|
| When a write of the engine fails with `QuotaExceededError`, the call fails with the SQLite full-disk error, which the store reports as `STORAGE_QUOTA_EXCEEDED`. The earlier rows stay, and after space frees, the same connection writes again and the file passes an integrity check. | Browser storage job: Chromium and Firefox on Linux. WebKit store job: WebKit and Safari on macOS | A fault in the worker makes each OPFS write that grows a file throw `QuotaExceededError`. It does not fill a real origin quota. |
|
|
127
|
-
| Over a long run, the store holds latency, memory, and file size flat. A closed store leaves no worker
|
|
127
|
+
| Over a long run, the store holds latency, memory, and file size flat. A closed store leaves no worker, no lock of the store, and no IndexedDB connection. Two tabs that write in turn each read the last write of the other. | Browser storage job: Chromium on Linux | 150 open, write, read, and close cycles, one session of 2,000 churn operations over 250 sessions, and 100 writes that two tabs make in turn. The check counts the workers, locks, IndexedDB connections, and OPFS entries that the cycles leave. It times each cycle and each two-tab read next to a control that does the same platform work with no store state, and compares the early and late thirds of that ratio. It compares the medians of the early and late thirds of the churn, and fits a slope to the page heap of the cycles. It reads the page heap, the IndexedDB connections, and the heap and Wasm memory of the store's worker, through the DevTools protocol. Firefox and WebKit have no such protocol in the test runner, and no CI job runs this check in them. |
|
|
128
128
|
| A worker without OPFS synchronous access handles fails with `OPFS_UNAVAILABLE` before it loads the engine. | Browser storage job: Chromium, Firefox, and WebKit on Linux | WebKit on Linux (WebKitGTK) has no OPFS synchronous access handles, so there WebKit runs only these checks and the checks that need no OPFS. |
|
|
129
129
|
|
|
130
130
|
The WebKit store job runs Playwright's WebKit on macOS, where WebKit has OPFS synchronous access handles. Playwright's WebKit is not Safari, so the same job then runs the same checks in the Safari of the macOS runner through `safaridriver`, and records the Safari version. A WebDriver runner runs the Playwright checks unchanged. It counts the workers of a page from inside the page, and it reports the uncaught errors of a page only after the page loads. Each browser context is a Safari WebDriver session, so the check for an ephemeral context that refuses OPFS access handles skips when that session has them. It runs only on a change to the web SQLite store, the SQLite core, the storage contract, the key vault, the job, or a dependency. On a pull request, it runs only when a maintainer requests it. In the browser storage job for Chromium and Firefox and in the WebKit store job, a check that skips for want of OPFS fails.
|
package/docs/DEVIATIONS.md
CHANGED
|
@@ -83,7 +83,7 @@ model and what is out of scope.
|
|
|
83
83
|
| **SPQR / ML-KEM Braid** | ML-KEM Braid rev. 1 | **Deviation.** Same protocol, same KDF labels, same Reed–Solomon parameters, byte-identical message framing — except `hek = SHA3-256(ek_seed ‖ ek_vector)`, the operand order the specification states, which is the reverse of `libsignal`'s implementation | The normative text was followed over the executable reference | Wire-visible. Headers, ciphertexts, and shared secrets diverge; a braid session cannot complete a single epoch against `libsignal`'s implementation. Also means the KEM is not FIPS 203 in braid mode |
|
|
84
84
|
| **Triple Ratchet** | `libsignal` `triple_ratchet.rs` | **Faithful.** The PQ secret enters as the HKDF salt at message-key expansion, same label, same order | — | The braiding construction follows the ML-KEM Braid specification |
|
|
85
85
|
| **Sesame** | Sesame rev. 2 | **Faithful** on deleted devices: a removed device is marked and kept for MAXLATENCY, and its archived sessions still decrypt. **Deviation** on session expiry (§4.2 applies only to unacknowledged sessions) and on device-list currency on the Convex relay only (the sender reads the relay's list at most once per 60 s). The Signal Protocol Relay and the memory relay reject a stale declared device set, as §3.3 requires. **Deviation** on stale-record cleanup timing (§5.1: the cleanup runs after the resume, not after a fetch of the whole mailbox, and the Relay's 30-day TTL cap bounds it). **Extensions:** device transfer, encrypted device names, identity-change gating, a 5-device cap | Product requirements the specification does not address | On the Convex relay, a device linked or removed less than 60 s ago can miss a send or still receive one. A client clock that moves forward against the Relay clock between a removal and the cleanup can lose a message accepted just before the removal. Device transfer copies the identity private key and no ratchet state, so each device starts its own sessions |
|
|
86
|
-
| **Device-set reconciliation** | Signal's server `MessageController`; Signal's Desktop client `sendToGroup` | **Deviation** in detail. The answer order, one post for each device of a direct send, a bound on direct sends, no empty sync post, a refusal for each not-found group destination, an acknowledgment marker, and a group body sealed again with the same ciphertext (§5.6) | The Relay takes one destination for each direct body, keeps one record for each account, admits
|
|
86
|
+
| **Device-set reconciliation** | Signal's server `MessageController`; Signal's Desktop client `sendToGroup` | **Deviation** in detail. The answer order, one post for each device of a direct send, a bound on direct sends, no empty sync post, a refusal for each not-found group destination, an acknowledgment marker, and a group body sealed again with the same ciphertext (§5.6) | The Relay takes one destination for each direct body, keeps one record for each account, admits a delivery epoch at most 5 minutes ahead of its clock and at most 24 hours behind it from the release that follows v2026.10.25, and stores each send attempt | A phase that does not match in 10 restarts fails the send with `DeviceSetReconciliationError`. A relay that does not acknowledge the comparison raises `DEVICE_SET_UNCHECKED` |
|
|
87
87
|
| **Sealed sender** | `libsignal` `sealed_sender.rs` | **Faithful** on the multi-recipient transport labels, KEM, AES-256-GCM-SIV, binary format, and `0x3FFF` registration-ID mask. **Extension:** sender and server certificates require signed Relay scope and issuer validity under operator-owned Ed25519 roots | Binds anonymous delivery to one Relay deployment and supports explicit issuer rotation and revocation | The transport follows `libsignal`; certificates are not interchangeable with Signal Messenger or another deployment |
|
|
88
88
|
| **Delivery token** | `libsignal` `profile_key.rs` | **Faithful.** `deriveAccessKey` follows `libsignal`'s `ProfileKey::derive_access_key`, and reproduces `libsignal`'s published known-answer values | — | Not an SDK invention, despite what the module name suggests |
|
|
89
89
|
| **Sender keys** | `libsignal` `sender_keys.rs` | **Deviation.** Protobuf fields, chain seeds, and HKDF-Extract/Expand match. The SDK uses frame version `0x44`, Ed25519 signatures, and UTF-8 distribution identifiers. | The identity profile selects Ed25519. The frame version marks the correction of the former missing Extract. | Message-key derivation matches the reference. Former SDK state and messages require a reset. Frames still differ from Signal Messenger. |
|
|
@@ -905,7 +905,7 @@ it never runs.
|
|
|
905
905
|
|
|
906
906
|
### 5.6 Device-set reconciliation differs in detail
|
|
907
907
|
|
|
908
|
-
Reviewed: 2026-10-
|
|
908
|
+
Reviewed: 2026-10-25.
|
|
909
909
|
|
|
910
910
|
The reconciliation of §5.5 follows Signal's server and Signal's Desktop
|
|
911
911
|
client in its rule: the server compares, the client repairs and posts again,
|
|
@@ -918,7 +918,7 @@ Signal's Android client. The following details differ.
|
|
|
918
918
|
| D1 | A stale registration is reported after missing and extra devices on every route, also for a direct post to one account | One answer order for every route | Signal's server reports stale devices first on its route for one account | Relay tests assert the order on each route |
|
|
919
919
|
| D2 | A direct send is one post for each device, and each post carries the full declaration of the account | The direct Relay route takes one destination for each body. A replay works for each device | One Signal request carries every device of the account. Here a race can accept some posts and refuse others | A restart posts the stored bytes to each accepted device, and each device gets the message once. A partly accepted pass posts every device again, and an accepted device replays |
|
|
920
920
|
| D3 | A group comparison reads the record of each account, up to 1,000, when the Relay accepts the post | The Relay keeps one record for each account | Signal's server reads accounts from one store in one process | Relay tests, and a cost measurement |
|
|
921
|
-
| D4 | The operation time is fixed. `OPERATION_EXPIRED` ends the reconciliation |
|
|
921
|
+
| D4 | The operation time is fixed. `OPERATION_EXPIRED` ends the reconciliation. A new send refuses an application timestamp outside the delivery window with `InvalidSendTimestampError` | From the Relay release that follows v2026.10.25, the Relay admits a mailbox delivery epoch and a new group fan-out operation at most 5 minutes ahead of its clock and at most 24 hours behind it. Earlier Relay releases admit a new operation only within 5 minutes of its epoch. On an earlier Relay release, a time 5 minutes to 24 hours old passes the SDK check but gets `OPERATION_EXPIRED`. The SDK check uses the same bounds, so the SDK refuses an application-supplied time before any post | Signal has no admission window | A restart post that gets `OPERATION_EXPIRED` ends the phase as expired. A new send with a timestamp outside the window throws `InvalidSendTimestampError`, and stores and posts nothing |
|
|
922
922
|
| D5 | No fallback to one post for each recipient after the bound | The same bound covers every path | Signal's Desktop client falls back because its one-to-one path has no bound. Under the bound, a fallback only moves the churn | The 11th refusal of a phase ends the send with `DeviceSetReconciliationError` |
|
|
923
923
|
| D6 | A direct send also stops at 10 restarts | One bound for every send | Signal's Desktop client has no bound on missing or extra devices for a one-to-one send | The restart bound test of the direct send |
|
|
924
924
|
| D7 | No empty sync post. A `needsSync` mark on the recipient receipt and one read of the own list replace it | A Relay post needs at least one destination | Signal's server accepts an empty sync list, and Signal's Android client addresses its own device | A new own device repairs the sync phase and the recipient post is not sent again. The own list is read only on `needsSync` with no own record, and a failed read leaves the sync phase pending |
|
package/docs/ERROR_HANDLING.md
CHANGED
|
@@ -83,6 +83,7 @@ holds each member to a production construction site.
|
|
|
83
83
|
| `INVALID_CIPHERTEXT` | The ciphertext format is invalid. | Reject the message. |
|
|
84
84
|
| `DECRYPTION_FAILED` | Available session state could not decrypt the message. | Let the retry flow recover, or inspect the session state. |
|
|
85
85
|
| `ENCRYPTION_FAILED` | The SDK could not encrypt the message. | Inspect the session state and `originalError`. |
|
|
86
|
+
| `INVALID_SEND_TIMESTAMP` | A new send carries a `timestamp`, or a sync to linked devices carries an application time, that is not a safe positive integer, or that is more than 5 minutes ahead of or more than 24 hours behind the SDK clock. The SDK throws `InvalidSendTimestampError` from `@open-e2ee/signal-protocol-sdk/types` and stores or posts nothing for the send. | Send again with a timestamp in the window, or with no timestamp. |
|
|
86
87
|
| `MESSAGE_DUPLICATE` | The session processed this message before. | Discard the duplicate. |
|
|
87
88
|
| `TOO_MANY_SKIPPED_MESSAGES` | The message exceeded the skipped-key bound. | Reset the affected session. |
|
|
88
89
|
| `REPLAY_DETECTED` | Envelope and encrypted-content timestamps differ. | Reject the message as a replay. |
|
package/docs/GETTING_STARTED.md
CHANGED
|
@@ -150,6 +150,16 @@ await signal.send("bob", {
|
|
|
150
150
|
});
|
|
151
151
|
```
|
|
152
152
|
|
|
153
|
+
A new send accepts a `timestamp` at most 5 minutes ahead of the SDK clock and
|
|
154
|
+
at most 24 hours behind it. For any other value, `send()` throws
|
|
155
|
+
`InvalidSendTimestampError` and stores or posts nothing. Omit `timestamp`, and
|
|
156
|
+
the SDK uses its clock. From the Relay release that follows v2026.10.25, the
|
|
157
|
+
Relay admits a mailbox delivery epoch and a new group fan-out operation in the
|
|
158
|
+
same window. Earlier Relay releases admit a new operation only within 5
|
|
159
|
+
minutes of its epoch. On an earlier Relay release, a time 5 minutes to 24 hours
|
|
160
|
+
old passes the SDK check but gets `OPERATION_EXPIRED`. The SDK check uses the
|
|
161
|
+
same bounds, so the SDK refuses an application-supplied time before any post.
|
|
162
|
+
|
|
153
163
|
A hosted client sends a sealed 1:1 message only when you pass
|
|
154
164
|
`hosted.profileKeys`, and only to a contact whose profile key `contacts` holds.
|
|
155
165
|
Each other 1:1 message is identified, so the Relay sees its sender. Until the
|
package/local/store/README.md
CHANGED
|
@@ -169,14 +169,21 @@ environment an adapter must honor its promises in, not the subject of a test.
|
|
|
169
169
|
in turn, so that the file moves to the other tab at each write. Each
|
|
170
170
|
write is read back, and `PRAGMA integrity_check` returns `ok` after
|
|
171
171
|
each phase and after each open. A closed store leaves no worker in the
|
|
172
|
-
tab and no lock of the store in the origin.
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
172
|
+
tab and no lock of the store in the origin. After the cycles, the tab
|
|
173
|
+
holds no IndexedDB connection, the OPFS root holds no new entry, and
|
|
174
|
+
the database file has not grown since the first third. Each cycle and
|
|
175
|
+
each two-tab read is timed next to a control that does the same
|
|
176
|
+
platform work with no store state. The gate fails if the late-run
|
|
177
|
+
median of that ratio grows by more than half over the early-run
|
|
178
|
+
median, or if the page heap grows by more than 1.5 KiB a cycle. It
|
|
179
|
+
also fails if the late-run median of the churn latency, of the page
|
|
180
|
+
heap, or of the worker heap grows beyond a small tolerance over the
|
|
181
|
+
early-run median, if the Wasm memory of the worker grows after the
|
|
182
|
+
first third of the churn, or if the database file grows by more than
|
|
183
|
+
10% and 64 KiB over the churn. Runs in Chromium on each change to the
|
|
184
|
+
main branch and on each pull request that is ready for review.
|
|
185
|
+
`npm run soak:web-sqlite` also runs it in Firefox and WebKit on
|
|
186
|
+
demand, without the memory and IndexedDB connection checks.
|
|
180
187
|
|
|
181
188
|
`KeyValueSignalProtocolStore` (graduated, and the gates keep running):
|
|
182
189
|
|
|
@@ -402,7 +409,7 @@ with `assertBackendConformance`.
|
|
|
402
409
|
|
|
403
410
|
## Design Notes
|
|
404
411
|
|
|
405
|
-
Reviewed: 2026-10-
|
|
412
|
+
Reviewed: 2026-10-24.
|
|
406
413
|
|
|
407
414
|
Receive records use the same encryption and transaction boundary as protocol state.
|
|
408
415
|
|
|
@@ -39,10 +39,10 @@ open (`INVALID_STATE`).
|
|
|
39
39
|
|
|
40
40
|
Options:
|
|
41
41
|
|
|
42
|
-
- `name`: the database name in OPFS
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
- `name`: the database name in OPFS, at most 224 UTF-8 bytes. It starts with
|
|
43
|
+
an ASCII letter or digit and contains only ASCII letters, digits, `.`, `_`,
|
|
44
|
+
and `-`. The `.oe2e-convert` ending is reserved. The name also identifies
|
|
45
|
+
the vault slot of the key. Default: `open-e2ee-signal-protocol.db`.
|
|
46
46
|
- `vault`: the `SignalProtocolLocalSecretVault` that holds the database key.
|
|
47
47
|
Default: the SDK's IndexedDB vault in the same origin.
|
|
48
48
|
- `encryptionAtRest`: pass `false` to store the database without encryption.
|
|
@@ -55,6 +55,21 @@ Options:
|
|
|
55
55
|
- `logger`: receives the warning of each open without encryption.
|
|
56
56
|
- `workerUrl` and `wasmUrl`: see [Content Security Policy](#content-security-policy).
|
|
57
57
|
|
|
58
|
+
The name budget reserves 18 bytes for `.open-e2ee-sqlite-` and 13 bytes for
|
|
59
|
+
the conversion ending. Thus the longest generated directory component is
|
|
60
|
+
255 bytes. This is a conservative portability contract.
|
|
61
|
+
[Filesystem documentation](https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation)
|
|
62
|
+
reports 255 as a common component limit.
|
|
63
|
+
OPFS does not specify a universal 255-byte limit.
|
|
64
|
+
|
|
65
|
+
The budget also fits the engine's 512-byte path header, including the root
|
|
66
|
+
slash, SQLite's auxiliary ending, and the terminator reserve.
|
|
67
|
+
[SQLite permits an auxiliary ending of at most 12 ASCII bytes](https://sqlite.org/c3ref/vfs.html).
|
|
68
|
+
The store checks the name before any lock, vault, worker, or OPFS access.
|
|
69
|
+
It rejects oversized inputs before encoding and uses a fixed-size encoding
|
|
70
|
+
buffer for the remaining inputs. Existing accepted names keep their file,
|
|
71
|
+
directory, lock, and vault identities.
|
|
72
|
+
|
|
58
73
|
Each store runs its own worker. Close the store with `close()`: it closes the
|
|
59
74
|
database and stops the worker. A failed open also stops its worker. Keep
|
|
60
75
|
application tables in a separate
|
|
@@ -134,8 +149,9 @@ database that does not exist leaves no directory.
|
|
|
134
149
|
|
|
135
150
|
The conversion needs the store of the name in no other tab or worker of the
|
|
136
151
|
origin. While another context has it open, the conversion fails at once with
|
|
137
|
-
`INVALID_STATE` and changes nothing.
|
|
138
|
-
|
|
152
|
+
`INVALID_STATE` and changes nothing. Every accepted database name fits its
|
|
153
|
+
conversion temporary name. A name over 224 UTF-8 bytes fails with
|
|
154
|
+
`INVALID_STATE` before any storage access.
|
|
139
155
|
|
|
140
156
|
The conversion refuses, with `INVALID_STATE`, a database that holds an
|
|
141
157
|
application table, a BLOB value, or an integer outside the safe JavaScript
|
package/package.json
CHANGED