tool-db 2.3.1 → 2.5.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 (615) hide show
  1. package/README.md +1 -74
  2. package/lib/adapters-base/networkAdapter.ts +215 -0
  3. package/lib/adapters-base/storageAdapter.ts +35 -0
  4. package/lib/adapters-base/userAdapter.ts +49 -0
  5. package/lib/crdt/baseCrdt.ts +21 -0
  6. package/lib/crdt/counterCrdt.ts +111 -0
  7. package/lib/crdt/listCrdt.ts +190 -0
  8. package/lib/crdt/mapCrdt.ts +119 -0
  9. package/{dist/index.d.ts → lib/index.ts} +8 -5
  10. package/lib/logger.ts +30 -0
  11. package/lib/messageHandlers/handleCrdtGet.ts +29 -0
  12. package/lib/messageHandlers/handleCrdtPut.ts +118 -0
  13. package/lib/messageHandlers/handleGet.ts +29 -0
  14. package/lib/messageHandlers/handlePing.ts +40 -0
  15. package/lib/messageHandlers/handlePong.ts +30 -0
  16. package/lib/messageHandlers/handlePut.ts +54 -0
  17. package/lib/messageHandlers/handleQuery.ts +25 -0
  18. package/lib/messageHandlers/handleSubscribe.ts +46 -0
  19. package/lib/server.ts +7 -0
  20. package/lib/shared.ts +5 -0
  21. package/lib/toolDbAnonSignIn.ts +5 -0
  22. package/lib/toolDbClientOnMessage.ts +75 -0
  23. package/lib/toolDbCrdtGet.ts +82 -0
  24. package/lib/toolDbCrdtPut.ts +77 -0
  25. package/lib/toolDbGet.ts +80 -0
  26. package/lib/toolDbKeysSignIn.ts +16 -0
  27. package/lib/toolDbPut.ts +83 -0
  28. package/lib/toolDbQueryKeys.ts +64 -0
  29. package/lib/toolDbSignIn.ts +31 -0
  30. package/lib/toolDbSignUp.ts +71 -0
  31. package/lib/toolDbSubscribe.ts +53 -0
  32. package/lib/toolDbVerificationWrapper.ts +55 -0
  33. package/lib/tooldb.ts +314 -0
  34. package/lib/types/message.ts +133 -0
  35. package/lib/types/tooldb.ts +89 -0
  36. package/lib/utils/catchReturn.ts +4 -0
  37. package/lib/utils/encoding/arrayBufferToHex.ts +18 -0
  38. package/lib/utils/encoding/arrayBufferToString.ts +8 -0
  39. package/lib/utils/encoding/hexToArrayBuffer.ts +13 -0
  40. package/lib/utils/encoding/hexToString.ts +8 -0
  41. package/lib/utils/encoding/hexToUint8.ts +5 -0
  42. package/lib/utils/encoding/stringToArrayBuffer.ts +8 -0
  43. package/lib/utils/getPeerSignature.ts +12 -0
  44. package/lib/utils/getTimestamp.ts +3 -0
  45. package/lib/utils/proofOfWork.ts +16 -0
  46. package/lib/utils/randomAnimal.ts +77 -0
  47. package/lib/utils/sha1.ts +7 -0
  48. package/lib/utils/sha256.ts +7 -0
  49. package/lib/utils/textRandom.ts +11 -0
  50. package/lib/utils/uniq.ts +3 -0
  51. package/lib/utils/verifyMessage.ts +88 -0
  52. package/lib/utils/verifyPeer.ts +15 -0
  53. package/package.json +31 -65
  54. package/tsconfig.json +10 -72
  55. package/.eslintrc.json +0 -74
  56. package/.github/workflows/main.yml +0 -29
  57. package/_____peer/000005.ldb +0 -0
  58. package/_____peer/000008.log +0 -0
  59. package/_____peer/CURRENT +0 -1
  60. package/_____peer/LOCK +0 -0
  61. package/_____peer/LOG +0 -0
  62. package/_____peer/LOG.old +0 -0
  63. package/_____peer/MANIFEST-000007 +0 -0
  64. package/_____peer_test-alice/000003.log +0 -0
  65. package/_____peer_test-alice/CURRENT +0 -1
  66. package/_____peer_test-alice/LOCK +0 -0
  67. package/_____peer_test-alice/LOG +0 -1
  68. package/_____peer_test-alice/MANIFEST-000002 +0 -0
  69. package/_____peer_test-base-client/000005.ldb +0 -0
  70. package/_____peer_test-base-client/000006.log +0 -0
  71. package/_____peer_test-base-client/CURRENT +0 -1
  72. package/_____peer_test-base-client/LOCK +0 -0
  73. package/_____peer_test-base-client/LOG +0 -5
  74. package/_____peer_test-base-client/LOG.old +0 -1
  75. package/_____peer_test-base-client/MANIFEST-000004 +0 -0
  76. package/_____peer_test-base-server/000005.ldb +0 -0
  77. package/_____peer_test-base-server/000006.log +0 -0
  78. package/_____peer_test-base-server/CURRENT +0 -1
  79. package/_____peer_test-base-server/LOCK +0 -0
  80. package/_____peer_test-base-server/LOG +0 -5
  81. package/_____peer_test-base-server/LOG.old +0 -1
  82. package/_____peer_test-base-server/MANIFEST-000004 +0 -0
  83. package/_____peer_test-bob/000003.log +0 -0
  84. package/_____peer_test-bob/CURRENT +0 -1
  85. package/_____peer_test-bob/LOCK +0 -0
  86. package/_____peer_test-bob/LOG +0 -1
  87. package/_____peer_test-bob/MANIFEST-000002 +0 -0
  88. package/_____peer_test-chris/000003.log +0 -0
  89. package/_____peer_test-chris/CURRENT +0 -1
  90. package/_____peer_test-chris/LOCK +0 -0
  91. package/_____peer_test-chris/LOG +0 -1
  92. package/_____peer_test-chris/MANIFEST-000002 +0 -0
  93. package/_____peer_test-node-a/000003.log +0 -0
  94. package/_____peer_test-node-a/CURRENT +0 -1
  95. package/_____peer_test-node-a/LOCK +0 -0
  96. package/_____peer_test-node-a/LOG +0 -1
  97. package/_____peer_test-node-a/MANIFEST-000002 +0 -0
  98. package/_____peer_test-node-b/000003.log +0 -0
  99. package/_____peer_test-node-b/CURRENT +0 -1
  100. package/_____peer_test-node-b/LOCK +0 -0
  101. package/_____peer_test-node-b/LOG +0 -1
  102. package/_____peer_test-node-b/MANIFEST-000002 +0 -0
  103. package/_____peer_test-store/000003.log +0 -0
  104. package/_____peer_test-store/CURRENT +0 -1
  105. package/_____peer_test-store/LOCK +0 -0
  106. package/_____peer_test-store/LOG +0 -1
  107. package/_____peer_test-store/MANIFEST-000002 +0 -0
  108. package/_____peer_test-verify-a/000003.log +0 -0
  109. package/_____peer_test-verify-a/CURRENT +0 -1
  110. package/_____peer_test-verify-a/LOCK +0 -0
  111. package/_____peer_test-verify-a/LOG +0 -1
  112. package/_____peer_test-verify-a/MANIFEST-000002 +0 -0
  113. package/babel.config.js +0 -6
  114. package/bundle.js +0 -1
  115. package/custom-test-env.js +0 -28
  116. package/dist/__tests__ copy/base64.d.ts +0 -1
  117. package/dist/__tests__ copy/base64.js +0 -61
  118. package/dist/__tests__ copy/base64.js.map +0 -1
  119. package/dist/__tests__ copy/encryption.d.ts +0 -1
  120. package/dist/__tests__ copy/encryption.js +0 -68
  121. package/dist/__tests__ copy/encryption.js.map +0 -1
  122. package/dist/__tests__ copy/keys.d.ts +0 -1
  123. package/dist/__tests__ copy/keys.js +0 -238
  124. package/dist/__tests__ copy/keys.js.map +0 -1
  125. package/dist/__tests__ copy/network.d.ts +0 -1
  126. package/dist/__tests__ copy/network.js +0 -206
  127. package/dist/__tests__ copy/network.js.map +0 -1
  128. package/dist/__tests__ copy/pow.d.ts +0 -1
  129. package/dist/__tests__ copy/pow.js +0 -25
  130. package/dist/__tests__ copy/pow.js.map +0 -1
  131. package/dist/__tests__ copy/sha1.d.ts +0 -1
  132. package/dist/__tests__ copy/sha1.js +0 -16
  133. package/dist/__tests__ copy/sha1.js.map +0 -1
  134. package/dist/__tests__ copy/sha256.d.ts +0 -1
  135. package/dist/__tests__ copy/sha256.js +0 -16
  136. package/dist/__tests__ copy/sha256.js.map +0 -1
  137. package/dist/__tests__ copy/textRandom.d.ts +0 -1
  138. package/dist/__tests__ copy/textRandom.js +0 -17
  139. package/dist/__tests__ copy/textRandom.js.map +0 -1
  140. package/dist/adapters/toolDbIndexedb.d.ts +0 -9
  141. package/dist/adapters/toolDbIndexedb.js +0 -131
  142. package/dist/adapters/toolDbIndexedb.js.map +0 -1
  143. package/dist/adapters/toolDbLeveldb.d.ts +0 -8
  144. package/dist/adapters/toolDbLeveldb.js +0 -109
  145. package/dist/adapters/toolDbLeveldb.js.map +0 -1
  146. package/dist/adapters/toolDbWeb3User.d.ts +0 -18
  147. package/dist/adapters/toolDbWeb3User.js +0 -74
  148. package/dist/adapters/toolDbWeb3User.js.map +0 -1
  149. package/dist/adapters/toolDbWebrtc.d.ts +0 -58
  150. package/dist/adapters/toolDbWebrtc.js +0 -487
  151. package/dist/adapters/toolDbWebrtc.js.map +0 -1
  152. package/dist/adapters/toolDbWebsocket.d.ts +0 -18
  153. package/dist/adapters/toolDbWebsocket.js +0 -176
  154. package/dist/adapters/toolDbWebsocket.js.map +0 -1
  155. package/dist/adapters-base/networkAdapter.d.ts +0 -58
  156. package/dist/adapters-base/networkAdapter.js +0 -214
  157. package/dist/adapters-base/networkAdapter.js.map +0 -1
  158. package/dist/adapters-base/storageAdapter.d.ts +0 -11
  159. package/dist/adapters-base/storageAdapter.js +0 -36
  160. package/dist/adapters-base/storageAdapter.js.map +0 -1
  161. package/dist/adapters-base/userAdapter.d.ts +0 -15
  162. package/dist/adapters-base/userAdapter.js +0 -42
  163. package/dist/adapters-base/userAdapter.js.map +0 -1
  164. package/dist/bundle.js +0 -69086
  165. package/dist/chain/Block.d.ts +0 -29
  166. package/dist/chain/Block.js +0 -142
  167. package/dist/chain/Block.js.map +0 -1
  168. package/dist/chain/ToolChain.d.ts +0 -27
  169. package/dist/chain/ToolChain.js +0 -253
  170. package/dist/chain/ToolChain.js.map +0 -1
  171. package/dist/chain/Tx.d.ts +0 -50
  172. package/dist/chain/Tx.js +0 -54
  173. package/dist/chain/Tx.js.map +0 -1
  174. package/dist/chain/Wallet.d.ts +0 -9
  175. package/dist/chain/Wallet.js +0 -37
  176. package/dist/chain/Wallet.js.map +0 -1
  177. package/dist/chain/isValidChain.d.ts +0 -1
  178. package/dist/chain/isValidChain.js +0 -37
  179. package/dist/chain/isValidChain.js.map +0 -1
  180. package/dist/chain/mempool.d.ts +0 -0
  181. package/dist/chain/mempool.js +0 -2
  182. package/dist/chain/mempool.js.map +0 -1
  183. package/dist/crdt/baseCrdt.d.ts +0 -9
  184. package/dist/crdt/baseCrdt.js +0 -27
  185. package/dist/crdt/baseCrdt.js.map +0 -1
  186. package/dist/crdt/counterCrdt.d.ts +0 -30
  187. package/dist/crdt/counterCrdt.js +0 -106
  188. package/dist/crdt/counterCrdt.js.map +0 -1
  189. package/dist/crdt/listCrdt.d.ts +0 -42
  190. package/dist/crdt/listCrdt.js +0 -159
  191. package/dist/crdt/listCrdt.js.map +0 -1
  192. package/dist/crdt/mapCrdt.d.ts +0 -32
  193. package/dist/crdt/mapCrdt.js +0 -118
  194. package/dist/crdt/mapCrdt.js.map +0 -1
  195. package/dist/getCrypto.d.ts +0 -1
  196. package/dist/getCrypto.js +0 -10
  197. package/dist/getCrypto.js.map +0 -1
  198. package/dist/index.js +0 -93
  199. package/dist/index.js.map +0 -1
  200. package/dist/infuraFilecoin.d.ts +0 -0
  201. package/dist/infuraFilecoin.js +0 -2
  202. package/dist/infuraFilecoin.js.map +0 -1
  203. package/dist/loadCrdtDocument.d.ts +0 -3
  204. package/dist/loadCrdtDocument.js +0 -43
  205. package/dist/loadCrdtDocument.js.map +0 -1
  206. package/dist/logger.d.ts +0 -2
  207. package/dist/logger.js +0 -29
  208. package/dist/logger.js.map +0 -1
  209. package/dist/makeTx.d.ts +0 -1
  210. package/dist/makeTx.js +0 -27
  211. package/dist/makeTx.js.map +0 -1
  212. package/dist/messageHandlers/handleCrdt.d.ts +0 -2
  213. package/dist/messageHandlers/handleCrdt.js +0 -15
  214. package/dist/messageHandlers/handleCrdt.js.map +0 -1
  215. package/dist/messageHandlers/handleCrdtGet.d.ts +0 -2
  216. package/dist/messageHandlers/handleCrdtGet.js +0 -29
  217. package/dist/messageHandlers/handleCrdtGet.js.map +0 -1
  218. package/dist/messageHandlers/handleCrdtPut.d.ts +0 -2
  219. package/dist/messageHandlers/handleCrdtPut.js +0 -93
  220. package/dist/messageHandlers/handleCrdtPut.js.map +0 -1
  221. package/dist/messageHandlers/handleGet.d.ts +0 -2
  222. package/dist/messageHandlers/handleGet.js +0 -29
  223. package/dist/messageHandlers/handleGet.js.map +0 -1
  224. package/dist/messageHandlers/handleJoin.d.ts +0 -2
  225. package/dist/messageHandlers/handleJoin.js +0 -36
  226. package/dist/messageHandlers/handleJoin.js.map +0 -1
  227. package/dist/messageHandlers/handlePing.d.ts +0 -2
  228. package/dist/messageHandlers/handlePing.js +0 -36
  229. package/dist/messageHandlers/handlePing.js.map +0 -1
  230. package/dist/messageHandlers/handlePong.d.ts +0 -2
  231. package/dist/messageHandlers/handlePong.js +0 -26
  232. package/dist/messageHandlers/handlePong.js.map +0 -1
  233. package/dist/messageHandlers/handlePut.d.ts +0 -2
  234. package/dist/messageHandlers/handlePut.js +0 -57
  235. package/dist/messageHandlers/handlePut.js.map +0 -1
  236. package/dist/messageHandlers/handleQuery.d.ts +0 -2
  237. package/dist/messageHandlers/handleQuery.js +0 -23
  238. package/dist/messageHandlers/handleQuery.js.map +0 -1
  239. package/dist/messageHandlers/handleServers.d.ts +0 -2
  240. package/dist/messageHandlers/handleServers.js +0 -23
  241. package/dist/messageHandlers/handleServers.js.map +0 -1
  242. package/dist/messageHandlers/handleSubscribe.d.ts +0 -2
  243. package/dist/messageHandlers/handleSubscribe.js +0 -44
  244. package/dist/messageHandlers/handleSubscribe.js.map +0 -1
  245. package/dist/sendJoin.d.ts +0 -2
  246. package/dist/sendJoin.js +0 -31
  247. package/dist/sendJoin.js.map +0 -1
  248. package/dist/server.d.ts +0 -1
  249. package/dist/server.js +0 -9
  250. package/dist/server.js.map +0 -1
  251. package/dist/shared.d.ts +0 -2
  252. package/dist/shared.js +0 -7
  253. package/dist/shared.js.map +0 -1
  254. package/dist/test.d.ts +0 -1
  255. package/dist/test.js +0 -17
  256. package/dist/test.js.map +0 -1
  257. package/dist/toolChainServer.d.ts +0 -8
  258. package/dist/toolChainServer.js +0 -60
  259. package/dist/toolChainServer.js.map +0 -1
  260. package/dist/toolDbAnonSignIn.d.ts +0 -2
  261. package/dist/toolDbAnonSignIn.js +0 -7
  262. package/dist/toolDbAnonSignIn.js.map +0 -1
  263. package/dist/toolDbClientOnMessage.d.ts +0 -2
  264. package/dist/toolDbClientOnMessage.js +0 -59
  265. package/dist/toolDbClientOnMessage.js.map +0 -1
  266. package/dist/toolDbCrdtGet.d.ts +0 -9
  267. package/dist/toolDbCrdtGet.js +0 -77
  268. package/dist/toolDbCrdtGet.js.map +0 -1
  269. package/dist/toolDbCrdtPut.d.ts +0 -9
  270. package/dist/toolDbCrdtPut.js +0 -63
  271. package/dist/toolDbCrdtPut.js.map +0 -1
  272. package/dist/toolDbGet.d.ts +0 -9
  273. package/dist/toolDbGet.js +0 -77
  274. package/dist/toolDbGet.js.map +0 -1
  275. package/dist/toolDbGetPubKey.d.ts +0 -2
  276. package/dist/toolDbGetPubKey.js +0 -18
  277. package/dist/toolDbGetPubKey.js.map +0 -1
  278. package/dist/toolDbKeysSignIn.d.ts +0 -2
  279. package/dist/toolDbKeysSignIn.js +0 -16
  280. package/dist/toolDbKeysSignIn.js.map +0 -1
  281. package/dist/toolDbNetwork.d.ts +0 -32
  282. package/dist/toolDbNetwork.js +0 -296
  283. package/dist/toolDbNetwork.js.map +0 -1
  284. package/dist/toolDbNetworkAdapter.d.ts +0 -57
  285. package/dist/toolDbNetworkAdapter.js +0 -188
  286. package/dist/toolDbNetworkAdapter.js.map +0 -1
  287. package/dist/toolDbPut.d.ts +0 -9
  288. package/dist/toolDbPut.js +0 -69
  289. package/dist/toolDbPut.js.map +0 -1
  290. package/dist/toolDbQueryKeys.d.ts +0 -8
  291. package/dist/toolDbQueryKeys.js +0 -66
  292. package/dist/toolDbQueryKeys.js.map +0 -1
  293. package/dist/toolDbSignIn.d.ts +0 -2
  294. package/dist/toolDbSignIn.js +0 -27
  295. package/dist/toolDbSignIn.js.map +0 -1
  296. package/dist/toolDbSignUp.d.ts +0 -2
  297. package/dist/toolDbSignUp.js +0 -101
  298. package/dist/toolDbSignUp.js.map +0 -1
  299. package/dist/toolDbSubscribe.d.ts +0 -9
  300. package/dist/toolDbSubscribe.js +0 -50
  301. package/dist/toolDbSubscribe.js.map +0 -1
  302. package/dist/toolDbVerificationWrapper.d.ts +0 -2
  303. package/dist/toolDbVerificationWrapper.js +0 -98
  304. package/dist/toolDbVerificationWrapper.js.map +0 -1
  305. package/dist/toolDbWeb3User.d.ts +0 -20
  306. package/dist/toolDbWeb3User.js +0 -75
  307. package/dist/toolDbWeb3User.js.map +0 -1
  308. package/dist/toolDbWebrtc.d.ts +0 -75
  309. package/dist/toolDbWebrtc.js +0 -472
  310. package/dist/toolDbWebrtc.js.map +0 -1
  311. package/dist/toolDbWebsocket.d.ts +0 -19
  312. package/dist/toolDbWebsocket.js +0 -187
  313. package/dist/toolDbWebsocket.js.map +0 -1
  314. package/dist/toolchain.d.ts +0 -1
  315. package/dist/toolchain.js +0 -8
  316. package/dist/toolchain.js.map +0 -1
  317. package/dist/tooldb.d.ts +0 -108
  318. package/dist/tooldb.js +0 -285
  319. package/dist/tooldb.js.map +0 -1
  320. package/dist/types/graph.d.ts +0 -0
  321. package/dist/types/graph.js +0 -2
  322. package/dist/types/graph.js.map +0 -1
  323. package/dist/types/message.d.ts +0 -100
  324. package/dist/types/message.js +0 -17
  325. package/dist/types/message.js.map +0 -1
  326. package/dist/types/tooldb.d.ts +0 -79
  327. package/dist/types/tooldb.js +0 -3
  328. package/dist/types/tooldb.js.map +0 -1
  329. package/dist/utils/arrayBufferToBase64.d.ts +0 -1
  330. package/dist/utils/arrayBufferToBase64.js +0 -12
  331. package/dist/utils/arrayBufferToBase64.js.map +0 -1
  332. package/dist/utils/arrayBufferToHex.d.ts +0 -1
  333. package/dist/utils/arrayBufferToHex.js +0 -19
  334. package/dist/utils/arrayBufferToHex.js.map +0 -1
  335. package/dist/utils/arrayBufferToString.d.ts +0 -1
  336. package/dist/utils/arrayBufferToString.js +0 -12
  337. package/dist/utils/arrayBufferToString.js.map +0 -1
  338. package/dist/utils/base64ToArrayBuffer.d.ts +0 -1
  339. package/dist/utils/base64ToArrayBuffer.js +0 -12
  340. package/dist/utils/base64ToArrayBuffer.js.map +0 -1
  341. package/dist/utils/base64ToBinaryChange.d.ts +0 -2
  342. package/dist/utils/base64ToBinaryChange.js +0 -18
  343. package/dist/utils/base64ToBinaryChange.js.map +0 -1
  344. package/dist/utils/base64ToBinaryDocument.d.ts +0 -2
  345. package/dist/utils/base64ToBinaryDocument.js +0 -18
  346. package/dist/utils/base64ToBinaryDocument.js.map +0 -1
  347. package/dist/utils/base64ToHex.d.ts +0 -1
  348. package/dist/utils/base64ToHex.js +0 -13
  349. package/dist/utils/base64ToHex.js.map +0 -1
  350. package/dist/utils/base64ToUint8.d.ts +0 -1
  351. package/dist/utils/base64ToUint8.js +0 -17
  352. package/dist/utils/base64ToUint8.js.map +0 -1
  353. package/dist/utils/catchReturn.d.ts +0 -1
  354. package/dist/utils/catchReturn.js +0 -8
  355. package/dist/utils/catchReturn.js.map +0 -1
  356. package/dist/utils/crypto/base64KeyToHex.d.ts +0 -1
  357. package/dist/utils/crypto/base64KeyToHex.js +0 -24
  358. package/dist/utils/crypto/base64KeyToHex.js.map +0 -1
  359. package/dist/utils/crypto/base64PublicKeyToHex.d.ts +0 -1
  360. package/dist/utils/crypto/base64PublicKeyToHex.js +0 -22
  361. package/dist/utils/crypto/base64PublicKeyToHex.js.map +0 -1
  362. package/dist/utils/crypto/decodeKeyString.d.ts +0 -1
  363. package/dist/utils/crypto/decodeKeyString.js +0 -13
  364. package/dist/utils/crypto/decodeKeyString.js.map +0 -1
  365. package/dist/utils/crypto/decryptData.d.ts +0 -1
  366. package/dist/utils/crypto/decryptData.js +0 -28
  367. package/dist/utils/crypto/decryptData.js.map +0 -1
  368. package/dist/utils/crypto/decryptWithPass.d.ts +0 -1
  369. package/dist/utils/crypto/decryptWithPass.js +0 -23
  370. package/dist/utils/crypto/decryptWithPass.js.map +0 -1
  371. package/dist/utils/crypto/deriveSecret.d.ts +0 -1
  372. package/dist/utils/crypto/deriveSecret.js +0 -18
  373. package/dist/utils/crypto/deriveSecret.js.map +0 -1
  374. package/dist/utils/crypto/encodeKeyString.d.ts +0 -1
  375. package/dist/utils/crypto/encodeKeyString.js +0 -13
  376. package/dist/utils/crypto/encodeKeyString.js.map +0 -1
  377. package/dist/utils/crypto/encryptData.d.ts +0 -1
  378. package/dist/utils/crypto/encryptData.js +0 -30
  379. package/dist/utils/crypto/encryptData.js.map +0 -1
  380. package/dist/utils/crypto/encryptWithPass.d.ts +0 -1
  381. package/dist/utils/crypto/encryptWithPass.js +0 -26
  382. package/dist/utils/crypto/encryptWithPass.js.map +0 -1
  383. package/dist/utils/crypto/exportKey.d.ts +0 -1
  384. package/dist/utils/crypto/exportKey.js +0 -14
  385. package/dist/utils/crypto/exportKey.js.map +0 -1
  386. package/dist/utils/crypto/exportKeyAsHex.d.ts +0 -1
  387. package/dist/utils/crypto/exportKeyAsHex.js +0 -18
  388. package/dist/utils/crypto/exportKeyAsHex.js.map +0 -1
  389. package/dist/utils/crypto/generateKeyFromPassword.d.ts +0 -1
  390. package/dist/utils/crypto/generateKeyFromPassword.js +0 -25
  391. package/dist/utils/crypto/generateKeyFromPassword.js.map +0 -1
  392. package/dist/utils/crypto/generateKeyPair.d.ts +0 -1
  393. package/dist/utils/crypto/generateKeyPair.js +0 -17
  394. package/dist/utils/crypto/generateKeyPair.js.map +0 -1
  395. package/dist/utils/crypto/generateKeysComb.d.ts +0 -4
  396. package/dist/utils/crypto/generateKeysComb.js +0 -60
  397. package/dist/utils/crypto/generateKeysComb.js.map +0 -1
  398. package/dist/utils/crypto/importKey.d.ts +0 -1
  399. package/dist/utils/crypto/importKey.js +0 -23
  400. package/dist/utils/crypto/importKey.js.map +0 -1
  401. package/dist/utils/crypto/loadKeysComb.d.ts +0 -5
  402. package/dist/utils/crypto/loadKeysComb.js +0 -90
  403. package/dist/utils/crypto/loadKeysComb.js.map +0 -1
  404. package/dist/utils/crypto/loadSignKeys.d.ts +0 -2
  405. package/dist/utils/crypto/loadSignKeys.js +0 -78
  406. package/dist/utils/crypto/loadSignKeys.js.map +0 -1
  407. package/dist/utils/crypto/recoverPubKey.d.ts +0 -1
  408. package/dist/utils/crypto/recoverPubKey.js +0 -27
  409. package/dist/utils/crypto/recoverPubKey.js.map +0 -1
  410. package/dist/utils/crypto/recoverPubKeyFromPrivate.d.ts +0 -1
  411. package/dist/utils/crypto/recoverPubKeyFromPrivate.js +0 -16
  412. package/dist/utils/crypto/recoverPubKeyFromPrivate.js.map +0 -1
  413. package/dist/utils/crypto/saveKeysComb.d.ts +0 -2
  414. package/dist/utils/crypto/saveKeysComb.js +0 -75
  415. package/dist/utils/crypto/saveKeysComb.js.map +0 -1
  416. package/dist/utils/crypto/saveSignKeys.d.ts +0 -2
  417. package/dist/utils/crypto/saveSignKeys.js +0 -67
  418. package/dist/utils/crypto/saveSignKeys.js.map +0 -1
  419. package/dist/utils/crypto/verifyData.d.ts +0 -1
  420. package/dist/utils/crypto/verifyData.js +0 -20
  421. package/dist/utils/crypto/verifyData.js.map +0 -1
  422. package/dist/utils/encoding/arrayBufferToBase64.d.ts +0 -1
  423. package/dist/utils/encoding/arrayBufferToBase64.js +0 -12
  424. package/dist/utils/encoding/arrayBufferToBase64.js.map +0 -1
  425. package/dist/utils/encoding/arrayBufferToHex.d.ts +0 -1
  426. package/dist/utils/encoding/arrayBufferToHex.js +0 -19
  427. package/dist/utils/encoding/arrayBufferToHex.js.map +0 -1
  428. package/dist/utils/encoding/arrayBufferToString.d.ts +0 -1
  429. package/dist/utils/encoding/arrayBufferToString.js +0 -12
  430. package/dist/utils/encoding/arrayBufferToString.js.map +0 -1
  431. package/dist/utils/encoding/base64ToArrayBuffer.d.ts +0 -1
  432. package/dist/utils/encoding/base64ToArrayBuffer.js +0 -12
  433. package/dist/utils/encoding/base64ToArrayBuffer.js.map +0 -1
  434. package/dist/utils/encoding/base64ToBinaryChange.d.ts +0 -2
  435. package/dist/utils/encoding/base64ToBinaryChange.js +0 -18
  436. package/dist/utils/encoding/base64ToBinaryChange.js.map +0 -1
  437. package/dist/utils/encoding/base64ToBinaryDocument.d.ts +0 -2
  438. package/dist/utils/encoding/base64ToBinaryDocument.js +0 -18
  439. package/dist/utils/encoding/base64ToBinaryDocument.js.map +0 -1
  440. package/dist/utils/encoding/base64ToHex.d.ts +0 -1
  441. package/dist/utils/encoding/base64ToHex.js +0 -13
  442. package/dist/utils/encoding/base64ToHex.js.map +0 -1
  443. package/dist/utils/encoding/base64ToUint8.d.ts +0 -1
  444. package/dist/utils/encoding/base64ToUint8.js +0 -17
  445. package/dist/utils/encoding/base64ToUint8.js.map +0 -1
  446. package/dist/utils/encoding/fromBase64.d.ts +0 -1
  447. package/dist/utils/encoding/fromBase64.js +0 -7
  448. package/dist/utils/encoding/fromBase64.js.map +0 -1
  449. package/dist/utils/encoding/hexToArrayBuffer.d.ts +0 -1
  450. package/dist/utils/encoding/hexToArrayBuffer.js +0 -15
  451. package/dist/utils/encoding/hexToArrayBuffer.js.map +0 -1
  452. package/dist/utils/encoding/hexToBase64.d.ts +0 -1
  453. package/dist/utils/encoding/hexToBase64.js +0 -12
  454. package/dist/utils/encoding/hexToBase64.js.map +0 -1
  455. package/dist/utils/encoding/hexToString.d.ts +0 -1
  456. package/dist/utils/encoding/hexToString.js +0 -12
  457. package/dist/utils/encoding/hexToString.js.map +0 -1
  458. package/dist/utils/encoding/hexToUint8.d.ts +0 -1
  459. package/dist/utils/encoding/hexToUint8.js +0 -8
  460. package/dist/utils/encoding/hexToUint8.js.map +0 -1
  461. package/dist/utils/encoding/stringToArrayBuffer.d.ts +0 -1
  462. package/dist/utils/encoding/stringToArrayBuffer.js +0 -12
  463. package/dist/utils/encoding/stringToArrayBuffer.js.map +0 -1
  464. package/dist/utils/encoding/toBase64.d.ts +0 -1
  465. package/dist/utils/encoding/toBase64.js +0 -7
  466. package/dist/utils/encoding/toBase64.js.map +0 -1
  467. package/dist/utils/encoding/uint8ArrayToHex.d.ts +0 -1
  468. package/dist/utils/encoding/uint8ArrayToHex.js +0 -7
  469. package/dist/utils/encoding/uint8ArrayToHex.js.map +0 -1
  470. package/dist/utils/encoding/uint8ToBase64.d.ts +0 -1
  471. package/dist/utils/encoding/uint8ToBase64.js +0 -15
  472. package/dist/utils/encoding/uint8ToBase64.js.map +0 -1
  473. package/dist/utils/fromBase64.d.ts +0 -1
  474. package/dist/utils/fromBase64.js +0 -7
  475. package/dist/utils/fromBase64.js.map +0 -1
  476. package/dist/utils/generateIv.d.ts +0 -1
  477. package/dist/utils/generateIv.js +0 -12
  478. package/dist/utils/generateIv.js.map +0 -1
  479. package/dist/utils/getPeerSignature.d.ts +0 -2
  480. package/dist/utils/getPeerSignature.js +0 -9
  481. package/dist/utils/getPeerSignature.js.map +0 -1
  482. package/dist/utils/getTimestamp.d.ts +0 -1
  483. package/dist/utils/getTimestamp.js +0 -7
  484. package/dist/utils/getTimestamp.js.map +0 -1
  485. package/dist/utils/hexToArrayBuffer.d.ts +0 -1
  486. package/dist/utils/hexToArrayBuffer.js +0 -15
  487. package/dist/utils/hexToArrayBuffer.js.map +0 -1
  488. package/dist/utils/hexToBase64.d.ts +0 -1
  489. package/dist/utils/hexToBase64.js +0 -12
  490. package/dist/utils/hexToBase64.js.map +0 -1
  491. package/dist/utils/hexToString.d.ts +0 -1
  492. package/dist/utils/hexToString.js +0 -12
  493. package/dist/utils/hexToString.js.map +0 -1
  494. package/dist/utils/hexToUint8.d.ts +0 -1
  495. package/dist/utils/hexToUint8.js +0 -8
  496. package/dist/utils/hexToUint8.js.map +0 -1
  497. package/dist/utils/indexedb.d.ts +0 -2
  498. package/dist/utils/indexedb.js +0 -116
  499. package/dist/utils/indexedb.js.map +0 -1
  500. package/dist/utils/leveldb.d.ts +0 -2
  501. package/dist/utils/leveldb.js +0 -83
  502. package/dist/utils/leveldb.js.map +0 -1
  503. package/dist/utils/proofOfWork.d.ts +0 -4
  504. package/dist/utils/proofOfWork.js +0 -16
  505. package/dist/utils/proofOfWork.js.map +0 -1
  506. package/dist/utils/randomAnimal.d.ts +0 -1
  507. package/dist/utils/randomAnimal.js +0 -77
  508. package/dist/utils/randomAnimal.js.map +0 -1
  509. package/dist/utils/sha1.d.ts +0 -1
  510. package/dist/utils/sha1.js +0 -13
  511. package/dist/utils/sha1.js.map +0 -1
  512. package/dist/utils/sha256.d.ts +0 -3
  513. package/dist/utils/sha256.js +0 -13
  514. package/dist/utils/sha256.js.map +0 -1
  515. package/dist/utils/signData.d.ts +0 -1
  516. package/dist/utils/signData.js +0 -19
  517. package/dist/utils/signData.js.map +0 -1
  518. package/dist/utils/stringToArrayBuffer.d.ts +0 -1
  519. package/dist/utils/stringToArrayBuffer.js +0 -12
  520. package/dist/utils/stringToArrayBuffer.js.map +0 -1
  521. package/dist/utils/textRandom.d.ts +0 -1
  522. package/dist/utils/textRandom.js +0 -15
  523. package/dist/utils/textRandom.js.map +0 -1
  524. package/dist/utils/toBase64.d.ts +0 -1
  525. package/dist/utils/toBase64.js +0 -7
  526. package/dist/utils/toBase64.js.map +0 -1
  527. package/dist/utils/uint8ArrayToHex.d.ts +0 -2
  528. package/dist/utils/uint8ArrayToHex.js +0 -7
  529. package/dist/utils/uint8ArrayToHex.js.map +0 -1
  530. package/dist/utils/uint8ToBase64.d.ts +0 -2
  531. package/dist/utils/uint8ToBase64.js +0 -15
  532. package/dist/utils/uint8ToBase64.js.map +0 -1
  533. package/dist/utils/uniq.d.ts +0 -1
  534. package/dist/utils/uniq.js +0 -7
  535. package/dist/utils/uniq.js.map +0 -1
  536. package/dist/utils/verifyMessage.d.ts +0 -8
  537. package/dist/utils/verifyMessage.js +0 -129
  538. package/dist/utils/verifyMessage.js.map +0 -1
  539. package/dist/utils/verifyPeer.d.ts +0 -2
  540. package/dist/utils/verifyPeer.js +0 -15
  541. package/dist/utils/verifyPeer.js.map +0 -1
  542. package/jest.config.ts +0 -195
  543. package/jest.setup.js +0 -0
  544. package/test-alice/000216.ldb +0 -0
  545. package/test-alice/000218.ldb +0 -0
  546. package/test-alice/000221.ldb +0 -0
  547. package/test-alice/000224.ldb +0 -0
  548. package/test-alice/000225.log +0 -0
  549. package/test-alice/CURRENT +0 -1
  550. package/test-alice/LOCK +0 -0
  551. package/test-alice/LOG +0 -5
  552. package/test-alice/LOG.old +0 -5
  553. package/test-alice/MANIFEST-000223 +0 -0
  554. package/test-base-client/000019.log +0 -0
  555. package/test-base-client/CURRENT +0 -1
  556. package/test-base-client/LOCK +0 -0
  557. package/test-base-client/LOG +0 -3
  558. package/test-base-client/LOG.old +0 -3
  559. package/test-base-client/MANIFEST-000018 +0 -0
  560. package/test-base-server/000019.log +0 -0
  561. package/test-base-server/CURRENT +0 -1
  562. package/test-base-server/LOCK +0 -0
  563. package/test-base-server/LOG +0 -3
  564. package/test-base-server/LOG.old +0 -3
  565. package/test-base-server/MANIFEST-000018 +0 -0
  566. package/test-bob/000231.ldb +0 -0
  567. package/test-bob/000233.ldb +0 -0
  568. package/test-bob/000234.log +0 -0
  569. package/test-bob/CURRENT +0 -1
  570. package/test-bob/LOCK +0 -0
  571. package/test-bob/LOG +0 -5
  572. package/test-bob/LOG.old +0 -14
  573. package/test-bob/MANIFEST-000232 +0 -0
  574. package/test-chris/000005.ldb +0 -0
  575. package/test-chris/000008.ldb +0 -0
  576. package/test-chris/000009.log +0 -0
  577. package/test-chris/CURRENT +0 -1
  578. package/test-chris/LOCK +0 -0
  579. package/test-chris/LOG +0 -5
  580. package/test-chris/LOG.old +0 -5
  581. package/test-chris/MANIFEST-000007 +0 -0
  582. package/test-node-a/000246.ldb +0 -0
  583. package/test-node-a/000248.ldb +0 -0
  584. package/test-node-a/000249.log +0 -0
  585. package/test-node-a/CURRENT +0 -1
  586. package/test-node-a/LOCK +0 -0
  587. package/test-node-a/LOG +0 -5
  588. package/test-node-a/LOG.old +0 -14
  589. package/test-node-a/MANIFEST-000247 +0 -0
  590. package/test-node-b/000246.ldb +0 -0
  591. package/test-node-b/000248.ldb +0 -0
  592. package/test-node-b/000249.log +0 -0
  593. package/test-node-b/CURRENT +0 -1
  594. package/test-node-b/LOCK +0 -0
  595. package/test-node-b/LOG +0 -5
  596. package/test-node-b/LOG.old +0 -14
  597. package/test-node-b/MANIFEST-000247 +0 -0
  598. package/test-store/000005.ldb +0 -0
  599. package/test-store/000008.ldb +0 -0
  600. package/test-store/000011.ldb +0 -0
  601. package/test-store/000014.ldb +0 -0
  602. package/test-store/000017.ldb +0 -0
  603. package/test-store/000018.log +0 -0
  604. package/test-store/CURRENT +0 -1
  605. package/test-store/LOCK +0 -0
  606. package/test-store/LOG +0 -6
  607. package/test-store/LOG.old +0 -6
  608. package/test-store/MANIFEST-000016 +0 -0
  609. package/test-verify-a/000059.ldb +0 -0
  610. package/test-verify-a/000066.log +0 -0
  611. package/test-verify-a/CURRENT +0 -1
  612. package/test-verify-a/LOCK +0 -0
  613. package/test-verify-a/LOG +0 -3
  614. package/test-verify-a/LOG.old +0 -3
  615. package/test-verify-a/MANIFEST-000065 +0 -0
