@xylabs/aries 0.1.1 → 0.1.7

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 (421) hide show
  1. package/README.md +6 -688
  2. package/dist/aries.mjs +47 -8466
  3. package/package.json +14 -169
  4. package/dist/actions/audit/auditPaths.mjs +0 -22
  5. package/dist/actions/audit/auditPaths.mjs.map +0 -1
  6. package/dist/actions/audit/index.mjs +0 -739
  7. package/dist/actions/audit/index.mjs.map +0 -1
  8. package/dist/actions/audit/installPlugin.mjs +0 -298
  9. package/dist/actions/audit/installPlugin.mjs.map +0 -1
  10. package/dist/actions/audit/listSessions.mjs +0 -93
  11. package/dist/actions/audit/listSessions.mjs.map +0 -1
  12. package/dist/actions/audit/openAuditDir.mjs +0 -44
  13. package/dist/actions/audit/openAuditDir.mjs.map +0 -1
  14. package/dist/actions/audit/searchAudit.mjs +0 -77
  15. package/dist/actions/audit/searchAudit.mjs.map +0 -1
  16. package/dist/actions/audit/showAiMeta.mjs +0 -105
  17. package/dist/actions/audit/showAiMeta.mjs.map +0 -1
  18. package/dist/actions/audit/showSession.mjs +0 -105
  19. package/dist/actions/audit/showSession.mjs.map +0 -1
  20. package/dist/actions/audit/statusAudit.mjs +0 -98
  21. package/dist/actions/audit/statusAudit.mjs.map +0 -1
  22. package/dist/actions/clamp/clampAudit.mjs +0 -53
  23. package/dist/actions/clamp/clampAudit.mjs.map +0 -1
  24. package/dist/actions/clamp/index.mjs +0 -2258
  25. package/dist/actions/clamp/index.mjs.map +0 -1
  26. package/dist/actions/clamp/ipcServer.mjs +0 -55
  27. package/dist/actions/clamp/ipcServer.mjs.map +0 -1
  28. package/dist/actions/clamp/policyManagement.mjs +0 -144
  29. package/dist/actions/clamp/policyManagement.mjs.map +0 -1
  30. package/dist/actions/clamp/promptUser.mjs +0 -91
  31. package/dist/actions/clamp/promptUser.mjs.map +0 -1
  32. package/dist/actions/clamp/runClamped.mjs +0 -2107
  33. package/dist/actions/clamp/runClamped.mjs.map +0 -1
  34. package/dist/actions/clamp/sandboxExec.mjs +0 -1612
  35. package/dist/actions/clamp/sandboxExec.mjs.map +0 -1
  36. package/dist/actions/clamp/shellEnvSetup.mjs +0 -59
  37. package/dist/actions/clamp/shellEnvSetup.mjs.map +0 -1
  38. package/dist/actions/clamp/shimGenerator.mjs +0 -68
  39. package/dist/actions/clamp/shimGenerator.mjs.map +0 -1
  40. package/dist/actions/clamp/terminalRenderer.mjs +0 -145
  41. package/dist/actions/clamp/terminalRenderer.mjs.map +0 -1
  42. package/dist/actions/datalake/audit/auditLog.mjs +0 -191
  43. package/dist/actions/datalake/audit/auditLog.mjs.map +0 -1
  44. package/dist/actions/datalake/createDatalake.mjs +0 -127
  45. package/dist/actions/datalake/createDatalake.mjs.map +0 -1
  46. package/dist/actions/datalake/describeDatalake.mjs +0 -159
  47. package/dist/actions/datalake/describeDatalake.mjs.map +0 -1
  48. package/dist/actions/datalake/destroyDatalake.mjs +0 -34
  49. package/dist/actions/datalake/destroyDatalake.mjs.map +0 -1
  50. package/dist/actions/datalake/dev/downDevServer.mjs +0 -102
  51. package/dist/actions/datalake/dev/downDevServer.mjs.map +0 -1
  52. package/dist/actions/datalake/dev/index.mjs +0 -369
  53. package/dist/actions/datalake/dev/index.mjs.map +0 -1
  54. package/dist/actions/datalake/dev/logsDevServer.mjs +0 -44
  55. package/dist/actions/datalake/dev/logsDevServer.mjs.map +0 -1
  56. package/dist/actions/datalake/dev/paths.mjs +0 -25
  57. package/dist/actions/datalake/dev/paths.mjs.map +0 -1
  58. package/dist/actions/datalake/dev/resetDevServer.mjs +0 -118
  59. package/dist/actions/datalake/dev/resetDevServer.mjs.map +0 -1
  60. package/dist/actions/datalake/dev/resolveServerBin.mjs +0 -26
  61. package/dist/actions/datalake/dev/resolveServerBin.mjs.map +0 -1
  62. package/dist/actions/datalake/dev/state.mjs +0 -62
  63. package/dist/actions/datalake/dev/state.mjs.map +0 -1
  64. package/dist/actions/datalake/dev/statusDevServer.mjs +0 -101
  65. package/dist/actions/datalake/dev/statusDevServer.mjs.map +0 -1
  66. package/dist/actions/datalake/dev/upDevServer.mjs +0 -221
  67. package/dist/actions/datalake/dev/upDevServer.mjs.map +0 -1
  68. package/dist/actions/datalake/dev/waitForHealth.mjs +0 -22
  69. package/dist/actions/datalake/dev/waitForHealth.mjs.map +0 -1
  70. package/dist/actions/datalake/formatters.mjs +0 -90
  71. package/dist/actions/datalake/formatters.mjs.map +0 -1
  72. package/dist/actions/datalake/grantAccess.mjs +0 -116
  73. package/dist/actions/datalake/grantAccess.mjs.map +0 -1
  74. package/dist/actions/datalake/index.mjs +0 -361
  75. package/dist/actions/datalake/index.mjs.map +0 -1
  76. package/dist/actions/datalake/listDatalakes.mjs +0 -54
  77. package/dist/actions/datalake/listDatalakes.mjs.map +0 -1
  78. package/dist/actions/datalake/login.mjs +0 -20
  79. package/dist/actions/datalake/login.mjs.map +0 -1
  80. package/dist/actions/datalake/logout.mjs +0 -11
  81. package/dist/actions/datalake/logout.mjs.map +0 -1
  82. package/dist/actions/datalake/mintToken.mjs +0 -37
  83. package/dist/actions/datalake/mintToken.mjs.map +0 -1
  84. package/dist/actions/datalake/parseSize.mjs +0 -21
  85. package/dist/actions/datalake/parseSize.mjs.map +0 -1
  86. package/dist/actions/datalake/payloads/fetchPayload.mjs +0 -76
  87. package/dist/actions/datalake/payloads/fetchPayload.mjs.map +0 -1
  88. package/dist/actions/datalake/payloads/index.mjs +0 -271
  89. package/dist/actions/datalake/payloads/index.mjs.map +0 -1
  90. package/dist/actions/datalake/payloads/mintAndConnect.mjs +0 -46
  91. package/dist/actions/datalake/payloads/mintAndConnect.mjs.map +0 -1
  92. package/dist/actions/datalake/payloads/parsePayloadsFile.mjs +0 -71
  93. package/dist/actions/datalake/payloads/parsePayloadsFile.mjs.map +0 -1
  94. package/dist/actions/datalake/payloads/pushPayloads.mjs +0 -181
  95. package/dist/actions/datalake/payloads/pushPayloads.mjs.map +0 -1
  96. package/dist/actions/datalake/payloads/tailPayloads.mjs +0 -106
  97. package/dist/actions/datalake/payloads/tailPayloads.mjs.map +0 -1
  98. package/dist/actions/datalake/resolveTarget.mjs +0 -15
  99. package/dist/actions/datalake/resolveTarget.mjs.map +0 -1
  100. package/dist/actions/datalake/revokeAccess.mjs +0 -108
  101. package/dist/actions/datalake/revokeAccess.mjs.map +0 -1
  102. package/dist/actions/datalake/useDatalake.mjs +0 -22
  103. package/dist/actions/datalake/useDatalake.mjs.map +0 -1
  104. package/dist/actions/detect/detectAiClients.mjs +0 -405
  105. package/dist/actions/detect/detectAiClients.mjs.map +0 -1
  106. package/dist/actions/detect/index.mjs +0 -405
  107. package/dist/actions/detect/index.mjs.map +0 -1
  108. package/dist/actions/hash/algorithms/blockhash.mjs +0 -61
  109. package/dist/actions/hash/algorithms/blockhash.mjs.map +0 -1
  110. package/dist/actions/hash/algorithms/chromaprint.mjs +0 -205
  111. package/dist/actions/hash/algorithms/chromaprint.mjs.map +0 -1
  112. package/dist/actions/hash/algorithms/dhash.mjs +0 -75
  113. package/dist/actions/hash/algorithms/dhash.mjs.map +0 -1
  114. package/dist/actions/hash/algorithms/index.mjs +0 -818
  115. package/dist/actions/hash/algorithms/index.mjs.map +0 -1
  116. package/dist/actions/hash/algorithms/nilsimsa.mjs +0 -27
  117. package/dist/actions/hash/algorithms/nilsimsa.mjs.map +0 -1
  118. package/dist/actions/hash/algorithms/pdq.mjs +0 -83
  119. package/dist/actions/hash/algorithms/pdq.mjs.map +0 -1
  120. package/dist/actions/hash/algorithms/phash.mjs +0 -71
  121. package/dist/actions/hash/algorithms/phash.mjs.map +0 -1
  122. package/dist/actions/hash/algorithms/sha256.mjs +0 -24
  123. package/dist/actions/hash/algorithms/sha256.mjs.map +0 -1
  124. package/dist/actions/hash/algorithms/ssdeep.mjs +0 -203
  125. package/dist/actions/hash/algorithms/ssdeep.mjs.map +0 -1
  126. package/dist/actions/hash/algorithms/tlsh.mjs +0 -66
  127. package/dist/actions/hash/algorithms/tlsh.mjs.map +0 -1
  128. package/dist/actions/hash/algorithms/types.mjs +0 -1
  129. package/dist/actions/hash/algorithms/types.mjs.map +0 -1
  130. package/dist/actions/hash/algorithms/videoFrames.mjs +0 -404
  131. package/dist/actions/hash/algorithms/videoFrames.mjs.map +0 -1
  132. package/dist/actions/hash/algorithms/xyo.mjs +0 -30
  133. package/dist/actions/hash/algorithms/xyo.mjs.map +0 -1
  134. package/dist/actions/hash/compareHashes.mjs +0 -823
  135. package/dist/actions/hash/compareHashes.mjs.map +0 -1
  136. package/dist/actions/hash/hashInput.mjs +0 -868
  137. package/dist/actions/hash/hashInput.mjs.map +0 -1
  138. package/dist/actions/hash/index.mjs +0 -881
  139. package/dist/actions/hash/index.mjs.map +0 -1
  140. package/dist/actions/hash/lib/hamming.mjs +0 -44
  141. package/dist/actions/hash/lib/hamming.mjs.map +0 -1
  142. package/dist/actions/hash/lib/levenshtein.mjs +0 -36
  143. package/dist/actions/hash/lib/levenshtein.mjs.map +0 -1
  144. package/dist/actions/hash/lib/runBinary.mjs +0 -54
  145. package/dist/actions/hash/lib/runBinary.mjs.map +0 -1
  146. package/dist/actions/hash/lib/which.mjs +0 -36
  147. package/dist/actions/hash/lib/which.mjs.map +0 -1
  148. package/dist/actions/hash/lib/withTempfile.mjs +0 -19
  149. package/dist/actions/hash/lib/withTempfile.mjs.map +0 -1
  150. package/dist/actions/index.mjs +0 -4615
  151. package/dist/actions/index.mjs.map +0 -1
  152. package/dist/actions/printVersion.mjs +0 -12
  153. package/dist/actions/printVersion.mjs.map +0 -1
  154. package/dist/actions/sync/index.mjs +0 -51
  155. package/dist/actions/sync/index.mjs.map +0 -1
  156. package/dist/actions/sync/syncAiConfig.mjs +0 -51
  157. package/dist/actions/sync/syncAiConfig.mjs.map +0 -1
  158. package/dist/actions/wallet/account/deriveAndAdd.mjs +0 -394
  159. package/dist/actions/wallet/account/deriveAndAdd.mjs.map +0 -1
  160. package/dist/actions/wallet/account/getActiveWallet.mjs +0 -338
  161. package/dist/actions/wallet/account/getActiveWallet.mjs.map +0 -1
  162. package/dist/actions/wallet/account/labelAccount.mjs +0 -389
  163. package/dist/actions/wallet/account/labelAccount.mjs.map +0 -1
  164. package/dist/actions/wallet/account/listAccounts.mjs +0 -374
  165. package/dist/actions/wallet/account/listAccounts.mjs.map +0 -1
  166. package/dist/actions/wallet/account/removeAccount.mjs +0 -384
  167. package/dist/actions/wallet/account/removeAccount.mjs.map +0 -1
  168. package/dist/actions/wallet/account/showAccount.mjs +0 -368
  169. package/dist/actions/wallet/account/showAccount.mjs.map +0 -1
  170. package/dist/actions/wallet/addressBook/storage.mjs +0 -110
  171. package/dist/actions/wallet/addressBook/storage.mjs.map +0 -1
  172. package/dist/actions/wallet/backup/exportBackup.mjs +0 -93
  173. package/dist/actions/wallet/backup/exportBackup.mjs.map +0 -1
  174. package/dist/actions/wallet/backup/importBackup.mjs +0 -142
  175. package/dist/actions/wallet/backup/importBackup.mjs.map +0 -1
  176. package/dist/actions/wallet/balance/getBalance.mjs +0 -434
  177. package/dist/actions/wallet/balance/getBalance.mjs.map +0 -1
  178. package/dist/actions/wallet/client/walletClient.mjs +0 -64
  179. package/dist/actions/wallet/client/walletClient.mjs.map +0 -1
  180. package/dist/actions/wallet/contact/contactActions.mjs +0 -120
  181. package/dist/actions/wallet/contact/contactActions.mjs.map +0 -1
  182. package/dist/actions/wallet/contact/storage.mjs +0 -69
  183. package/dist/actions/wallet/contact/storage.mjs.map +0 -1
  184. package/dist/actions/wallet/index.mjs +0 -1439
  185. package/dist/actions/wallet/index.mjs.map +0 -1
  186. package/dist/actions/wallet/network/networkActions.mjs +0 -137
  187. package/dist/actions/wallet/network/networkActions.mjs.map +0 -1
  188. package/dist/actions/wallet/network/storage.mjs +0 -93
  189. package/dist/actions/wallet/network/storage.mjs.map +0 -1
  190. package/dist/actions/wallet/password/changePassword.mjs +0 -282
  191. package/dist/actions/wallet/password/changePassword.mjs.map +0 -1
  192. package/dist/actions/wallet/password/getActiveKey.mjs +0 -297
  193. package/dist/actions/wallet/password/getActiveKey.mjs.map +0 -1
  194. package/dist/actions/wallet/password/initOrUnlock.mjs +0 -337
  195. package/dist/actions/wallet/password/initOrUnlock.mjs.map +0 -1
  196. package/dist/actions/wallet/password/passwordStorage.mjs +0 -69
  197. package/dist/actions/wallet/password/passwordStorage.mjs.map +0 -1
  198. package/dist/actions/wallet/password/setPassword.mjs +0 -138
  199. package/dist/actions/wallet/password/setPassword.mjs.map +0 -1
  200. package/dist/actions/wallet/password/validatePassword.mjs +0 -123
  201. package/dist/actions/wallet/password/validatePassword.mjs.map +0 -1
  202. package/dist/actions/wallet/passwordKey.mjs +0 -87
  203. package/dist/actions/wallet/passwordKey.mjs.map +0 -1
  204. package/dist/actions/wallet/paths.mjs +0 -26
  205. package/dist/actions/wallet/paths.mjs.map +0 -1
  206. package/dist/actions/wallet/prompt.mjs +0 -93
  207. package/dist/actions/wallet/prompt.mjs.map +0 -1
  208. package/dist/actions/wallet/seedPhrase/createPhrase.mjs +0 -392
  209. package/dist/actions/wallet/seedPhrase/createPhrase.mjs.map +0 -1
  210. package/dist/actions/wallet/seedPhrase/exportPhrase.mjs +0 -334
  211. package/dist/actions/wallet/seedPhrase/exportPhrase.mjs.map +0 -1
  212. package/dist/actions/wallet/seedPhrase/idGen.mjs +0 -11
  213. package/dist/actions/wallet/seedPhrase/idGen.mjs.map +0 -1
  214. package/dist/actions/wallet/seedPhrase/importPhrase.mjs +0 -393
  215. package/dist/actions/wallet/seedPhrase/importPhrase.mjs.map +0 -1
  216. package/dist/actions/wallet/seedPhrase/listPhrases.mjs +0 -62
  217. package/dist/actions/wallet/seedPhrase/listPhrases.mjs.map +0 -1
  218. package/dist/actions/wallet/seedPhrase/phraseStorage.mjs +0 -89
  219. package/dist/actions/wallet/seedPhrase/phraseStorage.mjs.map +0 -1
  220. package/dist/actions/wallet/seedPhrase/removePhrase.mjs +0 -366
  221. package/dist/actions/wallet/seedPhrase/removePhrase.mjs.map +0 -1
  222. package/dist/actions/wallet/seedPhrase/renamePhrase.mjs +0 -78
  223. package/dist/actions/wallet/seedPhrase/renamePhrase.mjs.map +0 -1
  224. package/dist/actions/wallet/seedPhrase/types.mjs +0 -1
  225. package/dist/actions/wallet/seedPhrase/types.mjs.map +0 -1
  226. package/dist/actions/wallet/seedPhrase/usePhrase.mjs +0 -83
  227. package/dist/actions/wallet/seedPhrase/usePhrase.mjs.map +0 -1
  228. package/dist/actions/wallet/session/machineId.mjs +0 -145
  229. package/dist/actions/wallet/session/machineId.mjs.map +0 -1
  230. package/dist/actions/wallet/session/sessionCache.mjs +0 -221
  231. package/dist/actions/wallet/session/sessionCache.mjs.map +0 -1
  232. package/dist/actions/wallet/session/unlock.mjs +0 -307
  233. package/dist/actions/wallet/session/unlock.mjs.map +0 -1
  234. package/dist/actions/wallet/sign/signPayload.mjs +0 -637
  235. package/dist/actions/wallet/sign/signPayload.mjs.map +0 -1
  236. package/dist/actions/wallet/storage.mjs +0 -51
  237. package/dist/actions/wallet/storage.mjs.map +0 -1
  238. package/dist/actions/wallet/transaction/broadcastTransaction.mjs +0 -453
  239. package/dist/actions/wallet/transaction/broadcastTransaction.mjs.map +0 -1
  240. package/dist/actions/wallet/transaction/sendTransaction.mjs +0 -457
  241. package/dist/actions/wallet/transaction/sendTransaction.mjs.map +0 -1
  242. package/dist/actions/wallet/transaction/signTransactionFile.mjs +0 -378
  243. package/dist/actions/wallet/transaction/signTransactionFile.mjs.map +0 -1
  244. package/dist/actions/xyo/index.mjs +0 -138
  245. package/dist/actions/xyo/index.mjs.map +0 -1
  246. package/dist/actions/xyo/transaction/index.mjs +0 -138
  247. package/dist/actions/xyo/transaction/index.mjs.map +0 -1
  248. package/dist/actions/xyo/transaction/validateTransactions.mjs +0 -138
  249. package/dist/actions/xyo/transaction/validateTransactions.mjs.map +0 -1
  250. package/dist/aries.mjs.map +0 -1
  251. package/dist/bin/aries.mjs +0 -8472
  252. package/dist/bin/aries.mjs.map +0 -1
  253. package/dist/commands/aiCommand.mjs +0 -492
  254. package/dist/commands/aiCommand.mjs.map +0 -1
  255. package/dist/commands/auditAiCommand.mjs +0 -119
  256. package/dist/commands/auditAiCommand.mjs.map +0 -1
  257. package/dist/commands/auditCommand.mjs +0 -857
  258. package/dist/commands/auditCommand.mjs.map +0 -1
  259. package/dist/commands/auditInstallCommand.mjs +0 -324
  260. package/dist/commands/auditInstallCommand.mjs.map +0 -1
  261. package/dist/commands/auditListCommand.mjs +0 -107
  262. package/dist/commands/auditListCommand.mjs.map +0 -1
  263. package/dist/commands/auditOpenCommand.mjs +0 -51
  264. package/dist/commands/auditOpenCommand.mjs.map +0 -1
  265. package/dist/commands/auditSearchCommand.mjs +0 -98
  266. package/dist/commands/auditSearchCommand.mjs.map +0 -1
  267. package/dist/commands/auditShowCommand.mjs +0 -123
  268. package/dist/commands/auditShowCommand.mjs.map +0 -1
  269. package/dist/commands/auditStatusCommand.mjs +0 -105
  270. package/dist/commands/auditStatusCommand.mjs.map +0 -1
  271. package/dist/commands/clampCommand.mjs +0 -2328
  272. package/dist/commands/clampCommand.mjs.map +0 -1
  273. package/dist/commands/clampPolicyCommand.mjs +0 -184
  274. package/dist/commands/clampPolicyCommand.mjs.map +0 -1
  275. package/dist/commands/clampPolicyInitCommand.mjs +0 -63
  276. package/dist/commands/clampPolicyInitCommand.mjs.map +0 -1
  277. package/dist/commands/clampPolicyListCommand.mjs +0 -56
  278. package/dist/commands/clampPolicyListCommand.mjs.map +0 -1
  279. package/dist/commands/clampPolicyShowCommand.mjs +0 -83
  280. package/dist/commands/clampPolicyShowCommand.mjs.map +0 -1
  281. package/dist/commands/clampRunCommand.mjs +0 -2137
  282. package/dist/commands/clampRunCommand.mjs.map +0 -1
  283. package/dist/commands/datalakeAuditCommand.mjs +0 -273
  284. package/dist/commands/datalakeAuditCommand.mjs.map +0 -1
  285. package/dist/commands/datalakeCommand.mjs +0 -1637
  286. package/dist/commands/datalakeCommand.mjs.map +0 -1
  287. package/dist/commands/datalakeCreateCommand.mjs +0 -189
  288. package/dist/commands/datalakeCreateCommand.mjs.map +0 -1
  289. package/dist/commands/datalakeDescribeCommand.mjs +0 -172
  290. package/dist/commands/datalakeDescribeCommand.mjs.map +0 -1
  291. package/dist/commands/datalakeDestroyCommand.mjs +0 -53
  292. package/dist/commands/datalakeDestroyCommand.mjs.map +0 -1
  293. package/dist/commands/datalakeDevCommand.mjs +0 -470
  294. package/dist/commands/datalakeDevCommand.mjs.map +0 -1
  295. package/dist/commands/datalakeDevDownCommand.mjs +0 -111
  296. package/dist/commands/datalakeDevDownCommand.mjs.map +0 -1
  297. package/dist/commands/datalakeDevLogsCommand.mjs +0 -65
  298. package/dist/commands/datalakeDevLogsCommand.mjs.map +0 -1
  299. package/dist/commands/datalakeDevResetCommand.mjs +0 -125
  300. package/dist/commands/datalakeDevResetCommand.mjs.map +0 -1
  301. package/dist/commands/datalakeDevStatusCommand.mjs +0 -110
  302. package/dist/commands/datalakeDevStatusCommand.mjs.map +0 -1
  303. package/dist/commands/datalakeDevUpCommand.mjs +0 -268
  304. package/dist/commands/datalakeDevUpCommand.mjs.map +0 -1
  305. package/dist/commands/datalakeFetchCommand.mjs +0 -106
  306. package/dist/commands/datalakeFetchCommand.mjs.map +0 -1
  307. package/dist/commands/datalakeGrantCommand.mjs +0 -147
  308. package/dist/commands/datalakeGrantCommand.mjs.map +0 -1
  309. package/dist/commands/datalakeListCommand.mjs +0 -61
  310. package/dist/commands/datalakeListCommand.mjs.map +0 -1
  311. package/dist/commands/datalakeLoginCommand.mjs +0 -39
  312. package/dist/commands/datalakeLoginCommand.mjs.map +0 -1
  313. package/dist/commands/datalakeLogoutCommand.mjs +0 -20
  314. package/dist/commands/datalakeLogoutCommand.mjs.map +0 -1
  315. package/dist/commands/datalakePushCommand.mjs +0 -214
  316. package/dist/commands/datalakePushCommand.mjs.map +0 -1
  317. package/dist/commands/datalakeRevokeCommand.mjs +0 -127
  318. package/dist/commands/datalakeRevokeCommand.mjs.map +0 -1
  319. package/dist/commands/datalakeTailCommand.mjs +0 -144
  320. package/dist/commands/datalakeTailCommand.mjs.map +0 -1
  321. package/dist/commands/datalakeTokenCommand.mjs +0 -61
  322. package/dist/commands/datalakeTokenCommand.mjs.map +0 -1
  323. package/dist/commands/datalakeUseCommand.mjs +0 -35
  324. package/dist/commands/datalakeUseCommand.mjs.map +0 -1
  325. package/dist/commands/detectCommand.mjs +0 -419
  326. package/dist/commands/detectCommand.mjs.map +0 -1
  327. package/dist/commands/hashCommand.mjs +0 -976
  328. package/dist/commands/hashCommand.mjs.map +0 -1
  329. package/dist/commands/hashCompareCommand.mjs +0 -865
  330. package/dist/commands/hashCompareCommand.mjs.map +0 -1
  331. package/dist/commands/index.mjs +0 -8461
  332. package/dist/commands/index.mjs.map +0 -1
  333. package/dist/commands/syncCommand.mjs +0 -66
  334. package/dist/commands/syncCommand.mjs.map +0 -1
  335. package/dist/commands/versionCommand.mjs +0 -24
  336. package/dist/commands/versionCommand.mjs.map +0 -1
  337. package/dist/commands/walletAccountCommand.mjs +0 -536
  338. package/dist/commands/walletAccountCommand.mjs.map +0 -1
  339. package/dist/commands/walletAccountDeriveCommand.mjs +0 -415
  340. package/dist/commands/walletAccountDeriveCommand.mjs.map +0 -1
  341. package/dist/commands/walletAccountLabelCommand.mjs +0 -405
  342. package/dist/commands/walletAccountLabelCommand.mjs.map +0 -1
  343. package/dist/commands/walletAccountListCommand.mjs +0 -381
  344. package/dist/commands/walletAccountListCommand.mjs.map +0 -1
  345. package/dist/commands/walletAccountRemoveCommand.mjs +0 -396
  346. package/dist/commands/walletAccountRemoveCommand.mjs.map +0 -1
  347. package/dist/commands/walletAccountShowCommand.mjs +0 -380
  348. package/dist/commands/walletAccountShowCommand.mjs.map +0 -1
  349. package/dist/commands/walletBackupCommand.mjs +0 -222
  350. package/dist/commands/walletBackupCommand.mjs.map +0 -1
  351. package/dist/commands/walletBackupExportCommand.mjs +0 -107
  352. package/dist/commands/walletBackupExportCommand.mjs.map +0 -1
  353. package/dist/commands/walletBackupImportCommand.mjs +0 -154
  354. package/dist/commands/walletBackupImportCommand.mjs.map +0 -1
  355. package/dist/commands/walletBalanceCommand.mjs +0 -448
  356. package/dist/commands/walletBalanceCommand.mjs.map +0 -1
  357. package/dist/commands/walletCommand.mjs +0 -1968
  358. package/dist/commands/walletCommand.mjs.map +0 -1
  359. package/dist/commands/walletContactAddCommand.mjs +0 -111
  360. package/dist/commands/walletContactAddCommand.mjs.map +0 -1
  361. package/dist/commands/walletContactCommand.mjs +0 -184
  362. package/dist/commands/walletContactCommand.mjs.map +0 -1
  363. package/dist/commands/walletContactListCommand.mjs +0 -66
  364. package/dist/commands/walletContactListCommand.mjs.map +0 -1
  365. package/dist/commands/walletContactRemoveCommand.mjs +0 -97
  366. package/dist/commands/walletContactRemoveCommand.mjs.map +0 -1
  367. package/dist/commands/walletContactRenameCommand.mjs +0 -114
  368. package/dist/commands/walletContactRenameCommand.mjs.map +0 -1
  369. package/dist/commands/walletCreateCommand.mjs +0 -407
  370. package/dist/commands/walletCreateCommand.mjs.map +0 -1
  371. package/dist/commands/walletExportCommand.mjs +0 -345
  372. package/dist/commands/walletExportCommand.mjs.map +0 -1
  373. package/dist/commands/walletImportCommand.mjs +0 -413
  374. package/dist/commands/walletImportCommand.mjs.map +0 -1
  375. package/dist/commands/walletListCommand.mjs +0 -69
  376. package/dist/commands/walletListCommand.mjs.map +0 -1
  377. package/dist/commands/walletLockCommand.mjs +0 -56
  378. package/dist/commands/walletLockCommand.mjs.map +0 -1
  379. package/dist/commands/walletNetworkAddCommand.mjs +0 -131
  380. package/dist/commands/walletNetworkAddCommand.mjs.map +0 -1
  381. package/dist/commands/walletNetworkCommand.mjs +0 -206
  382. package/dist/commands/walletNetworkCommand.mjs.map +0 -1
  383. package/dist/commands/walletNetworkListCommand.mjs +0 -104
  384. package/dist/commands/walletNetworkListCommand.mjs.map +0 -1
  385. package/dist/commands/walletNetworkRemoveCommand.mjs +0 -112
  386. package/dist/commands/walletNetworkRemoveCommand.mjs.map +0 -1
  387. package/dist/commands/walletNetworkUseCommand.mjs +0 -110
  388. package/dist/commands/walletNetworkUseCommand.mjs.map +0 -1
  389. package/dist/commands/walletPasswordChangeCommand.mjs +0 -291
  390. package/dist/commands/walletPasswordChangeCommand.mjs.map +0 -1
  391. package/dist/commands/walletPasswordCommand.mjs +0 -301
  392. package/dist/commands/walletPasswordCommand.mjs.map +0 -1
  393. package/dist/commands/walletRemoveCommand.mjs +0 -378
  394. package/dist/commands/walletRemoveCommand.mjs.map +0 -1
  395. package/dist/commands/walletRenameCommand.mjs +0 -94
  396. package/dist/commands/walletRenameCommand.mjs.map +0 -1
  397. package/dist/commands/walletSignCommand.mjs +0 -662
  398. package/dist/commands/walletSignCommand.mjs.map +0 -1
  399. package/dist/commands/walletTxBroadcastCommand.mjs +0 -473
  400. package/dist/commands/walletTxBroadcastCommand.mjs.map +0 -1
  401. package/dist/commands/walletTxCommand.mjs +0 -612
  402. package/dist/commands/walletTxCommand.mjs.map +0 -1
  403. package/dist/commands/walletTxSendCommand.mjs +0 -492
  404. package/dist/commands/walletTxSendCommand.mjs.map +0 -1
  405. package/dist/commands/walletTxSignCommand.mjs +0 -403
  406. package/dist/commands/walletTxSignCommand.mjs.map +0 -1
  407. package/dist/commands/walletUnlockCommand.mjs +0 -308
  408. package/dist/commands/walletUnlockCommand.mjs.map +0 -1
  409. package/dist/commands/walletUseCommand.mjs +0 -95
  410. package/dist/commands/walletUseCommand.mjs.map +0 -1
  411. package/dist/commands/xyoCommand.mjs +0 -188
  412. package/dist/commands/xyoCommand.mjs.map +0 -1
  413. package/dist/commands/xyoTxCommand.mjs +0 -178
  414. package/dist/commands/xyoTxCommand.mjs.map +0 -1
  415. package/dist/commands/xyoTxValidateCommand.mjs +0 -168
  416. package/dist/commands/xyoTxValidateCommand.mjs.map +0 -1
  417. package/dist/index.d.ts +0 -3
  418. package/dist/index.mjs +0 -8466
  419. package/dist/index.mjs.map +0 -1
  420. package/dist/types/modules.d.mjs +0 -1
  421. package/dist/types/modules.d.mjs.map +0 -1
