@open-e2ee/signal-protocol-sdk 12.0.1 → 13.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 (157) hide show
  1. package/ADAPTERS.md +3 -0
  2. package/ARCHITECTURE.md +4 -4
  3. package/CHANGELOG.md +132 -0
  4. package/README.md +1 -1
  5. package/SECURITY.md +2 -2
  6. package/client/README.md +40 -0
  7. package/device/README.md +29 -3
  8. package/dist/client/client.d.ts +8 -0
  9. package/dist/client/client.d.ts.map +1 -1
  10. package/dist/client/client.js +19 -1
  11. package/dist/client/client.js.map +1 -1
  12. package/dist/client/event-hooks.d.ts +28 -0
  13. package/dist/client/event-hooks.d.ts.map +1 -1
  14. package/dist/client/event-hooks.js +1 -0
  15. package/dist/client/event-hooks.js.map +1 -1
  16. package/dist/client/group-init-status.d.ts +21 -0
  17. package/dist/client/group-init-status.d.ts.map +1 -0
  18. package/dist/client/group-init-status.js +156 -0
  19. package/dist/client/group-init-status.js.map +1 -0
  20. package/dist/client/hosted-device-link.d.ts +97 -0
  21. package/dist/client/hosted-device-link.d.ts.map +1 -0
  22. package/dist/client/hosted-device-link.js +149 -0
  23. package/dist/client/hosted-device-link.js.map +1 -0
  24. package/dist/client/hosted-http-error.d.ts +30 -0
  25. package/dist/client/hosted-http-error.d.ts.map +1 -0
  26. package/dist/client/hosted-http-error.js +34 -0
  27. package/dist/client/hosted-http-error.js.map +1 -0
  28. package/dist/client/hosted-presence.js +1 -1
  29. package/dist/client/hosted-presence.js.map +1 -1
  30. package/dist/client/hosted-profile-keys.js +1 -1
  31. package/dist/client/hosted-profile-keys.js.map +1 -1
  32. package/dist/client/hosted-sandbox-identity.d.ts +3 -3
  33. package/dist/client/hosted-sandbox-identity.js +3 -3
  34. package/dist/client/hosted-transport.d.ts +0 -11
  35. package/dist/client/hosted-transport.d.ts.map +1 -1
  36. package/dist/client/hosted-transport.js +1 -15
  37. package/dist/client/hosted-transport.js.map +1 -1
  38. package/dist/client/hosted.d.ts +53 -7
  39. package/dist/client/hosted.d.ts.map +1 -1
  40. package/dist/client/hosted.js +158 -17
  41. package/dist/client/hosted.js.map +1 -1
  42. package/dist/client/index.d.ts +2 -1
  43. package/dist/client/index.d.ts.map +1 -1
  44. package/dist/client/index.js +1 -1
  45. package/dist/client/index.js.map +1 -1
  46. package/dist/client/receive-queue.d.ts +4 -2
  47. package/dist/client/receive-queue.d.ts.map +1 -1
  48. package/dist/client/receive-queue.js +26 -22
  49. package/dist/client/receive-queue.js.map +1 -1
  50. package/dist/index.d.ts +2 -1
  51. package/dist/index.d.ts.map +1 -1
  52. package/dist/index.js +1 -1
  53. package/dist/index.js.map +1 -1
  54. package/dist/local/store/conformance/cases/ciphertext.d.ts +7 -0
  55. package/dist/local/store/conformance/cases/ciphertext.d.ts.map +1 -0
  56. package/dist/local/store/conformance/cases/ciphertext.js +55 -0
  57. package/dist/local/store/conformance/cases/ciphertext.js.map +1 -0
  58. package/dist/local/store/conformance/cases/durability.d.ts +6 -0
  59. package/dist/local/store/conformance/cases/durability.d.ts.map +1 -0
  60. package/dist/local/store/conformance/cases/durability.js +34 -0
  61. package/dist/local/store/conformance/cases/durability.js.map +1 -0
  62. package/dist/local/store/conformance/cases/identity.d.ts +7 -0
  63. package/dist/local/store/conformance/cases/identity.d.ts.map +1 -0
  64. package/dist/local/store/conformance/cases/identity.js +84 -0
  65. package/dist/local/store/conformance/cases/identity.js.map +1 -0
  66. package/dist/local/store/conformance/cases/metadata.d.ts +7 -0
  67. package/dist/local/store/conformance/cases/metadata.d.ts.map +1 -0
  68. package/dist/local/store/conformance/cases/metadata.js +48 -0
  69. package/dist/local/store/conformance/cases/metadata.js.map +1 -0
  70. package/dist/local/store/conformance/cases/protection.d.ts +7 -0
  71. package/dist/local/store/conformance/cases/protection.d.ts.map +1 -0
  72. package/dist/local/store/conformance/cases/protection.js +14 -0
  73. package/dist/local/store/conformance/cases/protection.js.map +1 -0
  74. package/dist/local/store/conformance/cases/receive-work.d.ts +8 -0
  75. package/dist/local/store/conformance/cases/receive-work.d.ts.map +1 -0
  76. package/dist/local/store/conformance/cases/receive-work.js +152 -0
  77. package/dist/local/store/conformance/cases/receive-work.js.map +1 -0
  78. package/dist/local/store/conformance/cases/sender-key.d.ts +7 -0
  79. package/dist/local/store/conformance/cases/sender-key.d.ts.map +1 -0
  80. package/dist/local/store/conformance/cases/sender-key.js +59 -0
  81. package/dist/local/store/conformance/cases/sender-key.js.map +1 -0
  82. package/dist/local/store/conformance/cases/session-trust.d.ts +7 -0
  83. package/dist/local/store/conformance/cases/session-trust.d.ts.map +1 -0
  84. package/dist/local/store/conformance/cases/session-trust.js +64 -0
  85. package/dist/local/store/conformance/cases/session-trust.js.map +1 -0
  86. package/dist/local/store/conformance/checks.d.ts +15 -0
  87. package/dist/local/store/conformance/checks.d.ts.map +1 -0
  88. package/dist/local/store/conformance/checks.js +67 -0
  89. package/dist/local/store/conformance/checks.js.map +1 -0
  90. package/dist/local/store/conformance/index.d.ts +30 -0
  91. package/dist/local/store/conformance/index.d.ts.map +1 -0
  92. package/dist/local/store/conformance/index.js +29 -0
  93. package/dist/local/store/conformance/index.js.map +1 -0
  94. package/dist/local/store/conformance/records.d.ts +36 -0
  95. package/dist/local/store/conformance/records.d.ts.map +1 -0
  96. package/dist/local/store/conformance/records.js +109 -0
  97. package/dist/local/store/conformance/records.js.map +1 -0
  98. package/dist/local/store/conformance/run.d.ts +24 -0
  99. package/dist/local/store/conformance/run.d.ts.map +1 -0
  100. package/dist/local/store/conformance/run.js +156 -0
  101. package/dist/local/store/conformance/run.js.map +1 -0
  102. package/dist/local/store/conformance/types.d.ts +55 -0
  103. package/dist/local/store/conformance/types.d.ts.map +1 -0
  104. package/dist/local/store/conformance/types.js +6 -0
  105. package/dist/local/store/conformance/types.js.map +1 -0
  106. package/dist/local/store/expo/adapter.d.ts +2 -1
  107. package/dist/local/store/expo/adapter.d.ts.map +1 -1
  108. package/dist/local/store/expo/adapter.js.map +1 -1
  109. package/dist/local/store/node/adapter.d.ts +2 -2
  110. package/dist/local/store/react-native/adapter.d.ts +2 -1
  111. package/dist/local/store/react-native/adapter.d.ts.map +1 -1
  112. package/dist/local/store/react-native/adapter.js.map +1 -1
  113. package/dist/local/store/sqlite/convert-plaintext.d.ts +62 -0
  114. package/dist/local/store/sqlite/convert-plaintext.d.ts.map +1 -0
  115. package/dist/local/store/sqlite/convert-plaintext.js +236 -0
  116. package/dist/local/store/sqlite/convert-plaintext.js.map +1 -0
  117. package/dist/local/store/sqlite/encryption.d.ts +21 -0
  118. package/dist/local/store/sqlite/encryption.d.ts.map +1 -1
  119. package/dist/local/store/sqlite/encryption.js.map +1 -1
  120. package/dist/local/store/sqlite/errors.d.ts.map +1 -1
  121. package/dist/local/store/sqlite/errors.js +2 -1
  122. package/dist/local/store/sqlite/errors.js.map +1 -1
  123. package/dist/local/store/sqlite/key-storage/identity-keys.d.ts +3 -1
  124. package/dist/local/store/sqlite/key-storage/identity-keys.d.ts.map +1 -1
  125. package/dist/local/store/sqlite/key-storage/identity-keys.js +3 -1
  126. package/dist/local/store/sqlite/key-storage/identity-keys.js.map +1 -1
  127. package/dist/local/store/sqlite/open-store.d.ts +36 -4
  128. package/dist/local/store/sqlite/open-store.d.ts.map +1 -1
  129. package/dist/local/store/sqlite/open-store.js +326 -21
  130. package/dist/local/store/sqlite/open-store.js.map +1 -1
  131. package/dist/local/store/sqlite/web/worker.d.ts +5 -0
  132. package/dist/local/store/sqlite/web/worker.d.ts.map +1 -1
  133. package/dist/local/store/sqlite/web/worker.js +99 -20
  134. package/dist/local/store/sqlite/web/worker.js.map +1 -1
  135. package/dist/local/store/web-sqlite/adapter.d.ts +3 -2
  136. package/dist/local/store/web-sqlite/adapter.d.ts.map +1 -1
  137. package/dist/local/store/web-sqlite/adapter.js +12 -2
  138. package/dist/local/store/web-sqlite/adapter.js.map +1 -1
  139. package/dist/remote/relay/types.d.ts +4 -2
  140. package/dist/remote/relay/types.d.ts.map +1 -1
  141. package/dist/types/api.d.ts +20 -4
  142. package/dist/types/api.d.ts.map +1 -1
  143. package/docs/ASSURANCE.md +25 -7
  144. package/docs/DEVIATIONS.md +35 -3
  145. package/docs/ERROR_HANDLING.md +8 -6
  146. package/docs/GETTING_STARTED.md +15 -8
  147. package/docs/INTERFACES.md +3 -1
  148. package/docs/PACKAGE_SURFACE.md +1 -0
  149. package/docs/SECURITY.md +23 -5
  150. package/keys/README.md +3 -1
  151. package/local/store/README.md +92 -12
  152. package/local/store/expo/README.md +63 -6
  153. package/local/store/key-value/README.md +3 -2
  154. package/local/store/node/README.md +68 -6
  155. package/local/store/react-native/README.md +62 -4
  156. package/local/store/web-sqlite/README.md +73 -4
  157. package/package.json +5 -1