@@ -1,129 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- var __1 = require("..");
40
- /**
41
- * Verifies a message validity (PoW, Address, timestamp, signatures)
42
- * @param msg AnyMessage
43
- * @param pow amount of proof of work required, number of leading zeroes (default is 0/no pow)
44
- * @returns boolean or undefined if the message type does not match
45
- */
46
- function verifyMessage(msg, pow) {
47
- if (pow === void 0) { pow = 0; }
48
- return __awaiter(this, void 0, void 0, function () {
49
- var strData, addressNamespace, key, data, verified, _a;
50
- return __generator(this, function (_b) {
51
- switch (_b.label) {
52
- case 0:
53
- strData = JSON.stringify(msg.v);
54
- if (msg.t === undefined ||
55
- msg.k === undefined ||
56
- msg.h === undefined ||
57
- msg.a === undefined ||
58
- msg.s === undefined ||
59
- msg.c === undefined) {
60
- return [2 /*return*/, __1.VerifyResult.InvalidData];
61
- }
62
- // Max clock shift allowed is 30 seconds.
63
- // Ten seconds was my original threshold but it failed some times.
64
- if (msg.t > new Date().getTime() + 30000) {
65
- // this.logger("Invalid message timestamp.");
66
- return [2 /*return*/, __1.VerifyResult.InvalidTimestamp];
67
- }
68
- addressNamespace = false;
69
- if (msg.k.slice(0, 1) == ":") {
70
- addressNamespace = msg.k.split(".")[0].slice(1);
71
- }
72
- if (!(msg.k.slice(0, 2) == "==")) return [3 /*break*/, 2];
73
- key = msg.k;
74
- return [4 /*yield*/, this.store
75
- .get(key)
76
- .then(function (data) {
77
- try {
78
- var message = JSON.parse(data);
79
- return message;
80
- }
81
- catch (e) {
82
- return null;
83
- }
84
- })
85
- .catch(function () {
86
- return null;
87
- })];
88
- case 1:
89
- data = _b.sent();
90
- if (data && data.a !== msg.a)
91
- return [2 /*return*/, __1.VerifyResult.CantOverwrite];
92
- _b.label = 2;
93
- case 2:
94
- if (addressNamespace && addressNamespace !== msg.a) {
95
- // this.logger("Provided address does not match");
96
- return [2 /*return*/, __1.VerifyResult.AddressMismatch];
97
- }
98
- // Verify hash and nonce (adjust zeroes for difficulty of the network)
99
- // While this POW does not enforce security per-se, it does make it harder
100
- // for attackers to spam the network, and could be adjusted by peers.
101
- // Disabled for now because it is painful on large requests
102
- if (pow > 0) {
103
- if (msg.h.slice(0, pow) !== new Array(pow).fill("0").join("")) {
104
- // this.logger("No valid hash (no pow)");
105
- return [2 /*return*/, __1.VerifyResult.NoProofOfWork];
106
- }
107
- if ((0, __1.sha256)("".concat(strData).concat(msg.a).concat(msg.t).concat(msg.n)) !== msg.h) {
108
- // this.logger("Specified hash does not generate a valid pow");
109
- return [2 /*return*/, __1.VerifyResult.InvalidHashNonce];
110
- }
111
- }
112
- if (!this.userAccount) return [3 /*break*/, 4];
113
- return [4 /*yield*/, this.userAccount.verifySignature(msg)];
114
- case 3:
115
- _a = _b.sent();
116
- return [3 /*break*/, 5];
117
- case 4:
118
- _a = false;
119
- _b.label = 5;
120
- case 5:
121
- verified = _a;
122
- // this.logger(`Signature validation: ${verified ? "Sucess" : "Failed"}`);
123
- return [2 /*return*/, verified ? __1.VerifyResult.Verified : __1.VerifyResult.InvalidSignature];
124
- }
125
- });
126
- });
127
- }
128
- exports.default = verifyMessage;
129
- //# sourceMappingURL=verifyMessage.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"verifyMessage.js","sourceRoot":"","sources":["../../src/utils/verifyMessage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wBAAoE;AAEpE;;;;;GAKG;AACH,SAA8B,aAAa,CAEzC,GAAiC,EACjC,GAAO;IAAP,oBAAA,EAAA,OAAO;;;;;;oBAGD,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;oBAEtC,IACE,GAAG,CAAC,CAAC,KAAK,SAAS;wBACnB,GAAG,CAAC,CAAC,KAAK,SAAS;wBACnB,GAAG,CAAC,CAAC,KAAK,SAAS;wBACnB,GAAG,CAAC,CAAC,KAAK,SAAS;wBACnB,GAAG,CAAC,CAAC,KAAK,SAAS;wBACnB,GAAG,CAAC,CAAC,KAAK,SAAS,EACnB;wBACA,sBAAO,gBAAY,CAAC,WAAW,EAAC;qBACjC;oBAED,yCAAyC;oBACzC,kEAAkE;oBAClE,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,EAAE;wBACxC,6CAA6C;wBAC7C,sBAAO,gBAAY,CAAC,gBAAgB,EAAC;qBACtC;oBAGG,gBAAgB,GAAmB,KAAK,CAAC;oBAC7C,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,GAAG,EAAE;wBAC5B,gBAAgB,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;qBACjD;yBAIG,CAAA,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,IAAI,CAAA,EAAzB,wBAAyB;oBACrB,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC;oBACL,qBAAM,IAAI,CAAC,KAAK;6BAC1B,GAAG,CAAC,GAAG,CAAC;6BACR,IAAI,CAAC,UAAC,IAAI;4BACT,IAAI;gCACF,IAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gCACjC,OAAO,OAAO,CAAC;6BAChB;4BAAC,OAAO,CAAC,EAAE;gCACV,OAAO,IAAI,CAAC;6BACb;wBACH,CAAC,CAAC;6BACD,KAAK,CAAC;4BACL,OAAO,IAAI,CAAC;wBACd,CAAC,CAAC,EAAA;;oBAZE,IAAI,GAAG,SAYT;oBACJ,IAAI,IAAI,IAAI,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC;wBAAE,sBAAO,gBAAY,CAAC,aAAa,EAAC;;;oBAGlE,IAAI,gBAAgB,IAAI,gBAAgB,KAAK,GAAG,CAAC,CAAC,EAAE;wBAClD,kDAAkD;wBAClD,sBAAO,gBAAY,CAAC,eAAe,EAAC;qBACrC;oBAED,sEAAsE;oBACtE,0EAA0E;oBAC1E,qEAAqE;oBACrE,2DAA2D;oBAC3D,IAAI,GAAG,GAAG,CAAC,EAAE;wBACX,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,KAAK,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;4BAC7D,yCAAyC;4BACzC,sBAAO,gBAAY,CAAC,aAAa,EAAC;yBACnC;wBAED,IAAI,IAAA,UAAM,EAAC,UAAG,OAAO,SAAG,GAAG,CAAC,CAAC,SAAG,GAAG,CAAC,CAAC,SAAG,GAAG,CAAC,CAAC,CAAE,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE;4BAC1D,+DAA+D;4BAC/D,sBAAO,gBAAY,CAAC,gBAAgB,EAAC;yBACtC;qBACF;yBAEgB,IAAI,CAAC,WAAW,EAAhB,wBAAgB;oBAC7B,qBAAM,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,GAAG,CAAC,EAAA;;oBAA3C,KAAA,SAA2C,CAAA;;;oBAC3C,KAAA,KAAK,CAAA;;;oBAFH,QAAQ,KAEL;oBACT,0EAA0E;oBAE1E,sBAAO,QAAQ,CAAC,CAAC,CAAC,gBAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,gBAAY,CAAC,gBAAgB,EAAC;;;;CACzE;AA/ED,gCA+EC"}
@@ -1,2 +0,0 @@
1
- import { ToolDb, Peer } from "..";
2
- export default function verifyPeer(tooldb: ToolDb, peer: Peer): Promise<import("..").VerifyResult>;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var __1 = require("..");
4
- function verifyPeer(tooldb, peer) {
5
- var data = (0, __1.sha256)("".concat(peer.topic, "-").concat(peer.timestamp, "-").concat(peer.host, ":").concat(peer.port));
6
- // its not really a message but this function works with a Partial
7
- // I want to keep it like this so the signature verification is in a single place
8
- return tooldb.verifyMessage({
9
- h: data,
10
- a: peer.address,
11
- s: peer.sig,
12
- });
13
- }
14
- exports.default = verifyPeer;
15
- //# sourceMappingURL=verifyPeer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"verifyPeer.js","sourceRoot":"","sources":["../../src/utils/verifyPeer.ts"],"names":[],"mappings":";;AAAA,wBAA0C;AAE1C,SAAwB,UAAU,CAAC,MAAc,EAAE,IAAU;IAC3D,IAAM,IAAI,GAAG,IAAA,UAAM,EACjB,UAAG,IAAI,CAAC,KAAK,cAAI,IAAI,CAAC,SAAS,cAAI,IAAI,CAAC,IAAI,cAAI,IAAI,CAAC,IAAI,CAAE,CAC5D,CAAC;IAEF,kEAAkE;IAClE,iFAAiF;IACjF,OAAO,MAAM,CAAC,aAAa,CAAC;QAC1B,CAAC,EAAE,IAAI;QACP,CAAC,EAAE,IAAI,CAAC,OAAO;QACf,CAAC,EAAE,IAAI,CAAC,GAAG;KACZ,CAAC,CAAC;AACL,CAAC;AAZD,6BAYC"}
package/jest.config.ts DELETED
@@ -1,195 +0,0 @@
1
- /*
2
- * For a detailed explanation regarding each configuration property and type check, visit:
3
- * https://jestjs.io/docs/configuration
4
- */
5
-
6
- export default {
7
- // All imported modules in your tests should be mocked automatically
8
- // automock: false,
9
-
10
- // Stop running tests after `n` failures
11
- // bail: 0,
12
-
13
- // The directory where Jest should store its cached dependency information
14
- // cacheDirectory: "C:\\Users\\manue\\AppData\\Local\\Temp\\jest",
15
-
16
- // Automatically clear mock calls and instances between every test
17
- // clearMocks: false,
18
-
19
- // Indicates whether the coverage information should be collected while executing the test
20
- collectCoverage: true,
21
-
22
- // An array of glob patterns indicating a set of files for which coverage information should be collected
23
- // collectCoverageFrom: undefined,
24
-
25
- // The directory where Jest should output its coverage files
26
- coverageDirectory: "coverage",
27
-
28
- // An array of regexp pattern strings used to skip coverage collection
29
- // coveragePathIgnorePatterns: [
30
- // "\\\\node_modules\\\\"
31
- // ],
32
-
33
- // Indicates which provider should be used to instrument code for coverage
34
- // coverageProvider: "babel",
35
-
36
- // A list of reporter names that Jest uses when writing coverage reports
37
- // coverageReporters: [
38
- // "json",
39
- // "text",
40
- // "lcov",
41
- // "clover"
42
- // ],
43
-
44
- // An object that configures minimum threshold enforcement for coverage results
45
- // coverageThreshold: undefined,
46
-
47
- // A path to a custom dependency extractor
48
- // dependencyExtractor: undefined,
49
-
50
- // Make calling deprecated APIs throw helpful error messages
51
- // errorOnDeprecated: false,
52
-
53
- // Force coverage collection from ignored files using an array of glob patterns
54
- // forceCoverageMatch: [],
55
-
56
- // A path to a module which exports an async function that is triggered once before all test suites
57
- // globalSetup: undefined,
58
-
59
- // A path to a module which exports an async function that is triggered once after all test suites
60
- // globalTeardown: undefined,
61
-
62
- // A set of global variables that need to be available in all test environments
63
- // globals: {},
64
-
65
- // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
66
- // maxWorkers: "50%",
67
-
68
- // An array of directory names to be searched recursively up from the requiring module's location
69
- // moduleDirectories: [
70
- // "node_modules"
71
- // ],
72
-
73
- // An array of file extensions your modules use
74
- // moduleFileExtensions: [
75
- // "js",
76
- // "jsx",
77
- // "ts",
78
- // "tsx",
79
- // "json",
80
- // "node"
81
- // ],
82
-
83
- // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
84
- // moduleNameMapper: {},
85
-
86
- // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
87
- // modulePathIgnorePatterns: [],
88
-
89
- // Activates notifications for test results
90
- // notify: false,
91
-
92
- // An enum that specifies notification mode. Requires { notify: true }
93
- // notifyMode: "failure-change",
94
-
95
- // A preset that is used as a base for Jest's configuration
96
- // preset: undefined,
97
-
98
- // Run tests from one or more projects
99
- // projects: undefined,
100
-
101
- // Use this configuration option to add custom reporters to Jest
102
- // reporters: undefined,
103
-
104
- // Automatically reset mock state between every test
105
- // resetMocks: false,
106
-
107
- // Reset the module registry before running each individual test
108
- // resetModules: false,
109
-
110
- // A path to a custom resolver
111
- // resolver: undefined,
112
-
113
- // Automatically restore mock state between every test
114
- // restoreMocks: false,
115
-
116
- // The root directory that Jest should scan for tests and modules within
117
- // rootDir: undefined,
118
-
119
- // A list of paths to directories that Jest should use to search for files in
120
- // roots: [
121
- // "<rootDir>"
122
- // ],
123
-
124
- // Allows you to use a custom runner instead of Jest's default test runner
125
- // runner: "jest-runner",
126
-
127
- // The paths to modules that run some code to configure or set up the testing environment before each test
128
- // setupFiles: [],
129
-
130
- // A list of paths to modules that run some code to configure or set up the testing framework before each test
131
- // setupFilesAfterEnv: [],
132
-
133
- // The number of seconds after which a test is considered as slow and reported as such in the results.
134
- // slowTestThreshold: 5,
135
-
136
- // A list of paths to snapshot serializer modules Jest should use for snapshot testing
137
- // snapshotSerializers: [],
138
-
139
- // The test environment that will be used for testing
140
- // testEnvironment: "jsdom",
141
- testEnvironment: "./custom-test-env.js",
142
-
143
- // Options that will be passed to the testEnvironment
144
- // testEnvironmentOptions: {},
145
-
146
- // Adds a location field to test results
147
- // testLocationInResults: false,
148
-
149
- // The glob patterns Jest uses to detect test files
150
- // testMatch: [
151
- // "**/__tests__/**/*.[jt]s?(x)",
152
- // "**/?(*.)+(spec|test).[tj]s?(x)"
153
- // ],
154
-
155
- // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
156
- // testPathIgnorePatterns: [
157
- // "\\\\node_modules\\\\"
158
- // ],
159
-
160
- // The regexp pattern or array of patterns that Jest uses to detect test files
161
- // testRegex: [],
162
-
163
- // This option allows the use of a custom results processor
164
- // testResultsProcessor: undefined,
165
-
166
- // This option allows use of a custom test runner
167
- // testRunner: "jest-circus/runner",
168
-
169
- // This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
170
- // testURL: "http://localhost",
171
-
172
- // Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
173
- // timers: "real",
174
-
175
- // A map from regular expressions to paths to transformers
176
- // transform: undefined,
177
-
178
- // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
179
- // transformIgnorePatterns: [
180
- // "\\\\node_modules\\\\",
181
- // "\\.pnp\\.[^\\\\]+$"
182
- // ],
183
-
184
- // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
185
- // unmockedModulePathPatterns: undefined,
186
-
187
- // Indicates whether each individual test should be reported during the run
188
- // verbose: undefined,
189
-
190
- // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
191
- // watchPathIgnorePatterns: [],
192
-
193
- // Whether to use watchman for file crawling
194
- // watchman: true,
195
- };
package/jest.setup.js DELETED
File without changes
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1 +0,0 @@
1
- MANIFEST-000223
package/test-alice/LOCK DELETED
File without changes
package/test-alice/LOG DELETED
@@ -1,5 +0,0 @@
1
- 2022/07/04-18:56:49.959 18b8 Recovering log #222
2
- 2022/07/04-18:56:49.959 18b8 Level-0 table #224: started
3
- 2022/07/04-18:56:49.967 18b8 Level-0 table #224: 2161 bytes OK
4
- 2022/07/04-18:56:49.979 18b8 Delete type=0 #222
5
- 2022/07/04-18:56:49.980 18b8 Delete type=3 #220
@@ -1,5 +0,0 @@
1
- 2022/07/04-18:33:41.667 47a0 Recovering log #219
2
- 2022/07/04-18:33:41.667 47a0 Level-0 table #221: started
3
- 2022/07/04-18:33:41.709 47a0 Level-0 table #221: 2141 bytes OK
4
- 2022/07/04-18:33:41.778 47a0 Delete type=0 #219
5
- 2022/07/04-18:33:41.778 47a0 Delete type=3 #217
Binary file
File without changes
@@ -1 +0,0 @@
1
- MANIFEST-000018
File without changes
@@ -1,3 +0,0 @@
1
- 2022/07/04-18:57:06.570 650 Recovering log #17
2
- 2022/07/04-18:57:06.581 650 Delete type=0 #17
3
- 2022/07/04-18:57:06.581 650 Delete type=3 #16
@@ -1,3 +0,0 @@
1
- 2022/07/04-18:50:44.420 30fc Recovering log #15
2
- 2022/07/04-18:50:44.430 30fc Delete type=0 #15
3
- 2022/07/04-18:50:44.430 30fc Delete type=3 #14
Binary file
File without changes
@@ -1 +0,0 @@
1
- MANIFEST-000018
File without changes
@@ -1,3 +0,0 @@
1
- 2022/07/04-18:57:11.706 614c Recovering log #17
2
- 2022/07/04-18:57:11.715 614c Delete type=0 #17
3
- 2022/07/04-18:57:11.715 614c Delete type=3 #16
@@ -1,3 +0,0 @@
1
- 2022/07/04-18:50:49.555 485c Recovering log #15
2
- 2022/07/04-18:50:49.564 485c Delete type=0 #15
3
- 2022/07/04-18:50:49.564 485c Delete type=3 #14
Binary file
Binary file
Binary file
Binary file
package/test-bob/CURRENT DELETED
@@ -1 +0,0 @@
1
- MANIFEST-000232
package/test-bob/LOCK DELETED
File without changes
package/test-bob/LOG DELETED
@@ -1,5 +0,0 @@
1
- 2022/07/04-18:56:50.030 650 Recovering log #230
2
- 2022/07/04-18:56:50.030 650 Level-0 table #233: started
3
- 2022/07/04-18:56:50.037 650 Level-0 table #233: 1645 bytes OK
4
- 2022/07/04-18:56:50.050 650 Delete type=0 #230
5
- 2022/07/04-18:56:50.050 650 Delete type=3 #228
package/test-bob/LOG.old DELETED
@@ -1,14 +0,0 @@
1
- 2022/07/04-18:33:41.778 1e38 Recovering log #227
2
- 2022/07/04-18:33:41.778 1e38 Level-0 table #229: started
3
- 2022/07/04-18:33:41.819 1e38 Level-0 table #229: 1859 bytes OK
4
- 2022/07/04-18:33:41.902 1e38 Delete type=0 #227
5
- 2022/07/04-18:33:41.902 1e38 Delete type=3 #225
6
- 2022/07/04-18:33:41.903 42a8 Compacting 4@0 + 1@1 files
7
- 2022/07/04-18:33:41.979 42a8 Generated table #231@0: 141 keys, 63431 bytes
8
- 2022/07/04-18:33:41.979 42a8 Compacted 4@0 + 1@1 files => 63431 bytes
9
- 2022/07/04-18:33:42.044 42a8 compacted to: files[ 0 1 0 0 0 0 0 ]
10
- 2022/07/04-18:33:42.056 42a8 Delete type=2 #212
11
- 2022/07/04-18:33:42.056 42a8 Delete type=2 #214
12
- 2022/07/04-18:33:42.056 42a8 Delete type=2 #223
13
- 2022/07/04-18:33:42.057 42a8 Delete type=2 #226
14
- 2022/07/04-18:33:42.057 42a8 Delete type=2 #229
Binary file
Binary file
Binary file
Binary file
@@ -1 +0,0 @@
1
- MANIFEST-000007
package/test-chris/LOCK DELETED
File without changes
package/test-chris/LOG DELETED
@@ -1,5 +0,0 @@
1
- 2022/07/04-18:56:50.096 614c Recovering log #6
2
- 2022/07/04-18:56:50.096 614c Level-0 table #8: started
3
- 2022/07/04-18:56:50.106 614c Level-0 table #8: 544 bytes OK
4
- 2022/07/04-18:56:50.118 614c Delete type=0 #6
5
- 2022/07/04-18:56:50.118 614c Delete type=3 #4
@@ -1,5 +0,0 @@
1
- 2022/07/04-18:33:41.887 6380 Recovering log #3
2
- 2022/07/04-18:33:41.887 6380 Level-0 table #5: started
3
- 2022/07/04-18:33:41.983 6380 Level-0 table #5: 544 bytes OK
4
- 2022/07/04-18:33:42.113 6380 Delete type=0 #3
5
- 2022/07/04-18:33:42.114 6380 Delete type=3 #2
Binary file
Binary file
Binary file
Binary file
@@ -1 +0,0 @@
1
- MANIFEST-000247
package/test-node-a/LOCK DELETED
File without changes
package/test-node-a/LOG DELETED
@@ -1,5 +0,0 @@
1
- 2022/07/04-18:56:49.737 18b8 Recovering log #245
2
- 2022/07/04-18:56:49.737 18b8 Level-0 table #248: started
3
- 2022/07/04-18:56:49.744 18b8 Level-0 table #248: 2424 bytes OK
4
- 2022/07/04-18:56:49.753 18b8 Delete type=0 #245
5
- 2022/07/04-18:56:49.753 18b8 Delete type=3 #243
@@ -1,14 +0,0 @@
1
- 2022/07/04-18:33:41.232 47a0 Recovering log #242
2
- 2022/07/04-18:33:41.232 47a0 Level-0 table #244: started
3
- 2022/07/04-18:33:41.251 47a0 Level-0 table #244: 2463 bytes OK
4
- 2022/07/04-18:33:41.261 47a0 Delete type=0 #242
5
- 2022/07/04-18:33:41.261 47a0 Delete type=3 #240
6
- 2022/07/04-18:33:41.263 42a8 Compacting 4@0 + 1@1 files
7
- 2022/07/04-18:33:41.278 42a8 Generated table #246@0: 334 keys, 126875 bytes
8
- 2022/07/04-18:33:41.279 42a8 Compacted 4@0 + 1@1 files => 126875 bytes
9
- 2022/07/04-18:33:41.283 42a8 compacted to: files[ 0 1 0 0 0 0 0 ]
10
- 2022/07/04-18:33:41.284 42a8 Delete type=2 #227
11
- 2022/07/04-18:33:41.284 42a8 Delete type=2 #229
12
- 2022/07/04-18:33:41.284 42a8 Delete type=2 #238
13
- 2022/07/04-18:33:41.285 42a8 Delete type=2 #241
14
- 2022/07/04-18:33:41.285 42a8 Delete type=2 #244
Binary file
Binary file
Binary file
Binary file
@@ -1 +0,0 @@
1
- MANIFEST-000247
package/test-node-b/LOCK DELETED
File without changes
package/test-node-b/LOG DELETED
@@ -1,5 +0,0 @@
1
- 2022/07/04-18:56:49.852 2078 Recovering log #245
2
- 2022/07/04-18:56:49.852 2078 Level-0 table #248: started
3
- 2022/07/04-18:56:49.858 2078 Level-0 table #248: 2424 bytes OK
4
- 2022/07/04-18:56:49.870 2078 Delete type=0 #245
5
- 2022/07/04-18:56:49.871 2078 Delete type=3 #243
@@ -1,14 +0,0 @@
1
- 2022/07/04-18:33:41.465 1e38 Recovering log #242
2
- 2022/07/04-18:33:41.466 1e38 Level-0 table #244: started
3
- 2022/07/04-18:33:41.471 1e38 Level-0 table #244: 2463 bytes OK
4
- 2022/07/04-18:33:41.494 1e38 Delete type=0 #242
5
- 2022/07/04-18:33:41.494 1e38 Delete type=3 #240
6
- 2022/07/04-18:33:41.494 42a8 Compacting 4@0 + 1@1 files
7
- 2022/07/04-18:33:41.637 42a8 Generated table #246@0: 334 keys, 126881 bytes
8
- 2022/07/04-18:33:41.637 42a8 Compacted 4@0 + 1@1 files => 126881 bytes
9
- 2022/07/04-18:33:41.669 42a8 compacted to: files[ 0 1 0 0 0 0 0 ]
10
- 2022/07/04-18:33:41.669 42a8 Delete type=2 #227
11
- 2022/07/04-18:33:41.670 42a8 Delete type=2 #229
12
- 2022/07/04-18:33:41.670 42a8 Delete type=2 #238
13
- 2022/07/04-18:33:41.670 42a8 Delete type=2 #241
14
- 2022/07/04-18:33:41.670 42a8 Delete type=2 #244
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1 +0,0 @@
1
- MANIFEST-000016
package/test-store/LOCK DELETED
File without changes
package/test-store/LOG DELETED
@@ -1,6 +0,0 @@
1
- 2022/07/04-18:57:13.643 614c Recovering log #15
2
- 2022/07/04-18:57:13.643 614c Level-0 table #17: started
3
- 2022/07/04-18:57:13.654 614c Level-0 table #17: 222 bytes OK
4
- 2022/07/04-18:57:13.662 614c Delete type=0 #15
5
- 2022/07/04-18:57:13.662 614c Delete type=3 #13
6
- 2022/07/04-18:57:13.666 1024 Moved #8 to level-1 222 bytes OK: files[ 3 2 0 0 0 0 0 ]
@@ -1,6 +0,0 @@
1
- 2022/07/04-18:35:32.273 50f0 Recovering log #12
2
- 2022/07/04-18:35:32.274 50f0 Level-0 table #14: started
3
- 2022/07/04-18:35:32.289 50f0 Level-0 table #14: 222 bytes OK
4
- 2022/07/04-18:35:32.298 50f0 Delete type=0 #12
5
- 2022/07/04-18:35:32.298 50f0 Delete type=3 #10
6
- 2022/07/04-18:35:32.301 1a98 Moved #14 to level-1 222 bytes OK: files[ 3 1 0 0 0 0 0 ]
Binary file
Binary file
File without changes
@@ -1 +0,0 @@
1
- MANIFEST-000065
File without changes