@@ -1,823 +0,0 @@
1
- // src/actions/hash/algorithms/blockhash.ts
2
- import imghash from "imghash";
3
-
4
- // src/actions/hash/lib/hamming.ts
5
- function popcount8(byte) {
6
- let count = 0;
7
- let value = byte & 255;
8
- while (value !== 0) {
9
- count += value & 1;
10
- value >>>= 1;
11
- }
12
- return count;
13
- }
14
- function hammingHex(a, b) {
15
- if (a.length !== b.length) {
16
- throw new Error(`Hash length mismatch: ${a.length} vs ${b.length}`);
17
- }
18
- if (a.length % 2 !== 0) {
19
- throw new Error(`Hash hex length must be even, got ${a.length}`);
20
- }
21
- let dist = 0;
22
- for (let i = 0; i < a.length; i += 2) {
23
- const xa = Number.parseInt(a.slice(i, i + 2), 16);
24
- const xb = Number.parseInt(b.slice(i, i + 2), 16);
25
- if (Number.isNaN(xa) || Number.isNaN(xb)) {
26
- throw new TypeError(`Invalid hex at position ${i}: '${a.slice(i, i + 2)}' / '${b.slice(i, i + 2)}'`);
27
- }
28
- dist += popcount8(xa ^ xb);
29
- }
30
- return dist;
31
- }
32
- function popcount32(value) {
33
- let v = Math.trunc(value);
34
- v = v - (v >>> 1 & 1431655765);
35
- v = (v & 858993459) + (v >>> 2 & 858993459);
36
- v = v + (v >>> 4) & 252645135;
37
- return v * 16843009 >>> 24 & 255;
38
- }
39
-
40
- // src/actions/hash/algorithms/blockhash.ts
41
- var { hash: imghashFn } = imghash;
42
- var blockhashAlgorithm = {
43
- name: "blockhash",
44
- family: "perceptual-image",
45
- inputType: "image",
46
- async hash(input) {
47
- if (input.path !== void 0) {
48
- return await imghashFn(input.path, 8, "hex");
49
- }
50
- if (input.bytes !== void 0) {
51
- return await imghashFn(input.bytes, 8, "hex");
52
- }
53
- throw new Error("blockhash requires bytes or a path.");
54
- },
55
- async compare(a, b) {
56
- const dist = hammingHex(a, b);
57
- const bits = a.length / 2 * 8;
58
- return {
59
- distance: dist,
60
- similarity: 1 - dist / bits,
61
- metric: `hamming-${bits}`
62
- };
63
- }
64
- };
65
-
66
- // src/actions/hash/lib/runBinary.ts
67
- import { spawn } from "child_process";
68
- async function runBinary(options) {
69
- const maxBytes = options.maxBytes ?? 64 * 1024 * 1024;
70
- return await new Promise((resolve, reject) => {
71
- const child = spawn(options.binary, [...options.args ?? []], { stdio: ["pipe", "pipe", "pipe"] });
72
- const stdoutChunks = [];
73
- let stdoutBytes = 0;
74
- let stderr = "";
75
- let killedForOverflow = false;
76
- child.stdout.on("data", (chunk) => {
77
- stdoutBytes += chunk.length;
78
- if (stdoutBytes > maxBytes) {
79
- if (!killedForOverflow) {
80
- killedForOverflow = true;
81
- child.kill("SIGKILL");
82
- }
83
- return;
84
- }
85
- stdoutChunks.push(chunk);
86
- });
87
- child.stderr.on("data", (chunk) => {
88
- stderr += chunk.toString("utf8");
89
- });
90
- child.on("error", (err) => reject(err));
91
- child.on("close", (code) => {
92
- if (killedForOverflow) {
93
- reject(new Error(`${options.binary} stdout exceeded ${maxBytes} bytes`));
94
- return;
95
- }
96
- const exitCode = code ?? -1;
97
- const stdout = Buffer.concat(stdoutChunks);
98
- if (exitCode !== 0) {
99
- const tail = stderr.trim().split(/\r?\n/).slice(-3).join("\n");
100
- reject(new Error(`${options.binary} exited ${exitCode}${tail.length > 0 ? `: ${tail}` : ""}`));
101
- return;
102
- }
103
- resolve({
104
- stdout,
105
- stderr,
106
- exitCode
107
- });
108
- });
109
- if (options.stdin === void 0) {
110
- child.stdin.end();
111
- } else {
112
- child.stdin.end(options.stdin);
113
- }
114
- });
115
- }
116
-
117
- // src/actions/hash/lib/which.ts
118
- import { spawn as spawn2 } from "child_process";
119
- async function which(binary) {
120
- return await new Promise((resolve) => {
121
- const cmd = process.platform === "win32" ? "where" : "command";
122
- const args = process.platform === "win32" ? [binary] : ["-v", binary];
123
- const child = spawn2(cmd, args, { shell: process.platform !== "win32" });
124
- let stdout = "";
125
- child.stdout.on("data", (chunk) => {
126
- stdout += chunk.toString("utf8");
127
- });
128
- child.on("error", () => resolve(null));
129
- child.on("close", (code) => {
130
- if (code === 0) {
131
- const path = stdout.split(/\r?\n/).find((line) => line.trim().length > 0)?.trim() ?? null;
132
- resolve(path);
133
- } else {
134
- resolve(null);
135
- }
136
- });
137
- });
138
- }
139
- async function requireBinary(req) {
140
- const path = await which(req.binary);
141
- if (path !== null) return path;
142
- const lines = [`${req.binary} binary not found on PATH. Install with:`];
143
- if (req.install.brew !== void 0) lines.push(` macOS: brew install ${req.install.brew}`);
144
- if (req.install.apt !== void 0) lines.push(` Debian: apt install ${req.install.apt}`);
145
- if (req.install.choco !== void 0) lines.push(` Windows: choco install ${req.install.choco}`);
146
- throw new Error(lines.join("\n"));
147
- }
148
-
149
- // src/actions/hash/lib/withTempfile.ts
150
- import { randomBytes } from "crypto";
151
- import { rm, writeFile } from "fs/promises";
152
- import OS from "os";
153
- import PATH from "path";
154
- async function withTempfile(bytes, extension, fn) {
155
- const ext = extension !== void 0 && extension.length > 0 ? `.${extension}` : "";
156
- const path = PATH.join(OS.tmpdir(), `aries-hash-${randomBytes(8).toString("hex")}${ext}`);
157
- await writeFile(path, bytes);
158
- try {
159
- return await fn(path);
160
- } finally {
161
- await rm(path, { force: true });
162
- }
163
- }
164
-
165
- // src/actions/hash/algorithms/chromaprint.ts
166
- var FPCALC_BIN = {
167
- binary: "fpcalc",
168
- install: {
169
- brew: "chromaprint",
170
- apt: "libchromaprint-tools",
171
- choco: "chromaprint"
172
- }
173
- };
174
- async function runFpcalc(path) {
175
- await requireBinary(FPCALC_BIN);
176
- const { stdout } = await runBinary({ binary: "fpcalc", args: ["-raw", "-json", path] });
177
- const parsed = JSON.parse(stdout.toString("utf8"));
178
- if (typeof parsed.duration !== "number" || !Array.isArray(parsed.fingerprint)) {
179
- throw new TypeError("fpcalc returned unexpected JSON shape.");
180
- }
181
- return {
182
- algorithm: "chromaprint",
183
- duration: parsed.duration,
184
- fingerprint: parsed.fingerprint
185
- };
186
- }
187
- function parseChromaprintHash(raw) {
188
- let parsed;
189
- try {
190
- parsed = JSON.parse(raw);
191
- } catch {
192
- throw new Error("chromaprint hash must be a JSON document produced by `aries hash --algorithm chromaprint`.");
193
- }
194
- const obj = parsed;
195
- if (obj.algorithm !== "chromaprint" || typeof obj.duration !== "number" || !Array.isArray(obj.fingerprint)) {
196
- throw new Error("chromaprint hash JSON missing required fields (algorithm, duration, fingerprint).");
197
- }
198
- return obj;
199
- }
200
- function compareFingerprints(a, b) {
201
- if (a.length === 0 || b.length === 0) {
202
- return {
203
- similarity: 0,
204
- distance: Number.NaN,
205
- offset: 0
206
- };
207
- }
208
- const span = Math.min(a.length, b.length);
209
- const maxOffset = Math.max(a.length, b.length) - span;
210
- let best = {
211
- similarity: 0,
212
- distance: 32 * span,
213
- offset: 0
214
- };
215
- for (let offset = -maxOffset; offset <= maxOffset; offset++) {
216
- const aStart = Math.max(0, -offset);
217
- const bStart = Math.max(0, offset);
218
- const overlap = Math.min(a.length - aStart, b.length - bStart);
219
- if (overlap < Math.max(8, span / 4)) continue;
220
- let bits = 0;
221
- for (let i = 0; i < overlap; i++) {
222
- bits += popcount32(a[aStart + i] ^ b[bStart + i]);
223
- }
224
- const similarity = 1 - bits / (32 * overlap);
225
- if (similarity > best.similarity) {
226
- best = {
227
- similarity,
228
- distance: bits,
229
- offset
230
- };
231
- }
232
- }
233
- return best;
234
- }
235
- var chromaprintAlgorithm = {
236
- name: "chromaprint",
237
- family: "audio",
238
- inputType: "audio",
239
- requires: [FPCALC_BIN],
240
- async hash(input) {
241
- const fp = input.path === void 0 ? input.bytes === void 0 ? null : await withTempfile(input.bytes, "audio.bin", async (path) => await runFpcalc(path)) : await runFpcalc(input.path);
242
- if (fp === null) {
243
- throw new Error("chromaprint requires bytes or a path.");
244
- }
245
- return JSON.stringify(fp);
246
- },
247
- async compare(a, b) {
248
- const fpA = parseChromaprintHash(a);
249
- const fpB = parseChromaprintHash(b);
250
- const result = compareFingerprints(fpA.fingerprint, fpB.fingerprint);
251
- return {
252
- similarity: result.similarity,
253
- distance: Number.isFinite(result.distance) ? result.distance : void 0,
254
- metric: "chromaprint-windowed-hamming"
255
- };
256
- }
257
- };
258
-
259
- // src/actions/hash/algorithms/dhash.ts
260
- import { readFile } from "fs/promises";
261
- import sharp from "sharp";
262
- var dhashAlgorithm = {
263
- name: "dhash",
264
- family: "perceptual-image",
265
- inputType: "image",
266
- async hash(input) {
267
- const source = input.bytes ?? (input.path === void 0 ? void 0 : await readFile(input.path));
268
- if (source === void 0) {
269
- throw new Error("dhash requires bytes or a path.");
270
- }
271
- const raw = await sharp(source).resize(9, 8, { fit: "fill" }).grayscale().raw().toBuffer();
272
- if (raw.length !== 9 * 8) {
273
- throw new Error(`dhash unexpected raw buffer length ${raw.length}`);
274
- }
275
- let bits = "";
276
- for (let row = 0; row < 8; row++) {
277
- for (let col = 0; col < 8; col++) {
278
- const left = raw[row * 9 + col];
279
- const right = raw[row * 9 + col + 1];
280
- bits += left > right ? "1" : "0";
281
- }
282
- }
283
- let hex = "";
284
- for (let i = 0; i < bits.length; i += 4) {
285
- hex += Number.parseInt(bits.slice(i, i + 4), 2).toString(16);
286
- }
287
- return hex;
288
- },
289
- async compare(a, b) {
290
- const dist = hammingHex(a, b);
291
- const bits = a.length / 2 * 8;
292
- return {
293
- distance: dist,
294
- similarity: 1 - dist / bits,
295
- metric: `hamming-${bits}`
296
- };
297
- }
298
- };
299
-
300
- // src/actions/hash/algorithms/nilsimsa.ts
301
- import { Nilsimsa } from "nilsimsa";
302
- var nilsimsaAlgorithm = {
303
- name: "nilsimsa",
304
- family: "fuzzy-byte",
305
- inputType: "bytes",
306
- async hash(input) {
307
- if (input.bytes === void 0) {
308
- throw new Error("nilsimsa requires loaded bytes.");
309
- }
310
- const n = new Nilsimsa(input.bytes);
311
- return n.digest("hex");
312
- },
313
- async compare(a, b) {
314
- const raw = Nilsimsa.compare(a, b, "hex");
315
- const similarity = Math.max(0, Math.min(1, (raw + 128) / 256));
316
- return {
317
- distance: 128 - raw,
318
- similarity,
319
- metric: "nilsimsa-score"
320
- };
321
- }
322
- };
323
-
324
- // src/actions/hash/algorithms/pdq.ts
325
- import { createRequire } from "module";
326
- import sharp2 from "sharp";
327
- var require2 = createRequire(import.meta.url);
328
- var { PDQ } = require2("pdq-wasm");
329
- var initialized = false;
330
- async function ensureInit() {
331
- if (initialized) return;
332
- await PDQ.init();
333
- initialized = true;
334
- }
335
- async function toRgbRaw(source) {
336
- const { data, info } = await sharp2(source).removeAlpha().raw().toBuffer({ resolveWithObject: true });
337
- return {
338
- data: new Uint8Array(data.buffer, data.byteOffset, data.byteLength),
339
- width: info.width,
340
- height: info.height
341
- };
342
- }
343
- var pdqAlgorithm = {
344
- name: "pdq",
345
- family: "perceptual-image",
346
- inputType: "image",
347
- async hash(input) {
348
- const source = input.path ?? input.bytes;
349
- if (source === void 0) {
350
- throw new Error("pdq requires bytes or a path.");
351
- }
352
- await ensureInit();
353
- const rgb = await toRgbRaw(source);
354
- const result = PDQ.hash({
355
- data: rgb.data,
356
- width: rgb.width,
357
- height: rgb.height,
358
- channels: 3
359
- });
360
- return PDQ.toHex(result.hash);
361
- },
362
- async compare(a, b) {
363
- const dist = hammingHex(a, b);
364
- const bits = a.length / 2 * 8;
365
- return {
366
- distance: dist,
367
- similarity: 1 - dist / bits,
368
- metric: `hamming-${bits}`
369
- };
370
- }
371
- };
372
-
373
- // src/actions/hash/algorithms/phash.ts
374
- import phashLib from "sharp-phash";
375
- var phash = phashLib;
376
- function binaryToHex(bin) {
377
- if (!/^[01]+$/.test(bin)) {
378
- throw new TypeError(`phash returned unexpected output: ${bin.slice(0, 20)}\u2026`);
379
- }
380
- const padded = bin.padStart(Math.ceil(bin.length / 4) * 4, "0");
381
- let hex = "";
382
- for (let i = 0; i < padded.length; i += 4) {
383
- hex += Number.parseInt(padded.slice(i, i + 4), 2).toString(16);
384
- }
385
- return hex;
386
- }
387
- var phashAlgorithm = {
388
- name: "phash",
389
- family: "perceptual-image",
390
- inputType: "image",
391
- async hash(input) {
392
- const source = input.path ?? input.bytes;
393
- if (source === void 0) {
394
- throw new Error("phash requires bytes or a path.");
395
- }
396
- const bin = await phash(source);
397
- return binaryToHex(bin);
398
- },
399
- async compare(a, b) {
400
- const dist = hammingHex(a, b);
401
- const bits = a.length / 2 * 8;
402
- return {
403
- distance: dist,
404
- similarity: 1 - dist / bits,
405
- metric: `hamming-${bits}`
406
- };
407
- }
408
- };
409
-
410
- // src/actions/hash/algorithms/sha256.ts
411
- import { createHash } from "crypto";
412
- var sha256Algorithm = {
413
- name: "sha256",
414
- family: "strict",
415
- inputType: "bytes",
416
- async hash(input) {
417
- if (input.bytes === void 0) {
418
- throw new Error("sha256 requires loaded bytes.");
419
- }
420
- return createHash("sha256").update(input.bytes).digest("hex");
421
- },
422
- async compare(a, b) {
423
- return {
424
- similarity: a === b ? 1 : 0,
425
- distance: a === b ? 0 : 1,
426
- metric: "exact-match"
427
- };
428
- }
429
- };
430
-
431
- // src/actions/hash/lib/levenshtein.ts
432
- function levenshtein(a, b) {
433
- if (a === b) return 0;
434
- if (a.length === 0) return b.length;
435
- if (b.length === 0) return a.length;
436
- let s1 = a;
437
- let s2 = b;
438
- if (s1.length < s2.length) {
439
- const tmp = s1;
440
- s1 = s2;
441
- s2 = tmp;
442
- }
443
- const m = s1.length;
444
- const n = s2.length;
445
- let prev = Array.from({ length: n + 1 }, (_, j) => j);
446
- let curr = Array.from({ length: n + 1 }, () => 0);
447
- for (let i = 1; i <= m; i++) {
448
- curr[0] = i;
449
- const cp1 = s1.codePointAt(i - 1);
450
- for (let j = 1; j <= n; j++) {
451
- const cost = cp1 === s2.codePointAt(j - 1) ? 0 : 1;
452
- const del = prev[j] + 1;
453
- const ins = curr[j - 1] + 1;
454
- const sub = prev[j - 1] + cost;
455
- curr[j] = Math.min(del, ins, sub);
456
- }
457
- const tmp = prev;
458
- prev = curr;
459
- curr = tmp;
460
- }
461
- return prev[n];
462
- }
463
-
464
- // src/actions/hash/algorithms/ssdeep.ts
465
- var SSDEEP_BIN = {
466
- binary: "ssdeep",
467
- install: {
468
- brew: "ssdeep",
469
- apt: "ssdeep",
470
- choco: "ssdeep"
471
- }
472
- };
473
- function parseSsdeepHash(raw) {
474
- const cleaned = raw.replace(/,.*$/u, "").trim();
475
- const parts = cleaned.split(":");
476
- if (parts.length < 3) {
477
- throw new Error(`Invalid ssdeep hash: ${raw}`);
478
- }
479
- const blockSize = Number.parseInt(parts[0], 10);
480
- if (!Number.isFinite(blockSize) || blockSize <= 0) {
481
- throw new Error(`Invalid ssdeep block size: ${parts[0]}`);
482
- }
483
- return {
484
- blockSize,
485
- h1: parts[1],
486
- h2: parts[2]
487
- };
488
- }
489
- function levenshteinSimilarity(a, b) {
490
- if (a.length === 0 && b.length === 0) return 1;
491
- const dist = levenshtein(a, b);
492
- const maxLen = Math.max(a.length, b.length, 1);
493
- return Math.max(0, 1 - dist / maxLen);
494
- }
495
- function ssdeepSimilarity(rawA, rawB) {
496
- const a = parseSsdeepHash(rawA);
497
- const b = parseSsdeepHash(rawB);
498
- if (a.blockSize === b.blockSize) {
499
- const s1 = levenshteinSimilarity(a.h1, b.h1);
500
- const s2 = levenshteinSimilarity(a.h2, b.h2);
501
- const similarity = Math.max(s1, s2);
502
- const distance = Math.round((1 - similarity) * Math.max(a.h1.length, b.h1.length, a.h2.length, b.h2.length));
503
- return { similarity, distance };
504
- }
505
- if (a.blockSize === b.blockSize * 2) {
506
- const similarity = levenshteinSimilarity(a.h2, b.h1);
507
- return { similarity, distance: Math.round((1 - similarity) * Math.max(a.h2.length, b.h1.length)) };
508
- }
509
- if (b.blockSize === a.blockSize * 2) {
510
- const similarity = levenshteinSimilarity(a.h1, b.h2);
511
- return { similarity, distance: Math.round((1 - similarity) * Math.max(a.h1.length, b.h2.length)) };
512
- }
513
- return { similarity: 0, distance: Number.NaN };
514
- }
515
- var ssdeepAlgorithm = {
516
- name: "ssdeep",
517
- family: "fuzzy-byte",
518
- inputType: "bytes",
519
- requires: [SSDEEP_BIN],
520
- async hash(input) {
521
- if (input.bytes === void 0) {
522
- throw new Error("ssdeep requires loaded bytes.");
523
- }
524
- await requireBinary(SSDEEP_BIN);
525
- const { stdout } = await runBinary({
526
- binary: "ssdeep",
527
- args: ["-b", "-s"],
528
- stdin: input.bytes
529
- });
530
- const text = stdout.toString("utf8");
531
- const lines = text.split(/\r?\n/).map((l) => l.trim()).filter((l) => l.length > 0);
532
- const hashLine = lines.find((l) => !l.startsWith("ssdeep,")) ?? lines.at(-1);
533
- if (hashLine === void 0) {
534
- throw new Error("ssdeep produced no output.");
535
- }
536
- return hashLine.replace(/,.*$/u, "");
537
- },
538
- async compare(a, b) {
539
- const { similarity, distance } = ssdeepSimilarity(a, b);
540
- return {
541
- similarity,
542
- distance: Number.isFinite(distance) ? distance : void 0,
543
- metric: "ssdeep-levenshtein"
544
- };
545
- }
546
- };
547
-
548
- // src/actions/hash/algorithms/tlsh.ts
549
- import tlsh from "tlsh";
550
- var tlshAlgorithm = {
551
- name: "tlsh",
552
- family: "fuzzy-byte",
553
- inputType: "bytes",
554
- async hash(input) {
555
- if (input.bytes === void 0) {
556
- throw new Error("tlsh requires loaded bytes.");
557
- }
558
- if (input.bytes.length < 50) {
559
- throw new Error(`tlsh requires at least 50 bytes of input (got ${input.bytes.length}).`);
560
- }
561
- return tlsh(input.bytes.toString("binary"));
562
- },
563
- async compare(a, b) {
564
- if (a.length !== b.length) {
565
- throw new Error(`tlsh hash length mismatch: ${a.length} vs ${b.length}`);
566
- }
567
- const skip = a.length >= 8 ? 4 : 0;
568
- const aBody = a.slice(skip);
569
- const bBody = b.slice(skip);
570
- const distance = hammingHex(aBody, bBody);
571
- const bits = aBody.length / 2 * 8;
572
- return {
573
- distance,
574
- similarity: 1 - distance / bits,
575
- metric: "tlsh-bit-hamming"
576
- };
577
- }
578
- };
579
-
580
- // src/actions/hash/algorithms/videoFrames.ts
581
- import { randomBytes as randomBytes2 } from "crypto";
582
- import {
583
- mkdtemp,
584
- readdir,
585
- readFile as readFile2,
586
- rm as rm2
587
- } from "fs/promises";
588
- import OS2 from "os";
589
- import PATH2 from "path";
590
- var FFMPEG_BIN = {
591
- binary: "ffmpeg",
592
- install: {
593
- brew: "ffmpeg",
594
- apt: "ffmpeg",
595
- choco: "ffmpeg"
596
- }
597
- };
598
- var SUPPORTED_FRAME_ALGORITHMS = ["phash", "pdq"];
599
- var DEFAULT_FPS = 1;
600
- var DEFAULT_FRAME_ALGORITHM = "phash";
601
- async function extractFrames(videoPath, fps) {
602
- await requireBinary(FFMPEG_BIN);
603
- const dir = await mkdtemp(PATH2.join(OS2.tmpdir(), `aries-vframes-${randomBytes2(6).toString("hex")}-`));
604
- try {
605
- await runBinary({
606
- binary: "ffmpeg",
607
- args: [
608
- "-hide_banner",
609
- "-loglevel",
610
- "error",
611
- "-i",
612
- videoPath,
613
- "-vf",
614
- `fps=${fps},scale=128:128:force_original_aspect_ratio=disable`,
615
- "-q:v",
616
- "5",
617
- PATH2.join(dir, "frame-%05d.jpg")
618
- ]
619
- });
620
- const entries = (await readdir(dir)).filter((name) => name.endsWith(".jpg")).toSorted();
621
- const frames = await Promise.all(entries.map(async (name) => await readFile2(PATH2.join(dir, name))));
622
- return { frames };
623
- } finally {
624
- await rm2(dir, { recursive: true, force: true });
625
- }
626
- }
627
- function frameHasher(name) {
628
- switch (name) {
629
- case "phash": {
630
- return async (bytes) => await phashAlgorithm.hash({ bytes });
631
- }
632
- case "pdq": {
633
- return async (bytes) => await pdqAlgorithm.hash({ bytes });
634
- }
635
- }
636
- }
637
- async function fingerprintVideo(videoPath, fps, frameAlgorithm) {
638
- const { frames } = await extractFrames(videoPath, fps);
639
- const hashFrame = frameHasher(frameAlgorithm);
640
- const hashes = await Promise.all(frames.map(async (frame, idx) => ({
641
- t: idx / fps,
642
- hash: await hashFrame(frame)
643
- })));
644
- return {
645
- algorithm: "video-frames",
646
- fps,
647
- frameAlgorithm,
648
- duration: frames.length / fps,
649
- frames: hashes
650
- };
651
- }
652
- function parseVideoFramesHash(raw) {
653
- let parsed;
654
- try {
655
- parsed = JSON.parse(raw);
656
- } catch {
657
- throw new Error("video-frames hash must be JSON produced by `aries hash --algorithm video-frames`.");
658
- }
659
- const obj = parsed;
660
- if (obj.algorithm !== "video-frames" || typeof obj.fps !== "number" || typeof obj.duration !== "number" || !Array.isArray(obj.frames)) {
661
- throw new Error("video-frames hash JSON missing required fields.");
662
- }
663
- if (obj.frameAlgorithm === void 0) {
664
- return { ...obj, frameAlgorithm: "phash" };
665
- }
666
- return obj;
667
- }
668
- function compareFrameSequences(a, b) {
669
- const fps = Math.min(a.fps, b.fps);
670
- if (a.frames.length === 0 || b.frames.length === 0) {
671
- return {
672
- similarity: 0,
673
- distance: Number.NaN,
674
- bestOffsetSeconds: 0,
675
- overlapSeconds: 0
676
- };
677
- }
678
- const minLen = Math.min(a.frames.length, b.frames.length);
679
- const maxOffset = Math.max(a.frames.length, b.frames.length) - 1;
680
- let best = {
681
- similarity: 0,
682
- distance: Number.NaN,
683
- bestOffsetSeconds: 0,
684
- overlapSeconds: 0
685
- };
686
- const minOverlap = Math.max(2, Math.floor(minLen / 4));
687
- for (let offset = -maxOffset; offset <= maxOffset; offset++) {
688
- const aStart = Math.max(0, -offset);
689
- const bStart = Math.max(0, offset);
690
- const overlap = Math.min(a.frames.length - aStart, b.frames.length - bStart);
691
- if (overlap < minOverlap) continue;
692
- let totalBits = 0;
693
- let bitWidth = 0;
694
- for (let i = 0; i < overlap; i++) {
695
- const ah = a.frames[aStart + i].hash;
696
- const bh = b.frames[bStart + i].hash;
697
- if (ah.length !== bh.length) continue;
698
- totalBits += hammingHex(ah, bh);
699
- bitWidth += ah.length / 2 * 8;
700
- }
701
- if (bitWidth === 0) continue;
702
- const similarity = 1 - totalBits / bitWidth;
703
- if (similarity > best.similarity) {
704
- best = {
705
- similarity,
706
- distance: totalBits,
707
- bestOffsetSeconds: offset / fps,
708
- overlapSeconds: overlap / fps
709
- };
710
- }
711
- }
712
- return best;
713
- }
714
- function parseFps(options) {
715
- const raw = options?.fps;
716
- if (raw === void 0) return DEFAULT_FPS;
717
- const value = typeof raw === "string" ? Number.parseFloat(raw) : Number(raw);
718
- if (!Number.isFinite(value) || value <= 0 || value > 60) {
719
- const display = typeof raw === "string" || typeof raw === "number" ? String(raw) : "<non-scalar>";
720
- throw new RangeError(`Invalid --fps ${display}: expected a number in (0, 60].`);
721
- }
722
- return value;
723
- }
724
- function parseFrameAlgorithm(options) {
725
- const raw = options?.frameAlgorithm;
726
- if (raw === void 0) return DEFAULT_FRAME_ALGORITHM;
727
- if (typeof raw !== "string" || !SUPPORTED_FRAME_ALGORITHMS.includes(raw)) {
728
- const display = typeof raw === "string" ? raw : `<${typeof raw}>`;
729
- throw new RangeError(`Invalid --frame-algorithm ${display}: expected one of ${SUPPORTED_FRAME_ALGORITHMS.join(", ")}.`);
730
- }
731
- return raw;
732
- }
733
- var videoFramesAlgorithm = {
734
- name: "video-frames",
735
- family: "video",
736
- inputType: "video",
737
- requires: [FFMPEG_BIN],
738
- async hash(input) {
739
- const fps = parseFps(input.options);
740
- const frameAlgorithm = parseFrameAlgorithm(input.options);
741
- const fp = input.path === void 0 ? input.bytes === void 0 ? null : await withTempfile(input.bytes, "video.bin", async (path) => await fingerprintVideo(path, fps, frameAlgorithm)) : await fingerprintVideo(input.path, fps, frameAlgorithm);
742
- if (fp === null) {
743
- throw new Error("video-frames requires bytes or a path.");
744
- }
745
- return JSON.stringify(fp);
746
- },
747
- async compare(a, b) {
748
- const fpA = parseVideoFramesHash(a);
749
- const fpB = parseVideoFramesHash(b);
750
- if (fpA.frameAlgorithm !== fpB.frameAlgorithm) {
751
- throw new Error(`Cannot compare video-frames hashes with different frame algorithms (${fpA.frameAlgorithm} vs ${fpB.frameAlgorithm}).`);
752
- }
753
- const result = compareFrameSequences(fpA, fpB);
754
- return {
755
- similarity: result.similarity,
756
- distance: Number.isFinite(result.distance) ? result.distance : void 0,
757
- metric: `frame-sequence-${fpA.frameAlgorithm}@${fpA.fps}fps`
758
- };
759
- }
760
- };
761
-
762
- // src/actions/hash/algorithms/xyo.ts
763
- import { ObjectHasher } from "@xyo-network/hash";
764
- var xyoAlgorithm = {
765
- name: "xyo",
766
- family: "strict",
767
- inputType: "bytes",
768
- async hash(input) {
769
- if (input.bytes === void 0) {
770
- throw new Error("xyo requires loaded bytes.");
771
- }
772
- let parsed;
773
- try {
774
- parsed = JSON.parse(input.bytes.toString("utf8"));
775
- } catch {
776
- throw new Error("xyo requires valid JSON input.");
777
- }
778
- return await ObjectHasher.hash(parsed);
779
- },
780
- async compare(a, b) {
781
- return {
782
- similarity: a === b ? 1 : 0,
783
- distance: a === b ? 0 : 1,
784
- metric: "exact-match"
785
- };
786
- }
787
- };
788
-
789
- // src/actions/hash/algorithms/index.ts
790
- var REGISTRY = new Map([
791
- sha256Algorithm,
792
- xyoAlgorithm,
793
- tlshAlgorithm,
794
- nilsimsaAlgorithm,
795
- ssdeepAlgorithm,
796
- phashAlgorithm,
797
- dhashAlgorithm,
798
- blockhashAlgorithm,
799
- pdqAlgorithm,
800
- chromaprintAlgorithm,
801
- videoFramesAlgorithm
802
- ].map((algo) => [algo.name, algo]));
803
- function getAlgorithm(name) {
804
- const algo = REGISTRY.get(name);
805
- if (algo === void 0) {
806
- const known = [...REGISTRY.keys()].join(", ");
807
- throw new Error(`Unknown algorithm '${name}'. Known: ${known}`);
808
- }
809
- return algo;
810
- }
811
-
812
- // src/actions/hash/compareHashes.ts
813
- async function compareHashes(options) {
814
- const algo = getAlgorithm(options.algorithm);
815
- if (algo.compare === void 0) {
816
- throw new Error(`Algorithm '${algo.name}' does not support comparison.`);
817
- }
818
- return await algo.compare(options.hashA, options.hashB);
819
- }
820
- export {
821
- compareHashes
822
- };
823
- //# sourceMappingURL=compareHashes.mjs.map