@@ -0,0 +1,109 @@
1
+ /**
2
+ * The records that the local store conformance cases write. Each one is a
3
+ * valid value that every store accepts, and none comes from a live protocol
4
+ * run.
5
+ */
6
+ import { bytesToBase64 } from '../../../internal/crypto/utils.js';
7
+ import { ProtocolAddress } from '../../../types/address.js';
8
+ import { CURRENT_SESSION_RECORD_VERSION } from '../../../types/session.js';
9
+ import { sizedReceiveWork } from '../receive-work.js';
10
+ /**
11
+ * A text that no store writes on its own. The ciphertext scan writes it in
12
+ * values that a cipher must protect, then looks for it in the stored bytes.
13
+ */
14
+ export const PLAINTEXT_MARKER = 'local-store-conformance-plaintext-marker';
15
+ /** A 32-byte key in base64. Each seed gives a different key. */
16
+ export function testKey(seed) {
17
+ return bytesToBase64(Uint8Array.from({ length: 32 }, (_, index) => (seed + index * 13) & 0xff));
18
+ }
19
+ /** A contact identity. Each seed gives a different identity. */
20
+ export function contactIdentity(seed) {
21
+ return {
22
+ version: 1,
23
+ x25519PublicKey: testKey(seed),
24
+ ed25519PublicKey: testKey(seed + 1),
25
+ };
26
+ }
27
+ /**
28
+ * A current session record for `address`. The received message count
29
+ * tells two records apart.
30
+ */
31
+ export function sessionRecord(address, receivedMessages) {
32
+ return {
33
+ currentSession: {
34
+ baseKey: testKey(20),
35
+ localAddress: ProtocolAddress.create('conformance-local-user', 1),
36
+ remoteAddress: address,
37
+ localDeviceId: 1,
38
+ remoteDeviceId: address.deviceId,
39
+ localRegistrationId: 1,
40
+ remoteRegistrationId: 1,
41
+ RK: testKey(21),
42
+ DHs: { publicKey: testKey(22), privateKey: testKey(23) },
43
+ DHr: testKey(24),
44
+ CKs: testKey(25),
45
+ CKr: testKey(26),
46
+ Ns: 0,
47
+ Nr: receivedMessages,
48
+ PN: 0,
49
+ receiverChains: [],
50
+ identityKeyPair: {
51
+ dhKey: { publicKey: testKey(27), privateKey: testKey(28) },
52
+ signingKey: { publicKey: testKey(29), privateKey: testKey(30) },
53
+ registrationId: 1,
54
+ },
55
+ localIdentity: {
56
+ version: 1,
57
+ x25519PublicKey: testKey(27),
58
+ ed25519PublicKey: testKey(29),
59
+ },
60
+ remoteIdentity: {
61
+ version: 1,
62
+ x25519PublicKey: testKey(31),
63
+ ed25519PublicKey: testKey(32),
64
+ },
65
+ localIdentityType: 'aci',
66
+ remoteIdentityType: 'aci',
67
+ createdAt: 1_000,
68
+ lastUsedAt: 1_000,
69
+ },
70
+ archivedSessions: {},
71
+ version: CURRENT_SESSION_RECORD_VERSION,
72
+ };
73
+ }
74
+ /** The sender key ID of every sender key state of the kit. */
75
+ export const SENDER_KEY_ID = '00000000-0000-4000-8000-0000000000c1';
76
+ /** A sender key state at `chainIndex`. */
77
+ export function senderKeyState(chainIndex, chainKey = 'chain-key-' + chainIndex) {
78
+ return {
79
+ senderKeyId: SENDER_KEY_ID,
80
+ senderKeyVersion: 'v2',
81
+ chainId: 1,
82
+ generation: 0,
83
+ chainKey: chainKey,
84
+ signatureKey: 'signature-key',
85
+ publicSignatureKey: 'public-signature-key',
86
+ chainIndex: chainIndex,
87
+ createdAt: 1_000,
88
+ };
89
+ }
90
+ /** A skipped message key. Each index gives a different key. */
91
+ export function skippedMessageKey(index) {
92
+ return { cipherKey: testKey(40 + index), iv: testKey(80 + index) };
93
+ }
94
+ /** A valid receive record with its size set. Each override replaces one field. */
95
+ export function receiveWork(workId, overrides = {}) {
96
+ return sizedReceiveWork({
97
+ workId: workId,
98
+ revision: 0,
99
+ stage: 'decrypted',
100
+ origin: 'relay',
101
+ arrivalSeq: 1,
102
+ receivedAt: 1_000,
103
+ dueAt: 1_000,
104
+ sizeBytes: 0,
105
+ plaintext: 'content of ' + workId,
106
+ ...overrides,
107
+ });
108
+ }
109
+ //# sourceMappingURL=records.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"records.js","sourceRoot":"","sources":["../../../../local/store/conformance/records.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAG/D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,8BAA8B,EAAsB,MAAM,wBAAwB,CAAC;AAE5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,0CAA0C,CAAC;AAE3E,gEAAgE;AAChE,MAAM,UAAU,OAAO,CAAC,IAAY;IAClC,OAAO,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,IAAI,GAAG,KAAK,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;AAClG,CAAC;AAED,gEAAgE;AAChE,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,OAAO;QACL,OAAO,EAAE,CAAC;QACV,eAAe,EAAE,OAAO,CAAC,IAAI,CAAc;QAC3C,gBAAgB,EAAE,OAAO,CAAC,IAAI,GAAG,CAAC,CAAc;KACjD,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,OAAwB,EAAE,gBAAwB;IAC9E,OAAO;QACL,cAAc,EAAE;YACd,OAAO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YAChB,UAAU,EAAE,KAAK;SAClB;QACD,gBAAgB,EAAE,EAAE;QACpB,OAAO,EAAE,8BAA8B;KACxC,CAAC;AACJ,CAAC;AAED,8DAA8D;AAC9D,MAAM,CAAC,MAAM,aAAa,GAAG,sCAAsC,CAAC;AAEpE,0CAA0C;AAC1C,MAAM,UAAU,cAAc,CAAC,UAAkB,EAAE,QAAQ,GAAG,YAAY,GAAG,UAAU;IACrF,OAAO;QACL,WAAW,EAAE,aAAa;QAC1B,gBAAgB,EAAE,IAAI;QACtB,OAAO,EAAE,CAAC;QACV,UAAU,EAAE,CAAC;QACb,QAAQ,EAAE,QAAQ;QAClB,YAAY,EAAE,eAAe;QAC7B,kBAAkB,EAAE,sBAAsB;QAC1C,UAAU,EAAE,UAAU;QACtB,SAAS,EAAE,KAAK;KACjB,CAAC;AACJ,CAAC;AAED,+DAA+D;AAC/D,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;AACrE,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,WAAW,CACzB,MAAc,EACd,SAAS,GAA+B,EAAE;IAE1C,OAAO,gBAAgB,CAAC;QACtB,MAAM,EAAE,MAAM;QACd,QAAQ,EAAE,CAAC;QACX,KAAK,EAAE,WAAW;QAClB,MAAM,EAAE,OAAO;QACf,UAAU,EAAE,CAAC;QACb,UAAU,EAAE,KAAK;QACjB,KAAK,EAAE,KAAK;QACZ,SAAS,EAAE,CAAC;QACZ,SAAS,EAAE,aAAa,GAAG,MAAM;QACjC,GAAG,SAAS;KACb,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * The runner of the local store conformance kit. It runs each case on a
3
+ * fresh store from the application, and it reports each case as passed,
4
+ * skipped, or failed.
5
+ *
6
+ * The runner has no framework or platform dependencies, and avoids class
7
+ * syntax. It runs unchanged under jest, Node, a browser, or Hermes.
8
+ */
9
+ import type { LocalStoreConformanceOptions, LocalStoreConformanceResult } from './types.js';
10
+ /**
11
+ * Run every case of the kit on stores from `options.createStore`, and report
12
+ * the outcome without throwing. A case that needs an option that is not
13
+ * given is skipped, and so is the ciphertext case on a store that declares
14
+ * no cipher.
15
+ */
16
+ export declare function runLocalStoreConformance(options: LocalStoreConformanceOptions): Promise<LocalStoreConformanceResult>;
17
+ /**
18
+ * Run the kit, and throw with every problem listed when the store does not
19
+ * conform. A failed case is a problem. A skipped rollback case is also a
20
+ * problem, because a store must prove that its atomic commits roll back.
21
+ * This is the form for the automated checks of an application.
22
+ */
23
+ export declare function assertLocalStoreConformance(options: LocalStoreConformanceOptions): Promise<LocalStoreConformanceResult>;
24
+ //# sourceMappingURL=run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../../local/store/conformance/run.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAYH,OAAO,KAAK,EAGV,4BAA4B,EAC5B,2BAA2B,EAC5B,MAAM,SAAS,CAAC;AA6EjB;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,2BAA2B,CAAC,CA2BtC;AAED;;;;;GAKG;AACH,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,2BAA2B,CAAC,CA6BtC"}
@@ -0,0 +1,156 @@
1
+ /**
2
+ * The runner of the local store conformance kit. It runs each case on a
3
+ * fresh store from the application, and it reports each case as passed,
4
+ * skipped, or failed.
5
+ *
6
+ * The runner has no framework or platform dependencies, and avoids class
7
+ * syntax. It runs unchanged under jest, Node, a browser, or Hermes.
8
+ */
9
+ import { errorMessage } from './checks.js';
10
+ import { ciphertextCases } from './cases/ciphertext.js';
11
+ import { durabilityCases } from './cases/durability.js';
12
+ import { identityCases } from './cases/identity.js';
13
+ import { metadataCases } from './cases/metadata.js';
14
+ import { protectionCases } from './cases/protection.js';
15
+ import { receiveWorkCases } from './cases/receive-work.js';
16
+ import { senderKeyCases } from './cases/sender-key.js';
17
+ import { sessionTrustCases } from './cases/session-trust.js';
18
+ const CASES = [
19
+ ...identityCases,
20
+ ...sessionTrustCases,
21
+ ...senderKeyCases,
22
+ ...metadataCases,
23
+ ...receiveWorkCases,
24
+ ...durabilityCases,
25
+ ...ciphertextCases,
26
+ ...protectionCases,
27
+ ];
28
+ /** The name of the case that reads the protection declaration. */
29
+ const PROTECTION_CASE = protectionCases[0].name;
30
+ function missingOption(option) {
31
+ throw new Error('The case needs the ' + option + ' option.');
32
+ }
33
+ /** Run one case on a fresh store, and close that store after the case. */
34
+ async function runCase(conformanceCase, options, report) {
35
+ let current;
36
+ try {
37
+ current = await options.createStore();
38
+ }
39
+ catch (error) {
40
+ return { outcome: 'failed', message: 'createStore failed: ' + errorMessage(error) };
41
+ }
42
+ const context = {
43
+ get store() {
44
+ return current;
45
+ },
46
+ reopen: async function reopen() {
47
+ if (!options.reopen)
48
+ missingOption('reopen');
49
+ current = await options.reopen(current);
50
+ return current;
51
+ },
52
+ armWriteFailure: function armWriteFailure() {
53
+ if (!options.armWriteFailure)
54
+ missingOption('armWriteFailure');
55
+ options.armWriteFailure(current);
56
+ },
57
+ readRawBytes: function readRawBytes() {
58
+ if (!options.readRawBytes)
59
+ missingOption('readRawBytes');
60
+ return options.readRawBytes(current);
61
+ },
62
+ reportProtection: report,
63
+ };
64
+ let outcome;
65
+ try {
66
+ if (conformanceCase.applies && !conformanceCase.applies(current)) {
67
+ outcome = { outcome: 'skipped' };
68
+ }
69
+ else {
70
+ await conformanceCase.run(context);
71
+ outcome = { outcome: 'passed' };
72
+ }
73
+ }
74
+ catch (error) {
75
+ outcome = { outcome: 'failed', message: errorMessage(error) };
76
+ }
77
+ if (options.closeStore) {
78
+ try {
79
+ await options.closeStore(current);
80
+ }
81
+ catch (error) {
82
+ if (outcome.outcome !== 'failed') {
83
+ outcome = { outcome: 'failed', message: 'closeStore failed: ' + errorMessage(error) };
84
+ }
85
+ }
86
+ }
87
+ return outcome;
88
+ }
89
+ /**
90
+ * Run every case of the kit on stores from `options.createStore`, and report
91
+ * the outcome without throwing. A case that needs an option that is not
92
+ * given is skipped, and so is the ciphertext case on a store that declares
93
+ * no cipher.
94
+ */
95
+ export async function runLocalStoreConformance(options) {
96
+ const result = {
97
+ total: CASES.length,
98
+ passed: [],
99
+ skipped: [],
100
+ failures: [],
101
+ protection: null,
102
+ };
103
+ for (const conformanceCase of CASES) {
104
+ if (conformanceCase.needs && !options[conformanceCase.needs]) {
105
+ result.skipped.push(conformanceCase.name);
106
+ continue;
107
+ }
108
+ let reported = null;
109
+ const outcome = await runCase(conformanceCase, options, function report(protection) {
110
+ reported = protection;
111
+ });
112
+ if (outcome.outcome === 'failed') {
113
+ result.failures.push({ name: conformanceCase.name, message: outcome.message });
114
+ }
115
+ else if (outcome.outcome === 'skipped') {
116
+ result.skipped.push(conformanceCase.name);
117
+ }
118
+ else {
119
+ result.passed.push(conformanceCase.name);
120
+ if (conformanceCase.name === PROTECTION_CASE)
121
+ result.protection = reported;
122
+ }
123
+ }
124
+ return result;
125
+ }
126
+ /**
127
+ * Run the kit, and throw with every problem listed when the store does not
128
+ * conform. A failed case is a problem. A skipped rollback case is also a
129
+ * problem, because a store must prove that its atomic commits roll back.
130
+ * This is the form for the automated checks of an application.
131
+ */
132
+ export async function assertLocalStoreConformance(options) {
133
+ const result = await runLocalStoreConformance(options);
134
+ const lines = [];
135
+ for (const failure of result.failures) {
136
+ lines.push('- ' + failure.name + ': ' + failure.message);
137
+ }
138
+ for (const conformanceCase of CASES) {
139
+ if (conformanceCase.needs === 'armWriteFailure' &&
140
+ result.skipped.indexOf(conformanceCase.name) !== -1) {
141
+ lines.push('- ' +
142
+ conformanceCase.name +
143
+ ': skipped. Give armWriteFailure, so that the rollback of an atomic commit can run.');
144
+ }
145
+ }
146
+ if (lines.length > 0) {
147
+ throw new Error('Local store conformance failed (' +
148
+ lines.length +
149
+ ' of ' +
150
+ result.total +
151
+ ' cases):\n' +
152
+ lines.join('\n'));
153
+ }
154
+ return result;
155
+ }
156
+ //# sourceMappingURL=run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.js","sourceRoot":"","sources":["../../../../local/store/conformance/run.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAQ1D,MAAM,KAAK,GAAyC;IAClD,GAAG,aAAa;IAChB,GAAG,iBAAiB;IACpB,GAAG,cAAc;IACjB,GAAG,aAAa;IAChB,GAAG,gBAAgB;IACnB,GAAG,eAAe;IAClB,GAAG,eAAe;IAClB,GAAG,eAAe;CACnB,CAAC;AAEF,kEAAkE;AAClE,MAAM,eAAe,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAEhD,SAAS,aAAa,CAAC,MAAc;IACnC,MAAM,IAAI,KAAK,CAAC,qBAAqB,GAAG,MAAM,GAAG,UAAU,CAAC,CAAC;AAC/D,CAAC;AAKD,0EAA0E;AAC1E,KAAK,UAAU,OAAO,CACpB,eAA0C,EAC1C,OAAqC,EACrC,MAAkD;IAElD,IAAI,OAAiC,CAAC;IACtC,IAAI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,CACb,kCAAkC;YAChC,KAAK,CAAC,MAAM;YACZ,MAAM;YACN,MAAM,CAAC,KAAK;YACZ,YAAY;YACZ,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CACnB,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * The options, the result, and the case shape of the local store
3
+ * conformance kit.
4
+ */
5
+ import type { LocalStoreProtection, SignalProtocolLocalStore } from '../../../types/api.js';
6
+ export interface LocalStoreConformanceOptions {
7
+ /** A fresh, empty store for each case. */
8
+ createStore(): Promise<SignalProtocolLocalStore>;
9
+ /** Close and open the same store. Durability cases skip without it. */
10
+ reopen?(store: SignalProtocolLocalStore): Promise<SignalProtocolLocalStore>;
11
+ /** Make the next atomic commit fail after its first write. Atomic cases skip without it. */
12
+ armWriteFailure?(store: SignalProtocolLocalStore): void;
13
+ /** The stored bytes. The ciphertext scan skips without it. */
14
+ readRawBytes?(store: SignalProtocolLocalStore): Promise<Uint8Array[]>;
15
+ /** Release a store after its case. */
16
+ closeStore?(store: SignalProtocolLocalStore): Promise<void>;
17
+ }
18
+ export interface LocalStoreConformanceFailure {
19
+ name: string;
20
+ message: string;
21
+ }
22
+ export interface LocalStoreConformanceResult {
23
+ /** Number of cases in the kit, including skipped ones. */
24
+ total: number;
25
+ passed: string[];
26
+ skipped: string[];
27
+ failures: LocalStoreConformanceFailure[];
28
+ /** The declaration of the store, as the protection declaration case reads it. Null when that case fails. */
29
+ protection: LocalStoreProtection | null;
30
+ }
31
+ /**
32
+ * The store of one case and the optional hooks of the application. A
33
+ * reopen replaces `store`.
34
+ */
35
+ export interface LocalStoreConformanceContext {
36
+ readonly store: SignalProtocolLocalStore;
37
+ /** Close the store and open it again. The new store replaces `store`. */
38
+ reopen(): Promise<SignalProtocolLocalStore>;
39
+ /** Make the next atomic commit of `store` fail after its first write. */
40
+ armWriteFailure(): void;
41
+ /** The bytes that `store` keeps. */
42
+ readRawBytes(): Promise<Uint8Array[]>;
43
+ /** Put the protection declaration of the store in the result. */
44
+ reportProtection(protection: LocalStoreProtection): void;
45
+ }
46
+ /** One named case of the kit. */
47
+ export interface LocalStoreConformanceCase {
48
+ name: string;
49
+ /** The option that the case needs. The case is skipped without it. */
50
+ needs?: 'reopen' | 'armWriteFailure' | 'readRawBytes';
51
+ /** Tell whether the case applies to the store. The case is skipped when it does not. */
52
+ applies?(store: SignalProtocolLocalStore): boolean;
53
+ run(context: LocalStoreConformanceContext): Promise<void>;
54
+ }
55
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../local/store/conformance/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAEzF,MAAM,WAAW,4BAA4B;IAC3C,0CAA0C;IAC1C,WAAW,IAAI,OAAO,CAAC,wBAAwB,CAAC,CAAC;IACjD,uEAAuE;IACvE,MAAM,CAAC,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;IAC5E,4FAA4F;IAC5F,eAAe,CAAC,CAAC,KAAK,EAAE,wBAAwB,GAAG,IAAI,CAAC;IACxD,8DAA8D;IAC9D,YAAY,CAAC,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;IACtE,sCAAsC;IACtC,UAAU,CAAC,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7D;AAED,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,2BAA2B;IAC1C,0DAA0D;IAC1D,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,EAAE,4BAA4B,EAAE,CAAC;IACzC,4GAA4G;IAC5G,UAAU,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACzC;AAED;;;GAGG;AACH,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,KAAK,EAAE,wBAAwB,CAAC;IACzC,yEAAyE;IACzE,MAAM,IAAI,OAAO,CAAC,wBAAwB,CAAC,CAAC;IAC5C,yEAAyE;IACzE,eAAe,IAAI,IAAI,CAAC;IACxB,oCAAoC;IACpC,YAAY,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;IACtC,iEAAiE;IACjE,gBAAgB,CAAC,UAAU,EAAE,oBAAoB,GAAG,IAAI,CAAC;CAC1D;AAED,iCAAiC;AACjC,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,KAAK,CAAC,EAAE,QAAQ,GAAG,iBAAiB,GAAG,cAAc,CAAC;IACtD,wFAAwF;IACxF,OAAO,CAAC,CAAC,KAAK,EAAE,wBAAwB,GAAG,OAAO,CAAC;IACnD,GAAG,CAAC,OAAO,EAAE,4BAA4B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3D"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The options, the result, and the case shape of the local store
3
+ * conformance kit.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../local/store/conformance/types.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -13,7 +13,8 @@ export interface ExpoSignalProtocolStoreOptions extends SqliteOpenOptions {
13
13
  /**
14
14
  * The database file name in the expo-sqlite default directory. It also
15
15
  * names the vault slot of the database key. Letters, digits, `.`, `_`, and
16
- * `-` only. Default: `open-e2ee-signal-protocol.db`.
16
+ * `-` only, and no `.oe2e-convert` ending. Default:
17
+ * `open-e2ee-signal-protocol.db`.
17
18
  */
18
19
  readonly name?: string;
19
20
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../../local/store/expo/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAwB,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AAE/F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAQ7D,OAAO,EACL,yBAAyB,EAE1B,MAAM,iBAAiB,CAAC;AAMzB,MAAM,WAAW,8BAA+B,SAAQ,iBAAiB;IACvE;;;;OAIG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,8BAA8B,CAAC;CACjD;AAyBD,kEAAkE;AAClE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,uBAAuB,GAAG,kBAAkB,CAIpF;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,uBAAwB,SAAQ,yBAAyB;IACpE,OAAO,eAON;IAuBD;;;OAGG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAErB;CACF;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,SAAS,CACvB,OAAO,GAAE,8BAAmC,GAC3C,OAAO,CAAC,uBAAuB,CAAC,CAElC;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,OAAO,GAAE,8BAAmC,GAC3C,OAAO,CAAC,uBAAuB,CAAC,CAElC"}
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../../local/store/expo/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAwB,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AAE/F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAs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CAC5B,OAAO,GAAmC,EAAE;IAE5C,OAAO,uBAAuB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAChD,CAAC"}
@@ -18,8 +18,8 @@ export interface NodeSignalProtocolStoreOptions extends SqliteOpenOptions {
18
18
  readonly directory: string;
19
19
  /**
20
20
  * The database file name in `directory`. Letters, digits, `.`, `_`, and
21
- * `-` only, and no `.lock`, `-wal`, `-shm`, or `-journal` ending. Default:
22
- * `open-e2ee-signal-protocol.db`.
21
+ * `-` only, and no `.lock`, `-wal`, `-shm`, `-journal`, or `.oe2e-convert`
22
+ * ending. Default: `open-e2ee-signal-protocol.db`.
23
23
  */
24
24
  readonly name?: string;
25
25
  /**
@@ -13,7 +13,8 @@ export interface ReactNativeSignalProtocolStoreOptions extends SqliteOpenOptions
13
13
  /**
14
14
  * The database file name in the op-sqlite default location. It also names
15
15
  * the vault slot of the database key. Letters, digits, `.`, `_`, and `-`
16
- * only. Default: `open-e2ee-signal-protocol.db`.
16
+ * only, and no `.oe2e-convert` ending. Default:
17
+ * `open-e2ee-signal-protocol.db`.
17
18
  */
18
19
  readonly name?: string;
19
20
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../../local/store/react-native/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAwB,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AAE/F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAQ7D,OAAO,EACL,yBAAyB,EAE1B,MAAM,iBAAiB,CAAC;AAKzB,MAAM,WAAW,qCAAsC,SAAQ,iBAAiB;IAC9E;;;;OAIG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,8BAA8B,CAAC;CACjD;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O,CAAC,CAAC;AACvD,CAAC"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * The data side of the conversion of a plaintext SQLite store to an encrypted
3
+ * one.
4
+ *
5
+ * The open in `./open-store` owns the steps, the keys, and the recovery. This
6
+ * module checks a plaintext database before the first write. It also copies
7
+ * the schema and the rows of one database into another in one transaction.
8
+ * The driver seam has no rename, attach, or export, so the copy is the only
9
+ * path, and it runs the same way on every driver.
10
+ *
11
+ * The copy keeps every row, its rowid, the `sqlite_sequence` counters, and
12
+ * `PRAGMA user_version`. Only SDK tables are copied. A driver value is a
13
+ * string, a number, or null, so a BLOB value or an integer outside the safe
14
+ * JavaScript range cannot pass through the copy. The check refuses them
15
+ * before anything is written.
16
+ */
17
+ import type { SqliteDriver, SqliteExecutor } from './driver.js';
18
+ import { type SqliteRootExecutor } from './executor.js';
19
+ /**
20
+ * The name ending of the temporary file of a conversion. The core refuses a
21
+ * store name with this ending, so no store shares the file.
22
+ */
23
+ export declare const SQLITE_CONVERT_SUFFIX = ".oe2e-convert";
24
+ /** The temporary file of the conversion of the store `name`. */
25
+ export declare function sqliteConvertTempName(name: string): string;
26
+ /**
27
+ * Open the plaintext database `file` with no key, and check that the copy
28
+ * can keep all of it. The open writes nothing. On a failure, it closes the
29
+ * database before it throws.
30
+ *
31
+ * @throws EncryptionError with `INVALID_STATE` when the database holds no SDK
32
+ * schema, holds a table that is not an SDK table, or holds a BLOB value or
33
+ * an unsafe integer.
34
+ * @throws SqliteSchemaTooNewError when a newer SDK wrote the database.
35
+ * @throws SqliteStoreInUseError when another connection holds the file.
36
+ */
37
+ export declare function openSqliteConversionSource(driver: SqliteDriver, file: string): Promise<SqliteRootExecutor>;
38
+ /**
39
+ * Copy the schema and the rows of `source` into the empty database `target`,
40
+ * in one `BEGIN IMMEDIATE` transaction on `target`.
41
+ *
42
+ * The order is: the tables, their rows page by page in rowid order, the
43
+ * `sqlite_sequence` counters, the other schema objects in creation order, and
44
+ * `PRAGMA user_version` last. Indexes and triggers come after the rows, so no
45
+ * trigger runs on a copied row. Foreign keys are off on `target`, so the
46
+ * table order does not matter. The transaction checks the row count of each
47
+ * table, and a difference rolls it back.
48
+ *
49
+ * @throws EncryptionError with `INVALID_STATE` when a table of `target` has
50
+ * another row count than the same table of `source`.
51
+ */
52
+ export declare function copySqliteDatabase(source: SqliteExecutor, target: SqliteRootExecutor): Promise<void>;
53
+ /**
54
+ * Open the existing file `file` with `key`, read its `PRAGMA user_version`,
55
+ * and close it. The read writes nothing. Return `null` when the key does not
56
+ * open the file. Call it only for a file that exists, because a driver
57
+ * creates a file that it opens.
58
+ *
59
+ * @throws SqliteStoreInUseError when another connection holds the file.
60
+ */
61
+ export declare function readSqliteUserVersion(driver: SqliteDriver, file: string, key: Uint8Array): Promise<number | null>;
62
+ //# sourceMappingURL=convert-plaintext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convert-plaintext.d.ts","sourceRoot":"","sources":["../../../../local/store/sqlite/convert-plaintext.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAA0B,MAAM,UAAU,CAAC;AAErF,OAAO,EAAwB,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAI3E;;;GAGG;AACH,eAAO,MAAM,qBAAqB,kBAAkB,CAAC;AAErD,gEAAgE;AAChE,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE1D;AAwDD;;;;;;;;;;GAUG;AACH,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,YAAY,EACpB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,kBAAkB,CAAC,CAgB7B;AAyDD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,IAAI,CAAC,CA6Bf;AAqCD;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,YAAY,EACpB,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAexB"}