@open-e2ee/signal-protocol-sdk 7.2.0 → 8.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 (688) hide show
  1. package/ADAPTERS.md +54 -7
  2. package/ARCHITECTURE.md +1 -0
  3. package/CHANGELOG.md +503 -0
  4. package/README.md +9 -5
  5. package/SECURITY.md +2 -2
  6. package/THIRD_PARTY_NOTICES.md +429 -0
  7. package/client/README.md +1 -2
  8. package/device/README.md +50 -19
  9. package/dist/client/client.d.ts +31 -5
  10. package/dist/client/client.d.ts.map +1 -1
  11. package/dist/client/client.js +149 -90
  12. package/dist/client/client.js.map +1 -1
  13. package/dist/client/event-hooks.d.ts.map +1 -1
  14. package/dist/client/event-hooks.js +2 -0
  15. package/dist/client/event-hooks.js.map +1 -1
  16. package/dist/client/files.d.ts.map +1 -1
  17. package/dist/client/files.js +19 -2
  18. package/dist/client/files.js.map +1 -1
  19. package/dist/client/headless.d.ts +1 -1
  20. package/dist/client/headless.js +1 -1
  21. package/dist/client/hosted-anonymous-delivery.d.ts.map +1 -1
  22. package/dist/client/hosted-anonymous-delivery.js +2 -1
  23. package/dist/client/hosted-anonymous-delivery.js.map +1 -1
  24. package/dist/client/hosted-connection.d.ts +1 -1
  25. package/dist/client/hosted-connection.d.ts.map +1 -1
  26. package/dist/client/hosted-connection.js +8 -12
  27. package/dist/client/hosted-connection.js.map +1 -1
  28. package/dist/client/hosted-group-authority.d.ts.map +1 -1
  29. package/dist/client/hosted-group-authority.js +2 -1
  30. package/dist/client/hosted-group-authority.js.map +1 -1
  31. package/dist/client/hosted-groups.d.ts.map +1 -1
  32. package/dist/client/hosted-groups.js +2 -1
  33. package/dist/client/hosted-groups.js.map +1 -1
  34. package/dist/client/hosted-push.d.ts.map +1 -1
  35. package/dist/client/hosted-push.js +2 -1
  36. package/dist/client/hosted-push.js.map +1 -1
  37. package/dist/client/hosted-transport.d.ts.map +1 -1
  38. package/dist/client/hosted-transport.js +10 -11
  39. package/dist/client/hosted-transport.js.map +1 -1
  40. package/dist/client/hosted-trust.d.ts +11 -11
  41. package/dist/client/hosted-trust.d.ts.map +1 -1
  42. package/dist/client/hosted-trust.js +12 -12
  43. package/dist/client/hosted-trust.js.map +1 -1
  44. package/dist/client/messages.d.ts.map +1 -1
  45. package/dist/client/messages.js +6 -1
  46. package/dist/client/messages.js.map +1 -1
  47. package/dist/client/multi-device.d.ts.map +1 -1
  48. package/dist/client/multi-device.js +2 -1
  49. package/dist/client/multi-device.js.map +1 -1
  50. package/dist/client/relay-work.d.ts +30 -0
  51. package/dist/client/relay-work.d.ts.map +1 -0
  52. package/dist/client/relay-work.js +189 -0
  53. package/dist/client/relay-work.js.map +1 -0
  54. package/dist/client/retry.d.ts.map +1 -1
  55. package/dist/client/retry.js +2 -0
  56. package/dist/client/retry.js.map +1 -1
  57. package/dist/client/sessions.d.ts.map +1 -1
  58. package/dist/client/sessions.js +3 -0
  59. package/dist/client/sessions.js.map +1 -1
  60. package/dist/client/signal-service-cipher.d.ts +19 -11
  61. package/dist/client/signal-service-cipher.d.ts.map +1 -1
  62. package/dist/client/signal-service-cipher.js +48 -46
  63. package/dist/client/signal-service-cipher.js.map +1 -1
  64. package/dist/client/state.d.ts +8 -0
  65. package/dist/client/state.d.ts.map +1 -1
  66. package/dist/client/state.js +11 -0
  67. package/dist/client/state.js.map +1 -1
  68. package/dist/device/connection.d.ts +1 -1
  69. package/dist/device/connection.d.ts.map +1 -1
  70. package/dist/device/connection.js +4 -11
  71. package/dist/device/connection.js.map +1 -1
  72. package/dist/device/device-id.d.ts +10 -4
  73. package/dist/device/device-id.d.ts.map +1 -1
  74. package/dist/device/device-id.js +15 -9
  75. package/dist/device/device-id.js.map +1 -1
  76. package/dist/device/device-name-crypto.d.ts.map +1 -1
  77. package/dist/device/device-name-crypto.js +2 -2
  78. package/dist/device/device-name-crypto.js.map +1 -1
  79. package/dist/device/expo/index.d.ts +25 -8
  80. package/dist/device/expo/index.d.ts.map +1 -1
  81. package/dist/device/expo/index.js +58 -8
  82. package/dist/device/expo/index.js.map +1 -1
  83. package/dist/device/index.d.ts +2 -2
  84. package/dist/device/index.d.ts.map +1 -1
  85. package/dist/device/index.js +3 -2
  86. package/dist/device/index.js.map +1 -1
  87. package/dist/device/lifecycle/index.d.ts +4 -2
  88. package/dist/device/lifecycle/index.d.ts.map +1 -1
  89. package/dist/device/lifecycle/index.js.map +1 -1
  90. package/dist/device/lifecycle/manager.d.ts +12 -14
  91. package/dist/device/lifecycle/manager.d.ts.map +1 -1
  92. package/dist/device/lifecycle/manager.js +52 -97
  93. package/dist/device/lifecycle/manager.js.map +1 -1
  94. package/dist/device/lifecycle/types.d.ts +26 -16
  95. package/dist/device/lifecycle/types.d.ts.map +1 -1
  96. package/dist/device/lifecycle/utils.d.ts +8 -4
  97. package/dist/device/lifecycle/utils.d.ts.map +1 -1
  98. package/dist/device/lifecycle/utils.js +12 -16
  99. package/dist/device/lifecycle/utils.js.map +1 -1
  100. package/dist/device/provisioning.d.ts.map +1 -1
  101. package/dist/device/provisioning.js +6 -8
  102. package/dist/device/provisioning.js.map +1 -1
  103. package/dist/device/react-native/index.d.ts +40 -0
  104. package/dist/device/react-native/index.d.ts.map +1 -0
  105. package/dist/device/react-native/index.js +74 -0
  106. package/dist/device/react-native/index.js.map +1 -0
  107. package/dist/device/transfer.d.ts +15 -7
  108. package/dist/device/transfer.d.ts.map +1 -1
  109. package/dist/device/transfer.js +30 -22
  110. package/dist/device/transfer.js.map +1 -1
  111. package/dist/device/types.d.ts +15 -7
  112. package/dist/device/types.d.ts.map +1 -1
  113. package/dist/device/types.js.map +1 -1
  114. package/dist/device/vault-text.d.ts +13 -0
  115. package/dist/device/vault-text.d.ts.map +1 -0
  116. package/dist/device/vault-text.js +17 -0
  117. package/dist/device/vault-text.js.map +1 -0
  118. package/dist/index.d.ts +9 -5
  119. package/dist/index.d.ts.map +1 -1
  120. package/dist/index.js +9 -5
  121. package/dist/index.js.map +1 -1
  122. package/dist/internal/crypto/index.d.ts +3 -3
  123. package/dist/internal/crypto/index.d.ts.map +1 -1
  124. package/dist/internal/crypto/index.js +3 -3
  125. package/dist/internal/crypto/index.js.map +1 -1
  126. package/dist/internal/crypto/random-host.d.ts +1 -1
  127. package/dist/internal/crypto/random-host.d.ts.map +1 -1
  128. package/dist/internal/crypto/random-host.js +3 -2
  129. package/dist/internal/crypto/random-host.js.map +1 -1
  130. package/dist/internal/crypto/random-host.native.d.ts +6 -1
  131. package/dist/internal/crypto/random-host.native.d.ts.map +1 -1
  132. package/dist/internal/crypto/random-host.native.js +14 -10
  133. package/dist/internal/crypto/random-host.native.js.map +1 -1
  134. package/dist/internal/crypto/random-host.node.d.ts +1 -1
  135. package/dist/internal/crypto/random-host.node.d.ts.map +1 -1
  136. package/dist/internal/crypto/random-host.node.js +1 -1
  137. package/dist/internal/crypto/random-host.node.js.map +1 -1
  138. package/dist/internal/crypto/random.d.ts +12 -3
  139. package/dist/internal/crypto/random.d.ts.map +1 -1
  140. package/dist/internal/crypto/random.js +14 -3
  141. package/dist/internal/crypto/random.js.map +1 -1
  142. package/dist/internal/crypto/utils.d.ts.map +1 -1
  143. package/dist/internal/crypto/utils.js +10 -6
  144. package/dist/internal/crypto/utils.js.map +1 -1
  145. package/dist/internal/encoding/proto/primitives.d.ts +2 -0
  146. package/dist/internal/encoding/proto/primitives.d.ts.map +1 -1
  147. package/dist/internal/encoding/proto/primitives.js +2 -1
  148. package/dist/internal/encoding/proto/primitives.js.map +1 -1
  149. package/dist/internal/encoding/proto/signal-message.d.ts +1 -0
  150. package/dist/internal/encoding/proto/signal-message.d.ts.map +1 -1
  151. package/dist/internal/encoding/proto/signal-message.js +2 -1
  152. package/dist/internal/encoding/proto/signal-message.js.map +1 -1
  153. package/dist/internal/groups/authority-certificate.d.ts.map +1 -1
  154. package/dist/internal/groups/authority-certificate.js +2 -1
  155. package/dist/internal/groups/authority-certificate.js.map +1 -1
  156. package/dist/internal/groups/encrypted-state.d.ts.map +1 -1
  157. package/dist/internal/groups/encrypted-state.js +9 -7
  158. package/dist/internal/groups/encrypted-state.js.map +1 -1
  159. package/dist/internal/groups/invite-link.d.ts.map +1 -1
  160. package/dist/internal/groups/invite-link.js +2 -1
  161. package/dist/internal/groups/invite-link.js.map +1 -1
  162. package/dist/internal/groups/manager.d.ts.map +1 -1
  163. package/dist/internal/groups/manager.js +5 -5
  164. package/dist/internal/groups/manager.js.map +1 -1
  165. package/dist/internal/groups/sdk-store.d.ts.map +1 -1
  166. package/dist/internal/groups/sdk-store.js +4 -3
  167. package/dist/internal/groups/sdk-store.js.map +1 -1
  168. package/dist/internal/groups/server-engine.d.ts +6 -1
  169. package/dist/internal/groups/server-engine.d.ts.map +1 -1
  170. package/dist/internal/groups/server-engine.js +11 -15
  171. package/dist/internal/groups/server-engine.js.map +1 -1
  172. package/dist/internal/groups/wire.d.ts.map +1 -1
  173. package/dist/internal/groups/wire.js +2 -1
  174. package/dist/internal/groups/wire.js.map +1 -1
  175. package/dist/internal/platform/blob.d.ts +10 -0
  176. package/dist/internal/platform/blob.d.ts.map +1 -0
  177. package/dist/internal/platform/blob.js +30 -0
  178. package/dist/internal/platform/blob.js.map +1 -0
  179. package/dist/internal/platform/env.d.ts +13 -0
  180. package/dist/internal/platform/env.d.ts.map +1 -0
  181. package/dist/internal/platform/env.js +17 -0
  182. package/dist/internal/platform/env.js.map +1 -0
  183. package/dist/internal/platform/index.d.ts +5 -0
  184. package/dist/internal/platform/index.d.ts.map +1 -0
  185. package/dist/internal/platform/index.js +5 -0
  186. package/dist/internal/platform/index.js.map +1 -0
  187. package/dist/internal/platform/url.d.ts +72 -0
  188. package/dist/internal/platform/url.d.ts.map +1 -0
  189. package/dist/internal/platform/url.js +275 -0
  190. package/dist/internal/platform/url.js.map +1 -0
  191. package/dist/internal/platform/utf8.d.ts +28 -0
  192. package/dist/internal/platform/utf8.d.ts.map +1 -0
  193. package/dist/internal/platform/utf8.js +167 -0
  194. package/dist/internal/platform/utf8.js.map +1 -0
  195. package/dist/internal/protocol/sealed-sender/delivery-token.d.ts +1 -1
  196. package/dist/internal/protocol/sealed-sender/delivery-token.d.ts.map +1 -1
  197. package/dist/internal/protocol/sealed-sender/delivery-token.js +5 -10
  198. package/dist/internal/protocol/sealed-sender/delivery-token.js.map +1 -1
  199. package/dist/internal/protocol/sealed-sender/proto/index.d.ts.map +1 -1
  200. package/dist/internal/protocol/sealed-sender/proto/index.js +2 -4
  201. package/dist/internal/protocol/sealed-sender/proto/index.js.map +1 -1
  202. package/dist/internal/protocol/sender-keys/manager.d.ts.map +1 -1
  203. package/dist/internal/protocol/sender-keys/manager.js +4 -3
  204. package/dist/internal/protocol/sender-keys/manager.js.map +1 -1
  205. package/dist/internal/protocol/spqr/ml-kem-braid/noble-pq/index.d.ts +4 -4
  206. package/dist/internal/protocol/spqr/ml-kem-braid/noble-pq/index.d.ts.map +1 -1
  207. package/dist/internal/protocol/spqr/ml-kem-braid/noble-pq/index.js +8 -10
  208. package/dist/internal/protocol/spqr/ml-kem-braid/noble-pq/index.js.map +1 -1
  209. package/dist/internal/protocol/username/hash.d.ts.map +1 -1
  210. package/dist/internal/protocol/username/hash.js +18 -3
  211. package/dist/internal/protocol/username/hash.js.map +1 -1
  212. package/dist/internal/protocol/username/link.d.ts.map +1 -1
  213. package/dist/internal/protocol/username/link.js +2 -1
  214. package/dist/internal/protocol/username/link.js.map +1 -1
  215. package/dist/internal/protocol/username/proof.d.ts.map +1 -1
  216. package/dist/internal/protocol/username/proof.js +2 -1
  217. package/dist/internal/protocol/username/proof.js.map +1 -1
  218. package/dist/internal/sesame/device-registry.d.ts +16 -3
  219. package/dist/internal/sesame/device-registry.d.ts.map +1 -1
  220. package/dist/internal/sesame/device-registry.js +10 -7
  221. package/dist/internal/sesame/device-registry.js.map +1 -1
  222. package/dist/internal/sesame/index.d.ts +1 -1
  223. package/dist/internal/sesame/index.d.ts.map +1 -1
  224. package/dist/internal/sesame/manager.d.ts.map +1 -1
  225. package/dist/internal/sesame/manager.js +3 -2
  226. package/dist/internal/sesame/manager.js.map +1 -1
  227. package/dist/internal/session/index.d.ts +1 -2
  228. package/dist/internal/session/index.d.ts.map +1 -1
  229. package/dist/internal/session/index.js +1 -1
  230. package/dist/internal/session/index.js.map +1 -1
  231. package/dist/internal/session/validation.d.ts +0 -80
  232. package/dist/internal/session/validation.d.ts.map +1 -1
  233. package/dist/internal/session/validation.js +0 -134
  234. package/dist/internal/session/validation.js.map +1 -1
  235. package/dist/local/store/device-record.d.ts +18 -0
  236. package/dist/local/store/device-record.d.ts.map +1 -0
  237. package/dist/local/store/device-record.js +34 -0
  238. package/dist/local/store/device-record.js.map +1 -0
  239. package/dist/local/store/expo/adapter.d.ts +59 -238
  240. package/dist/local/store/expo/adapter.d.ts.map +1 -1
  241. package/dist/local/store/expo/adapter.js +83 -640
  242. package/dist/local/store/expo/adapter.js.map +1 -1
  243. package/dist/local/store/expo/driver.d.ts +16 -0
  244. package/dist/local/store/expo/driver.d.ts.map +1 -0
  245. package/dist/local/store/expo/driver.js +141 -0
  246. package/dist/local/store/expo/driver.js.map +1 -0
  247. package/dist/local/store/expo/index.d.ts +3 -12
  248. package/dist/local/store/expo/index.d.ts.map +1 -1
  249. package/dist/local/store/expo/index.js +1 -8
  250. package/dist/local/store/expo/index.js.map +1 -1
  251. package/dist/local/store/expo/maintenance.d.ts +3 -2
  252. package/dist/local/store/expo/maintenance.d.ts.map +1 -1
  253. package/dist/local/store/expo/maintenance.js +5 -34
  254. package/dist/local/store/expo/maintenance.js.map +1 -1
  255. package/dist/local/store/index.d.ts +10 -5
  256. package/dist/local/store/index.d.ts.map +1 -1
  257. package/dist/local/store/index.js +10 -5
  258. package/dist/local/store/index.js.map +1 -1
  259. package/dist/local/store/key-value/adapter.d.ts +326 -0
  260. package/dist/local/store/key-value/adapter.d.ts.map +1 -0
  261. package/dist/local/store/key-value/adapter.js +1472 -0
  262. package/dist/local/store/key-value/adapter.js.map +1 -0
  263. package/dist/local/store/{react-native → key-value}/backend-conformance.d.ts +6 -6
  264. package/dist/local/store/key-value/backend-conformance.d.ts.map +1 -0
  265. package/dist/local/store/{react-native → key-value}/backend-conformance.js +3 -3
  266. package/dist/local/store/key-value/backend-conformance.js.map +1 -0
  267. package/dist/local/store/key-value/batch.d.ts +41 -0
  268. package/dist/local/store/key-value/batch.d.ts.map +1 -0
  269. package/dist/local/store/key-value/batch.js +77 -0
  270. package/dist/local/store/key-value/batch.js.map +1 -0
  271. package/dist/local/store/key-value/device-record.d.ts +23 -0
  272. package/dist/local/store/key-value/device-record.d.ts.map +1 -0
  273. package/dist/local/store/key-value/device-record.js +33 -0
  274. package/dist/local/store/key-value/device-record.js.map +1 -0
  275. package/dist/local/store/key-value/index.d.ts +24 -0
  276. package/dist/local/store/key-value/index.d.ts.map +1 -0
  277. package/dist/local/store/key-value/index.js +8 -0
  278. package/dist/local/store/key-value/index.js.map +1 -0
  279. package/dist/local/store/key-value/realm/index.d.ts +83 -0
  280. package/dist/local/store/key-value/realm/index.d.ts.map +1 -0
  281. package/dist/local/store/key-value/realm/index.js +102 -0
  282. package/dist/local/store/key-value/realm/index.js.map +1 -0
  283. package/dist/local/store/{react-native → key-value}/storage.d.ts +6 -6
  284. package/dist/local/store/key-value/storage.d.ts.map +1 -0
  285. package/dist/local/store/key-value/storage.js.map +1 -0
  286. package/dist/local/store/key-value/transactional-backend.d.ts +50 -0
  287. package/dist/local/store/key-value/transactional-backend.d.ts.map +1 -0
  288. package/dist/local/store/key-value/transactional-backend.js +90 -0
  289. package/dist/local/store/key-value/transactional-backend.js.map +1 -0
  290. package/dist/local/store/key-value/value-key.d.ts +34 -0
  291. package/dist/local/store/key-value/value-key.d.ts.map +1 -0
  292. package/dist/local/store/key-value/value-key.js +83 -0
  293. package/dist/local/store/key-value/value-key.js.map +1 -0
  294. package/dist/local/store/memory/adapter.d.ts +8 -0
  295. package/dist/local/store/memory/adapter.d.ts.map +1 -1
  296. package/dist/local/store/memory/adapter.js +60 -75
  297. package/dist/local/store/memory/adapter.js.map +1 -1
  298. package/dist/local/store/node/adapter.d.ts +74 -130
  299. package/dist/local/store/node/adapter.d.ts.map +1 -1
  300. package/dist/local/store/node/adapter.js +83 -727
  301. package/dist/local/store/node/adapter.js.map +1 -1
  302. package/dist/local/store/node/index.d.ts +8 -6
  303. package/dist/local/store/node/index.d.ts.map +1 -1
  304. package/dist/local/store/node/index.js +3 -7
  305. package/dist/local/store/node/index.js.map +1 -1
  306. package/dist/local/store/node/maintenance.d.ts +5 -0
  307. package/dist/local/store/node/maintenance.d.ts.map +1 -0
  308. package/dist/local/store/node/maintenance.js +7 -0
  309. package/dist/local/store/node/maintenance.js.map +1 -0
  310. package/dist/local/store/node/owner-lock.d.ts +26 -0
  311. package/dist/local/store/node/owner-lock.d.ts.map +1 -0
  312. package/dist/local/store/node/owner-lock.js +88 -0
  313. package/dist/local/store/node/owner-lock.js.map +1 -0
  314. package/dist/local/store/react-native/adapter.d.ts +63 -274
  315. package/dist/local/store/react-native/adapter.d.ts.map +1 -1
  316. package/dist/local/store/react-native/adapter.js +80 -1406
  317. package/dist/local/store/react-native/adapter.js.map +1 -1
  318. package/dist/local/store/react-native/index.d.ts +7 -19
  319. package/dist/local/store/react-native/index.d.ts.map +1 -1
  320. package/dist/local/store/react-native/index.js +2 -7
  321. package/dist/local/store/react-native/index.js.map +1 -1
  322. package/dist/local/store/react-native/maintenance.d.ts +5 -0
  323. package/dist/local/store/react-native/maintenance.d.ts.map +1 -0
  324. package/dist/local/store/react-native/maintenance.js +7 -0
  325. package/dist/local/store/react-native/maintenance.js.map +1 -0
  326. package/dist/local/store/sqlite/better-sqlite3-multiple-ciphers-driver.d.ts +38 -0
  327. package/dist/local/store/sqlite/better-sqlite3-multiple-ciphers-driver.d.ts.map +1 -0
  328. package/dist/local/store/sqlite/better-sqlite3-multiple-ciphers-driver.js +196 -0
  329. package/dist/local/store/sqlite/better-sqlite3-multiple-ciphers-driver.js.map +1 -0
  330. package/dist/local/store/sqlite/database.d.ts +20 -0
  331. package/dist/local/store/sqlite/database.d.ts.map +1 -0
  332. package/dist/local/store/sqlite/database.js +41 -0
  333. package/dist/local/store/sqlite/database.js.map +1 -0
  334. package/dist/local/store/sqlite/driver.d.ts +138 -0
  335. package/dist/local/store/sqlite/driver.d.ts.map +1 -0
  336. package/dist/local/store/sqlite/driver.js +10 -0
  337. package/dist/local/store/sqlite/driver.js.map +1 -0
  338. package/dist/local/store/sqlite/encryption.d.ts +61 -0
  339. package/dist/local/store/sqlite/encryption.d.ts.map +1 -0
  340. package/dist/local/store/sqlite/encryption.js +98 -0
  341. package/dist/local/store/sqlite/encryption.js.map +1 -0
  342. package/dist/local/store/sqlite/errors.d.ts +70 -0
  343. package/dist/local/store/sqlite/errors.d.ts.map +1 -0
  344. package/dist/local/store/sqlite/errors.js +101 -0
  345. package/dist/local/store/sqlite/errors.js.map +1 -0
  346. package/dist/local/store/sqlite/executor.d.ts +22 -0
  347. package/dist/local/store/sqlite/executor.d.ts.map +1 -0
  348. package/dist/local/store/sqlite/executor.js +129 -0
  349. package/dist/local/store/sqlite/executor.js.map +1 -0
  350. package/dist/local/store/sqlite/index.d.ts +20 -0
  351. package/dist/local/store/sqlite/index.d.ts.map +1 -0
  352. package/dist/local/store/sqlite/index.js +18 -0
  353. package/dist/local/store/sqlite/index.js.map +1 -0
  354. package/dist/local/store/sqlite/key-storage/account.d.ts +45 -0
  355. package/dist/local/store/sqlite/key-storage/account.d.ts.map +1 -0
  356. package/dist/local/store/sqlite/key-storage/account.js +125 -0
  357. package/dist/local/store/sqlite/key-storage/account.js.map +1 -0
  358. package/dist/local/store/sqlite/key-storage/contact-identities.d.ts +19 -0
  359. package/dist/local/store/sqlite/key-storage/contact-identities.d.ts.map +1 -0
  360. package/dist/local/store/sqlite/key-storage/contact-identities.js +85 -0
  361. package/dist/local/store/sqlite/key-storage/contact-identities.js.map +1 -0
  362. package/dist/local/store/sqlite/key-storage/context.d.ts +19 -0
  363. package/dist/local/store/sqlite/key-storage/context.d.ts.map +1 -0
  364. package/dist/local/store/sqlite/key-storage/context.js +18 -0
  365. package/dist/local/store/sqlite/key-storage/context.js.map +1 -0
  366. package/dist/local/store/sqlite/key-storage/identity-keys.d.ts +18 -0
  367. package/dist/local/store/sqlite/key-storage/identity-keys.d.ts.map +1 -0
  368. package/dist/local/store/sqlite/key-storage/identity-keys.js +88 -0
  369. package/dist/local/store/sqlite/key-storage/identity-keys.js.map +1 -0
  370. package/dist/local/store/sqlite/key-storage/index.d.ts +108 -0
  371. package/dist/local/store/sqlite/key-storage/index.d.ts.map +1 -0
  372. package/dist/local/store/sqlite/key-storage/index.js +241 -0
  373. package/dist/local/store/sqlite/key-storage/index.js.map +1 -0
  374. package/dist/local/store/sqlite/key-storage/message-records.d.ts +41 -0
  375. package/dist/local/store/sqlite/key-storage/message-records.d.ts.map +1 -0
  376. package/dist/local/store/sqlite/key-storage/message-records.js +133 -0
  377. package/dist/local/store/sqlite/key-storage/message-records.js.map +1 -0
  378. package/dist/local/store/sqlite/key-storage/metadata.d.ts +16 -0
  379. package/dist/local/store/sqlite/key-storage/metadata.d.ts.map +1 -0
  380. package/dist/local/store/sqlite/key-storage/metadata.js +53 -0
  381. package/dist/local/store/sqlite/key-storage/metadata.js.map +1 -0
  382. package/dist/local/store/sqlite/key-storage/one-time-prekeys.d.ts +36 -0
  383. package/dist/local/store/sqlite/key-storage/one-time-prekeys.d.ts.map +1 -0
  384. package/dist/local/store/sqlite/key-storage/one-time-prekeys.js +129 -0
  385. package/dist/local/store/sqlite/key-storage/one-time-prekeys.js.map +1 -0
  386. package/dist/local/store/sqlite/key-storage/session-trust.d.ts +10 -0
  387. package/dist/local/store/sqlite/key-storage/session-trust.d.ts.map +1 -0
  388. package/dist/local/store/sqlite/key-storage/session-trust.js +88 -0
  389. package/dist/local/store/sqlite/key-storage/session-trust.js.map +1 -0
  390. package/dist/local/store/sqlite/key-storage/sessions.d.ts +50 -0
  391. package/dist/local/store/sqlite/key-storage/sessions.d.ts.map +1 -0
  392. package/dist/local/store/sqlite/key-storage/sessions.js +209 -0
  393. package/dist/local/store/sqlite/key-storage/sessions.js.map +1 -0
  394. package/dist/local/store/sqlite/key-storage/signed-prekeys.d.ts +69 -0
  395. package/dist/local/store/sqlite/key-storage/signed-prekeys.d.ts.map +1 -0
  396. package/dist/local/store/sqlite/key-storage/signed-prekeys.js +219 -0
  397. package/dist/local/store/sqlite/key-storage/signed-prekeys.js.map +1 -0
  398. package/dist/local/store/sqlite/maintenance.d.ts +7 -0
  399. package/dist/local/store/sqlite/maintenance.d.ts.map +1 -0
  400. package/dist/local/store/sqlite/maintenance.js +32 -0
  401. package/dist/local/store/sqlite/maintenance.js.map +1 -0
  402. package/dist/local/store/sqlite/migrations.d.ts +31 -0
  403. package/dist/local/store/sqlite/migrations.d.ts.map +1 -0
  404. package/dist/local/store/sqlite/migrations.js +232 -0
  405. package/dist/local/store/sqlite/migrations.js.map +1 -0
  406. package/dist/local/store/{expo → sqlite}/models/ec-one-time-prekey.d.ts +17 -22
  407. package/dist/local/store/sqlite/models/ec-one-time-prekey.d.ts.map +1 -0
  408. package/dist/local/store/{expo → sqlite}/models/ec-one-time-prekey.js +61 -99
  409. package/dist/local/store/sqlite/models/ec-one-time-prekey.js.map +1 -0
  410. package/dist/local/store/{expo → sqlite}/models/ec-signed-prekey.d.ts +22 -25
  411. package/dist/local/store/sqlite/models/ec-signed-prekey.d.ts.map +1 -0
  412. package/dist/local/store/{expo → sqlite}/models/ec-signed-prekey.js +82 -128
  413. package/dist/local/store/sqlite/models/ec-signed-prekey.js.map +1 -0
  414. package/dist/local/store/sqlite/models/identity-key-id.d.ts.map +1 -0
  415. package/dist/local/store/sqlite/models/identity-key-id.js.map +1 -0
  416. package/dist/local/store/{expo → sqlite}/models/index.d.ts +5 -5
  417. package/dist/local/store/sqlite/models/index.d.ts.map +1 -0
  418. package/dist/local/store/{expo → sqlite}/models/index.js +12 -5
  419. package/dist/local/store/sqlite/models/index.js.map +1 -0
  420. package/dist/local/store/{expo → sqlite}/models/kyber-one-time-prekey.d.ts +17 -20
  421. package/dist/local/store/sqlite/models/kyber-one-time-prekey.d.ts.map +1 -0
  422. package/dist/local/store/{expo → sqlite}/models/kyber-one-time-prekey.js +65 -105
  423. package/dist/local/store/sqlite/models/kyber-one-time-prekey.js.map +1 -0
  424. package/dist/local/store/{expo → sqlite}/models/kyber-prekey-used.d.ts +3 -3
  425. package/dist/local/store/sqlite/models/kyber-prekey-used.d.ts.map +1 -0
  426. package/dist/local/store/{expo → sqlite}/models/kyber-prekey-used.js +13 -25
  427. package/dist/local/store/sqlite/models/kyber-prekey-used.js.map +1 -0
  428. package/dist/local/store/{expo → sqlite}/models/kyber-prekey.d.ts +16 -19
  429. package/dist/local/store/sqlite/models/kyber-prekey.d.ts.map +1 -0
  430. package/dist/local/store/{expo → sqlite}/models/kyber-prekey.js +67 -111
  431. package/dist/local/store/sqlite/models/kyber-prekey.js.map +1 -0
  432. package/dist/local/store/sqlite/models/local-identity.d.ts +51 -0
  433. package/dist/local/store/sqlite/models/local-identity.d.ts.map +1 -0
  434. package/dist/local/store/sqlite/models/local-identity.js +150 -0
  435. package/dist/local/store/sqlite/models/local-identity.js.map +1 -0
  436. package/dist/local/store/{expo → sqlite}/models/message-record.d.ts +15 -44
  437. package/dist/local/store/sqlite/models/message-record.d.ts.map +1 -0
  438. package/dist/local/store/{expo → sqlite}/models/message-record.js +43 -109
  439. package/dist/local/store/sqlite/models/message-record.js.map +1 -0
  440. package/dist/local/store/sqlite/models/recipient-identity.d.ts +21 -0
  441. package/dist/local/store/sqlite/models/recipient-identity.d.ts.map +1 -0
  442. package/dist/local/store/sqlite/models/recipient-identity.js +59 -0
  443. package/dist/local/store/sqlite/models/recipient-identity.js.map +1 -0
  444. package/dist/local/store/sqlite/models/replaced-prekeys.d.ts +23 -0
  445. package/dist/local/store/sqlite/models/replaced-prekeys.d.ts.map +1 -0
  446. package/dist/local/store/sqlite/models/replaced-prekeys.js +42 -0
  447. package/dist/local/store/sqlite/models/replaced-prekeys.js.map +1 -0
  448. package/dist/local/store/{expo → sqlite}/models/sender-key.d.ts +22 -23
  449. package/dist/local/store/sqlite/models/sender-key.d.ts.map +1 -0
  450. package/dist/local/store/{expo → sqlite}/models/sender-key.js +66 -94
  451. package/dist/local/store/sqlite/models/sender-key.js.map +1 -0
  452. package/dist/local/store/sqlite/models/sesame-user-record.d.ts +32 -0
  453. package/dist/local/store/sqlite/models/sesame-user-record.d.ts.map +1 -0
  454. package/dist/local/store/sqlite/models/sesame-user-record.js +78 -0
  455. package/dist/local/store/sqlite/models/sesame-user-record.js.map +1 -0
  456. package/dist/local/store/{expo → sqlite}/models/session.d.ts +24 -20
  457. package/dist/local/store/sqlite/models/session.d.ts.map +1 -0
  458. package/dist/local/store/{expo → sqlite}/models/session.js +54 -72
  459. package/dist/local/store/sqlite/models/session.js.map +1 -0
  460. package/dist/local/store/sqlite/models/skipped-sender-key.d.ts +24 -0
  461. package/dist/local/store/sqlite/models/skipped-sender-key.d.ts.map +1 -0
  462. package/dist/local/store/sqlite/models/skipped-sender-key.js +62 -0
  463. package/dist/local/store/sqlite/models/skipped-sender-key.js.map +1 -0
  464. package/dist/local/store/sqlite/op-sqlite-driver.d.ts +14 -0
  465. package/dist/local/store/sqlite/op-sqlite-driver.d.ts.map +1 -0
  466. package/dist/local/store/sqlite/op-sqlite-driver.js +180 -0
  467. package/dist/local/store/sqlite/op-sqlite-driver.js.map +1 -0
  468. package/dist/local/store/sqlite/open-store.d.ts +83 -0
  469. package/dist/local/store/sqlite/open-store.d.ts.map +1 -0
  470. package/dist/local/store/sqlite/open-store.js +177 -0
  471. package/dist/local/store/sqlite/open-store.js.map +1 -0
  472. package/dist/local/store/sqlite/schema.d.ts +102 -0
  473. package/dist/local/store/sqlite/schema.d.ts.map +1 -0
  474. package/dist/local/store/sqlite/schema.js +61 -0
  475. package/dist/local/store/sqlite/schema.js.map +1 -0
  476. package/dist/local/store/sqlite/store.d.ts +199 -0
  477. package/dist/local/store/sqlite/store.d.ts.map +1 -0
  478. package/dist/local/store/sqlite/store.js +494 -0
  479. package/dist/local/store/sqlite/store.js.map +1 -0
  480. package/dist/local/store/sqlite/web/driver.d.ts +50 -0
  481. package/dist/local/store/sqlite/web/driver.d.ts.map +1 -0
  482. package/dist/local/store/sqlite/web/driver.js +169 -0
  483. package/dist/local/store/sqlite/web/driver.js.map +1 -0
  484. package/dist/local/store/sqlite/web/protocol.d.ts +80 -0
  485. package/dist/local/store/sqlite/web/protocol.d.ts.map +1 -0
  486. package/dist/local/store/sqlite/web/protocol.js +13 -0
  487. package/dist/local/store/sqlite/web/protocol.js.map +1 -0
  488. package/dist/local/store/sqlite/web/sqlite3mc/sqlite3.mjs +14526 -0
  489. package/dist/local/store/sqlite/web/sqlite3mc/sqlite3.wasm +0 -0
  490. package/dist/local/store/sqlite/web/worker.d.ts +36 -0
  491. package/dist/local/store/sqlite/web/worker.d.ts.map +1 -0
  492. package/dist/local/store/sqlite/web/worker.js +616 -0
  493. package/dist/local/store/sqlite/web/worker.js.map +1 -0
  494. package/dist/local/store/web/adapter.d.ts +5 -14
  495. package/dist/local/store/web/adapter.d.ts.map +1 -1
  496. package/dist/local/store/web/adapter.js +119 -106
  497. package/dist/local/store/web/adapter.js.map +1 -1
  498. package/dist/local/store/web/device-record.d.ts +23 -0
  499. package/dist/local/store/web/device-record.d.ts.map +1 -0
  500. package/dist/local/store/web/device-record.js +31 -0
  501. package/dist/local/store/web/device-record.js.map +1 -0
  502. package/dist/local/store/web-sqlite/adapter.d.ts +98 -0
  503. package/dist/local/store/web-sqlite/adapter.d.ts.map +1 -0
  504. package/dist/local/store/web-sqlite/adapter.js +151 -0
  505. package/dist/local/store/web-sqlite/adapter.js.map +1 -0
  506. package/dist/local/store/web-sqlite/index.d.ts +14 -0
  507. package/dist/local/store/web-sqlite/index.d.ts.map +1 -0
  508. package/dist/local/store/web-sqlite/index.js +3 -0
  509. package/dist/local/store/web-sqlite/index.js.map +1 -0
  510. package/dist/local/store/web-sqlite/maintenance.d.ts +5 -0
  511. package/dist/local/store/web-sqlite/maintenance.d.ts.map +1 -0
  512. package/dist/local/store/web-sqlite/maintenance.js +7 -0
  513. package/dist/local/store/web-sqlite/maintenance.js.map +1 -0
  514. package/dist/local/store/web-sqlite/store-locks.d.ts +33 -0
  515. package/dist/local/store/web-sqlite/store-locks.d.ts.map +1 -0
  516. package/dist/local/store/web-sqlite/store-locks.js +60 -0
  517. package/dist/local/store/web-sqlite/store-locks.js.map +1 -0
  518. package/dist/local/vault/electron-safe-storage.d.ts +45 -0
  519. package/dist/local/vault/electron-safe-storage.d.ts.map +1 -0
  520. package/dist/local/vault/electron-safe-storage.js +212 -0
  521. package/dist/local/vault/electron-safe-storage.js.map +1 -0
  522. package/dist/local/vault/index.d.ts +4 -2
  523. package/dist/local/vault/index.d.ts.map +1 -1
  524. package/dist/local/vault/indexed-db.d.ts +37 -0
  525. package/dist/local/vault/indexed-db.d.ts.map +1 -0
  526. package/dist/local/vault/indexed-db.js +102 -0
  527. package/dist/local/vault/indexed-db.js.map +1 -0
  528. package/dist/local/vault/react-native-keychain.d.ts +12 -0
  529. package/dist/local/vault/react-native-keychain.d.ts.map +1 -0
  530. package/dist/local/vault/react-native-keychain.js +71 -0
  531. package/dist/local/vault/react-native-keychain.js.map +1 -0
  532. package/dist/local/vault/require.d.ts +10 -0
  533. package/dist/local/vault/require.d.ts.map +1 -0
  534. package/dist/local/vault/require.js +16 -0
  535. package/dist/local/vault/require.js.map +1 -0
  536. package/dist/logger.d.ts.map +1 -1
  537. package/dist/logger.js +2 -1
  538. package/dist/logger.js.map +1 -1
  539. package/dist/media/index.d.ts.map +1 -1
  540. package/dist/media/index.js +2 -1
  541. package/dist/media/index.js.map +1 -1
  542. package/dist/profile/contact-state.d.ts.map +1 -1
  543. package/dist/profile/contact-state.js +2 -4
  544. package/dist/profile/contact-state.js.map +1 -1
  545. package/dist/profile/index.d.ts +0 -1
  546. package/dist/profile/index.d.ts.map +1 -1
  547. package/dist/profile/index.js +0 -2
  548. package/dist/profile/index.js.map +1 -1
  549. package/dist/profile/profile-key.d.ts +16 -11
  550. package/dist/profile/profile-key.d.ts.map +1 -1
  551. package/dist/profile/profile-key.js +29 -29
  552. package/dist/profile/profile-key.js.map +1 -1
  553. package/dist/profile/update-service.d.ts +6 -0
  554. package/dist/profile/update-service.d.ts.map +1 -1
  555. package/dist/profile/update-service.js +3 -1
  556. package/dist/profile/update-service.js.map +1 -1
  557. package/dist/remote/object-store/validation.d.ts.map +1 -1
  558. package/dist/remote/object-store/validation.js +2 -1
  559. package/dist/remote/object-store/validation.js.map +1 -1
  560. package/dist/remote/relay/memory/adapter.d.ts +2 -3
  561. package/dist/remote/relay/memory/adapter.d.ts.map +1 -1
  562. package/dist/remote/relay/memory/adapter.js +22 -30
  563. package/dist/remote/relay/memory/adapter.js.map +1 -1
  564. package/dist/remote/relay/memory/failures.d.ts.map +1 -1
  565. package/dist/remote/relay/memory/failures.js +2 -1
  566. package/dist/remote/relay/memory/failures.js.map +1 -1
  567. package/dist/remote/relay/memory/group-server.d.ts +5 -1
  568. package/dist/remote/relay/memory/group-server.d.ts.map +1 -1
  569. package/dist/remote/relay/memory/group-server.js +11 -1
  570. package/dist/remote/relay/memory/group-server.js.map +1 -1
  571. package/dist/safety/url.d.ts.map +1 -1
  572. package/dist/safety/url.js +21 -26
  573. package/dist/safety/url.js.map +1 -1
  574. package/dist/types/api.d.ts +15 -2
  575. package/dist/types/api.d.ts.map +1 -1
  576. package/dist/types/errors.d.ts +97 -1
  577. package/dist/types/errors.d.ts.map +1 -1
  578. package/dist/types/errors.js +105 -1
  579. package/dist/types/errors.js.map +1 -1
  580. package/dist/types/session.d.ts.map +1 -1
  581. package/dist/types/session.js +2 -1
  582. package/dist/types/session.js.map +1 -1
  583. package/dist/utils/retry.d.ts +2 -0
  584. package/dist/utils/retry.d.ts.map +1 -1
  585. package/dist/utils/retry.js +4 -2
  586. package/dist/utils/retry.js.map +1 -1
  587. package/docs/ASSURANCE.md +80 -8
  588. package/docs/CLIENT_COMPOSITION.md +1 -2
  589. package/docs/DEVIATIONS.md +1 -1
  590. package/docs/ERROR_HANDLING.md +6 -0
  591. package/docs/GETTING_STARTED.md +1 -2
  592. package/docs/PACKAGE_SURFACE.md +29 -11
  593. package/docs/RECIPES.md +1 -2
  594. package/examples/browser/index.html +1 -1
  595. package/local/store/README.md +117 -37
  596. package/local/store/expo/README.md +67 -47
  597. package/local/store/key-value/README.md +278 -0
  598. package/local/store/node/README.md +206 -46
  599. package/local/store/react-native/README.md +120 -61
  600. package/local/store/web/README.md +9 -0
  601. package/local/store/web-sqlite/README.md +202 -0
  602. package/local/vault/README.md +115 -2
  603. package/package.json +42 -23
  604. package/profile/README.md +9 -11
  605. package/remote/README.md +1 -2
  606. package/dist/local/store/expo/database-key.d.ts +0 -142
  607. package/dist/local/store/expo/database-key.d.ts.map +0 -1
  608. package/dist/local/store/expo/database-key.js +0 -312
  609. package/dist/local/store/expo/database-key.js.map +0 -1
  610. package/dist/local/store/expo/db.d.ts +0 -95
  611. package/dist/local/store/expo/db.d.ts.map +0 -1
  612. package/dist/local/store/expo/db.js +0 -147
  613. package/dist/local/store/expo/db.js.map +0 -1
  614. package/dist/local/store/expo/key-storage.d.ts +0 -429
  615. package/dist/local/store/expo/key-storage.d.ts.map +0 -1
  616. package/dist/local/store/expo/key-storage.js +0 -1361
  617. package/dist/local/store/expo/key-storage.js.map +0 -1
  618. package/dist/local/store/expo/models/ec-one-time-prekey.d.ts.map +0 -1
  619. package/dist/local/store/expo/models/ec-one-time-prekey.js.map +0 -1
  620. package/dist/local/store/expo/models/ec-signed-prekey.d.ts.map +0 -1
  621. package/dist/local/store/expo/models/ec-signed-prekey.js.map +0 -1
  622. package/dist/local/store/expo/models/identity-key-id.d.ts.map +0 -1
  623. package/dist/local/store/expo/models/identity-key-id.js.map +0 -1
  624. package/dist/local/store/expo/models/index.d.ts.map +0 -1
  625. package/dist/local/store/expo/models/index.js.map +0 -1
  626. package/dist/local/store/expo/models/kyber-one-time-prekey.d.ts.map +0 -1
  627. package/dist/local/store/expo/models/kyber-one-time-prekey.js.map +0 -1
  628. package/dist/local/store/expo/models/kyber-prekey-used.d.ts.map +0 -1
  629. package/dist/local/store/expo/models/kyber-prekey-used.js.map +0 -1
  630. package/dist/local/store/expo/models/kyber-prekey.d.ts.map +0 -1
  631. package/dist/local/store/expo/models/kyber-prekey.js.map +0 -1
  632. package/dist/local/store/expo/models/local-identity.d.ts +0 -52
  633. package/dist/local/store/expo/models/local-identity.d.ts.map +0 -1
  634. package/dist/local/store/expo/models/local-identity.js +0 -166
  635. package/dist/local/store/expo/models/local-identity.js.map +0 -1
  636. package/dist/local/store/expo/models/message-record.d.ts.map +0 -1
  637. package/dist/local/store/expo/models/message-record.js.map +0 -1
  638. package/dist/local/store/expo/models/recipient-identity.d.ts +0 -21
  639. package/dist/local/store/expo/models/recipient-identity.d.ts.map +0 -1
  640. package/dist/local/store/expo/models/recipient-identity.js +0 -66
  641. package/dist/local/store/expo/models/recipient-identity.js.map +0 -1
  642. package/dist/local/store/expo/models/replaced-prekey-utils.d.ts +0 -33
  643. package/dist/local/store/expo/models/replaced-prekey-utils.d.ts.map +0 -1
  644. package/dist/local/store/expo/models/replaced-prekey-utils.js +0 -54
  645. package/dist/local/store/expo/models/replaced-prekey-utils.js.map +0 -1
  646. package/dist/local/store/expo/models/sender-key.d.ts.map +0 -1
  647. package/dist/local/store/expo/models/sender-key.js.map +0 -1
  648. package/dist/local/store/expo/models/session.d.ts.map +0 -1
  649. package/dist/local/store/expo/models/session.js.map +0 -1
  650. package/dist/local/store/expo/schema.d.ts +0 -1917
  651. package/dist/local/store/expo/schema.d.ts.map +0 -1
  652. package/dist/local/store/expo/schema.js +0 -197
  653. package/dist/local/store/expo/schema.js.map +0 -1
  654. package/dist/local/store/node/database-encryption.d.ts +0 -109
  655. package/dist/local/store/node/database-encryption.d.ts.map +0 -1
  656. package/dist/local/store/node/database-encryption.js +0 -202
  657. package/dist/local/store/node/database-encryption.js.map +0 -1
  658. package/dist/local/store/node/database-file-commit.d.ts +0 -8
  659. package/dist/local/store/node/database-file-commit.d.ts.map +0 -1
  660. package/dist/local/store/node/database-file-commit.js +0 -62
  661. package/dist/local/store/node/database-file-commit.js.map +0 -1
  662. package/dist/local/store/node/database-key.d.ts +0 -129
  663. package/dist/local/store/node/database-key.d.ts.map +0 -1
  664. package/dist/local/store/node/database-key.js +0 -293
  665. package/dist/local/store/node/database-key.js.map +0 -1
  666. package/dist/local/store/node/database-lock.d.ts +0 -8
  667. package/dist/local/store/node/database-lock.d.ts.map +0 -1
  668. package/dist/local/store/node/database-lock.js +0 -44
  669. package/dist/local/store/node/database-lock.js.map +0 -1
  670. package/dist/local/store/node/database.d.ts +0 -226
  671. package/dist/local/store/node/database.d.ts.map +0 -1
  672. package/dist/local/store/node/database.js +0 -813
  673. package/dist/local/store/node/database.js.map +0 -1
  674. package/dist/local/store/react-native/backend-conformance.d.ts.map +0 -1
  675. package/dist/local/store/react-native/backend-conformance.js.map +0 -1
  676. package/dist/local/store/react-native/reference-backend.d.ts +0 -43
  677. package/dist/local/store/react-native/reference-backend.d.ts.map +0 -1
  678. package/dist/local/store/react-native/reference-backend.js +0 -178
  679. package/dist/local/store/react-native/reference-backend.js.map +0 -1
  680. package/dist/local/store/react-native/storage.d.ts.map +0 -1
  681. package/dist/local/store/react-native/storage.js.map +0 -1
  682. package/dist/profile/storage.d.ts +0 -61
  683. package/dist/profile/storage.d.ts.map +0 -1
  684. package/dist/profile/storage.js +0 -145
  685. package/dist/profile/storage.js.map +0 -1
  686. /package/dist/local/store/{react-native → key-value}/storage.js +0 -0
  687. /package/dist/local/store/{expo → sqlite}/models/identity-key-id.d.ts +0 -0
  688. /package/dist/local/store/{expo → sqlite}/models/identity-key-id.js +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../local/store/expo/schema.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,QAAQ;;;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O,mBAAmB,CAAC,YAAY,CAAC;AAC5E,MAAM,MAAM,OAAO,GAAG,OAAO,QAAQ,CAAC,YAAY,CAAC;AACnD,MAAM,MAAM,UAAU,GAAG,OAAO,QAAQ,CAAC,YAAY,CAAC;AACtD,MAAM,MAAM,SAAS,GAAG,OAAO,UAAU,CAAC,YAAY,CAAC;AACvD,MAAM,MAAM,YAAY,GAAG,OAAO,UAAU,CAAC,YAAY,CAAC;AAC1D,MAAM,MAAM,mBAAmB,GAAG,OAAO,iBAAiB,CAAC,YAAY,CAAC;AACxE,MAAM,MAAM,sBAAsB,GAAG,OAAO,iBAAiB,CAAC,YAAY,CAAC;AAC3E,MAAM,MAAM,aAAa,GAAG,OAAO,cAAc,CAAC,YAAY,CAAC;AAC/D,MAAM,MAAM,gBAAgB,GAAG,OAAO,cAAc,CAAC,YAAY,CAAC;AAClE,MAAM,MAAM,iBAAiB,GAAG,OAAO,eAAe,CAAC,YAAY,CAAC;AACpE,MAAM,MAAM,oBAAoB,GAAG,OAAO,eAAe,CAAC,YAAY,CAAC;AACvE,MAAM,MAAM,kBAAkB,GAAG,OAAO,eAAe,CAAC,YAAY,CAAC;AACrE,MAAM,MAAM,qBAAqB,GAAG,OAAO,eAAe,CAAC,YAAY,CAAC;AACxE,MAAM,MAAM,sBAAsB,GAAG,OAAO,mBAAmB,CAAC,YAAY,CAAC;AAC7E,MAAM,MAAM,yBAAyB,GAAG,OAAO,mBAAmB,CAAC,YAAY,CAAC"}
