@hashgraphonline/standards-sdk 0.1.189 → 0.1.190
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/dist/browser/hcs-25/adapters/agentverse.d.ts.map +1 -1
- package/dist/browser/hcs-25/adapters/availability.d.ts.map +1 -1
- package/dist/browser/hcs-25/adapters/connectivity.d.ts.map +1 -1
- package/dist/browser/hcs-25/adapters/ethos.d.ts.map +1 -1
- package/dist/browser/hcs-25/adapters/model-evals.d.ts.map +1 -1
- package/dist/browser/hcs-25/adapters/simple-evals.d.ts.map +1 -1
- package/dist/browser/hcs-25/adapters/x402.d.ts.map +1 -1
- package/dist/browser/hcs-25/collectors/acp.d.ts +42 -0
- package/dist/browser/hcs-25/collectors/acp.d.ts.map +1 -0
- package/dist/browser/hcs-25/collectors/agentverse.d.ts +37 -0
- package/dist/browser/hcs-25/collectors/agentverse.d.ts.map +1 -0
- package/dist/browser/hcs-25/collectors/availability.d.ts +29 -0
- package/dist/browser/hcs-25/collectors/availability.d.ts.map +1 -0
- package/dist/browser/hcs-25/collectors/catalog.d.ts +57 -0
- package/dist/browser/hcs-25/collectors/catalog.d.ts.map +1 -0
- package/dist/browser/hcs-25/collectors/connectivity.d.ts +49 -0
- package/dist/browser/hcs-25/collectors/connectivity.d.ts.map +1 -0
- package/dist/browser/hcs-25/collectors/endpoints.d.ts +9 -0
- package/dist/browser/hcs-25/collectors/endpoints.d.ts.map +1 -0
- package/dist/browser/hcs-25/collectors/erc8004.d.ts +104 -0
- package/dist/browser/hcs-25/collectors/erc8004.d.ts.map +1 -0
- package/dist/browser/hcs-25/collectors/ethos.d.ts +95 -0
- package/dist/browser/hcs-25/collectors/ethos.d.ts.map +1 -0
- package/dist/browser/hcs-25/collectors/freshness.d.ts +36 -0
- package/dist/browser/hcs-25/collectors/freshness.d.ts.map +1 -0
- package/dist/browser/hcs-25/collectors/http.d.ts +67 -0
- package/dist/browser/hcs-25/collectors/http.d.ts.map +1 -0
- package/dist/browser/hcs-25/collectors/index.d.ts +21 -0
- package/dist/browser/hcs-25/collectors/index.d.ts.map +1 -0
- package/dist/browser/hcs-25/collectors/merge.d.ts +11 -0
- package/dist/browser/hcs-25/collectors/merge.d.ts.map +1 -0
- package/dist/browser/hcs-25/collectors/model-evals.d.ts +315 -0
- package/dist/browser/hcs-25/collectors/model-evals.d.ts.map +1 -0
- package/dist/browser/hcs-25/collectors/oss-popularity.d.ts +51 -0
- package/dist/browser/hcs-25/collectors/oss-popularity.d.ts.map +1 -0
- package/dist/browser/hcs-25/collectors/output-verification.d.ts +37 -0
- package/dist/browser/hcs-25/collectors/output-verification.d.ts.map +1 -0
- package/dist/browser/hcs-25/collectors/pipeline.d.ts +19 -0
- package/dist/browser/hcs-25/collectors/pipeline.d.ts.map +1 -0
- package/dist/browser/hcs-25/collectors/runner.d.ts +20 -0
- package/dist/browser/hcs-25/collectors/runner.d.ts.map +1 -0
- package/dist/browser/hcs-25/collectors/simple-evals.d.ts +91 -0
- package/dist/browser/hcs-25/collectors/simple-evals.d.ts.map +1 -0
- package/dist/browser/hcs-25/collectors/types.d.ts +113 -0
- package/dist/browser/hcs-25/collectors/types.d.ts.map +1 -0
- package/dist/browser/hcs-25/collectors/x402-onchain.d.ts +105 -0
- package/dist/browser/hcs-25/collectors/x402-onchain.d.ts.map +1 -0
- package/dist/browser/hcs-25/collectors/x402.d.ts +48 -0
- package/dist/browser/hcs-25/collectors/x402.d.ts.map +1 -0
- package/dist/browser/hcs-25/index.d.ts +1 -0
- package/dist/browser/hcs-25/index.d.ts.map +1 -1
- package/dist/browser/hcs-25/signals/marketplace.d.ts +6 -6
- package/dist/browser/hcs-25/signals/marketplace.d.ts.map +1 -1
- package/dist/browser/hcs-25/signals/model-evals.d.ts +12 -12
- package/dist/browser/hcs-25/signals/model-evals.d.ts.map +1 -1
- package/dist/browser/hcs-25/signals/operational.d.ts +15 -12
- package/dist/browser/hcs-25/signals/operational.d.ts.map +1 -1
- package/dist/browser/hcs-25/signals/simple-evals.d.ts +1 -1
- package/dist/browser/hcs-25/signals/simple-evals.d.ts.map +1 -1
- package/dist/browser-root/hcs-25/adapters/agentverse.d.ts.map +1 -1
- package/dist/browser-root/hcs-25/adapters/availability.d.ts.map +1 -1
- package/dist/browser-root/hcs-25/adapters/connectivity.d.ts.map +1 -1
- package/dist/browser-root/hcs-25/adapters/ethos.d.ts.map +1 -1
- package/dist/browser-root/hcs-25/adapters/model-evals.d.ts.map +1 -1
- package/dist/browser-root/hcs-25/adapters/simple-evals.d.ts.map +1 -1
- package/dist/browser-root/hcs-25/adapters/x402.d.ts.map +1 -1
- package/dist/browser-root/hcs-25/collectors/acp.d.ts +42 -0
- package/dist/browser-root/hcs-25/collectors/acp.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/collectors/agentverse.d.ts +37 -0
- package/dist/browser-root/hcs-25/collectors/agentverse.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/collectors/availability.d.ts +29 -0
- package/dist/browser-root/hcs-25/collectors/availability.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/collectors/catalog.d.ts +57 -0
- package/dist/browser-root/hcs-25/collectors/catalog.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/collectors/connectivity.d.ts +49 -0
- package/dist/browser-root/hcs-25/collectors/connectivity.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/collectors/endpoints.d.ts +9 -0
- package/dist/browser-root/hcs-25/collectors/endpoints.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/collectors/erc8004.d.ts +104 -0
- package/dist/browser-root/hcs-25/collectors/erc8004.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/collectors/ethos.d.ts +95 -0
- package/dist/browser-root/hcs-25/collectors/ethos.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/collectors/freshness.d.ts +36 -0
- package/dist/browser-root/hcs-25/collectors/freshness.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/collectors/http.d.ts +67 -0
- package/dist/browser-root/hcs-25/collectors/http.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/collectors/index.d.ts +21 -0
- package/dist/browser-root/hcs-25/collectors/index.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/collectors/merge.d.ts +11 -0
- package/dist/browser-root/hcs-25/collectors/merge.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/collectors/model-evals.d.ts +315 -0
- package/dist/browser-root/hcs-25/collectors/model-evals.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/collectors/oss-popularity.d.ts +51 -0
- package/dist/browser-root/hcs-25/collectors/oss-popularity.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/collectors/output-verification.d.ts +37 -0
- package/dist/browser-root/hcs-25/collectors/output-verification.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/collectors/pipeline.d.ts +19 -0
- package/dist/browser-root/hcs-25/collectors/pipeline.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/collectors/runner.d.ts +20 -0
- package/dist/browser-root/hcs-25/collectors/runner.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/collectors/simple-evals.d.ts +91 -0
- package/dist/browser-root/hcs-25/collectors/simple-evals.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/collectors/types.d.ts +113 -0
- package/dist/browser-root/hcs-25/collectors/types.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/collectors/x402-onchain.d.ts +105 -0
- package/dist/browser-root/hcs-25/collectors/x402-onchain.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/collectors/x402.d.ts +48 -0
- package/dist/browser-root/hcs-25/collectors/x402.d.ts.map +1 -0
- package/dist/browser-root/hcs-25/index.d.ts +1 -0
- package/dist/browser-root/hcs-25/index.d.ts.map +1 -1
- package/dist/browser-root/hcs-25/signals/marketplace.d.ts +6 -6
- package/dist/browser-root/hcs-25/signals/marketplace.d.ts.map +1 -1
- package/dist/browser-root/hcs-25/signals/model-evals.d.ts +12 -12
- package/dist/browser-root/hcs-25/signals/model-evals.d.ts.map +1 -1
- package/dist/browser-root/hcs-25/signals/operational.d.ts +15 -12
- package/dist/browser-root/hcs-25/signals/operational.d.ts.map +1 -1
- package/dist/browser-root/hcs-25/signals/simple-evals.d.ts +1 -1
- package/dist/browser-root/hcs-25/signals/simple-evals.d.ts.map +1 -1
- package/dist/cjs/hcs-25/adapters/agentverse.d.ts.map +1 -1
- package/dist/cjs/hcs-25/adapters/availability.d.ts.map +1 -1
- package/dist/cjs/hcs-25/adapters/connectivity.d.ts.map +1 -1
- package/dist/cjs/hcs-25/adapters/ethos.d.ts.map +1 -1
- package/dist/cjs/hcs-25/adapters/model-evals.d.ts.map +1 -1
- package/dist/cjs/hcs-25/adapters/simple-evals.d.ts.map +1 -1
- package/dist/cjs/hcs-25/adapters/x402.d.ts.map +1 -1
- package/dist/cjs/hcs-25/collectors/acp.d.ts +42 -0
- package/dist/cjs/hcs-25/collectors/acp.d.ts.map +1 -0
- package/dist/cjs/hcs-25/collectors/agentverse.d.ts +37 -0
- package/dist/cjs/hcs-25/collectors/agentverse.d.ts.map +1 -0
- package/dist/cjs/hcs-25/collectors/availability.d.ts +29 -0
- package/dist/cjs/hcs-25/collectors/availability.d.ts.map +1 -0
- package/dist/cjs/hcs-25/collectors/catalog.d.ts +57 -0
- package/dist/cjs/hcs-25/collectors/catalog.d.ts.map +1 -0
- package/dist/cjs/hcs-25/collectors/connectivity.d.ts +49 -0
- package/dist/cjs/hcs-25/collectors/connectivity.d.ts.map +1 -0
- package/dist/cjs/hcs-25/collectors/endpoints.d.ts +9 -0
- package/dist/cjs/hcs-25/collectors/endpoints.d.ts.map +1 -0
- package/dist/cjs/hcs-25/collectors/erc8004.d.ts +104 -0
- package/dist/cjs/hcs-25/collectors/erc8004.d.ts.map +1 -0
- package/dist/cjs/hcs-25/collectors/ethos.d.ts +95 -0
- package/dist/cjs/hcs-25/collectors/ethos.d.ts.map +1 -0
- package/dist/cjs/hcs-25/collectors/freshness.d.ts +36 -0
- package/dist/cjs/hcs-25/collectors/freshness.d.ts.map +1 -0
- package/dist/cjs/hcs-25/collectors/http.d.ts +67 -0
- package/dist/cjs/hcs-25/collectors/http.d.ts.map +1 -0
- package/dist/cjs/hcs-25/collectors/index.d.ts +21 -0
- package/dist/cjs/hcs-25/collectors/index.d.ts.map +1 -0
- package/dist/cjs/hcs-25/collectors/merge.d.ts +11 -0
- package/dist/cjs/hcs-25/collectors/merge.d.ts.map +1 -0
- package/dist/cjs/hcs-25/collectors/model-evals.d.ts +315 -0
- package/dist/cjs/hcs-25/collectors/model-evals.d.ts.map +1 -0
- package/dist/cjs/hcs-25/collectors/oss-popularity.d.ts +51 -0
- package/dist/cjs/hcs-25/collectors/oss-popularity.d.ts.map +1 -0
- package/dist/cjs/hcs-25/collectors/output-verification.d.ts +37 -0
- package/dist/cjs/hcs-25/collectors/output-verification.d.ts.map +1 -0
- package/dist/cjs/hcs-25/collectors/pipeline.d.ts +19 -0
- package/dist/cjs/hcs-25/collectors/pipeline.d.ts.map +1 -0
- package/dist/cjs/hcs-25/collectors/runner.d.ts +20 -0
- package/dist/cjs/hcs-25/collectors/runner.d.ts.map +1 -0
- package/dist/cjs/hcs-25/collectors/simple-evals.d.ts +91 -0
- package/dist/cjs/hcs-25/collectors/simple-evals.d.ts.map +1 -0
- package/dist/cjs/hcs-25/collectors/types.d.ts +113 -0
- package/dist/cjs/hcs-25/collectors/types.d.ts.map +1 -0
- package/dist/cjs/hcs-25/collectors/x402-onchain.d.ts +105 -0
- package/dist/cjs/hcs-25/collectors/x402-onchain.d.ts.map +1 -0
- package/dist/cjs/hcs-25/collectors/x402.d.ts +48 -0
- package/dist/cjs/hcs-25/collectors/x402.d.ts.map +1 -0
- package/dist/cjs/hcs-25/index.d.ts +1 -0
- package/dist/cjs/hcs-25/index.d.ts.map +1 -1
- package/dist/cjs/hcs-25/signals/marketplace.d.ts +6 -6
- package/dist/cjs/hcs-25/signals/marketplace.d.ts.map +1 -1
- package/dist/cjs/hcs-25/signals/model-evals.d.ts +12 -12
- package/dist/cjs/hcs-25/signals/model-evals.d.ts.map +1 -1
- package/dist/cjs/hcs-25/signals/operational.d.ts +15 -12
- package/dist/cjs/hcs-25/signals/operational.d.ts.map +1 -1
- package/dist/cjs/hcs-25/signals/simple-evals.d.ts +1 -1
- package/dist/cjs/hcs-25/signals/simple-evals.d.ts.map +1 -1
- package/dist/cjs/standards-sdk.cjs +2 -2
- package/dist/cjs/standards-sdk.cjs.map +1 -1
- package/dist/es/hcs-25/adapters/agentverse.d.ts.map +1 -1
- package/dist/es/hcs-25/adapters/availability.d.ts.map +1 -1
- package/dist/es/hcs-25/adapters/connectivity.d.ts.map +1 -1
- package/dist/es/hcs-25/adapters/ethos.d.ts.map +1 -1
- package/dist/es/hcs-25/adapters/model-evals.d.ts.map +1 -1
- package/dist/es/hcs-25/adapters/simple-evals.d.ts.map +1 -1
- package/dist/es/hcs-25/adapters/x402.d.ts.map +1 -1
- package/dist/es/hcs-25/collectors/acp.d.ts +42 -0
- package/dist/es/hcs-25/collectors/acp.d.ts.map +1 -0
- package/dist/es/hcs-25/collectors/agentverse.d.ts +37 -0
- package/dist/es/hcs-25/collectors/agentverse.d.ts.map +1 -0
- package/dist/es/hcs-25/collectors/availability.d.ts +29 -0
- package/dist/es/hcs-25/collectors/availability.d.ts.map +1 -0
- package/dist/es/hcs-25/collectors/catalog.d.ts +57 -0
- package/dist/es/hcs-25/collectors/catalog.d.ts.map +1 -0
- package/dist/es/hcs-25/collectors/connectivity.d.ts +49 -0
- package/dist/es/hcs-25/collectors/connectivity.d.ts.map +1 -0
- package/dist/es/hcs-25/collectors/endpoints.d.ts +9 -0
- package/dist/es/hcs-25/collectors/endpoints.d.ts.map +1 -0
- package/dist/es/hcs-25/collectors/erc8004.d.ts +104 -0
- package/dist/es/hcs-25/collectors/erc8004.d.ts.map +1 -0
- package/dist/es/hcs-25/collectors/ethos.d.ts +95 -0
- package/dist/es/hcs-25/collectors/ethos.d.ts.map +1 -0
- package/dist/es/hcs-25/collectors/freshness.d.ts +36 -0
- package/dist/es/hcs-25/collectors/freshness.d.ts.map +1 -0
- package/dist/es/hcs-25/collectors/http.d.ts +67 -0
- package/dist/es/hcs-25/collectors/http.d.ts.map +1 -0
- package/dist/es/hcs-25/collectors/index.d.ts +21 -0
- package/dist/es/hcs-25/collectors/index.d.ts.map +1 -0
- package/dist/es/hcs-25/collectors/merge.d.ts +11 -0
- package/dist/es/hcs-25/collectors/merge.d.ts.map +1 -0
- package/dist/es/hcs-25/collectors/model-evals.d.ts +315 -0
- package/dist/es/hcs-25/collectors/model-evals.d.ts.map +1 -0
- package/dist/es/hcs-25/collectors/oss-popularity.d.ts +51 -0
- package/dist/es/hcs-25/collectors/oss-popularity.d.ts.map +1 -0
- package/dist/es/hcs-25/collectors/output-verification.d.ts +37 -0
- package/dist/es/hcs-25/collectors/output-verification.d.ts.map +1 -0
- package/dist/es/hcs-25/collectors/pipeline.d.ts +19 -0
- package/dist/es/hcs-25/collectors/pipeline.d.ts.map +1 -0
- package/dist/es/hcs-25/collectors/runner.d.ts +20 -0
- package/dist/es/hcs-25/collectors/runner.d.ts.map +1 -0
- package/dist/es/hcs-25/collectors/simple-evals.d.ts +91 -0
- package/dist/es/hcs-25/collectors/simple-evals.d.ts.map +1 -0
- package/dist/es/hcs-25/collectors/types.d.ts +113 -0
- package/dist/es/hcs-25/collectors/types.d.ts.map +1 -0
- package/dist/es/hcs-25/collectors/x402-onchain.d.ts +105 -0
- package/dist/es/hcs-25/collectors/x402-onchain.d.ts.map +1 -0
- package/dist/es/hcs-25/collectors/x402.d.ts +48 -0
- package/dist/es/hcs-25/collectors/x402.d.ts.map +1 -0
- package/dist/es/hcs-25/index.d.ts +1 -0
- package/dist/es/hcs-25/index.d.ts.map +1 -1
- package/dist/es/hcs-25/signals/marketplace.d.ts +6 -6
- package/dist/es/hcs-25/signals/marketplace.d.ts.map +1 -1
- package/dist/es/hcs-25/signals/model-evals.d.ts +12 -12
- package/dist/es/hcs-25/signals/model-evals.d.ts.map +1 -1
- package/dist/es/hcs-25/signals/operational.d.ts +15 -12
- package/dist/es/hcs-25/signals/operational.d.ts.map +1 -1
- package/dist/es/hcs-25/signals/simple-evals.d.ts +1 -1
- package/dist/es/hcs-25/signals/simple-evals.d.ts.map +1 -1
- package/dist/es/standards-sdk.es.js +137 -58
- package/dist/es/standards-sdk.es.js.map +1 -1
- package/dist/es/standards-sdk.es101.js +2 -2
- package/dist/es/standards-sdk.es103.js +2 -2
- package/dist/es/standards-sdk.es104.js +1 -1
- package/dist/es/standards-sdk.es106.js +1 -1
- package/dist/es/standards-sdk.es108.js +2 -2
- package/dist/es/standards-sdk.es11.js +1 -1
- package/dist/es/standards-sdk.es110.js +1 -1
- package/dist/es/standards-sdk.es111.js +2 -2
- package/dist/es/standards-sdk.es115.js +3 -3
- package/dist/es/standards-sdk.es116.js +4 -4
- package/dist/es/standards-sdk.es12.js +1 -1
- package/dist/es/standards-sdk.es120.js +4 -4
- package/dist/es/standards-sdk.es121.js +11 -11
- package/dist/es/standards-sdk.es122.js +176 -240
- package/dist/es/standards-sdk.es122.js.map +1 -1
- package/dist/es/standards-sdk.es123.js +41 -468
- package/dist/es/standards-sdk.es123.js.map +1 -1
- package/dist/es/standards-sdk.es124.js +28 -103
- package/dist/es/standards-sdk.es124.js.map +1 -1
- package/dist/es/standards-sdk.es125.js +185 -145
- package/dist/es/standards-sdk.es125.js.map +1 -1
- package/dist/es/standards-sdk.es126.js +13 -33
- package/dist/es/standards-sdk.es126.js.map +1 -1
- package/dist/es/standards-sdk.es127.js +44 -10
- package/dist/es/standards-sdk.es127.js.map +1 -1
- package/dist/es/standards-sdk.es128.js +150 -172
- package/dist/es/standards-sdk.es128.js.map +1 -1
- package/dist/es/standards-sdk.es129.js +166 -26
- package/dist/es/standards-sdk.es129.js.map +1 -1
- package/dist/es/standards-sdk.es13.js +1 -1
- package/dist/es/standards-sdk.es130.js +375 -18
- package/dist/es/standards-sdk.es130.js.map +1 -1
- package/dist/es/standards-sdk.es131.js +371 -139
- package/dist/es/standards-sdk.es131.js.map +1 -1
- package/dist/es/standards-sdk.es132.js +211 -180
- package/dist/es/standards-sdk.es132.js.map +1 -1
- package/dist/es/standards-sdk.es133.js +210 -770
- package/dist/es/standards-sdk.es133.js.map +1 -1
- package/dist/es/standards-sdk.es134.js +376 -10
- package/dist/es/standards-sdk.es134.js.map +1 -1
- package/dist/es/standards-sdk.es135.js +118 -564
- package/dist/es/standards-sdk.es135.js.map +1 -1
- package/dist/es/standards-sdk.es136.js +233 -608
- package/dist/es/standards-sdk.es136.js.map +1 -1
- package/dist/es/standards-sdk.es137.js +1328 -12
- package/dist/es/standards-sdk.es137.js.map +1 -1
- package/dist/es/standards-sdk.es138.js +133 -2
- package/dist/es/standards-sdk.es138.js.map +1 -1
- package/dist/es/standards-sdk.es139.js +258 -74
- package/dist/es/standards-sdk.es139.js.map +1 -1
- package/dist/es/standards-sdk.es14.js +1 -1
- package/dist/es/standards-sdk.es140.js +104 -38
- package/dist/es/standards-sdk.es140.js.map +1 -1
- package/dist/es/standards-sdk.es141.js +252 -2
- package/dist/es/standards-sdk.es141.js.map +1 -1
- package/dist/es/standards-sdk.es142.js +446 -203
- package/dist/es/standards-sdk.es142.js.map +1 -1
- package/dist/es/standards-sdk.es143.js +104 -1139
- package/dist/es/standards-sdk.es143.js.map +1 -1
- package/dist/es/standards-sdk.es144.js +144 -290
- package/dist/es/standards-sdk.es144.js.map +1 -1
- package/dist/es/standards-sdk.es145.js +31 -419
- package/dist/es/standards-sdk.es145.js.map +1 -1
- package/dist/es/standards-sdk.es146.js +10 -353
- package/dist/es/standards-sdk.es146.js.map +1 -1
- package/dist/es/standards-sdk.es147.js +144 -1084
- package/dist/es/standards-sdk.es147.js.map +1 -1
- package/dist/es/standards-sdk.es148.js +25 -204
- package/dist/es/standards-sdk.es148.js.map +1 -1
- package/dist/es/standards-sdk.es149.js +17 -1562
- package/dist/es/standards-sdk.es149.js.map +1 -1
- package/dist/es/standards-sdk.es15.js +1 -1
- package/dist/es/standards-sdk.es150.js +128 -1134
- package/dist/es/standards-sdk.es150.js.map +1 -1
- package/dist/es/standards-sdk.es151.js +199 -14
- package/dist/es/standards-sdk.es151.js.map +1 -1
- package/dist/es/standards-sdk.es152.js +773 -434
- package/dist/es/standards-sdk.es152.js.map +1 -1
- package/dist/es/standards-sdk.es153.js +10 -256
- package/dist/es/standards-sdk.es153.js.map +1 -1
- package/dist/es/standards-sdk.es154.js +567 -4
- package/dist/es/standards-sdk.es154.js.map +1 -1
- package/dist/es/standards-sdk.es155.js +619 -74
- package/dist/es/standards-sdk.es155.js.map +1 -1
- package/dist/es/standards-sdk.es156.js +12 -86
- package/dist/es/standards-sdk.es156.js.map +1 -1
- package/dist/es/standards-sdk.es157.js +2 -60
- package/dist/es/standards-sdk.es157.js.map +1 -1
- package/dist/es/standards-sdk.es158.js +87 -2547
- package/dist/es/standards-sdk.es158.js.map +1 -1
- package/dist/es/standards-sdk.es159.js +36 -155
- package/dist/es/standards-sdk.es159.js.map +1 -1
- package/dist/es/standards-sdk.es16.js +6 -6
- package/dist/es/standards-sdk.es160.js +2 -7
- package/dist/es/standards-sdk.es160.js.map +1 -1
- package/dist/es/standards-sdk.es161.js +223 -74
- package/dist/es/standards-sdk.es161.js.map +1 -1
- package/dist/es/standards-sdk.es162.js +1122 -47
- package/dist/es/standards-sdk.es162.js.map +1 -1
- package/dist/es/standards-sdk.es163.js +299 -187
- package/dist/es/standards-sdk.es163.js.map +1 -1
- package/dist/es/standards-sdk.es164.js +419 -23
- package/dist/es/standards-sdk.es164.js.map +1 -1
- package/dist/es/standards-sdk.es165.js +352 -55
- package/dist/es/standards-sdk.es165.js.map +1 -1
- package/dist/es/standards-sdk.es166.js +1113 -86
- package/dist/es/standards-sdk.es166.js.map +1 -1
- package/dist/es/standards-sdk.es167.js +200 -41
- package/dist/es/standards-sdk.es167.js.map +1 -1
- package/dist/es/standards-sdk.es168.js +1551 -188
- package/dist/es/standards-sdk.es168.js.map +1 -1
- package/dist/es/standards-sdk.es169.js +1161 -51
- package/dist/es/standards-sdk.es169.js.map +1 -1
- package/dist/es/standards-sdk.es170.js +15 -47
- package/dist/es/standards-sdk.es170.js.map +1 -1
- package/dist/es/standards-sdk.es171.js +445 -50
- package/dist/es/standards-sdk.es171.js.map +1 -1
- package/dist/es/standards-sdk.es172.js +255 -45
- package/dist/es/standards-sdk.es172.js.map +1 -1
- package/dist/es/standards-sdk.es173.js +4 -122
- package/dist/es/standards-sdk.es173.js.map +1 -1
- package/dist/es/standards-sdk.es174.js +77 -50
- package/dist/es/standards-sdk.es174.js.map +1 -1
- package/dist/es/standards-sdk.es175.js +85 -42
- package/dist/es/standards-sdk.es175.js.map +1 -1
- package/dist/es/standards-sdk.es176.js +60 -72
- package/dist/es/standards-sdk.es176.js.map +1 -1
- package/dist/es/standards-sdk.es177.js +2544 -65
- package/dist/es/standards-sdk.es177.js.map +1 -1
- package/dist/es/standards-sdk.es178.js +159 -44
- package/dist/es/standards-sdk.es178.js.map +1 -1
- package/dist/es/standards-sdk.es179.js +7 -36
- package/dist/es/standards-sdk.es179.js.map +1 -1
- package/dist/es/standards-sdk.es18.js +13 -13
- package/dist/es/standards-sdk.es180.js +86 -30
- package/dist/es/standards-sdk.es180.js.map +1 -1
- package/dist/es/standards-sdk.es181.js +65 -34
- package/dist/es/standards-sdk.es181.js.map +1 -1
- package/dist/es/standards-sdk.es182.js +196 -48
- package/dist/es/standards-sdk.es182.js.map +1 -1
- package/dist/es/standards-sdk.es183.js +23 -135
- package/dist/es/standards-sdk.es183.js.map +1 -1
- package/dist/es/standards-sdk.es184.js +54 -38
- package/dist/es/standards-sdk.es184.js.map +1 -1
- package/dist/es/standards-sdk.es185.js +102 -12470
- package/dist/es/standards-sdk.es185.js.map +1 -1
- package/dist/es/standards-sdk.es186.js +53 -52
- package/dist/es/standards-sdk.es186.js.map +1 -1
- package/dist/es/standards-sdk.es187.js +223 -103
- package/dist/es/standards-sdk.es187.js.map +1 -1
- package/dist/es/standards-sdk.es188.js +66 -75
- package/dist/es/standards-sdk.es188.js.map +1 -1
- package/dist/es/standards-sdk.es189.js +46 -197
- package/dist/es/standards-sdk.es189.js.map +1 -1
- package/dist/es/standards-sdk.es19.js +10 -10
- package/dist/es/standards-sdk.es190.js +58 -668
- package/dist/es/standards-sdk.es190.js.map +1 -1
- package/dist/es/standards-sdk.es191.js +45 -168
- package/dist/es/standards-sdk.es191.js.map +1 -1
- package/dist/es/standards-sdk.es192.js +115 -315
- package/dist/es/standards-sdk.es192.js.map +1 -1
- package/dist/es/standards-sdk.es193.js +51 -340
- package/dist/es/standards-sdk.es193.js.map +1 -1
- package/dist/es/standards-sdk.es194.js +54 -448
- package/dist/es/standards-sdk.es194.js.map +1 -1
- package/dist/es/standards-sdk.es195.js +72 -331
- package/dist/es/standards-sdk.es195.js.map +1 -1
- package/dist/es/standards-sdk.es196.js +75 -76
- package/dist/es/standards-sdk.es196.js.map +1 -1
- package/dist/es/standards-sdk.es197.js +44 -73
- package/dist/es/standards-sdk.es197.js.map +1 -1
- package/dist/es/standards-sdk.es198.js +34 -15
- package/dist/es/standards-sdk.es198.js.map +1 -1
- package/dist/es/standards-sdk.es199.js +30 -139
- package/dist/es/standards-sdk.es199.js.map +1 -1
- package/dist/es/standards-sdk.es2.js +2 -2
- package/dist/es/standards-sdk.es20.js +1 -1
- package/dist/es/standards-sdk.es200.js +34 -517
- package/dist/es/standards-sdk.es200.js.map +1 -1
- package/dist/es/standards-sdk.es201.js +48 -259
- package/dist/es/standards-sdk.es201.js.map +1 -1
- package/dist/es/standards-sdk.es202.js +127 -185
- package/dist/es/standards-sdk.es202.js.map +1 -1
- package/dist/es/standards-sdk.es203.js +36 -113
- package/dist/es/standards-sdk.es203.js.map +1 -1
- package/dist/es/standards-sdk.es204.js +12464 -134
- package/dist/es/standards-sdk.es204.js.map +1 -1
- package/dist/es/standards-sdk.es205.js +14 -181
- package/dist/es/standards-sdk.es205.js.map +1 -1
- package/dist/es/standards-sdk.es206.js +55 -683
- package/dist/es/standards-sdk.es206.js.map +1 -1
- package/dist/es/standards-sdk.es207.js +93 -167
- package/dist/es/standards-sdk.es207.js.map +1 -1
- package/dist/es/standards-sdk.es208.js +71 -225
- package/dist/es/standards-sdk.es208.js.map +1 -1
- package/dist/es/standards-sdk.es209.js +176 -215
- package/dist/es/standards-sdk.es209.js.map +1 -1
- package/dist/es/standards-sdk.es21.js +1 -1
- package/dist/es/standards-sdk.es210.js +675 -0
- package/dist/es/standards-sdk.es210.js.map +1 -0
- package/dist/es/standards-sdk.es211.js +76 -0
- package/dist/es/standards-sdk.es211.js.map +1 -0
- package/dist/es/standards-sdk.es212.js +175 -0
- package/dist/es/standards-sdk.es212.js.map +1 -0
- package/dist/es/standards-sdk.es213.js +325 -0
- package/dist/es/standards-sdk.es213.js.map +1 -0
- package/dist/es/standards-sdk.es214.js +349 -0
- package/dist/es/standards-sdk.es214.js.map +1 -0
- package/dist/es/standards-sdk.es215.js +456 -0
- package/dist/es/standards-sdk.es215.js.map +1 -0
- package/dist/es/standards-sdk.es216.js +334 -0
- package/dist/es/standards-sdk.es216.js.map +1 -0
- package/dist/es/standards-sdk.es217.js +79 -0
- package/dist/es/standards-sdk.es217.js.map +1 -0
- package/dist/es/standards-sdk.es218.js +142 -0
- package/dist/es/standards-sdk.es218.js.map +1 -0
- package/dist/es/standards-sdk.es219.js +520 -0
- package/dist/es/standards-sdk.es219.js.map +1 -0
- package/dist/es/standards-sdk.es22.js +1 -1
- package/dist/es/standards-sdk.es220.js +262 -0
- package/dist/es/standards-sdk.es220.js.map +1 -0
- package/dist/es/standards-sdk.es221.js +199 -0
- package/dist/es/standards-sdk.es221.js.map +1 -0
- package/dist/es/standards-sdk.es222.js +122 -0
- package/dist/es/standards-sdk.es222.js.map +1 -0
- package/dist/es/standards-sdk.es223.js +155 -0
- package/dist/es/standards-sdk.es223.js.map +1 -0
- package/dist/es/standards-sdk.es224.js +187 -0
- package/dist/es/standards-sdk.es224.js.map +1 -0
- package/dist/es/standards-sdk.es225.js +687 -0
- package/dist/es/standards-sdk.es225.js.map +1 -0
- package/dist/es/standards-sdk.es226.js +188 -0
- package/dist/es/standards-sdk.es226.js.map +1 -0
- package/dist/es/standards-sdk.es227.js +238 -0
- package/dist/es/standards-sdk.es227.js.map +1 -0
- package/dist/es/standards-sdk.es228.js +242 -0
- package/dist/es/standards-sdk.es228.js.map +1 -0
- package/dist/es/standards-sdk.es23.js +1 -1
- package/dist/es/standards-sdk.es24.js +1 -1
- package/dist/es/standards-sdk.es25.js +1 -1
- package/dist/es/standards-sdk.es26.js +1 -1
- package/dist/es/standards-sdk.es27.js +13 -13
- package/dist/es/standards-sdk.es30.js +2 -2
- package/dist/es/standards-sdk.es31.js +4 -4
- package/dist/es/standards-sdk.es32.js +1 -1
- package/dist/es/standards-sdk.es35.js +7 -7
- package/dist/es/standards-sdk.es36.js +4 -4
- package/dist/es/standards-sdk.es37.js +2 -2
- package/dist/es/standards-sdk.es38.js +2 -2
- package/dist/es/standards-sdk.es39.js +1 -1
- package/dist/es/standards-sdk.es4.js +2 -2
- package/dist/es/standards-sdk.es40.js +1 -1
- package/dist/es/standards-sdk.es41.js +2 -2
- package/dist/es/standards-sdk.es46.js +1 -1
- package/dist/es/standards-sdk.es5.js +2 -2
- package/dist/es/standards-sdk.es51.js +1 -1
- package/dist/es/standards-sdk.es53.js +1 -1
- package/dist/es/standards-sdk.es56.js +2 -2
- package/dist/es/standards-sdk.es59.js +1 -1
- package/dist/es/standards-sdk.es6.js +2 -2
- package/dist/es/standards-sdk.es60.js +1 -1
- package/dist/es/standards-sdk.es62.js +1 -1
- package/dist/es/standards-sdk.es63.js +2 -2
- package/dist/es/standards-sdk.es64.js +1 -1
- package/dist/es/standards-sdk.es65.js +1 -1
- package/dist/es/standards-sdk.es66.js +1 -1
- package/dist/es/standards-sdk.es67.js +8 -8
- package/dist/es/standards-sdk.es69.js +1 -1
- package/dist/es/standards-sdk.es7.js +1 -1
- package/dist/es/standards-sdk.es71.js +2 -2
- package/dist/es/standards-sdk.es72.js +3 -3
- package/dist/es/standards-sdk.es75.js +5 -5
- package/dist/es/standards-sdk.es76.js +3 -3
- package/dist/es/standards-sdk.es77.js +2 -2
- package/dist/es/standards-sdk.es78.js +1 -1
- package/dist/es/standards-sdk.es81.js +2 -2
- package/dist/es/standards-sdk.es83.js +2 -2
- package/dist/es/standards-sdk.es84.js +5 -5
- package/dist/es/standards-sdk.es85.js +1 -1
- package/dist/es/standards-sdk.es88.js +1 -1
- package/dist/es/standards-sdk.es89.js +2 -2
- package/dist/es/standards-sdk.es9.js +2 -2
- package/dist/es/standards-sdk.es90.js +4 -4
- package/dist/es/standards-sdk.es94.js +3 -3
- package/dist/es/standards-sdk.es96.js +2 -2
- package/dist/es/standards-sdk.es98.js +1 -1
- package/dist/es/standards-sdk.es99.js +3 -3
- package/package.json +1 -1
|
@@ -1,84 +1,629 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { PrivateKey } from "@hashgraph/sdk";
|
|
2
|
+
var KeyType = /* @__PURE__ */ ((KeyType2) => {
|
|
3
|
+
KeyType2["ED25519"] = "ed25519";
|
|
4
|
+
KeyType2["ECDSA"] = "ecdsa";
|
|
5
|
+
KeyType2["UNKNOWN"] = "unknown";
|
|
6
|
+
return KeyType2;
|
|
7
|
+
})(KeyType || {});
|
|
8
|
+
const _KeyTypeDetector = class _KeyTypeDetector {
|
|
9
|
+
/**
|
|
10
|
+
* Detects private key type from various input formats without throwing errors
|
|
11
|
+
*
|
|
12
|
+
* This detector is designed for private keys only. It uses various heuristics to determine
|
|
13
|
+
* the key type for ambiguous 32-byte keys, including byte patterns and statistical analysis.
|
|
14
|
+
*
|
|
15
|
+
* For ambiguous cases (where confidence is 'uncertain'), if you have the associated account ID,
|
|
16
|
+
* you can use the Hedera mirror node to confirm the key type.
|
|
17
|
+
*
|
|
18
|
+
* @param keyInput - The key to detect, can be a string (hex, base64, PEM), Buffer, or Uint8Array
|
|
19
|
+
* @returns KeyInfo object containing the detected key type and metadata
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* // Detect from hex string
|
|
23
|
+
* const info1 = KeyTypeDetector.detect('0x7f96cea0c0d9d5bfb3ab8a42cf0cea44d57f62f2e068f8e5a3251914a9252b04');
|
|
24
|
+
*
|
|
25
|
+
* // Detect from DER-encoded string
|
|
26
|
+
* const info2 = KeyTypeDetector.detect(privateKey.toStringDer());
|
|
27
|
+
*
|
|
28
|
+
* // Detect from PEM format
|
|
29
|
+
* const info3 = KeyTypeDetector.detect(`-----BEGIN PRIVATE KEY-----
|
|
30
|
+
* MC4CAQAwBQYDK2VwBCIEIGRchBsQGQduAAGBQ7GAkKCKkmQ3EGCARwHsHiRqTNR9
|
|
31
|
+
* -----END PRIVATE KEY-----`);
|
|
32
|
+
*/
|
|
33
|
+
static detect(keyInput) {
|
|
34
|
+
try {
|
|
35
|
+
let keyBytes;
|
|
36
|
+
let originalFormat = "raw";
|
|
37
|
+
if (typeof keyInput === "string") {
|
|
38
|
+
let trimmed = keyInput.trim();
|
|
39
|
+
if (trimmed.includes("-----BEGIN")) {
|
|
40
|
+
return this.detectFromPem(trimmed);
|
|
41
|
+
}
|
|
42
|
+
if (trimmed.toLowerCase().startsWith("0x")) {
|
|
43
|
+
trimmed = trimmed.substring(2);
|
|
44
|
+
}
|
|
45
|
+
if (this.isValidHex(trimmed)) {
|
|
46
|
+
keyBytes = this.hexToBytes(trimmed);
|
|
47
|
+
originalFormat = "hex";
|
|
48
|
+
} else if (this.isBase64(trimmed)) {
|
|
49
|
+
keyBytes = Buffer.from(trimmed, "base64");
|
|
50
|
+
originalFormat = "der";
|
|
51
|
+
} else {
|
|
52
|
+
return {
|
|
53
|
+
type: "unknown",
|
|
54
|
+
format: "raw",
|
|
55
|
+
isPrivateKey: false,
|
|
56
|
+
confidence: "certain"
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
} else if (keyInput instanceof Buffer) {
|
|
60
|
+
keyBytes = new Uint8Array(keyInput);
|
|
61
|
+
} else {
|
|
62
|
+
keyBytes = keyInput;
|
|
63
|
+
}
|
|
64
|
+
return this.detectFromBytes(keyBytes, originalFormat);
|
|
65
|
+
} catch (error) {
|
|
66
|
+
return {
|
|
67
|
+
type: "unknown",
|
|
68
|
+
format: "raw",
|
|
69
|
+
isPrivateKey: false,
|
|
70
|
+
confidence: "certain"
|
|
71
|
+
};
|
|
72
|
+
}
|
|
7
73
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Detect key type from raw bytes
|
|
76
|
+
*
|
|
77
|
+
* @param bytes - The raw bytes of the key
|
|
78
|
+
* @param format - The original format of the key
|
|
79
|
+
* @returns KeyInfo object with detection results
|
|
80
|
+
* @private
|
|
81
|
+
*/
|
|
82
|
+
static detectFromBytes(bytes, format) {
|
|
83
|
+
if (this.hasPrefix(bytes, this.ED25519_PUBLIC_KEY_PREFIX)) {
|
|
84
|
+
const keyStart = this.ED25519_PUBLIC_KEY_PREFIX.length;
|
|
85
|
+
return {
|
|
86
|
+
type: "ed25519",
|
|
87
|
+
format: "der",
|
|
88
|
+
isPrivateKey: false,
|
|
89
|
+
rawBytes: bytes.slice(keyStart),
|
|
90
|
+
confidence: "certain"
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
if (this.hasPrefix(bytes, this.ED25519_PRIVATE_KEY_PREFIX)) {
|
|
94
|
+
const keyStart = this.ED25519_PRIVATE_KEY_PREFIX.length;
|
|
95
|
+
if (bytes.length >= keyStart + 32) {
|
|
96
|
+
return {
|
|
97
|
+
type: "ed25519",
|
|
98
|
+
format: "der",
|
|
99
|
+
isPrivateKey: true,
|
|
100
|
+
rawBytes: bytes.slice(keyStart, keyStart + 32),
|
|
101
|
+
confidence: "certain"
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (this.hasPrefix(bytes, this.ECDSA_SECP256K1_PUBLIC_KEY_PREFIX)) {
|
|
106
|
+
const keyStart = this.ECDSA_SECP256K1_PUBLIC_KEY_PREFIX.length;
|
|
107
|
+
return {
|
|
108
|
+
type: "ecdsa",
|
|
109
|
+
format: "der",
|
|
110
|
+
isPrivateKey: false,
|
|
111
|
+
rawBytes: bytes.slice(keyStart),
|
|
112
|
+
confidence: "certain"
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
if (this.hasPrefix(bytes, this.ECDSA_SECP256K1_PRIVATE_KEY_PREFIX_SHORT)) {
|
|
116
|
+
const keyStart = this.ECDSA_SECP256K1_PRIVATE_KEY_PREFIX_SHORT.length;
|
|
117
|
+
return {
|
|
118
|
+
type: "ecdsa",
|
|
119
|
+
format: "der",
|
|
120
|
+
isPrivateKey: true,
|
|
121
|
+
rawBytes: bytes.slice(keyStart),
|
|
122
|
+
confidence: "certain"
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
if (this.hasPrefix(bytes, this.ECDSA_SECP256K1_PRIVATE_KEY_PREFIX)) {
|
|
126
|
+
const keyStart = this.ECDSA_SECP256K1_PRIVATE_KEY_PREFIX.length;
|
|
127
|
+
return {
|
|
128
|
+
type: "ecdsa",
|
|
129
|
+
format: "der",
|
|
130
|
+
isPrivateKey: true,
|
|
131
|
+
rawBytes: bytes.slice(keyStart, keyStart + 32),
|
|
132
|
+
confidence: "certain"
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
if (this.hasPrefix(bytes, this.ECDSA_SECP256K1_PRIVATE_KEY_PREFIX_LONG)) {
|
|
136
|
+
const keyStart = this.ECDSA_SECP256K1_PRIVATE_KEY_PREFIX_LONG.length;
|
|
137
|
+
return {
|
|
138
|
+
type: "ecdsa",
|
|
139
|
+
format: "der",
|
|
140
|
+
isPrivateKey: true,
|
|
141
|
+
rawBytes: bytes.slice(keyStart, keyStart + 32),
|
|
142
|
+
confidence: "certain"
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
if (bytes.length > 36 && this.containsECDSAPrivateKeyPattern(bytes)) {
|
|
146
|
+
return {
|
|
147
|
+
type: "ecdsa",
|
|
148
|
+
format: "der",
|
|
149
|
+
isPrivateKey: true,
|
|
150
|
+
rawBytes: this.extractECDSAPrivateKey(bytes),
|
|
151
|
+
confidence: "certain"
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
switch (bytes.length) {
|
|
155
|
+
case this.ED25519_PUBLIC_KEY_LENGTH:
|
|
156
|
+
if (format === "hex") {
|
|
157
|
+
const hexStr = Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
158
|
+
const privateResult = this.tryCreateKey(hexStr);
|
|
159
|
+
if (privateResult.type !== "unknown") {
|
|
160
|
+
return privateResult;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return {
|
|
164
|
+
type: "unknown",
|
|
165
|
+
format,
|
|
166
|
+
isPrivateKey: false,
|
|
167
|
+
rawBytes: bytes,
|
|
168
|
+
confidence: "certain"
|
|
169
|
+
};
|
|
170
|
+
case this.ED25519_EXPANDED_PRIVATE_KEY_LENGTH:
|
|
171
|
+
return {
|
|
172
|
+
type: "ed25519",
|
|
173
|
+
format,
|
|
174
|
+
isPrivateKey: true,
|
|
175
|
+
rawBytes: bytes,
|
|
176
|
+
confidence: "certain"
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
return {
|
|
180
|
+
type: "unknown",
|
|
181
|
+
format,
|
|
182
|
+
isPrivateKey: false,
|
|
183
|
+
rawBytes: bytes,
|
|
184
|
+
confidence: "certain"
|
|
185
|
+
};
|
|
12
186
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
187
|
+
/**
|
|
188
|
+
* Detect key type from PEM format
|
|
189
|
+
*
|
|
190
|
+
* @param pem - The PEM-encoded key string
|
|
191
|
+
* @returns KeyInfo object with detection results
|
|
192
|
+
* @private
|
|
193
|
+
*/
|
|
194
|
+
static detectFromPem(pem) {
|
|
195
|
+
const trimmedPem = pem.trim();
|
|
196
|
+
const isPrivateKey = trimmedPem.includes("PRIVATE KEY");
|
|
197
|
+
const pemTypes = {
|
|
198
|
+
EC_PRIVATE: /-----BEGIN EC PRIVATE KEY-----/,
|
|
199
|
+
EC_PUBLIC: /-----BEGIN EC PUBLIC KEY-----/,
|
|
200
|
+
PRIVATE: /-----BEGIN PRIVATE KEY-----/,
|
|
201
|
+
PUBLIC: /-----BEGIN PUBLIC KEY-----/
|
|
202
|
+
};
|
|
203
|
+
let isECKey = false;
|
|
204
|
+
for (const [type, regex] of Object.entries(pemTypes)) {
|
|
205
|
+
if (regex.test(trimmedPem) && type.includes("EC")) {
|
|
206
|
+
isECKey = true;
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
const beginMarkerIndex = trimmedPem.indexOf("-----BEGIN ");
|
|
211
|
+
if (beginMarkerIndex === -1) {
|
|
212
|
+
return {
|
|
213
|
+
type: "unknown",
|
|
214
|
+
format: "pem",
|
|
215
|
+
isPrivateKey,
|
|
216
|
+
confidence: "certain"
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
const beginLineEndIndex = trimmedPem.indexOf("\n", beginMarkerIndex);
|
|
220
|
+
if (beginLineEndIndex === -1) {
|
|
221
|
+
return {
|
|
222
|
+
type: "unknown",
|
|
223
|
+
format: "pem",
|
|
224
|
+
isPrivateKey,
|
|
225
|
+
confidence: "certain"
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
const endMarkerIndex = trimmedPem.lastIndexOf("-----END ");
|
|
229
|
+
if (endMarkerIndex === -1 || endMarkerIndex <= beginLineEndIndex) {
|
|
230
|
+
return {
|
|
231
|
+
type: "unknown",
|
|
232
|
+
format: "pem",
|
|
233
|
+
isPrivateKey,
|
|
234
|
+
confidence: "certain"
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
const base64Content = trimmedPem.slice(beginLineEndIndex + 1, endMarkerIndex).replace(/\s/g, "");
|
|
238
|
+
if (!base64Content) {
|
|
239
|
+
return {
|
|
240
|
+
type: "unknown",
|
|
241
|
+
format: "pem",
|
|
242
|
+
isPrivateKey,
|
|
243
|
+
confidence: "certain"
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
try {
|
|
247
|
+
const derBytes = Buffer.from(base64Content, "base64");
|
|
248
|
+
const result = this.detectFromBytes(new Uint8Array(derBytes), "der");
|
|
249
|
+
if (result.type === "unknown" && isECKey) {
|
|
250
|
+
return {
|
|
251
|
+
type: "ecdsa",
|
|
252
|
+
format: "pem",
|
|
253
|
+
isPrivateKey,
|
|
254
|
+
rawBytes: derBytes,
|
|
255
|
+
confidence: "certain"
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
return {
|
|
259
|
+
...result,
|
|
260
|
+
format: "pem"
|
|
261
|
+
};
|
|
262
|
+
} catch {
|
|
263
|
+
return {
|
|
264
|
+
type: "unknown",
|
|
265
|
+
format: "pem",
|
|
266
|
+
isPrivateKey,
|
|
267
|
+
confidence: "certain"
|
|
268
|
+
};
|
|
269
|
+
}
|
|
19
270
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
271
|
+
/**
|
|
272
|
+
* Try to create a key using Hedera SDK to validate the type
|
|
273
|
+
*
|
|
274
|
+
* @param keyInput - The key input string or bytes
|
|
275
|
+
* @returns KeyInfo object with detection results
|
|
276
|
+
* @private
|
|
277
|
+
*/
|
|
278
|
+
static tryCreateKey(keyInput) {
|
|
279
|
+
try {
|
|
280
|
+
if (typeof keyInput === "string") {
|
|
281
|
+
let keyStr = keyInput.trim();
|
|
282
|
+
if (keyStr.toLowerCase().startsWith("0x")) {
|
|
283
|
+
keyStr = keyStr.substring(2);
|
|
284
|
+
}
|
|
285
|
+
if (this.isValidHex(keyStr) && keyStr.length === 64) {
|
|
286
|
+
const keyBytes = this.hexToBytes(keyStr);
|
|
287
|
+
const signatureResult = this.detectBySignature(keyStr);
|
|
288
|
+
if (signatureResult.type !== "unknown") {
|
|
289
|
+
return {
|
|
290
|
+
type: signatureResult.type,
|
|
291
|
+
format: "hex",
|
|
292
|
+
isPrivateKey: true,
|
|
293
|
+
rawBytes: keyBytes,
|
|
294
|
+
confidence: signatureResult.confidence,
|
|
295
|
+
warning: signatureResult.warning
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
return {
|
|
299
|
+
type: "unknown",
|
|
300
|
+
format: "hex",
|
|
301
|
+
isPrivateKey: false,
|
|
302
|
+
rawBytes: keyBytes,
|
|
303
|
+
confidence: "certain"
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
} catch {
|
|
308
|
+
}
|
|
309
|
+
return {
|
|
310
|
+
type: "unknown",
|
|
311
|
+
format: "hex",
|
|
312
|
+
isPrivateKey: false,
|
|
313
|
+
rawBytes: new Uint8Array(),
|
|
314
|
+
confidence: "certain"
|
|
315
|
+
};
|
|
24
316
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
317
|
+
/**
|
|
318
|
+
* Detect key type by attempting to sign a message with both algorithms
|
|
319
|
+
*
|
|
320
|
+
* For ambiguous cases where both algorithms can use the key, this method
|
|
321
|
+
* uses heuristics to make a best-effort determination. For production use
|
|
322
|
+
* with ambiguous keys, consider using the Hedera mirror node to confirm
|
|
323
|
+
* the key type if you have the associated account ID.
|
|
324
|
+
*
|
|
325
|
+
* @param hexKey - The hex string representation of the key
|
|
326
|
+
* @returns Object containing type, confidence level, and optional warning
|
|
327
|
+
* @private
|
|
328
|
+
*/
|
|
329
|
+
static detectBySignature(hexKey) {
|
|
330
|
+
const keyBigInt = BigInt("0x" + hexKey);
|
|
331
|
+
const secp256k1Order = BigInt(
|
|
332
|
+
"0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141"
|
|
333
|
+
);
|
|
334
|
+
if (keyBigInt === 0n) {
|
|
335
|
+
return {
|
|
336
|
+
type: "ed25519",
|
|
337
|
+
confidence: "certain"
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
if (keyBigInt >= secp256k1Order) {
|
|
341
|
+
return {
|
|
342
|
+
type: "ed25519",
|
|
343
|
+
confidence: "certain"
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
let ed25519CanSign = false;
|
|
347
|
+
let ecdsaCanSign = false;
|
|
348
|
+
try {
|
|
349
|
+
const ed25519Key = PrivateKey.fromStringED25519(hexKey);
|
|
350
|
+
const testMessage = new Uint8Array([1, 2, 3, 4, 5]);
|
|
351
|
+
const signature = ed25519Key.sign(testMessage);
|
|
352
|
+
if (ed25519Key.publicKey.verify(testMessage, signature)) {
|
|
353
|
+
ed25519CanSign = true;
|
|
354
|
+
}
|
|
355
|
+
} catch {
|
|
356
|
+
}
|
|
357
|
+
try {
|
|
358
|
+
const ecdsaKey = PrivateKey.fromStringECDSA(hexKey);
|
|
359
|
+
const testMessage = new Uint8Array([1, 2, 3, 4, 5]);
|
|
360
|
+
const signature = ecdsaKey.sign(testMessage);
|
|
361
|
+
if (ecdsaKey.publicKey.verify(testMessage, signature)) {
|
|
362
|
+
ecdsaCanSign = true;
|
|
363
|
+
}
|
|
364
|
+
} catch {
|
|
365
|
+
}
|
|
366
|
+
if (ed25519CanSign && ecdsaCanSign) {
|
|
367
|
+
const keyBytes = this.hexToBytes(hexKey);
|
|
368
|
+
if (keyBytes[0] === 168 && keyBytes[1] === 1) {
|
|
369
|
+
return {
|
|
370
|
+
type: "ed25519",
|
|
371
|
+
confidence: "uncertain",
|
|
372
|
+
warning: "Detection based on byte pattern heuristic. Both ED25519 and ECDSA accept this key."
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
let highBytes = 0;
|
|
376
|
+
for (const byte of keyBytes) {
|
|
377
|
+
if (byte >= 128) highBytes++;
|
|
378
|
+
}
|
|
379
|
+
const highByteRatio = highBytes / keyBytes.length;
|
|
380
|
+
if (highByteRatio >= 0.4 && highByteRatio <= 0.6) {
|
|
381
|
+
return {
|
|
382
|
+
type: "ecdsa",
|
|
383
|
+
confidence: "uncertain",
|
|
384
|
+
warning: "Detection based on entropy heuristic. Both ED25519 and ECDSA accept this key."
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
return {
|
|
388
|
+
type: "ecdsa",
|
|
389
|
+
confidence: "uncertain",
|
|
390
|
+
warning: "Detection based on entropy heuristic. Both ED25519 and ECDSA accept this key. Defaulting to ECDSA."
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
if (ed25519CanSign && !ecdsaCanSign) {
|
|
394
|
+
return {
|
|
395
|
+
type: "ed25519",
|
|
396
|
+
confidence: "certain"
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
if (ecdsaCanSign && !ed25519CanSign) {
|
|
400
|
+
return {
|
|
401
|
+
type: "ecdsa",
|
|
402
|
+
confidence: "certain"
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
return {
|
|
406
|
+
type: "unknown",
|
|
407
|
+
confidence: "certain"
|
|
408
|
+
};
|
|
32
409
|
}
|
|
33
|
-
|
|
34
|
-
|
|
410
|
+
/**
|
|
411
|
+
* Check if a string is valid hexadecimal with even length
|
|
412
|
+
*
|
|
413
|
+
* @param str - The string to check
|
|
414
|
+
* @returns True if the string is valid hex with even length
|
|
415
|
+
* @private
|
|
416
|
+
*/
|
|
417
|
+
static isValidHex(str) {
|
|
418
|
+
return /^[0-9a-fA-F]+$/.test(str) && str.length % 2 === 0;
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Check if a string is valid base64
|
|
422
|
+
*
|
|
423
|
+
* @param str - The string to check
|
|
424
|
+
* @returns True if the string is valid base64
|
|
425
|
+
* @private
|
|
426
|
+
*/
|
|
427
|
+
static isBase64(str) {
|
|
428
|
+
try {
|
|
429
|
+
return Buffer.from(str, "base64").toString("base64") === str;
|
|
430
|
+
} catch {
|
|
431
|
+
return false;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Convert a hex string to bytes
|
|
436
|
+
*
|
|
437
|
+
* @param hex - The hex string to convert
|
|
438
|
+
* @returns Uint8Array of bytes
|
|
439
|
+
* @private
|
|
440
|
+
*/
|
|
441
|
+
static hexToBytes(hex) {
|
|
442
|
+
const bytes = new Uint8Array(hex.length / 2);
|
|
443
|
+
for (let i = 0; i < hex.length; i += 2) {
|
|
444
|
+
bytes[i / 2] = parseInt(hex.substr(i, 2), 16);
|
|
445
|
+
}
|
|
446
|
+
return bytes;
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Check if bytes start with a specific prefix
|
|
450
|
+
*
|
|
451
|
+
* @param bytes - The bytes to check
|
|
452
|
+
* @param prefix - The prefix to look for
|
|
453
|
+
* @returns True if bytes start with the prefix
|
|
454
|
+
* @private
|
|
455
|
+
*/
|
|
456
|
+
static hasPrefix(bytes, prefix) {
|
|
457
|
+
if (bytes.length < prefix.length) return false;
|
|
458
|
+
for (let i = 0; i < prefix.length; i++) {
|
|
459
|
+
if (bytes[i] !== prefix[i]) return false;
|
|
460
|
+
}
|
|
461
|
+
return true;
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Check if bytes contain an ECDSA private key pattern
|
|
465
|
+
*
|
|
466
|
+
* @param bytes - The bytes to check
|
|
467
|
+
* @returns True if ECDSA private key pattern is found
|
|
468
|
+
* @private
|
|
469
|
+
*/
|
|
470
|
+
static containsECDSAPrivateKeyPattern(bytes) {
|
|
471
|
+
for (let i = 0; i < bytes.length - 7; i++) {
|
|
472
|
+
if (bytes[i] === 48 && bytes[i + 1] === 116 && bytes[i + 2] === 2 && bytes[i + 3] === 1 && bytes[i + 4] === 1 && bytes[i + 5] === 4 && bytes[i + 6] === 32) {
|
|
473
|
+
return true;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
return false;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Extract ECDSA private key from DER structure
|
|
480
|
+
*
|
|
481
|
+
* @param bytes - The DER encoded bytes
|
|
482
|
+
* @returns The extracted private key bytes
|
|
483
|
+
* @private
|
|
484
|
+
*/
|
|
485
|
+
static extractECDSAPrivateKey(bytes) {
|
|
486
|
+
for (let i = 0; i < bytes.length - 32; i++) {
|
|
487
|
+
if (bytes[i] === 4 && bytes[i + 1] === 32) {
|
|
488
|
+
return bytes.slice(i + 2, i + 34);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
return bytes;
|
|
35
492
|
}
|
|
36
|
-
const accountId = AccountId.fromString(options.accountId);
|
|
37
|
-
const privateKey = PrivateKey.fromString(options.privateKey);
|
|
38
|
-
const ledgerId = LedgerId.fromString(options.network);
|
|
39
|
-
return {
|
|
40
|
-
getLedgerId: () => ledgerId,
|
|
41
|
-
getAccountId: () => accountId,
|
|
42
|
-
getAccountKey: () => privateKey.publicKey,
|
|
43
|
-
getNetwork: () => ({}),
|
|
44
|
-
getMirrorNetwork: () => [],
|
|
45
|
-
sign: async (messages) => Promise.all(
|
|
46
|
-
messages.map(async (message) => {
|
|
47
|
-
const signature = await privateKey.sign(message);
|
|
48
|
-
return new SignerSignature({
|
|
49
|
-
publicKey: privateKey.publicKey,
|
|
50
|
-
signature,
|
|
51
|
-
accountId
|
|
52
|
-
});
|
|
53
|
-
})
|
|
54
|
-
),
|
|
55
|
-
getAccountBalance: async () => {
|
|
56
|
-
throw unsupported("getAccountBalance");
|
|
57
|
-
},
|
|
58
|
-
getAccountInfo: async () => {
|
|
59
|
-
throw unsupported("getAccountInfo");
|
|
60
|
-
},
|
|
61
|
-
getAccountRecords: async () => {
|
|
62
|
-
throw unsupported("getAccountRecords");
|
|
63
|
-
},
|
|
64
|
-
signTransaction: async (_) => {
|
|
65
|
-
throw unsupported("signTransaction");
|
|
66
|
-
},
|
|
67
|
-
checkTransaction: async (_) => {
|
|
68
|
-
throw unsupported("checkTransaction");
|
|
69
|
-
},
|
|
70
|
-
populateTransaction: async (_) => {
|
|
71
|
-
throw unsupported("populateTransaction");
|
|
72
|
-
},
|
|
73
|
-
call: async (_request) => {
|
|
74
|
-
throw unsupported("call");
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
493
|
};
|
|
78
|
-
|
|
79
|
-
|
|
494
|
+
_KeyTypeDetector.ED25519_PUBLIC_KEY_LENGTH = 32;
|
|
495
|
+
_KeyTypeDetector.ED25519_EXPANDED_PRIVATE_KEY_LENGTH = 64;
|
|
496
|
+
_KeyTypeDetector.ED25519_PUBLIC_KEY_PREFIX = Buffer.from([
|
|
497
|
+
48,
|
|
498
|
+
42,
|
|
499
|
+
48,
|
|
500
|
+
5,
|
|
501
|
+
6,
|
|
502
|
+
3,
|
|
503
|
+
43,
|
|
504
|
+
101,
|
|
505
|
+
112,
|
|
506
|
+
3,
|
|
507
|
+
33,
|
|
508
|
+
0
|
|
509
|
+
]);
|
|
510
|
+
_KeyTypeDetector.ED25519_PRIVATE_KEY_PREFIX = Buffer.from([
|
|
511
|
+
48,
|
|
512
|
+
46,
|
|
513
|
+
2,
|
|
514
|
+
1,
|
|
515
|
+
0,
|
|
516
|
+
48,
|
|
517
|
+
5,
|
|
518
|
+
6,
|
|
519
|
+
3,
|
|
520
|
+
43,
|
|
521
|
+
101,
|
|
522
|
+
112,
|
|
523
|
+
4,
|
|
524
|
+
34,
|
|
525
|
+
4,
|
|
526
|
+
32
|
|
527
|
+
]);
|
|
528
|
+
_KeyTypeDetector.ECDSA_SECP256K1_PUBLIC_KEY_PREFIX = Buffer.from([
|
|
529
|
+
48,
|
|
530
|
+
86,
|
|
531
|
+
48,
|
|
532
|
+
16,
|
|
533
|
+
6,
|
|
534
|
+
7,
|
|
535
|
+
42,
|
|
536
|
+
134,
|
|
537
|
+
72,
|
|
538
|
+
206,
|
|
539
|
+
61,
|
|
540
|
+
2,
|
|
541
|
+
1,
|
|
542
|
+
6,
|
|
543
|
+
5,
|
|
544
|
+
43,
|
|
545
|
+
129,
|
|
546
|
+
4,
|
|
547
|
+
0,
|
|
548
|
+
10,
|
|
549
|
+
3,
|
|
550
|
+
66,
|
|
551
|
+
0
|
|
552
|
+
]);
|
|
553
|
+
_KeyTypeDetector.ECDSA_SECP256K1_PRIVATE_KEY_PREFIX = Buffer.from([
|
|
554
|
+
48,
|
|
555
|
+
116,
|
|
556
|
+
2,
|
|
557
|
+
1,
|
|
558
|
+
1,
|
|
559
|
+
4,
|
|
560
|
+
32
|
|
561
|
+
]);
|
|
562
|
+
_KeyTypeDetector.ECDSA_SECP256K1_PRIVATE_KEY_PREFIX_SHORT = Buffer.from([
|
|
563
|
+
48,
|
|
564
|
+
48,
|
|
565
|
+
2,
|
|
566
|
+
1,
|
|
567
|
+
0,
|
|
568
|
+
48,
|
|
569
|
+
7,
|
|
570
|
+
6,
|
|
571
|
+
5,
|
|
572
|
+
43,
|
|
573
|
+
129,
|
|
574
|
+
4,
|
|
575
|
+
0,
|
|
576
|
+
10,
|
|
577
|
+
4,
|
|
578
|
+
34,
|
|
579
|
+
4,
|
|
580
|
+
32
|
|
581
|
+
]);
|
|
582
|
+
_KeyTypeDetector.ECDSA_SECP256K1_PRIVATE_KEY_PREFIX_LONG = Buffer.from(
|
|
583
|
+
[48, 119, 2, 1, 1, 4, 32]
|
|
584
|
+
);
|
|
585
|
+
let KeyTypeDetector = _KeyTypeDetector;
|
|
586
|
+
function detectKeyTypeFromString(privateKeyString) {
|
|
587
|
+
const keyInfo = KeyTypeDetector.detect(privateKeyString);
|
|
588
|
+
if (keyInfo.type !== "unknown") {
|
|
589
|
+
try {
|
|
590
|
+
const privateKey = keyInfo.type === "ecdsa" ? PrivateKey.fromStringECDSA(privateKeyString) : PrivateKey.fromStringED25519(privateKeyString);
|
|
591
|
+
const result = {
|
|
592
|
+
detectedType: keyInfo.type,
|
|
593
|
+
privateKey
|
|
594
|
+
};
|
|
595
|
+
if (keyInfo.confidence === "uncertain") {
|
|
596
|
+
result.warning = `Key type detection is uncertain. If you have the associated account ID, consider using the Hedera mirror node to confirm the key type.`;
|
|
597
|
+
}
|
|
598
|
+
return result;
|
|
599
|
+
} catch (error) {
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
try {
|
|
603
|
+
const privateKey = PrivateKey.fromStringECDSA(privateKeyString);
|
|
604
|
+
return {
|
|
605
|
+
detectedType: "ecdsa",
|
|
606
|
+
privateKey,
|
|
607
|
+
warning: `Using ECDSA as default. If you have the associated account ID, consider using the Hedera mirror node to confirm the key type.`
|
|
608
|
+
};
|
|
609
|
+
} catch (ecdsaError) {
|
|
610
|
+
try {
|
|
611
|
+
const privateKey = PrivateKey.fromStringED25519(privateKeyString);
|
|
612
|
+
return {
|
|
613
|
+
detectedType: "ed25519",
|
|
614
|
+
privateKey,
|
|
615
|
+
warning: `Using ED25519 as fallback. If you have the associated account ID, consider using the Hedera mirror node to confirm the key type.`
|
|
616
|
+
};
|
|
617
|
+
} catch (ed25519Error) {
|
|
618
|
+
throw new Error(
|
|
619
|
+
`Failed to parse private key as either ECDSA or ED25519: ${ecdsaError}`
|
|
620
|
+
);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
}
|
|
80
624
|
export {
|
|
81
|
-
|
|
82
|
-
|
|
625
|
+
KeyType,
|
|
626
|
+
KeyTypeDetector,
|
|
627
|
+
detectKeyTypeFromString
|
|
83
628
|
};
|
|
84
629
|
//# sourceMappingURL=standards-sdk.es155.js.map
|