@xylabs/aries 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +693 -0
- package/dist/actions/audit/auditPaths.mjs +22 -0
- package/dist/actions/audit/auditPaths.mjs.map +1 -0
- package/dist/actions/audit/index.mjs +739 -0
- package/dist/actions/audit/index.mjs.map +1 -0
- package/dist/actions/audit/installPlugin.mjs +298 -0
- package/dist/actions/audit/installPlugin.mjs.map +1 -0
- package/dist/actions/audit/listSessions.mjs +93 -0
- package/dist/actions/audit/listSessions.mjs.map +1 -0
- package/dist/actions/audit/openAuditDir.mjs +44 -0
- package/dist/actions/audit/openAuditDir.mjs.map +1 -0
- package/dist/actions/audit/searchAudit.mjs +77 -0
- package/dist/actions/audit/searchAudit.mjs.map +1 -0
- package/dist/actions/audit/showAiMeta.mjs +105 -0
- package/dist/actions/audit/showAiMeta.mjs.map +1 -0
- package/dist/actions/audit/showSession.mjs +105 -0
- package/dist/actions/audit/showSession.mjs.map +1 -0
- package/dist/actions/audit/statusAudit.mjs +98 -0
- package/dist/actions/audit/statusAudit.mjs.map +1 -0
- package/dist/actions/clamp/clampAudit.mjs +53 -0
- package/dist/actions/clamp/clampAudit.mjs.map +1 -0
- package/dist/actions/clamp/index.mjs +2258 -0
- package/dist/actions/clamp/index.mjs.map +1 -0
- package/dist/actions/clamp/ipcServer.mjs +55 -0
- package/dist/actions/clamp/ipcServer.mjs.map +1 -0
- package/dist/actions/clamp/policyManagement.mjs +144 -0
- package/dist/actions/clamp/policyManagement.mjs.map +1 -0
- package/dist/actions/clamp/promptUser.mjs +91 -0
- package/dist/actions/clamp/promptUser.mjs.map +1 -0
- package/dist/actions/clamp/runClamped.mjs +2107 -0
- package/dist/actions/clamp/runClamped.mjs.map +1 -0
- package/dist/actions/clamp/sandboxExec.mjs +1612 -0
- package/dist/actions/clamp/sandboxExec.mjs.map +1 -0
- package/dist/actions/clamp/shellEnvSetup.mjs +59 -0
- package/dist/actions/clamp/shellEnvSetup.mjs.map +1 -0
- package/dist/actions/clamp/shimGenerator.mjs +68 -0
- package/dist/actions/clamp/shimGenerator.mjs.map +1 -0
- package/dist/actions/clamp/terminalRenderer.mjs +145 -0
- package/dist/actions/clamp/terminalRenderer.mjs.map +1 -0
- package/dist/actions/datalake/audit/auditLog.mjs +191 -0
- package/dist/actions/datalake/audit/auditLog.mjs.map +1 -0
- package/dist/actions/datalake/createDatalake.mjs +127 -0
- package/dist/actions/datalake/createDatalake.mjs.map +1 -0
- package/dist/actions/datalake/describeDatalake.mjs +159 -0
- package/dist/actions/datalake/describeDatalake.mjs.map +1 -0
- package/dist/actions/datalake/destroyDatalake.mjs +34 -0
- package/dist/actions/datalake/destroyDatalake.mjs.map +1 -0
- package/dist/actions/datalake/dev/downDevServer.mjs +102 -0
- package/dist/actions/datalake/dev/downDevServer.mjs.map +1 -0
- package/dist/actions/datalake/dev/index.mjs +369 -0
- package/dist/actions/datalake/dev/index.mjs.map +1 -0
- package/dist/actions/datalake/dev/logsDevServer.mjs +44 -0
- package/dist/actions/datalake/dev/logsDevServer.mjs.map +1 -0
- package/dist/actions/datalake/dev/paths.mjs +25 -0
- package/dist/actions/datalake/dev/paths.mjs.map +1 -0
- package/dist/actions/datalake/dev/resetDevServer.mjs +118 -0
- package/dist/actions/datalake/dev/resetDevServer.mjs.map +1 -0
- package/dist/actions/datalake/dev/resolveServerBin.mjs +26 -0
- package/dist/actions/datalake/dev/resolveServerBin.mjs.map +1 -0
- package/dist/actions/datalake/dev/state.mjs +62 -0
- package/dist/actions/datalake/dev/state.mjs.map +1 -0
- package/dist/actions/datalake/dev/statusDevServer.mjs +101 -0
- package/dist/actions/datalake/dev/statusDevServer.mjs.map +1 -0
- package/dist/actions/datalake/dev/upDevServer.mjs +221 -0
- package/dist/actions/datalake/dev/upDevServer.mjs.map +1 -0
- package/dist/actions/datalake/dev/waitForHealth.mjs +22 -0
- package/dist/actions/datalake/dev/waitForHealth.mjs.map +1 -0
- package/dist/actions/datalake/formatters.mjs +90 -0
- package/dist/actions/datalake/formatters.mjs.map +1 -0
- package/dist/actions/datalake/grantAccess.mjs +116 -0
- package/dist/actions/datalake/grantAccess.mjs.map +1 -0
- package/dist/actions/datalake/index.mjs +361 -0
- package/dist/actions/datalake/index.mjs.map +1 -0
- package/dist/actions/datalake/listDatalakes.mjs +54 -0
- package/dist/actions/datalake/listDatalakes.mjs.map +1 -0
- package/dist/actions/datalake/login.mjs +20 -0
- package/dist/actions/datalake/login.mjs.map +1 -0
- package/dist/actions/datalake/logout.mjs +11 -0
- package/dist/actions/datalake/logout.mjs.map +1 -0
- package/dist/actions/datalake/mintToken.mjs +37 -0
- package/dist/actions/datalake/mintToken.mjs.map +1 -0
- package/dist/actions/datalake/parseSize.mjs +21 -0
- package/dist/actions/datalake/parseSize.mjs.map +1 -0
- package/dist/actions/datalake/payloads/fetchPayload.mjs +76 -0
- package/dist/actions/datalake/payloads/fetchPayload.mjs.map +1 -0
- package/dist/actions/datalake/payloads/index.mjs +271 -0
- package/dist/actions/datalake/payloads/index.mjs.map +1 -0
- package/dist/actions/datalake/payloads/mintAndConnect.mjs +46 -0
- package/dist/actions/datalake/payloads/mintAndConnect.mjs.map +1 -0
- package/dist/actions/datalake/payloads/parsePayloadsFile.mjs +71 -0
- package/dist/actions/datalake/payloads/parsePayloadsFile.mjs.map +1 -0
- package/dist/actions/datalake/payloads/pushPayloads.mjs +181 -0
- package/dist/actions/datalake/payloads/pushPayloads.mjs.map +1 -0
- package/dist/actions/datalake/payloads/tailPayloads.mjs +106 -0
- package/dist/actions/datalake/payloads/tailPayloads.mjs.map +1 -0
- package/dist/actions/datalake/resolveTarget.mjs +15 -0
- package/dist/actions/datalake/resolveTarget.mjs.map +1 -0
- package/dist/actions/datalake/revokeAccess.mjs +108 -0
- package/dist/actions/datalake/revokeAccess.mjs.map +1 -0
- package/dist/actions/datalake/useDatalake.mjs +22 -0
- package/dist/actions/datalake/useDatalake.mjs.map +1 -0
- package/dist/actions/detect/detectAiClients.mjs +405 -0
- package/dist/actions/detect/detectAiClients.mjs.map +1 -0
- package/dist/actions/detect/index.mjs +405 -0
- package/dist/actions/detect/index.mjs.map +1 -0
- package/dist/actions/hash/algorithms/blockhash.mjs +61 -0
- package/dist/actions/hash/algorithms/blockhash.mjs.map +1 -0
- package/dist/actions/hash/algorithms/chromaprint.mjs +205 -0
- package/dist/actions/hash/algorithms/chromaprint.mjs.map +1 -0
- package/dist/actions/hash/algorithms/dhash.mjs +75 -0
- package/dist/actions/hash/algorithms/dhash.mjs.map +1 -0
- package/dist/actions/hash/algorithms/index.mjs +818 -0
- package/dist/actions/hash/algorithms/index.mjs.map +1 -0
- package/dist/actions/hash/algorithms/nilsimsa.mjs +27 -0
- package/dist/actions/hash/algorithms/nilsimsa.mjs.map +1 -0
- package/dist/actions/hash/algorithms/pdq.mjs +83 -0
- package/dist/actions/hash/algorithms/pdq.mjs.map +1 -0
- package/dist/actions/hash/algorithms/phash.mjs +71 -0
- package/dist/actions/hash/algorithms/phash.mjs.map +1 -0
- package/dist/actions/hash/algorithms/sha256.mjs +24 -0
- package/dist/actions/hash/algorithms/sha256.mjs.map +1 -0
- package/dist/actions/hash/algorithms/ssdeep.mjs +203 -0
- package/dist/actions/hash/algorithms/ssdeep.mjs.map +1 -0
- package/dist/actions/hash/algorithms/tlsh.mjs +66 -0
- package/dist/actions/hash/algorithms/tlsh.mjs.map +1 -0
- package/dist/actions/hash/algorithms/types.mjs +1 -0
- package/dist/actions/hash/algorithms/types.mjs.map +1 -0
- package/dist/actions/hash/algorithms/videoFrames.mjs +404 -0
- package/dist/actions/hash/algorithms/videoFrames.mjs.map +1 -0
- package/dist/actions/hash/algorithms/xyo.mjs +30 -0
- package/dist/actions/hash/algorithms/xyo.mjs.map +1 -0
- package/dist/actions/hash/compareHashes.mjs +823 -0
- package/dist/actions/hash/compareHashes.mjs.map +1 -0
- package/dist/actions/hash/hashInput.mjs +868 -0
- package/dist/actions/hash/hashInput.mjs.map +1 -0
- package/dist/actions/hash/index.mjs +881 -0
- package/dist/actions/hash/index.mjs.map +1 -0
- package/dist/actions/hash/lib/hamming.mjs +44 -0
- package/dist/actions/hash/lib/hamming.mjs.map +1 -0
- package/dist/actions/hash/lib/levenshtein.mjs +36 -0
- package/dist/actions/hash/lib/levenshtein.mjs.map +1 -0
- package/dist/actions/hash/lib/runBinary.mjs +54 -0
- package/dist/actions/hash/lib/runBinary.mjs.map +1 -0
- package/dist/actions/hash/lib/which.mjs +36 -0
- package/dist/actions/hash/lib/which.mjs.map +1 -0
- package/dist/actions/hash/lib/withTempfile.mjs +19 -0
- package/dist/actions/hash/lib/withTempfile.mjs.map +1 -0
- package/dist/actions/index.mjs +4615 -0
- package/dist/actions/index.mjs.map +1 -0
- package/dist/actions/printVersion.mjs +12 -0
- package/dist/actions/printVersion.mjs.map +1 -0
- package/dist/actions/sync/index.mjs +51 -0
- package/dist/actions/sync/index.mjs.map +1 -0
- package/dist/actions/sync/syncAiConfig.mjs +51 -0
- package/dist/actions/sync/syncAiConfig.mjs.map +1 -0
- package/dist/actions/wallet/account/deriveAndAdd.mjs +394 -0
- package/dist/actions/wallet/account/deriveAndAdd.mjs.map +1 -0
- package/dist/actions/wallet/account/getActiveWallet.mjs +338 -0
- package/dist/actions/wallet/account/getActiveWallet.mjs.map +1 -0
- package/dist/actions/wallet/account/labelAccount.mjs +389 -0
- package/dist/actions/wallet/account/labelAccount.mjs.map +1 -0
- package/dist/actions/wallet/account/listAccounts.mjs +374 -0
- package/dist/actions/wallet/account/listAccounts.mjs.map +1 -0
- package/dist/actions/wallet/account/removeAccount.mjs +384 -0
- package/dist/actions/wallet/account/removeAccount.mjs.map +1 -0
- package/dist/actions/wallet/account/showAccount.mjs +368 -0
- package/dist/actions/wallet/account/showAccount.mjs.map +1 -0
- package/dist/actions/wallet/addressBook/storage.mjs +110 -0
- package/dist/actions/wallet/addressBook/storage.mjs.map +1 -0
- package/dist/actions/wallet/backup/exportBackup.mjs +93 -0
- package/dist/actions/wallet/backup/exportBackup.mjs.map +1 -0
- package/dist/actions/wallet/backup/importBackup.mjs +142 -0
- package/dist/actions/wallet/backup/importBackup.mjs.map +1 -0
- package/dist/actions/wallet/balance/getBalance.mjs +434 -0
- package/dist/actions/wallet/balance/getBalance.mjs.map +1 -0
- package/dist/actions/wallet/client/walletClient.mjs +64 -0
- package/dist/actions/wallet/client/walletClient.mjs.map +1 -0
- package/dist/actions/wallet/contact/contactActions.mjs +120 -0
- package/dist/actions/wallet/contact/contactActions.mjs.map +1 -0
- package/dist/actions/wallet/contact/storage.mjs +69 -0
- package/dist/actions/wallet/contact/storage.mjs.map +1 -0
- package/dist/actions/wallet/index.mjs +1439 -0
- package/dist/actions/wallet/index.mjs.map +1 -0
- package/dist/actions/wallet/network/networkActions.mjs +137 -0
- package/dist/actions/wallet/network/networkActions.mjs.map +1 -0
- package/dist/actions/wallet/network/storage.mjs +93 -0
- package/dist/actions/wallet/network/storage.mjs.map +1 -0
- package/dist/actions/wallet/password/changePassword.mjs +282 -0
- package/dist/actions/wallet/password/changePassword.mjs.map +1 -0
- package/dist/actions/wallet/password/getActiveKey.mjs +297 -0
- package/dist/actions/wallet/password/getActiveKey.mjs.map +1 -0
- package/dist/actions/wallet/password/initOrUnlock.mjs +337 -0
- package/dist/actions/wallet/password/initOrUnlock.mjs.map +1 -0
- package/dist/actions/wallet/password/passwordStorage.mjs +69 -0
- package/dist/actions/wallet/password/passwordStorage.mjs.map +1 -0
- package/dist/actions/wallet/password/setPassword.mjs +138 -0
- package/dist/actions/wallet/password/setPassword.mjs.map +1 -0
- package/dist/actions/wallet/password/validatePassword.mjs +123 -0
- package/dist/actions/wallet/password/validatePassword.mjs.map +1 -0
- package/dist/actions/wallet/passwordKey.mjs +87 -0
- package/dist/actions/wallet/passwordKey.mjs.map +1 -0
- package/dist/actions/wallet/paths.mjs +26 -0
- package/dist/actions/wallet/paths.mjs.map +1 -0
- package/dist/actions/wallet/prompt.mjs +93 -0
- package/dist/actions/wallet/prompt.mjs.map +1 -0
- package/dist/actions/wallet/seedPhrase/createPhrase.mjs +392 -0
- package/dist/actions/wallet/seedPhrase/createPhrase.mjs.map +1 -0
- package/dist/actions/wallet/seedPhrase/exportPhrase.mjs +334 -0
- package/dist/actions/wallet/seedPhrase/exportPhrase.mjs.map +1 -0
- package/dist/actions/wallet/seedPhrase/idGen.mjs +11 -0
- package/dist/actions/wallet/seedPhrase/idGen.mjs.map +1 -0
- package/dist/actions/wallet/seedPhrase/importPhrase.mjs +393 -0
- package/dist/actions/wallet/seedPhrase/importPhrase.mjs.map +1 -0
- package/dist/actions/wallet/seedPhrase/listPhrases.mjs +62 -0
- package/dist/actions/wallet/seedPhrase/listPhrases.mjs.map +1 -0
- package/dist/actions/wallet/seedPhrase/phraseStorage.mjs +89 -0
- package/dist/actions/wallet/seedPhrase/phraseStorage.mjs.map +1 -0
- package/dist/actions/wallet/seedPhrase/removePhrase.mjs +366 -0
- package/dist/actions/wallet/seedPhrase/removePhrase.mjs.map +1 -0
- package/dist/actions/wallet/seedPhrase/renamePhrase.mjs +78 -0
- package/dist/actions/wallet/seedPhrase/renamePhrase.mjs.map +1 -0
- package/dist/actions/wallet/seedPhrase/types.mjs +1 -0
- package/dist/actions/wallet/seedPhrase/types.mjs.map +1 -0
- package/dist/actions/wallet/seedPhrase/usePhrase.mjs +83 -0
- package/dist/actions/wallet/seedPhrase/usePhrase.mjs.map +1 -0
- package/dist/actions/wallet/session/machineId.mjs +145 -0
- package/dist/actions/wallet/session/machineId.mjs.map +1 -0
- package/dist/actions/wallet/session/sessionCache.mjs +221 -0
- package/dist/actions/wallet/session/sessionCache.mjs.map +1 -0
- package/dist/actions/wallet/session/unlock.mjs +307 -0
- package/dist/actions/wallet/session/unlock.mjs.map +1 -0
- package/dist/actions/wallet/sign/signPayload.mjs +637 -0
- package/dist/actions/wallet/sign/signPayload.mjs.map +1 -0
- package/dist/actions/wallet/storage.mjs +51 -0
- package/dist/actions/wallet/storage.mjs.map +1 -0
- package/dist/actions/wallet/transaction/broadcastTransaction.mjs +453 -0
- package/dist/actions/wallet/transaction/broadcastTransaction.mjs.map +1 -0
- package/dist/actions/wallet/transaction/sendTransaction.mjs +457 -0
- package/dist/actions/wallet/transaction/sendTransaction.mjs.map +1 -0
- package/dist/actions/wallet/transaction/signTransactionFile.mjs +378 -0
- package/dist/actions/wallet/transaction/signTransactionFile.mjs.map +1 -0
- package/dist/actions/xyo/index.mjs +138 -0
- package/dist/actions/xyo/index.mjs.map +1 -0
- package/dist/actions/xyo/transaction/index.mjs +138 -0
- package/dist/actions/xyo/transaction/index.mjs.map +1 -0
- package/dist/actions/xyo/transaction/validateTransactions.mjs +138 -0
- package/dist/actions/xyo/transaction/validateTransactions.mjs.map +1 -0
- package/dist/aries.mjs +8466 -0
- package/dist/aries.mjs.map +1 -0
- package/dist/bin/aries.mjs +8472 -0
- package/dist/bin/aries.mjs.map +1 -0
- package/dist/commands/aiCommand.mjs +492 -0
- package/dist/commands/aiCommand.mjs.map +1 -0
- package/dist/commands/auditAiCommand.mjs +119 -0
- package/dist/commands/auditAiCommand.mjs.map +1 -0
- package/dist/commands/auditCommand.mjs +857 -0
- package/dist/commands/auditCommand.mjs.map +1 -0
- package/dist/commands/auditInstallCommand.mjs +324 -0
- package/dist/commands/auditInstallCommand.mjs.map +1 -0
- package/dist/commands/auditListCommand.mjs +107 -0
- package/dist/commands/auditListCommand.mjs.map +1 -0
- package/dist/commands/auditOpenCommand.mjs +51 -0
- package/dist/commands/auditOpenCommand.mjs.map +1 -0
- package/dist/commands/auditSearchCommand.mjs +98 -0
- package/dist/commands/auditSearchCommand.mjs.map +1 -0
- package/dist/commands/auditShowCommand.mjs +123 -0
- package/dist/commands/auditShowCommand.mjs.map +1 -0
- package/dist/commands/auditStatusCommand.mjs +105 -0
- package/dist/commands/auditStatusCommand.mjs.map +1 -0
- package/dist/commands/clampCommand.mjs +2328 -0
- package/dist/commands/clampCommand.mjs.map +1 -0
- package/dist/commands/clampPolicyCommand.mjs +184 -0
- package/dist/commands/clampPolicyCommand.mjs.map +1 -0
- package/dist/commands/clampPolicyInitCommand.mjs +63 -0
- package/dist/commands/clampPolicyInitCommand.mjs.map +1 -0
- package/dist/commands/clampPolicyListCommand.mjs +56 -0
- package/dist/commands/clampPolicyListCommand.mjs.map +1 -0
- package/dist/commands/clampPolicyShowCommand.mjs +83 -0
- package/dist/commands/clampPolicyShowCommand.mjs.map +1 -0
- package/dist/commands/clampRunCommand.mjs +2137 -0
- package/dist/commands/clampRunCommand.mjs.map +1 -0
- package/dist/commands/datalakeAuditCommand.mjs +273 -0
- package/dist/commands/datalakeAuditCommand.mjs.map +1 -0
- package/dist/commands/datalakeCommand.mjs +1637 -0
- package/dist/commands/datalakeCommand.mjs.map +1 -0
- package/dist/commands/datalakeCreateCommand.mjs +189 -0
- package/dist/commands/datalakeCreateCommand.mjs.map +1 -0
- package/dist/commands/datalakeDescribeCommand.mjs +172 -0
- package/dist/commands/datalakeDescribeCommand.mjs.map +1 -0
- package/dist/commands/datalakeDestroyCommand.mjs +53 -0
- package/dist/commands/datalakeDestroyCommand.mjs.map +1 -0
- package/dist/commands/datalakeDevCommand.mjs +470 -0
- package/dist/commands/datalakeDevCommand.mjs.map +1 -0
- package/dist/commands/datalakeDevDownCommand.mjs +111 -0
- package/dist/commands/datalakeDevDownCommand.mjs.map +1 -0
- package/dist/commands/datalakeDevLogsCommand.mjs +65 -0
- package/dist/commands/datalakeDevLogsCommand.mjs.map +1 -0
- package/dist/commands/datalakeDevResetCommand.mjs +125 -0
- package/dist/commands/datalakeDevResetCommand.mjs.map +1 -0
- package/dist/commands/datalakeDevStatusCommand.mjs +110 -0
- package/dist/commands/datalakeDevStatusCommand.mjs.map +1 -0
- package/dist/commands/datalakeDevUpCommand.mjs +268 -0
- package/dist/commands/datalakeDevUpCommand.mjs.map +1 -0
- package/dist/commands/datalakeFetchCommand.mjs +106 -0
- package/dist/commands/datalakeFetchCommand.mjs.map +1 -0
- package/dist/commands/datalakeGrantCommand.mjs +147 -0
- package/dist/commands/datalakeGrantCommand.mjs.map +1 -0
- package/dist/commands/datalakeListCommand.mjs +61 -0
- package/dist/commands/datalakeListCommand.mjs.map +1 -0
- package/dist/commands/datalakeLoginCommand.mjs +39 -0
- package/dist/commands/datalakeLoginCommand.mjs.map +1 -0
- package/dist/commands/datalakeLogoutCommand.mjs +20 -0
- package/dist/commands/datalakeLogoutCommand.mjs.map +1 -0
- package/dist/commands/datalakePushCommand.mjs +214 -0
- package/dist/commands/datalakePushCommand.mjs.map +1 -0
- package/dist/commands/datalakeRevokeCommand.mjs +127 -0
- package/dist/commands/datalakeRevokeCommand.mjs.map +1 -0
- package/dist/commands/datalakeTailCommand.mjs +144 -0
- package/dist/commands/datalakeTailCommand.mjs.map +1 -0
- package/dist/commands/datalakeTokenCommand.mjs +61 -0
- package/dist/commands/datalakeTokenCommand.mjs.map +1 -0
- package/dist/commands/datalakeUseCommand.mjs +35 -0
- package/dist/commands/datalakeUseCommand.mjs.map +1 -0
- package/dist/commands/detectCommand.mjs +419 -0
- package/dist/commands/detectCommand.mjs.map +1 -0
- package/dist/commands/hashCommand.mjs +976 -0
- package/dist/commands/hashCommand.mjs.map +1 -0
- package/dist/commands/hashCompareCommand.mjs +865 -0
- package/dist/commands/hashCompareCommand.mjs.map +1 -0
- package/dist/commands/index.mjs +8461 -0
- package/dist/commands/index.mjs.map +1 -0
- package/dist/commands/syncCommand.mjs +66 -0
- package/dist/commands/syncCommand.mjs.map +1 -0
- package/dist/commands/versionCommand.mjs +24 -0
- package/dist/commands/versionCommand.mjs.map +1 -0
- package/dist/commands/walletAccountCommand.mjs +536 -0
- package/dist/commands/walletAccountCommand.mjs.map +1 -0
- package/dist/commands/walletAccountDeriveCommand.mjs +415 -0
- package/dist/commands/walletAccountDeriveCommand.mjs.map +1 -0
- package/dist/commands/walletAccountLabelCommand.mjs +405 -0
- package/dist/commands/walletAccountLabelCommand.mjs.map +1 -0
- package/dist/commands/walletAccountListCommand.mjs +381 -0
- package/dist/commands/walletAccountListCommand.mjs.map +1 -0
- package/dist/commands/walletAccountRemoveCommand.mjs +396 -0
- package/dist/commands/walletAccountRemoveCommand.mjs.map +1 -0
- package/dist/commands/walletAccountShowCommand.mjs +380 -0
- package/dist/commands/walletAccountShowCommand.mjs.map +1 -0
- package/dist/commands/walletBackupCommand.mjs +222 -0
- package/dist/commands/walletBackupCommand.mjs.map +1 -0
- package/dist/commands/walletBackupExportCommand.mjs +107 -0
- package/dist/commands/walletBackupExportCommand.mjs.map +1 -0
- package/dist/commands/walletBackupImportCommand.mjs +154 -0
- package/dist/commands/walletBackupImportCommand.mjs.map +1 -0
- package/dist/commands/walletBalanceCommand.mjs +448 -0
- package/dist/commands/walletBalanceCommand.mjs.map +1 -0
- package/dist/commands/walletCommand.mjs +1968 -0
- package/dist/commands/walletCommand.mjs.map +1 -0
- package/dist/commands/walletContactAddCommand.mjs +111 -0
- package/dist/commands/walletContactAddCommand.mjs.map +1 -0
- package/dist/commands/walletContactCommand.mjs +184 -0
- package/dist/commands/walletContactCommand.mjs.map +1 -0
- package/dist/commands/walletContactListCommand.mjs +66 -0
- package/dist/commands/walletContactListCommand.mjs.map +1 -0
- package/dist/commands/walletContactRemoveCommand.mjs +97 -0
- package/dist/commands/walletContactRemoveCommand.mjs.map +1 -0
- package/dist/commands/walletContactRenameCommand.mjs +114 -0
- package/dist/commands/walletContactRenameCommand.mjs.map +1 -0
- package/dist/commands/walletCreateCommand.mjs +407 -0
- package/dist/commands/walletCreateCommand.mjs.map +1 -0
- package/dist/commands/walletExportCommand.mjs +345 -0
- package/dist/commands/walletExportCommand.mjs.map +1 -0
- package/dist/commands/walletImportCommand.mjs +413 -0
- package/dist/commands/walletImportCommand.mjs.map +1 -0
- package/dist/commands/walletListCommand.mjs +69 -0
- package/dist/commands/walletListCommand.mjs.map +1 -0
- package/dist/commands/walletLockCommand.mjs +56 -0
- package/dist/commands/walletLockCommand.mjs.map +1 -0
- package/dist/commands/walletNetworkAddCommand.mjs +131 -0
- package/dist/commands/walletNetworkAddCommand.mjs.map +1 -0
- package/dist/commands/walletNetworkCommand.mjs +206 -0
- package/dist/commands/walletNetworkCommand.mjs.map +1 -0
- package/dist/commands/walletNetworkListCommand.mjs +104 -0
- package/dist/commands/walletNetworkListCommand.mjs.map +1 -0
- package/dist/commands/walletNetworkRemoveCommand.mjs +112 -0
- package/dist/commands/walletNetworkRemoveCommand.mjs.map +1 -0
- package/dist/commands/walletNetworkUseCommand.mjs +110 -0
- package/dist/commands/walletNetworkUseCommand.mjs.map +1 -0
- package/dist/commands/walletPasswordChangeCommand.mjs +291 -0
- package/dist/commands/walletPasswordChangeCommand.mjs.map +1 -0
- package/dist/commands/walletPasswordCommand.mjs +301 -0
- package/dist/commands/walletPasswordCommand.mjs.map +1 -0
- package/dist/commands/walletRemoveCommand.mjs +378 -0
- package/dist/commands/walletRemoveCommand.mjs.map +1 -0
- package/dist/commands/walletRenameCommand.mjs +94 -0
- package/dist/commands/walletRenameCommand.mjs.map +1 -0
- package/dist/commands/walletSignCommand.mjs +662 -0
- package/dist/commands/walletSignCommand.mjs.map +1 -0
- package/dist/commands/walletTxBroadcastCommand.mjs +473 -0
- package/dist/commands/walletTxBroadcastCommand.mjs.map +1 -0
- package/dist/commands/walletTxCommand.mjs +612 -0
- package/dist/commands/walletTxCommand.mjs.map +1 -0
- package/dist/commands/walletTxSendCommand.mjs +492 -0
- package/dist/commands/walletTxSendCommand.mjs.map +1 -0
- package/dist/commands/walletTxSignCommand.mjs +403 -0
- package/dist/commands/walletTxSignCommand.mjs.map +1 -0
- package/dist/commands/walletUnlockCommand.mjs +308 -0
- package/dist/commands/walletUnlockCommand.mjs.map +1 -0
- package/dist/commands/walletUseCommand.mjs +95 -0
- package/dist/commands/walletUseCommand.mjs.map +1 -0
- package/dist/commands/xyoCommand.mjs +188 -0
- package/dist/commands/xyoCommand.mjs.map +1 -0
- package/dist/commands/xyoTxCommand.mjs +178 -0
- package/dist/commands/xyoTxCommand.mjs.map +1 -0
- package/dist/commands/xyoTxValidateCommand.mjs +168 -0
- package/dist/commands/xyoTxValidateCommand.mjs.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.mjs +8466 -0
- package/dist/index.mjs.map +1 -0
- package/dist/types/modules.d.mjs +1 -0
- package/dist/types/modules.d.mjs.map +1 -0
- package/package.json +197 -0
|
@@ -0,0 +1,823 @@
|
|
|
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
|