@@ -1,197 +0,0 @@
1
- import { index, integer, primaryKey, sqliteTable, text, uniqueIndex, } from 'drizzle-orm/sqlite-core';
2
- import { sql } from 'drizzle-orm';
3
- export const metadata = sqliteTable('metadata', {
4
- key: text('key').primaryKey(),
5
- value: text('value').notNull(),
6
- updatedAt: integer('updated_at').notNull(),
7
- });
8
- /**
9
- * SDK-managed SQLite schema fragment for Expo local storage.
10
- *
11
- * The app's unified Drizzle schema composes these tables, but the table
12
- * definitions themselves live with the Signal Protocol storage implementation.
13
- */
14
- export const profileKeys = sqliteTable('profile_keys', {
15
- userId: text('user_id').primaryKey(),
16
- profileKey: text('profile_key').notNull(),
17
- profileKeyVersion: integer('profile_key_version').notNull().default(1),
18
- receivedAt: integer('received_at').notNull(),
19
- updatedAt: integer('updated_at').notNull(),
20
- }, (table) => [index('idx_profile_keys_version').on(table.profileKeyVersion)]);
21
- export const identityKeys = sqliteTable('identity_keys', {
22
- id: text('id').primaryKey(),
23
- identityType: text('identity_type').notNull().default('aci'),
24
- publicKey: text('public_key').notNull(),
25
- registrationId: integer('registration_id'),
26
- dhPublicKey: text('dh_public_key'),
27
- dhPrivateKey: text('dh_private_key'),
28
- signingPublicKey: text('signing_public_key'),
29
- signingPrivateKey: text('signing_private_key'),
30
- createdAt: integer('created_at').notNull(),
31
- updatedAt: integer('updated_at').notNull(),
32
- });
33
- export const recipientIdentities = sqliteTable('recipient_identities', {
34
- recipientId: text('recipient_id').primaryKey(),
35
- identityType: text('identity_type').notNull(),
36
- /** JSON ContactIdentityRecord. No independently authoritative commitment. */
37
- recordJson: text('record_json').notNull(),
38
- updatedAt: integer('updated_at').notNull(),
39
- }, (table) => [index('idx_recipient_identities_updated').on(table.updatedAt)]);
40
- export const ecSignedPreKeys = sqliteTable('ec_signed_prekeys', {
41
- id: integer('id').primaryKey({ autoIncrement: true }),
42
- identityType: text('identity_type').notNull().default('aci'),
43
- prekeyId: integer('prekey_id').notNull(),
44
- publicKey: text('public_key').notNull(),
45
- privateKey: text('private_key').notNull(),
46
- signature: text('signature').notNull(),
47
- timestamp: integer('timestamp').notNull(),
48
- createdAt: integer('created_at').notNull(),
49
- replacedAt: integer('replaced_at'),
50
- }, (table) => [
51
- uniqueIndex('ec_signed_prekey_identity').on(table.identityType, table.prekeyId),
52
- index('idx_ec_signed_prekeys_timestamp').on(table.timestamp),
53
- ]);
54
- export const ecOneTimePreKeys = sqliteTable('ec_one_time_prekeys', {
55
- id: integer('id').primaryKey({ autoIncrement: true }),
56
- identityType: text('identity_type').notNull().default('aci'),
57
- prekeyId: integer('prekey_id').notNull(),
58
- publicKey: text('public_key').notNull(),
59
- privateKey: text('private_key').notNull(),
60
- createdAt: integer('created_at').notNull(),
61
- replacedAt: integer('replaced_at'),
62
- }, (table) => [uniqueIndex('ec_one_time_prekey_identity').on(table.identityType, table.prekeyId)]);
63
- export const kyberPreKeys = sqliteTable('kyber_prekeys', {
64
- id: integer('id').primaryKey({ autoIncrement: true }),
65
- instanceId: text('instance_id').notNull(),
66
- identityType: text('identity_type').notNull().default('aci'),
67
- prekeyId: integer('prekey_id').notNull(),
68
- publicKey: text('public_key').notNull(),
69
- privateKey: text('private_key').notNull(),
70
- signature: text('signature'),
71
- timestamp: integer('timestamp').notNull(),
72
- createdAt: integer('created_at').notNull(),
73
- replacedAt: integer('replaced_at'),
74
- }, (table) => [
75
- uniqueIndex('kyber_prekey_instance').on(table.instanceId),
76
- uniqueIndex('kyber_prekey_identity').on(table.identityType, table.prekeyId),
77
- uniqueIndex('kyber_prekey_current_identity')
78
- .on(table.identityType)
79
- .where(sql `${table.replacedAt} IS NULL`),
80
- index('idx_kyber_prekeys_timestamp').on(table.timestamp),
81
- ]);
82
- export const kyberPreKeyUsed = sqliteTable('kyber_prekey_used', {
83
- kyberPreKeyRowId: integer('kyber_prekey_row_id')
84
- .notNull()
85
- .references(() => kyberPreKeys.id, { onDelete: 'cascade', onUpdate: 'cascade' }),
86
- signedPreKeyIdentity: text('signed_prekey_identity').notNull(),
87
- signedPreKeyId: integer('signed_prekey_id').notNull(),
88
- baseKey: text('base_key').notNull(),
89
- }, (table) => [
90
- primaryKey({
91
- columns: [
92
- table.kyberPreKeyRowId,
93
- table.signedPreKeyIdentity,
94
- table.signedPreKeyId,
95
- table.baseKey,
96
- ],
97
- }),
98
- ]);
99
- export const kyberOneTimePreKeys = sqliteTable('kyber_one_time_prekeys', {
100
- id: integer('id').primaryKey({ autoIncrement: true }),
101
- identityType: text('identity_type').notNull().default('aci'),
102
- prekeyId: integer('prekey_id').notNull(),
103
- publicKey: text('public_key').notNull(),
104
- privateKey: text('private_key').notNull(),
105
- signature: text('signature').notNull(),
106
- timestamp: integer('timestamp').notNull(),
107
- createdAt: integer('created_at').notNull(),
108
- replacedAt: integer('replaced_at'),
109
- }, (table) => [
110
- uniqueIndex('kyber_one_time_prekey_identity').on(table.identityType, table.prekeyId),
111
- index('idx_kyber_one_time_prekeys_created').on(table.createdAt),
112
- ]);
113
- export const sessions = sqliteTable('sessions', {
114
- sessionId: text('session_id').primaryKey(),
115
- identityType: text('identity_type').notNull().default('aci'),
116
- record: text('record').notNull(),
117
- createdAt: integer('created_at').notNull(),
118
- updatedAt: integer('updated_at').notNull(),
119
- }, (table) => [
120
- index('idx_sessions_updated').on(table.updatedAt),
121
- index('idx_sessions_identity_type').on(table.identityType),
122
- ]);
123
- /**
124
- * Sender key state for group messaging.
125
- *
126
- * `record` holds the whole `SenderKeyState[]` as JSON, current state first,
127
- * then the superseded states that the rotation window still needs. One column
128
- * rather than one per field, so a row can never disagree with itself about
129
- * which state is current.
130
- *
131
- * The chain key and the sender's private signature key live in this column.
132
- * They are stored in the clear because the database file itself is
133
- * SQLCipher-encrypted with an application-supplied key. They must never leave
134
- * the device.
135
- */
136
- export const senderKeys = sqliteTable('sender_keys', {
137
- groupId: text('group_id').notNull(),
138
- senderId: text('sender_id').notNull(),
139
- deviceId: integer('device_id').notNull(),
140
- record: text('record').notNull(),
141
- createdAt: integer('created_at').notNull(),
142
- updatedAt: integer('updated_at').notNull(),
143
- }, (table) => [
144
- primaryKey({ columns: [table.groupId, table.senderId, table.deviceId] }),
145
- index('idx_sender_keys_group').on(table.groupId),
146
- index('idx_sender_keys_sender').on(table.senderId),
147
- ]);
148
- /**
149
- * Message keys skipped by out-of-order group messages.
150
- *
151
- * The composite primary key doubles as the range index for the
152
- * (group, sender, device) prefix scans that the count and eviction paths use.
153
- */
154
- export const skippedSenderKeys = sqliteTable('skipped_sender_keys', {
155
- groupId: text('group_id').notNull(),
156
- senderId: text('sender_id').notNull(),
157
- senderDeviceId: integer('sender_device_id').notNull(),
158
- chainIndex: integer('chain_index').notNull(),
159
- cipherKey: text('cipher_key').notNull(),
160
- iv: text('iv').notNull(),
161
- createdAt: integer('created_at').notNull(),
162
- }, (table) => [
163
- primaryKey({
164
- columns: [table.groupId, table.senderId, table.senderDeviceId, table.chainIndex],
165
- }),
166
- ]);
167
- export const messageRecords = sqliteTable('message_records', {
168
- sessionId: text('session_id').notNull(),
169
- timestamp: integer('timestamp').notNull(),
170
- recipientUserId: text('recipient_user_id').notNull(),
171
- recipientDeviceId: integer('recipient_device_id').notNull(),
172
- plaintext: text('plaintext').notNull(),
173
- createdAt: integer('created_at').notNull(),
174
- sessionStateId: text('session_state_id').notNull().default(''),
175
- }, (table) => [
176
- primaryKey({ columns: [table.sessionId, table.timestamp] }),
177
- index('idx_message_records_created').on(table.createdAt),
178
- index('idx_message_records_recipient').on(table.recipientUserId, table.recipientDeviceId),
179
- ]);
180
- export const groupMasterKeys = sqliteTable('group_master_keys', {
181
- groupId: text('group_id').primaryKey(),
182
- masterKey: text('master_key').notNull(),
183
- createdAt: integer('created_at').notNull(),
184
- });
185
- export const groupStateCache = sqliteTable('group_state_cache', {
186
- groupId: text('group_id').primaryKey(),
187
- decryptedState: text('decrypted_state').notNull(),
188
- revision: integer('revision').notNull(),
189
- lastSynced: integer('last_synced').notNull(),
190
- endorsementExpiration: integer('endorsement_expiration').default(0),
191
- });
192
- export const authCredentialCache = sqliteTable('auth_credential_cache', {
193
- redemptionDay: integer('redemption_day').primaryKey(),
194
- credential: text('credential').notNull(),
195
- expiresAt: integer('expires_at').notNull(),
196
- });
197
- //# sourceMappingURL=schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../local/store/expo/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EACP,UAAU,EACV,WAAW,EACX,IAAI,EACJ,WAAW,GACZ,MAAM,yBAAyB,CAAC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C;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,WAAW,CAAC,uBAAuB,EAAE;IACtE,aAAa,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC,UAAU,EAAE;IACrD,UAAU,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE;IACxC,SAAS,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE;CAC3C,CAAC,CAAC"}
@@ -1,109 +0,0 @@
1
- /**
2
- * Database Encryption for Node.js
3
- *
4
- * Provides AES-256-GCM encryption/decryption for database records using node:crypto.
5
- * Compatible with Web Crypto API encryption used in Expo/React Native.
6
- *
7
- * Encryption Spec:
8
- * - Algorithm: AES-256-GCM (AEAD)
9
- * - Key Size: 256 bits (32 bytes)
10
- * - IV Size: 96 bits (12 bytes) - recommended for GCM
11
- * - Auth Tag: 128 bits (16 bytes)
12
- * - Format: Base64-encoded strings for storage
13
- */
14
- /**
15
- * AES-256-GCM algorithm
16
- */
17
- export {};
18
- /**
19
- * Encrypted record structure
20
- *
21
- * Returned by encryptRecord(), stored in filesystem.
22
- */
23
- export interface EncryptedRecord {
24
- encrypted_data: string;
25
- iv: string;
26
- auth_tag: string;
27
- }
28
- /**
29
- * Encrypt a record for storage
30
- *
31
- * Serializes the record to JSON, encrypts with AES-256-GCM, and returns
32
- * the encrypted data with IV and authentication tag.
33
- *
34
- * @param plaintext - Object to encrypt (will be JSON.stringify'd)
35
- * @param dbKey - 32-byte database encryption key
36
- * @returns Encrypted record with data, IV, and auth tag
37
- * @throws EncryptionError if encryption fails
38
- */
39
- export declare function encryptRecord(plaintext: unknown, dbKey: Uint8Array): EncryptedRecord;
40
- /**
41
- * Decrypt a record from storage
42
- *
43
- * Decrypts with AES-256-GCM and verifies authentication tag.
44
- *
45
- * @param encrypted - Encrypted record from storage
46
- * @param dbKey - 32-byte database encryption key
47
- * @returns Decrypted plaintext object
48
- * @throws EncryptionError if decryption fails or auth tag invalid (tampering detected)
49
- */
50
- export declare function decryptRecord<T = unknown>(encrypted: EncryptedRecord, dbKey: Uint8Array): T;
51
- /**
52
- * Encrypt multiple records in batch
53
- *
54
- * More efficient than encrypting one at a time.
55
- *
56
- * @param records - Array of plaintext objects
57
- * @param dbKey - 32-byte database encryption key
58
- * @returns Array of encrypted records
59
- */
60
- export declare function encryptRecordsBatch(records: unknown[], dbKey: Uint8Array): EncryptedRecord[];
61
- /**
62
- * Decrypt multiple records in batch
63
- *
64
- * More efficient than decrypting one at a time.
65
- *
66
- * @param encryptedRecords - Array of encrypted records
67
- * @param dbKey - 32-byte database encryption key
68
- * @returns Array of decrypted plaintext objects
69
- */
70
- export declare function decryptRecordsBatch<T = unknown>(encryptedRecords: EncryptedRecord[], dbKey: Uint8Array): T[];
71
- /**
72
- * Re-encrypt a record with a new database key
73
- *
74
- * Used during key rotation. Decrypts with old key and re-encrypts with new key.
75
- *
76
- * @param encrypted - Encrypted record with old key
77
- * @param oldKey - Old database encryption key
78
- * @param newKey - New database encryption key
79
- * @returns Re-encrypted record
80
- */
81
- export declare function reEncryptRecord(encrypted: EncryptedRecord, oldKey: Uint8Array, newKey: Uint8Array): EncryptedRecord;
82
- /**
83
- * Verify encrypted record integrity
84
- *
85
- * Checks if the record can be decrypted without actually decrypting it.
86
- * Note: This still requires decryption to verify the auth tag.
87
- *
88
- * @param encrypted - Encrypted record
89
- * @param dbKey - Database encryption key
90
- * @returns true if record is valid and can be decrypted
91
- */
92
- export declare function verifyRecord(encrypted: EncryptedRecord, dbKey: Uint8Array): boolean;
93
- /**
94
- * Get estimated size of encrypted record
95
- *
96
- * Useful for debugging and performance monitoring.
97
- *
98
- * @param encrypted - Encrypted record
99
- * @returns Size estimate in bytes
100
- */
101
- export declare function getEncryptedRecordSize(encrypted: EncryptedRecord): number;
102
- /**
103
- * Validate encrypted record structure
104
- *
105
- * @param record - Record to validate
106
- * @returns true if structure is valid
107
- */
108
- export declare function isValidEncryptedRecord(record: unknown): record is EncryptedRecord;
109
- //# sourceMappingURL=database-encryption.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"database-encryption.d.ts","sourceRoot":"","sources":["../../../../local/store/node/database-encryption.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH;;GAEG;AACH,OAAO,EAAE,CAAC;AAkBV;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,cAAc,EAAE,MAAM,CAAC;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,GAAG,eAAe,CA0CpF;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,CAAC,GAAG,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,KAAK,EAAE,UAAU,GAAG,CAAC,CA2C3F;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,UAAU,GAAG,eAAe,EAAE,CAE5F;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,GAAG,OAAO,EAC7C,gBAAgB,EAAE,eAAe,EAAE,EACnC,KAAK,EAAE,UAAU,GAChB,CAAC,EAAE,CAEL;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,eAAe,EAC1B,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,UAAU,GACjB,eAAe,CAMjB;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,eAAe,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAOnF;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,eAAe,GAAG,MAAM,CAEzE;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,IAAI,eAAe,CAejF"}
@@ -1,202 +0,0 @@
1
- /**
2
- * Database Encryption for Node.js
3
- *
4
- * Provides AES-256-GCM encryption/decryption for database records using node:crypto.
5
- * Compatible with Web Crypto API encryption used in Expo/React Native.
6
- *
7
- * Encryption Spec:
8
- * - Algorithm: AES-256-GCM (AEAD)
9
- * - Key Size: 256 bits (32 bytes)
10
- * - IV Size: 96 bits (12 bytes) - recommended for GCM
11
- * - Auth Tag: 128 bits (16 bytes)
12
- * - Format: Base64-encoded strings for storage
13
- */
14
- import { createCipheriv, createDecipheriv, randomBytes } from 'node:crypto';
15
- import { EncryptionError, EncryptionErrorCode } from '../../../types/index.js';
16
- const AES_ALGORITHM = 'aes-256-gcm';
17
- /**
18
- * AES key size (256 bits)
19
- */
20
- const AES_KEY_SIZE = 32; // bytes
21
- /**
22
- * IV size (96 bits, recommended for GCM)
23
- */
24
- const IV_SIZE = 12; // bytes
25
- /**
26
- * Authentication tag size (128 bits)
27
- */
28
- const AUTH_TAG_SIZE = 16; // bytes
29
- /**
30
- * Encrypt a record for storage
31
- *
32
- * Serializes the record to JSON, encrypts with AES-256-GCM, and returns
33
- * the encrypted data with IV and authentication tag.
34
- *
35
- * @param plaintext - Object to encrypt (will be JSON.stringify'd)
36
- * @param dbKey - 32-byte database encryption key
37
- * @returns Encrypted record with data, IV, and auth tag
38
- * @throws EncryptionError if encryption fails
39
- */
40
- export function encryptRecord(plaintext, dbKey) {
41
- try {
42
- // Validate database key
43
- if (dbKey.length !== AES_KEY_SIZE) {
44
- throw new Error(`Invalid database key size: expected ${AES_KEY_SIZE} bytes, got ${dbKey.length}`);
45
- }
46
- // Serialize plaintext to JSON
47
- const plaintextJson = JSON.stringify(plaintext);
48
- // Generate unique IV for this record
49
- const iv = randomBytes(IV_SIZE);
50
- // Create cipher
51
- const cipher = createCipheriv(AES_ALGORITHM, Buffer.from(dbKey), iv);
52
- // Encrypt data
53
- const encrypted = Buffer.concat([cipher.update(plaintextJson, 'utf8'), cipher.final()]);
54
- // Get authentication tag
55
- const authTag = cipher.getAuthTag();
56
- // Validate auth tag size
57
- if (authTag.length !== AUTH_TAG_SIZE) {
58
- throw new Error(`Invalid auth tag size: expected ${AUTH_TAG_SIZE} bytes, got ${authTag.length}`);
59
- }
60
- // Return Base64-encoded result
61
- return {
62
- encrypted_data: encrypted.toString('base64'),
63
- iv: iv.toString('base64'),
64
- auth_tag: authTag.toString('base64'),
65
- };
66
- }
67
- catch (error) {
68
- throw new EncryptionError('Failed to encrypt record', EncryptionErrorCode.ENCRYPTION_FAILED, {
69
- originalError: error,
70
- });
71
- }
72
- }
73
- /**
74
- * Decrypt a record from storage
75
- *
76
- * Decrypts with AES-256-GCM and verifies authentication tag.
77
- *
78
- * @param encrypted - Encrypted record from storage
79
- * @param dbKey - 32-byte database encryption key
80
- * @returns Decrypted plaintext object
81
- * @throws EncryptionError if decryption fails or auth tag invalid (tampering detected)
82
- */
83
- export function decryptRecord(encrypted, dbKey) {
84
- try {
85
- // Validate database key
86
- if (dbKey.length !== AES_KEY_SIZE) {
87
- throw new Error(`Invalid database key size: expected ${AES_KEY_SIZE} bytes, got ${dbKey.length}`);
88
- }
89
- // Convert from Base64
90
- const ciphertext = Buffer.from(encrypted.encrypted_data, 'base64');
91
- const iv = Buffer.from(encrypted.iv, 'base64');
92
- const authTag = Buffer.from(encrypted.auth_tag, 'base64');
93
- // Validate IV size
94
- if (iv.length !== IV_SIZE) {
95
- throw new Error(`Invalid IV size: expected ${IV_SIZE} bytes, got ${iv.length}`);
96
- }
97
- // Validate auth tag size
98
- if (authTag.length !== AUTH_TAG_SIZE) {
99
- throw new Error(`Invalid auth tag size: expected ${AUTH_TAG_SIZE} bytes, got ${authTag.length}`);
100
- }
101
- // Create decipher
102
- const decipher = createDecipheriv(AES_ALGORITHM, Buffer.from(dbKey), iv);
103
- decipher.setAuthTag(authTag);
104
- // Decrypt data
105
- const decrypted = Buffer.concat([decipher.update(ciphertext), decipher.final()]);
106
- // Parse JSON
107
- const plaintextJson = decrypted.toString('utf8');
108
- return JSON.parse(plaintextJson);
109
- }
110
- catch (error) {
111
- throw new EncryptionError('Failed to decrypt record (data may be tampered or corrupted)', EncryptionErrorCode.DECRYPTION_FAILED, { originalError: error });
112
- }
113
- }
114
- /**
115
- * Encrypt multiple records in batch
116
- *
117
- * More efficient than encrypting one at a time.
118
- *
119
- * @param records - Array of plaintext objects
120
- * @param dbKey - 32-byte database encryption key
121
- * @returns Array of encrypted records
122
- */
123
- export function encryptRecordsBatch(records, dbKey) {
124
- return records.map((record) => encryptRecord(record, dbKey));
125
- }
126
- /**
127
- * Decrypt multiple records in batch
128
- *
129
- * More efficient than decrypting one at a time.
130
- *
131
- * @param encryptedRecords - Array of encrypted records
132
- * @param dbKey - 32-byte database encryption key
133
- * @returns Array of decrypted plaintext objects
134
- */
135
- export function decryptRecordsBatch(encryptedRecords, dbKey) {
136
- return encryptedRecords.map((record) => decryptRecord(record, dbKey));
137
- }
138
- /**
139
- * Re-encrypt a record with a new database key
140
- *
141
- * Used during key rotation. Decrypts with old key and re-encrypts with new key.
142
- *
143
- * @param encrypted - Encrypted record with old key
144
- * @param oldKey - Old database encryption key
145
- * @param newKey - New database encryption key
146
- * @returns Re-encrypted record
147
- */
148
- export function reEncryptRecord(encrypted, oldKey, newKey) {
149
- // Decrypt with old key
150
- const plaintext = decryptRecord(encrypted, oldKey);
151
- // Encrypt with new key
152
- return encryptRecord(plaintext, newKey);
153
- }
154
- /**
155
- * Verify encrypted record integrity
156
- *
157
- * Checks if the record can be decrypted without actually decrypting it.
158
- * Note: This still requires decryption to verify the auth tag.
159
- *
160
- * @param encrypted - Encrypted record
161
- * @param dbKey - Database encryption key
162
- * @returns true if record is valid and can be decrypted
163
- */
164
- export function verifyRecord(encrypted, dbKey) {
165
- try {
166
- decryptRecord(encrypted, dbKey);
167
- return true;
168
- }
169
- catch {
170
- return false;
171
- }
172
- }
173
- /**
174
- * Get estimated size of encrypted record
175
- *
176
- * Useful for debugging and performance monitoring.
177
- *
178
- * @param encrypted - Encrypted record
179
- * @returns Size estimate in bytes
180
- */
181
- export function getEncryptedRecordSize(encrypted) {
182
- return encrypted.encrypted_data.length + encrypted.iv.length + encrypted.auth_tag.length;
183
- }
184
- /**
185
- * Validate encrypted record structure
186
- *
187
- * @param record - Record to validate
188
- * @returns true if structure is valid
189
- */
190
- export function isValidEncryptedRecord(record) {
191
- if (typeof record !== 'object' || record === null) {
192
- return false;
193
- }
194
- const r = record;
195
- return (typeof r.encrypted_data === 'string' &&
196
- typeof r.iv === 'string' &&
197
- typeof r.auth_tag === 'string' &&
198
- r.encrypted_data.length > 0 &&
199
- r.iv.length > 0 &&
200
- r.auth_tag.length > 0);
201
- }
202
- //# sourceMappingURL=database-encryption.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"database-encryption.js","sourceRoot":"","sources":["../../../../local/store/node/database-encryption.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAMtE,MAAM,aAAa,GAAG,aAAa,CAAC;AAEpC;;GAEG;AACH,MAAM,YAAY,GAAG,EAAE,CAAC,CAAC,QAAQ;AAEjC;;GAEG;AACH,MAAM,OAAO,GAAG,EAAE,CAAC,CAAC,QAAQ;AAE5B;;GAEG;AACH,MAAM,aAAa,GAAG,EAAE,CAAC,CAAC,QAAQ;AAalC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,aAAa,CAAC,SAAkB,EAAE,KAAiB;IACjE,IAAI,CAAC;QACH,wBAAwB;QACxB,IAAI,KAAK,CAAC,MAAM,KAAK,YAAY,EAAE,CAAC;YAClC,MAAM,IAAI,KAAK,CACb,uCAAuC,YAAY,eAAe,KAAK,CAAC,MAAM,EAAE,CACjF,CAAC;QACJ,CAAC;QAED,8BAA8B;QAC9B,MAAM,aAAa,GAAG,IAAI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,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QAClD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,CAAC,GAAG,MAAiC,CAAC;IAE5C,OAAO,CACL,OAAO,CAAC,CAAC,cAAc,KAAK,QAAQ;QACpC,OAAO,CAAC,CAAC,EAAE,KAAK,QAAQ;QACxB,OAAO,CAAC,CAAC,QAAQ,KAAK,QAAQ;QAC9B,CAAC,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC;QAC3B,CAAC,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC;QACf,CAAC,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CACtB,CAAC;AACJ,CAAC"}
@@ -1,8 +0,0 @@
1
- export declare function isNodeDatabaseRecord(name: string): boolean;
2
- export declare function isNodeDatabaseDataEntry(name: string): boolean;
3
- /** Remove interrupted writes only while the same persistent lock excludes writers. */
4
- export declare function clearPendingNodeDatabaseFiles(directory: string): Promise<void>;
5
- export declare function syncNodeDatabaseDirectory(directory: string): Promise<void>;
6
- /** Call only while the database lock excludes readers, writers, and reset. */
7
- export declare function commitNodeDatabaseFile(path: string, value: string | Uint8Array): Promise<void>;
8
- //# sourceMappingURL=database-file-commit.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"database-file-commit.d.ts","sourceRoot":"","sources":["../../../../local/store/node/database-file-commit.ts"],"names":[],"mappings":"AAIA,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAI1D;AAcD,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAQ7D;AAED,sFAAsF;AACtF,wBAAsB,6BAA6B,CACjD,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAIf;AAED,wBAAsB,yBAAyB,CAC7C,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC,CAQf;AAED,8EAA8E;AAC9E,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GAAG,UAAU,GACzB,OAAO,CAAC,IAAI,CAAC,CAiBf"}
@@ -1,62 +0,0 @@
1
- import { randomUUID } from "node:crypto";
2
- import { open, readdir, rename, unlink } from "node:fs/promises";
3
- import { dirname, join } from "node:path";
4
- export function isNodeDatabaseRecord(name) {
5
- return /^(?:protocol_security_state_v1|(?:identity_keys|signed_prekeys|kyber_prekeys)_[a-zA-Z0-9_-]+)\.json$/.test(name);
6
- }
7
- function isPendingNodeDatabaseFile(name) {
8
- const base = name.match(/^(.+)\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\.pending$/)?.[1];
9
- return (base !== undefined &&
10
- (base === "db.key" ||
11
- base === ".database.reset" ||
12
- isNodeDatabaseRecord(base)));
13
- }
14
- export function isNodeDatabaseDataEntry(name) {
15
- return (name === "db.key" ||
16
- name === ".database.reset" ||
17
- name === "sessions" ||
18
- isNodeDatabaseRecord(name) ||
19
- isPendingNodeDatabaseFile(name));
20
- }
21
- /** Remove interrupted writes only while the same persistent lock excludes writers. */
22
- export async function clearPendingNodeDatabaseFiles(directory) {
23
- const pending = (await readdir(directory)).filter(isPendingNodeDatabaseFile);
24
- for (const name of pending)
25
- await unlink(join(directory, name));
26
- if (pending.length)
27
- await syncNodeDatabaseDirectory(directory);
28
- }
29
- export async function syncNodeDatabaseDirectory(directory) {
30
- if (process.platform === "win32")
31
- return;
32
- const handle = await open(directory, "r");
33
- try {
34
- await handle.sync();
35
- }
36
- finally {
37
- await handle.close();
38
- }
39
- }
40
- /** Call only while the database lock excludes readers, writers, and reset. */
41
- export async function commitNodeDatabaseFile(path, value) {
42
- const temporary = `${path}.${randomUUID()}.pending`;
43
- const handle = await open(temporary, "wx", 0o600);
44
- try {
45
- try {
46
- await handle.writeFile(value);
47
- await handle.sync();
48
- }
49
- finally {
50
- await handle.close();
51
- }
52
- await rename(temporary, path);
53
- await syncNodeDatabaseDirectory(dirname(path));
54
- }
55
- finally {
56
- await unlink(temporary).catch((error) => {
57
- if (error.code !== "ENOENT")
58
- throw error;
59
- });
60
- }
61
- }
62
- //# sourceMappingURL=database-file-commit.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"database-file-commit.js","sourceRoot":"","sources":["../../../../local/store/node/database-file-commit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,OAAO,sGAAsG,CAAC,IAAI,CAChH,IAAI,CACL,CAAC;AACJ,CAAC;AAED,SAAS,yBAAyB,CAAC,IAAY;IAC7C,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CACrB,+EAA+E,CAChF,EAAE,CAAC,CAAC,CAAC,CAAC;IACP,OAAO,CACL,IAAI,KAAK,SAAS;QAClB,CAAC,IAAI,KAAK,QAAQ;YAChB,IAAI,KAAK,iBAAiB;YAC1B,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAC9B,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,IAAY;IAClD,OAAO,CACL,IAAI,KAAK,QAAQ;QACjB,IAAI,KAAK,iBAAiB;QAC1B,IAAI,KAAK,UAAU;QACnB,oBAAoB,CAAC,IAAI,CAAC;QAC1B,yBAAyB,CAAC,IAAI,CAAC,CAChC,CAAC;AACJ,CAAC;AAED,sFAAsF;AACtF,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,SAAiB;IAEjB,MAAM,OAAO,GAAG,CAAC,MAAM,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC;IAC7E,KAAK,MAAM,IAAI,IAAI,OAAO;Q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