@reclaimprotocol/attestor-core 4.0.3 → 5.0.1-beta.10
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/LICENSE +660 -660
- package/README.md +1 -2
- package/lib/avs/abis/avsDirectoryABI.js +341 -342
- package/lib/avs/abis/delegationABI.js +4 -5
- package/lib/avs/abis/registryABI.js +722 -723
- package/lib/avs/client/create-claim-on-avs.d.ts +5 -5
- package/lib/avs/client/create-claim-on-avs.js +160 -139
- package/lib/avs/config.d.ts +1 -1
- package/lib/avs/config.js +25 -23
- package/lib/avs/contracts/ReclaimServiceManager.d.ts +436 -532
- package/lib/avs/contracts/ReclaimServiceManager.js +0 -3
- package/lib/avs/contracts/common.d.ts +40 -11
- package/lib/avs/contracts/common.js +0 -3
- package/lib/avs/contracts/factories/ReclaimServiceManager__factory.d.ts +13 -11
- package/lib/avs/contracts/factories/ReclaimServiceManager__factory.js +1157 -1148
- package/lib/avs/contracts/factories/index.d.ts +1 -1
- package/lib/avs/contracts/factories/index.js +4 -9
- package/lib/avs/contracts/index.d.ts +3 -3
- package/lib/avs/contracts/index.js +6 -40
- package/lib/avs/types/index.d.ts +6 -6
- package/lib/avs/types/index.js +0 -3
- package/lib/avs/utils/contracts.d.ts +14 -14
- package/lib/avs/utils/contracts.js +50 -35
- package/lib/avs/utils/register.d.ts +3 -3
- package/lib/avs/utils/register.js +71 -79
- package/lib/avs/utils/tasks.d.ts +4 -4
- package/lib/avs/utils/tasks.js +44 -41
- package/lib/browser/avs/abis/avsDirectoryABI.d.ts +60 -0
- package/lib/browser/avs/abis/avsDirectoryABI.js +343 -0
- package/lib/browser/avs/abis/delegationABI.d.ts +126 -0
- package/lib/browser/avs/abis/delegationABI.js +4 -0
- package/lib/browser/avs/abis/registryABI.d.ts +136 -0
- package/lib/browser/avs/abis/registryABI.js +728 -0
- package/lib/browser/avs/client/create-claim-on-avs.d.ts +12 -0
- package/lib/browser/avs/client/create-claim-on-avs.js +168 -0
- package/lib/browser/avs/config.d.ts +7 -0
- package/lib/browser/avs/config.js +26 -0
- package/lib/browser/avs/contracts/ReclaimServiceManager.d.ts +601 -0
- package/lib/browser/avs/contracts/ReclaimServiceManager.js +0 -0
- package/lib/browser/avs/contracts/common.d.ts +50 -0
- package/lib/browser/avs/contracts/common.js +0 -0
- package/lib/browser/avs/contracts/factories/ReclaimServiceManager__factory.d.ts +890 -0
- package/lib/browser/avs/contracts/factories/ReclaimServiceManager__factory.js +1183 -0
- package/lib/browser/avs/contracts/factories/index.d.ts +1 -0
- package/lib/browser/avs/contracts/factories/index.js +4 -0
- package/lib/browser/avs/contracts/index.d.ts +3 -0
- package/lib/browser/avs/contracts/index.js +6 -0
- package/lib/browser/avs/types/index.d.ts +55 -0
- package/lib/browser/avs/types/index.js +0 -0
- package/lib/browser/avs/utils/contracts.d.ts +21 -0
- package/lib/browser/avs/utils/contracts.js +53 -0
- package/lib/browser/avs/utils/register.d.ts +27 -0
- package/lib/browser/avs/utils/register.js +74 -0
- package/lib/browser/avs/utils/tasks.d.ts +22 -0
- package/lib/browser/avs/utils/tasks.js +48 -0
- package/lib/browser/client/create-claim.d.ts +5 -0
- package/lib/browser/client/create-claim.js +461 -0
- package/lib/browser/client/index.d.ts +3 -0
- package/lib/browser/client/index.js +3 -0
- package/lib/browser/client/tunnels/make-rpc-tcp-tunnel.d.ts +16 -0
- package/lib/browser/client/tunnels/make-rpc-tcp-tunnel.js +53 -0
- package/lib/browser/client/tunnels/make-rpc-tls-tunnel.d.ts +26 -0
- package/lib/browser/client/tunnels/make-rpc-tls-tunnel.js +127 -0
- package/lib/browser/client/utils/attestor-pool.d.ts +8 -0
- package/lib/browser/client/utils/attestor-pool.js +24 -0
- package/lib/browser/client/utils/client-socket.d.ts +11 -0
- package/lib/browser/client/utils/client-socket.js +120 -0
- package/lib/browser/client/utils/message-handler.d.ts +4 -0
- package/lib/browser/client/utils/message-handler.js +97 -0
- package/lib/browser/config/index.d.ts +31 -0
- package/lib/browser/config/index.js +62 -0
- package/lib/browser/external-rpc/benchmark.d.ts +1 -0
- package/lib/browser/external-rpc/benchmark.js +82 -0
- package/lib/browser/external-rpc/event-bus.d.ts +7 -0
- package/lib/browser/external-rpc/event-bus.js +17 -0
- package/lib/browser/external-rpc/global.d.js +0 -0
- package/lib/browser/external-rpc/handle-incoming-msg.d.ts +2 -0
- package/lib/browser/external-rpc/handle-incoming-msg.js +241 -0
- package/lib/browser/external-rpc/index.d.ts +3 -0
- package/lib/browser/external-rpc/index.js +3 -0
- package/lib/browser/external-rpc/jsc-polyfills/1.d.ts +14 -0
- package/lib/browser/external-rpc/jsc-polyfills/1.js +80 -0
- package/lib/browser/external-rpc/jsc-polyfills/2.js +15 -0
- package/lib/browser/external-rpc/jsc-polyfills/event.d.ts +10 -0
- package/lib/browser/external-rpc/jsc-polyfills/event.js +19 -0
- package/lib/browser/external-rpc/jsc-polyfills/index.d.ts +2 -0
- package/lib/browser/external-rpc/jsc-polyfills/index.js +2 -0
- package/lib/browser/external-rpc/jsc-polyfills/ws.d.ts +21 -0
- package/lib/browser/external-rpc/jsc-polyfills/ws.js +83 -0
- package/lib/browser/external-rpc/setup-browser.d.ts +6 -0
- package/lib/browser/external-rpc/setup-browser.js +33 -0
- package/lib/browser/external-rpc/setup-jsc.d.ts +24 -0
- package/lib/browser/external-rpc/setup-jsc.js +22 -0
- package/lib/{window-rpc → browser/external-rpc}/types.d.ts +56 -35
- package/lib/browser/external-rpc/types.js +0 -0
- package/lib/browser/external-rpc/utils.d.ts +20 -0
- package/lib/browser/external-rpc/utils.js +100 -0
- package/lib/browser/external-rpc/zk.d.ts +14 -0
- package/lib/browser/external-rpc/zk.js +58 -0
- package/lib/browser/index.browser.js +13 -0
- package/lib/browser/index.d.ts +9 -0
- package/lib/browser/index.js +13 -0
- package/lib/browser/mechain/abis/governanceABI.d.ts +50 -0
- package/lib/browser/mechain/abis/governanceABI.js +461 -0
- package/lib/browser/mechain/abis/taskABI.d.ts +157 -0
- package/lib/browser/mechain/abis/taskABI.js +512 -0
- package/lib/browser/mechain/client/create-claim-on-mechain.d.ts +10 -0
- package/lib/browser/mechain/client/create-claim-on-mechain.js +33 -0
- package/lib/browser/mechain/client/index.d.ts +1 -0
- package/lib/browser/mechain/client/index.js +1 -0
- package/lib/browser/mechain/constants/index.d.ts +3 -0
- package/lib/browser/mechain/constants/index.js +8 -0
- package/lib/browser/mechain/index.d.ts +2 -0
- package/lib/browser/mechain/index.js +2 -0
- package/lib/browser/mechain/types/index.d.ts +23 -0
- package/lib/browser/mechain/types/index.js +0 -0
- package/lib/browser/proto/api.d.ts +651 -0
- package/lib/browser/proto/api.js +4250 -0
- package/lib/browser/proto/tee-bundle.d.ts +156 -0
- package/lib/browser/proto/tee-bundle.js +1296 -0
- package/lib/browser/providers/http/index.d.ts +18 -0
- package/lib/browser/providers/http/index.js +640 -0
- package/lib/browser/providers/http/patch-parse5-tree.d.ts +6 -0
- package/lib/browser/providers/http/patch-parse5-tree.js +34 -0
- package/lib/browser/providers/http/utils.d.ts +77 -0
- package/lib/browser/providers/http/utils.js +283 -0
- package/lib/browser/providers/index.d.ts +4 -0
- package/lib/browser/providers/index.js +7 -0
- package/lib/browser/scripts/fallbacks/crypto.js +4 -0
- package/lib/browser/scripts/fallbacks/empty.js +4 -0
- package/lib/browser/scripts/fallbacks/gnark.js +15 -0
- package/lib/browser/scripts/fallbacks/re2.js +7 -0
- package/lib/browser/scripts/fallbacks/snarkjs.js +10 -0
- package/lib/browser/scripts/fallbacks/stwo.js +159 -0
- package/lib/browser/types/bgp.d.ts +11 -0
- package/lib/browser/types/bgp.js +0 -0
- package/lib/browser/types/claims.d.ts +70 -0
- package/lib/browser/types/claims.js +0 -0
- package/lib/browser/types/client.d.ts +163 -0
- package/lib/browser/types/client.js +0 -0
- package/lib/browser/types/general.d.ts +77 -0
- package/lib/browser/types/general.js +0 -0
- package/lib/browser/types/handlers.d.ts +10 -0
- package/lib/browser/types/handlers.js +0 -0
- package/lib/browser/types/index.d.ts +10 -0
- package/lib/browser/types/index.js +10 -0
- package/lib/browser/types/providers.d.ts +161 -0
- package/lib/browser/types/providers.gen.d.ts +443 -0
- package/lib/browser/types/providers.gen.js +16 -0
- package/lib/browser/types/providers.js +0 -0
- package/lib/browser/types/rpc.d.ts +35 -0
- package/lib/browser/types/rpc.js +0 -0
- package/lib/browser/types/signatures.d.ts +28 -0
- package/lib/browser/types/signatures.js +0 -0
- package/lib/browser/types/tunnel.d.ts +18 -0
- package/lib/browser/types/tunnel.js +0 -0
- package/lib/browser/types/zk.d.ts +38 -0
- package/lib/browser/types/zk.js +0 -0
- package/lib/browser/utils/auth.d.ts +8 -0
- package/lib/browser/utils/auth.js +71 -0
- package/lib/browser/utils/b64-json.d.ts +2 -0
- package/lib/browser/utils/b64-json.js +17 -0
- package/lib/browser/utils/claims.d.ts +33 -0
- package/lib/browser/utils/claims.js +89 -0
- package/lib/browser/utils/env.d.ts +3 -0
- package/lib/browser/utils/env.js +19 -0
- package/lib/browser/utils/error.d.ts +26 -0
- package/lib/browser/utils/error.js +54 -0
- package/lib/browser/utils/generics.d.ts +119 -0
- package/lib/browser/utils/generics.js +272 -0
- package/lib/browser/utils/http-parser.d.ts +59 -0
- package/lib/browser/utils/http-parser.js +201 -0
- package/lib/browser/utils/index.browser.js +13 -0
- package/lib/browser/utils/index.d.ts +13 -0
- package/lib/browser/utils/index.js +13 -0
- package/lib/browser/utils/logger.browser.js +88 -0
- package/lib/browser/utils/logger.d.ts +14 -0
- package/lib/browser/utils/logger.js +88 -0
- package/lib/browser/utils/prepare-packets.d.ts +16 -0
- package/lib/browser/utils/prepare-packets.js +69 -0
- package/lib/browser/utils/redactions.d.ts +73 -0
- package/lib/browser/utils/redactions.js +135 -0
- package/lib/browser/utils/retries.d.ts +12 -0
- package/lib/browser/utils/retries.js +26 -0
- package/lib/browser/utils/signatures/eth.d.ts +2 -0
- package/lib/browser/utils/signatures/eth.js +31 -0
- package/lib/browser/utils/signatures/index.d.ts +5 -0
- package/lib/browser/utils/signatures/index.js +12 -0
- package/lib/browser/utils/socket-base.d.ts +23 -0
- package/lib/browser/utils/socket-base.js +96 -0
- package/lib/browser/utils/tls-imports.d.ts +21 -0
- package/lib/browser/utils/tls-imports.js +71 -0
- package/lib/browser/utils/tls.d.ts +2 -0
- package/lib/browser/utils/tls.js +58 -0
- package/lib/browser/utils/ws.d.ts +7 -0
- package/lib/browser/utils/ws.js +22 -0
- package/lib/browser/utils/zk.d.ts +71 -0
- package/lib/browser/utils/zk.js +625 -0
- package/lib/client/create-claim.d.ts +2 -2
- package/lib/client/create-claim.js +437 -400
- package/lib/client/index.d.ts +3 -3
- package/lib/client/index.js +3 -20
- package/lib/client/tunnels/make-rpc-tcp-tunnel.d.ts +2 -2
- package/lib/client/tunnels/make-rpc-tcp-tunnel.js +49 -56
- package/lib/client/tunnels/make-rpc-tls-tunnel.d.ts +4 -3
- package/lib/client/tunnels/make-rpc-tls-tunnel.js +123 -131
- package/lib/client/utils/attestor-pool.d.ts +3 -1
- package/lib/client/utils/attestor-pool.js +21 -25
- package/lib/client/utils/client-socket.d.ts +4 -4
- package/lib/client/utils/client-socket.js +114 -94
- package/lib/client/utils/message-handler.d.ts +2 -2
- package/lib/client/utils/message-handler.js +89 -86
- package/lib/config/index.d.ts +6 -3
- package/lib/config/index.js +60 -37
- package/lib/external-rpc/benchmark.d.ts +1 -0
- package/lib/external-rpc/benchmark.js +82 -0
- package/lib/external-rpc/event-bus.d.ts +7 -0
- package/lib/external-rpc/event-bus.js +17 -0
- package/lib/external-rpc/global.d.js +0 -0
- package/lib/external-rpc/handle-incoming-msg.d.ts +2 -0
- package/lib/external-rpc/handle-incoming-msg.js +241 -0
- package/lib/external-rpc/index.d.ts +3 -0
- package/lib/external-rpc/index.js +3 -0
- package/lib/external-rpc/jsc-polyfills/1.d.ts +14 -0
- package/lib/external-rpc/jsc-polyfills/1.js +80 -0
- package/lib/external-rpc/jsc-polyfills/2.js +15 -0
- package/lib/external-rpc/jsc-polyfills/event.d.ts +10 -0
- package/lib/external-rpc/jsc-polyfills/event.js +19 -0
- package/lib/external-rpc/jsc-polyfills/index.d.ts +2 -0
- package/lib/external-rpc/jsc-polyfills/index.js +2 -0
- package/lib/external-rpc/jsc-polyfills/ws.d.ts +21 -0
- package/lib/external-rpc/jsc-polyfills/ws.js +83 -0
- package/lib/external-rpc/setup-browser.d.ts +6 -0
- package/lib/external-rpc/setup-browser.js +33 -0
- package/lib/external-rpc/setup-jsc.d.ts +24 -0
- package/lib/external-rpc/setup-jsc.js +22 -0
- package/lib/external-rpc/types.d.ts +213 -0
- package/lib/external-rpc/types.js +0 -0
- package/lib/external-rpc/utils.d.ts +20 -0
- package/lib/external-rpc/utils.js +100 -0
- package/lib/external-rpc/zk.d.ts +14 -0
- package/lib/external-rpc/zk.js +58 -0
- package/lib/index.browser.d.ts +9 -0
- package/lib/index.d.ts +8 -9
- package/lib/index.js +12 -49
- package/lib/mechain/abis/governanceABI.js +460 -461
- package/lib/mechain/abis/taskABI.js +505 -506
- package/lib/mechain/client/create-claim-on-mechain.d.ts +3 -3
- package/lib/mechain/client/create-claim-on-mechain.js +31 -30
- package/lib/mechain/client/index.d.ts +1 -1
- package/lib/mechain/client/index.js +1 -18
- package/lib/mechain/constants/index.js +8 -7
- package/lib/mechain/index.d.ts +2 -2
- package/lib/mechain/index.js +2 -19
- package/lib/mechain/types/index.d.ts +2 -2
- package/lib/mechain/types/index.js +0 -3
- package/lib/proto/api.d.ts +182 -39
- package/lib/proto/api.js +4105 -3555
- package/lib/proto/tee-bundle.d.ts +156 -0
- package/lib/proto/tee-bundle.js +1296 -0
- package/lib/providers/http/index.d.ts +16 -1
- package/lib/providers/http/index.js +603 -576
- package/lib/providers/http/patch-parse5-tree.d.ts +6 -0
- package/lib/providers/http/patch-parse5-tree.js +34 -0
- package/lib/providers/http/utils.d.ts +7 -4
- package/lib/providers/http/utils.js +240 -317
- package/lib/providers/index.d.ts +1 -1
- package/lib/providers/index.js +5 -9
- package/lib/scripts/check-avs-registration.d.ts +1 -1
- package/lib/scripts/check-avs-registration.js +24 -25
- package/lib/scripts/fallbacks/crypto.d.ts +1 -0
- package/lib/scripts/fallbacks/crypto.js +4 -0
- package/lib/scripts/fallbacks/empty.d.ts +3 -0
- package/lib/scripts/fallbacks/empty.js +4 -0
- package/lib/scripts/fallbacks/gnark.d.ts +7 -0
- package/lib/scripts/fallbacks/gnark.js +15 -0
- package/lib/scripts/fallbacks/re2.d.ts +1 -0
- package/lib/scripts/fallbacks/re2.js +7 -0
- package/lib/scripts/fallbacks/snarkjs.d.ts +1 -0
- package/lib/scripts/fallbacks/snarkjs.js +10 -0
- package/lib/scripts/fallbacks/stwo.d.ts +6 -0
- package/lib/scripts/generate-provider-types.js +92 -73
- package/lib/scripts/generate-receipt.d.ts +2 -2
- package/lib/scripts/generate-receipt.js +94 -83
- package/lib/scripts/generate-toprf-keys.js +17 -16
- package/lib/scripts/jsc-cli-rpc.d.ts +1 -0
- package/lib/scripts/jsc-cli-rpc.js +35 -0
- package/lib/scripts/register-avs-operator.d.ts +1 -1
- package/lib/scripts/register-avs-operator.js +3 -7
- package/lib/scripts/start-server.d.ts +1 -1
- package/lib/scripts/start-server.js +9 -11
- package/lib/scripts/update-avs-metadata.d.ts +1 -1
- package/lib/scripts/update-avs-metadata.js +17 -19
- package/lib/scripts/utils.js +8 -9
- package/lib/scripts/whitelist-operator.d.ts +1 -1
- package/lib/scripts/whitelist-operator.js +13 -15
- package/lib/server/create-server.d.ts +3 -2
- package/lib/server/create-server.js +98 -85
- package/lib/server/handlers/claimTeeBundle.d.ts +6 -0
- package/lib/server/handlers/claimTeeBundle.js +232 -0
- package/lib/server/handlers/claimTunnel.d.ts +1 -1
- package/lib/server/handlers/claimTunnel.js +75 -73
- package/lib/server/handlers/completeClaimOnChain.d.ts +1 -1
- package/lib/server/handlers/completeClaimOnChain.js +27 -26
- package/lib/server/handlers/createClaimOnChain.d.ts +1 -1
- package/lib/server/handlers/createClaimOnChain.js +30 -29
- package/lib/server/handlers/createTaskOnMechain.d.ts +1 -1
- package/lib/server/handlers/createTaskOnMechain.js +54 -49
- package/lib/server/handlers/createTunnel.d.ts +1 -1
- package/lib/server/handlers/createTunnel.js +91 -94
- package/lib/server/handlers/disconnectTunnel.d.ts +1 -1
- package/lib/server/handlers/disconnectTunnel.js +6 -8
- package/lib/server/handlers/fetchCertificateBytes.d.ts +2 -0
- package/lib/server/handlers/fetchCertificateBytes.js +57 -0
- package/lib/server/handlers/index.d.ts +1 -1
- package/lib/server/handlers/index.js +24 -21
- package/lib/server/handlers/init.d.ts +1 -1
- package/lib/server/handlers/init.js +31 -34
- package/lib/server/handlers/toprf.d.ts +1 -1
- package/lib/server/handlers/toprf.js +17 -19
- package/lib/server/index.d.ts +4 -4
- package/lib/server/index.js +4 -21
- package/lib/server/socket.d.ts +7 -7
- package/lib/server/socket.js +104 -106
- package/lib/server/tunnels/make-tcp-tunnel.d.ts +5 -3
- package/lib/server/tunnels/make-tcp-tunnel.js +189 -162
- package/lib/server/utils/apm.d.ts +1 -1
- package/lib/server/utils/apm.js +26 -40
- package/lib/server/utils/assert-valid-claim-request.d.ts +6 -5
- package/lib/server/utils/assert-valid-claim-request.js +339 -185
- package/lib/server/utils/config-env.js +4 -7
- package/lib/server/utils/dns.js +18 -16
- package/lib/server/utils/gcp-attestation.d.ts +17 -0
- package/lib/server/utils/gcp-attestation.js +237 -0
- package/lib/server/utils/generics.d.ts +3 -3
- package/lib/server/utils/generics.js +37 -51
- package/lib/server/utils/iso.js +255 -256
- package/lib/server/utils/keep-alive.d.ts +2 -2
- package/lib/server/utils/keep-alive.js +36 -40
- package/lib/server/utils/nitro-attestation.d.ts +33 -0
- package/lib/server/utils/nitro-attestation.js +249 -0
- package/lib/server/utils/oprf-raw.d.ts +21 -0
- package/lib/server/utils/oprf-raw.js +61 -0
- package/lib/server/utils/process-handshake.d.ts +3 -3
- package/lib/server/utils/process-handshake.js +217 -175
- package/lib/server/utils/proxy-session.d.ts +1 -0
- package/lib/server/utils/proxy-session.js +4 -0
- package/lib/server/utils/tee-oprf-mpc-verification.d.ts +16 -0
- package/lib/server/utils/tee-oprf-mpc-verification.js +86 -0
- package/lib/server/utils/tee-oprf-verification.d.ts +24 -0
- package/lib/server/utils/tee-oprf-verification.js +151 -0
- package/lib/server/utils/tee-transcript-reconstruction.d.ts +24 -0
- package/lib/server/utils/tee-transcript-reconstruction.js +140 -0
- package/lib/server/utils/tee-verification.d.ts +28 -0
- package/lib/server/utils/tee-verification.js +358 -0
- package/lib/{utils → server/utils}/validation.d.ts +1 -1
- package/lib/server/utils/validation.js +45 -0
- package/lib/types/bgp.js +0 -3
- package/lib/types/claims.d.ts +7 -10
- package/lib/types/claims.js +0 -3
- package/lib/types/client.d.ts +5 -5
- package/lib/types/client.js +0 -3
- package/lib/types/general.d.ts +30 -4
- package/lib/types/general.js +0 -3
- package/lib/types/handlers.d.ts +3 -3
- package/lib/types/handlers.js +0 -3
- package/lib/types/index.d.ts +10 -10
- package/lib/types/index.js +10 -27
- package/lib/types/providers.d.ts +15 -4
- package/lib/types/providers.gen.d.ts +15 -1
- package/lib/types/providers.gen.js +15 -13
- package/lib/types/providers.js +0 -3
- package/lib/types/rpc.d.ts +2 -2
- package/lib/types/rpc.js +0 -3
- package/lib/types/signatures.js +0 -3
- package/lib/types/tunnel.d.ts +2 -2
- package/lib/types/tunnel.js +0 -3
- package/lib/types/zk.d.ts +17 -2
- package/lib/types/zk.js +0 -3
- package/lib/utils/auth.d.ts +2 -1
- package/lib/utils/auth.js +66 -59
- package/lib/utils/b64-json.js +13 -19
- package/lib/utils/bgp-listener.d.ts +1 -1
- package/lib/utils/bgp-listener.js +111 -114
- package/lib/utils/claims.d.ts +3 -3
- package/lib/utils/claims.js +78 -101
- package/lib/utils/env.js +15 -16
- package/lib/utils/error.d.ts +6 -7
- package/lib/utils/error.js +50 -39
- package/lib/utils/generics.d.ts +20 -13
- package/lib/utils/generics.js +221 -297
- package/lib/utils/http-parser.d.ts +1 -1
- package/lib/utils/http-parser.js +186 -237
- package/lib/utils/index.browser.d.ts +13 -0
- package/lib/utils/index.d.ts +14 -12
- package/lib/utils/index.js +14 -29
- package/lib/utils/logger.browser.d.ts +14 -0
- package/lib/utils/logger.d.ts +1 -1
- package/lib/utils/logger.js +69 -87
- package/lib/utils/prepare-packets.d.ts +3 -3
- package/lib/utils/prepare-packets.js +66 -58
- package/lib/utils/redactions.d.ts +20 -1
- package/lib/utils/redactions.js +116 -129
- package/lib/utils/retries.d.ts +1 -1
- package/lib/utils/retries.js +24 -26
- package/lib/utils/signatures/eth.d.ts +1 -1
- package/lib/utils/signatures/eth.js +28 -30
- package/lib/utils/signatures/index.d.ts +3 -3
- package/lib/utils/signatures/index.js +11 -10
- package/lib/utils/socket-base.d.ts +6 -5
- package/lib/utils/socket-base.js +89 -88
- package/lib/utils/tls-imports.d.ts +21 -0
- package/lib/utils/tls-imports.js +71 -0
- package/lib/utils/tls.d.ts +1 -1
- package/lib/utils/tls.js +54 -28
- package/lib/utils/ws.d.ts +1 -6
- package/lib/utils/ws.js +17 -33
- package/lib/utils/zk.d.ts +28 -12
- package/lib/utils/zk.js +587 -406
- package/package.json +79 -60
- package/lib/avs/tests/test.operator.d.ts +0 -11
- package/lib/avs/tests/test.operator.js +0 -313
- package/lib/avs/tests/utils.d.ts +0 -2
- package/lib/avs/tests/utils.js +0 -50
- package/lib/scripts/verify-root-ca.d.ts +0 -1
- package/lib/scripts/verify-root-ca.js +0 -51
- package/lib/tests/describe-with-server.d.ts +0 -20
- package/lib/tests/describe-with-server.js +0 -64
- package/lib/tests/mock-provider-server.d.ts +0 -13
- package/lib/tests/mock-provider-server.js +0 -65
- package/lib/tests/mocks.d.ts +0 -4
- package/lib/tests/mocks.js +0 -23
- package/lib/tests/test.auth.js +0 -75
- package/lib/tests/test.bgp-listener.js +0 -169
- package/lib/tests/test.claim-creation.js +0 -280
- package/lib/tests/test.http-parser.d.ts +0 -1
- package/lib/tests/test.http-parser.js +0 -120
- package/lib/tests/test.http-provider-utils.js +0 -2416
- package/lib/tests/test.http-provider.js +0 -114
- package/lib/tests/test.rpc-communication.d.ts +0 -1
- package/lib/tests/test.rpc-communication.js +0 -64
- package/lib/tests/test.rpc-tunnel.d.ts +0 -1
- package/lib/tests/test.rpc-tunnel.js +0 -172
- package/lib/tests/test.signatures.d.ts +0 -1
- package/lib/tests/test.signatures.js +0 -24
- package/lib/tests/test.tcp-tunnel.d.ts +0 -1
- package/lib/tests/test.tcp-tunnel.js +0 -64
- package/lib/tests/test.zk.d.ts +0 -1
- package/lib/tests/test.zk.js +0 -337
- package/lib/tests/utils.d.ts +0 -18
- package/lib/tests/utils.js +0 -64
- package/lib/utils/atomic-operations.d.ts +0 -24
- package/lib/utils/atomic-operations.js +0 -65
- package/lib/utils/benchmark.d.ts +0 -1
- package/lib/utils/benchmark.js +0 -70
- package/lib/utils/connection-state-machine.d.ts +0 -43
- package/lib/utils/connection-state-machine.js +0 -129
- package/lib/utils/resource-monitor.d.ts +0 -61
- package/lib/utils/resource-monitor.js +0 -107
- package/lib/utils/validation.js +0 -46
- package/lib/window-rpc/index.d.ts +0 -3
- package/lib/window-rpc/index.js +0 -20
- package/lib/window-rpc/setup-window-rpc.d.ts +0 -5
- package/lib/window-rpc/setup-window-rpc.js +0 -291
- package/lib/window-rpc/types.js +0 -3
- package/lib/window-rpc/utils.d.ts +0 -14
- package/lib/window-rpc/utils.js +0 -102
- package/lib/window-rpc/window-rpc-zk.d.ts +0 -15
- package/lib/window-rpc/window-rpc-zk.js +0 -85
- /package/lib/{tests/test.auth.d.ts → browser/external-rpc/jsc-polyfills/2.d.ts} +0 -0
- /package/lib/{tests/test.bgp-listener.d.ts → external-rpc/jsc-polyfills/2.d.ts} +0 -0
- /package/lib/{tests/test.claim-creation.d.ts → scripts/build-browser.d.ts} +0 -0
- /package/lib/{tests/test.http-provider-utils.d.ts → scripts/build-jsc.d.ts} +0 -0
- /package/lib/{tests/test.http-provider.d.ts → scripts/build-lib.d.ts} +0 -0
|
@@ -1,29 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// eslint-disable-next-line simple-import-sort/imports
|
|
4
|
-
require("../server/utils/config-env");
|
|
5
|
-
const contracts_1 = require("../avs/utils/contracts");
|
|
1
|
+
import "src/server/utils/config-env";
|
|
2
|
+
import { getContracts } from "../avs/utils/contracts.js";
|
|
6
3
|
async function main() {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
console.log('Operator not registered');
|
|
21
|
-
const isWhitelisted = await contract
|
|
22
|
-
.isOperatorWhitelisted(operatorAddr);
|
|
23
|
-
console.log(`Is whitelisted: ${isWhitelisted}`);
|
|
24
|
-
return;
|
|
4
|
+
const { wallet, contract } = getContracts();
|
|
5
|
+
const meta = await contract.taskCreationMetadata();
|
|
6
|
+
console.log(
|
|
7
|
+
"Metadata parameters:",
|
|
8
|
+
`maxTaskCreationDelayS: ${meta.maxTaskCreationDelayS}`,
|
|
9
|
+
`minSignaturesPerTask: ${meta.minSignaturesPerTask}`,
|
|
10
|
+
`maxTaskLifetimeS: ${meta.maxTaskLifetimeS}`
|
|
11
|
+
);
|
|
12
|
+
console.log(`Checking registration for operator ${wallet.address}`);
|
|
13
|
+
const operatorAddr = wallet.address;
|
|
14
|
+
const metadata = await contract.getMetadataForOperator(operatorAddr).catch((err) => {
|
|
15
|
+
if (err.message.includes("Operator not found")) {
|
|
16
|
+
return;
|
|
25
17
|
}
|
|
26
|
-
|
|
18
|
+
throw err;
|
|
19
|
+
});
|
|
20
|
+
if (!metadata) {
|
|
21
|
+
console.log("Operator not registered");
|
|
22
|
+
const isWhitelisted = await contract.isOperatorWhitelisted(operatorAddr);
|
|
23
|
+
console.log(`Is whitelisted: ${isWhitelisted}`);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
console.log("Operator registered, URL:", metadata.url);
|
|
27
27
|
}
|
|
28
28
|
void main();
|
|
29
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hlY2stYXZzLXJlZ2lzdHJhdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zY3JpcHRzL2NoZWNrLWF2cy1yZWdpc3RyYXRpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxzREFBc0Q7QUFDdEQsdUNBQW9DO0FBQ3BDLHVEQUFzRDtBQUd0RCxLQUFLLFVBQVUsSUFBSTtJQUNsQixNQUFNLEVBQUUsTUFBTSxFQUFFLFFBQVEsRUFBRSxHQUFHLElBQUEsd0JBQVksR0FBRSxDQUFBO0lBRTNDLE1BQU0sSUFBSSxHQUFHLE1BQU0sUUFBUSxDQUFDLG9CQUFvQixFQUFFLENBQUE7SUFDbEQsT0FBTyxDQUFDLEdBQUcsQ0FDVixzQkFBc0IsRUFDdEIsMEJBQTBCLElBQUksQ0FBQyxxQkFBcUIsRUFBRSxFQUN0RCx5QkFBeUIsSUFBSSxDQUFDLG9CQUFvQixFQUFFLEVBQ3BELHFCQUFxQixJQUFJLENBQUMsZ0JBQWdCLEVBQUUsQ0FDNUMsQ0FBQTtJQUVELE9BQU8sQ0FBQyxHQUFHLENBQUMsc0NBQXNDLE1BQU8sQ0FBQyxPQUFPLEVBQUUsQ0FBQyxDQUFBO0lBQ3BFLE1BQU0sWUFBWSxHQUFHLE1BQU8sQ0FBQyxPQUFPLENBQUE7SUFDcEMsTUFBTSxRQUFRLEdBQUcsTUFBTSxRQUFRLENBQUMsc0JBQXNCLENBQUMsWUFBWSxDQUFDO1NBQ2xFLEtBQUssQ0FBQyxHQUFHLENBQUMsRUFBRTtRQUNaLElBQUcsR0FBRyxDQUFDLE9BQU8sQ0FBQyxRQUFRLENBQUMsb0JBQW9CLENBQUMsRUFBRSxDQUFDO1lBQy9DLE9BQU07UUFDUCxDQUFDO1FBRUQsTUFBTSxHQUFHLENBQUE7SUFDVixDQUFDLENBQUMsQ0FBQTtJQUNILElBQUcsQ0FBQyxRQUFRLEVBQUUsQ0FBQztRQUNkLE9BQU8sQ0FBQyxHQUFHLENBQUMseUJBQXlCLENBQUMsQ0FBQTtRQUN0QyxNQUFNLGFBQWEsR0FBRyxNQUFNLFFBQVE7YUFDbEMscUJBQXFCLENBQUMsWUFBWSxDQUFDLENBQUE7UUFDckMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxtQkFBbUIsYUFBYSxFQUFFLENBQUMsQ0FBQTtRQUMvQyxPQUFNO0lBQ1AsQ0FBQztJQUVELE9BQU8sQ0FBQyxHQUFHLENBQUMsMkJBQTJCLEVBQUUsUUFBUSxDQUFDLEdBQUcsQ0FBQyxDQUFBO0FBQ3ZELENBQUM7QUFFRCxLQUFLLElBQUksRUFBRSxDQUFBIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const webcrypto: Crypto;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser fallback for gnark - gnark requires native code (koffi) and cannot run in browser
|
|
3
|
+
*/
|
|
4
|
+
import type { EncryptionAlgorithm, MakeZKOperatorOpts, ZKOperator, OPRFOperator } from '@reclaimprotocol/zk-symmetric-crypto';
|
|
5
|
+
export declare function makeGnarkZkOperator(opts: MakeZKOperatorOpts<object>): ZKOperator;
|
|
6
|
+
export declare function makeGnarkOPRFOperator(algorithm: EncryptionAlgorithm, fetcher: unknown): OPRFOperator;
|
|
7
|
+
export declare function initGnark(): Promise<void>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const GNARK_ERROR = "gnark requires native code and cannot run in browser. Use snarkjs or stwo instead.";
|
|
2
|
+
function makeGnarkZkOperator(opts) {
|
|
3
|
+
throw new Error(GNARK_ERROR);
|
|
4
|
+
}
|
|
5
|
+
function makeGnarkOPRFOperator(algorithm, fetcher) {
|
|
6
|
+
throw new Error(GNARK_ERROR);
|
|
7
|
+
}
|
|
8
|
+
async function initGnark() {
|
|
9
|
+
throw new Error(GNARK_ERROR);
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
initGnark,
|
|
13
|
+
makeGnarkOPRFOperator,
|
|
14
|
+
makeGnarkZkOperator
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function regularRegex(pattern: string, flags?: string): RegExp;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const wtns: any, groth16: any, zkey: any;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser fallback for stwo - loads from window.s2circuits
|
|
3
|
+
* The s2circuits.js script must be loaded before this runs
|
|
4
|
+
*/
|
|
5
|
+
import type { MakeZKOperatorOpts, ZKOperator } from '@reclaimprotocol/zk-symmetric-crypto';
|
|
6
|
+
export declare function makeStwoZkOperator({ algorithm, fetcher, }: MakeZKOperatorOpts<object>): ZKOperator;
|
|
@@ -1,82 +1,101 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const PROVIDER_SCHEMAS_PATH = './provider-schemas';
|
|
8
|
-
const GEN_TS_FILENAME = './src/types/providers.gen.ts';
|
|
9
|
-
const BinaryDataType = 'BinaryData';
|
|
1
|
+
import { readdir, readFile, writeFile } from "fs/promises";
|
|
2
|
+
import { compile } from "json-schema-to-typescript";
|
|
3
|
+
import { parse } from "yaml";
|
|
4
|
+
const PROVIDER_SCHEMAS_PATH = "./provider-schemas";
|
|
5
|
+
const GEN_TS_FILENAME = "./src/types/providers.gen.ts";
|
|
6
|
+
const BinaryDataType = "BinaryData";
|
|
10
7
|
async function main() {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
providerTypeMap +=
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
8
|
+
const folders = await findAllProviderFolders();
|
|
9
|
+
console.log(`Generating for ${folders.length} provider folders`);
|
|
10
|
+
let ts = "/* eslint-disable */\n/* Generated file. Do not edit */";
|
|
11
|
+
ts += `
|
|
12
|
+
|
|
13
|
+
type ${BinaryDataType} = Uint8Array | string
|
|
14
|
+
`;
|
|
15
|
+
let providerTypeMap = "\nexport interface ProvidersConfig {\n";
|
|
16
|
+
let providerSchemaMap = "\nexport const PROVIDER_SCHEMAS = {\n";
|
|
17
|
+
for (const folder of folders) {
|
|
18
|
+
const {
|
|
19
|
+
schemaTitle: paramsSchemaTitle,
|
|
20
|
+
ts: paramsSchemaTs,
|
|
21
|
+
jsonTitle: paramsJsonTitle
|
|
22
|
+
} = await generateTsFromYamlSchema(folder, "parameters");
|
|
23
|
+
const {
|
|
24
|
+
schemaTitle: secretParamsSchemaTitle,
|
|
25
|
+
ts: secretParamsSchemaTs,
|
|
26
|
+
jsonTitle: secretParamsJsonTitle
|
|
27
|
+
} = await generateTsFromYamlSchema(
|
|
28
|
+
folder,
|
|
29
|
+
"secret-parameters"
|
|
30
|
+
);
|
|
31
|
+
ts += `
|
|
32
|
+
${paramsSchemaTs}
|
|
33
|
+
${secretParamsSchemaTs}`;
|
|
34
|
+
providerTypeMap += ` ${folder}: {
|
|
35
|
+
`;
|
|
36
|
+
providerTypeMap += ` parameters: ${paramsSchemaTitle}
|
|
37
|
+
`;
|
|
38
|
+
providerTypeMap += ` secretParameters: ${secretParamsSchemaTitle}
|
|
39
|
+
`;
|
|
40
|
+
providerTypeMap += " }\n";
|
|
41
|
+
providerSchemaMap += ` ${folder}: {
|
|
42
|
+
`;
|
|
43
|
+
providerSchemaMap += ` parameters: ${paramsJsonTitle},
|
|
44
|
+
`;
|
|
45
|
+
providerSchemaMap += ` secretParameters: ${secretParamsJsonTitle}
|
|
46
|
+
`;
|
|
47
|
+
providerSchemaMap += " },\n";
|
|
48
|
+
}
|
|
49
|
+
providerTypeMap += "}\n";
|
|
50
|
+
providerSchemaMap += "}\n";
|
|
51
|
+
ts += providerTypeMap;
|
|
52
|
+
ts += providerSchemaMap;
|
|
53
|
+
await writeFile(GEN_TS_FILENAME, ts);
|
|
54
|
+
console.log(`Wrote to ${GEN_TS_FILENAME}`);
|
|
43
55
|
}
|
|
44
56
|
async function getJsonSchemaForProvider(name, type) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
57
|
+
const paramsYaml = await readFile(
|
|
58
|
+
`${PROVIDER_SCHEMAS_PATH}/${name}/${type}.yaml`,
|
|
59
|
+
{ encoding: "utf-8" }
|
|
60
|
+
);
|
|
61
|
+
const paramsJson = parse(paramsYaml);
|
|
62
|
+
return paramsJson;
|
|
48
63
|
}
|
|
49
64
|
async function generateTsFromYamlSchema(name, type) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
const paramsJson = await getJsonSchemaForProvider(name, type);
|
|
66
|
+
let paramsSchemaTs = await compile(
|
|
67
|
+
paramsJson,
|
|
68
|
+
"",
|
|
69
|
+
{
|
|
70
|
+
additionalProperties: false,
|
|
71
|
+
bannerComment: "",
|
|
72
|
+
ignoreMinAndMaxItems: true,
|
|
73
|
+
declareExternallyReferenced: false,
|
|
74
|
+
customName({ type: type2, format }) {
|
|
75
|
+
if (type2 === "string" && format === "binary") {
|
|
76
|
+
return BinaryDataType;
|
|
77
|
+
}
|
|
78
|
+
return void 0;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
const jsonTitle = `${paramsJson.title}Json`;
|
|
83
|
+
paramsSchemaTs += `
|
|
84
|
+
export const ${jsonTitle} = ${JSON.stringify(paramsJson)}`;
|
|
85
|
+
return {
|
|
86
|
+
ts: paramsSchemaTs,
|
|
87
|
+
schemaTitle: paramsJson.title,
|
|
88
|
+
jsonTitle
|
|
89
|
+
};
|
|
70
90
|
}
|
|
71
|
-
/**
|
|
72
|
-
* Find all provider folders in the provider-schemas directory
|
|
73
|
-
* @returns {Promise<string[]>} List of provider folder names
|
|
74
|
-
*/
|
|
75
91
|
async function findAllProviderFolders() {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
92
|
+
const providerFolders = await readdir(
|
|
93
|
+
PROVIDER_SCHEMAS_PATH,
|
|
94
|
+
{ withFileTypes: true }
|
|
95
|
+
);
|
|
96
|
+
return providerFolders.filter((p) => p.isDirectory()).map((p) => p.name);
|
|
80
97
|
}
|
|
81
98
|
void main();
|
|
82
|
-
|
|
99
|
+
export {
|
|
100
|
+
generateTsFromYamlSchema
|
|
101
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import '
|
|
2
|
-
import { ProviderName, ProviderParams, ProviderSecretParams } from '
|
|
1
|
+
import '#src/server/utils/config-env.ts';
|
|
2
|
+
import type { ProviderName, ProviderParams, ProviderSecretParams } from '#src/index.ts';
|
|
3
3
|
type ProviderReceiptGenerationParams<P extends ProviderName> = {
|
|
4
4
|
name: P;
|
|
5
5
|
params: ProviderParams<P>;
|
|
@@ -1,90 +1,101 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import "../server/utils/config-env.js";
|
|
2
|
+
import { setCryptoImplementation } from "@reclaimprotocol/tls";
|
|
3
|
+
import { webcryptoCrypto } from "@reclaimprotocol/tls/webcrypto";
|
|
4
|
+
import { readFile } from "fs/promises";
|
|
5
|
+
import {
|
|
6
|
+
API_SERVER_PORT,
|
|
7
|
+
createClaimOnAttestor,
|
|
8
|
+
getAttestorClientFromPool,
|
|
9
|
+
getTranscriptString,
|
|
10
|
+
logger,
|
|
11
|
+
providers,
|
|
12
|
+
WS_PATHNAME
|
|
13
|
+
} from "../index.js";
|
|
14
|
+
import { getCliArgument } from "../scripts/utils.js";
|
|
15
|
+
import { createServer, decryptTranscript } from "../server/index.js";
|
|
16
|
+
import { assertValidateProviderParams } from "../server/utils/validation.js";
|
|
17
|
+
import { getEnvVariable } from "../utils/env.js";
|
|
18
|
+
setCryptoImplementation(webcryptoCrypto);
|
|
19
|
+
const DEFAULT_ATTESTOR_HOST_PORT = "wss://eu.attestor.reclaimprotocol.org/ws";
|
|
20
|
+
const PRIVATE_KEY_HEX = getEnvVariable("PRIVATE_KEY_HEX") || "0x0123788edad59d7c013cdc85e4372f350f828e2cec62d9a2de4560e69aec7f89";
|
|
16
21
|
let server;
|
|
17
22
|
async function main(receiptParams) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
const paramsJson = receiptParams ?? await getInputParameters();
|
|
24
|
+
if (!(paramsJson.name in providers)) {
|
|
25
|
+
throw new Error(`Unknown provider "${paramsJson.name}"`);
|
|
26
|
+
}
|
|
27
|
+
assertValidateProviderParams(paramsJson.name, paramsJson.params);
|
|
28
|
+
let attestorHostPort = getCliArgument("attestor") || DEFAULT_ATTESTOR_HOST_PORT;
|
|
29
|
+
if (attestorHostPort === "local") {
|
|
30
|
+
console.log("starting local attestor server...");
|
|
31
|
+
server = await createServer();
|
|
32
|
+
attestorHostPort = `ws://localhost:${API_SERVER_PORT}${WS_PATHNAME}`;
|
|
33
|
+
}
|
|
34
|
+
globalThis.ATTESTOR_BASE_URL = attestorHostPort.replace("ws://", "http://").replace("wss://", "https://");
|
|
35
|
+
const zkEngine = getCliArgument("zk") === "gnark" ? "gnark" : "stwo";
|
|
36
|
+
const { request, error, claim } = await createClaimOnAttestor({
|
|
37
|
+
name: paramsJson.name,
|
|
38
|
+
secretParams: paramsJson.secretParams,
|
|
39
|
+
params: paramsJson.params,
|
|
40
|
+
ownerPrivateKey: PRIVATE_KEY_HEX,
|
|
41
|
+
client: { url: attestorHostPort },
|
|
42
|
+
logger,
|
|
43
|
+
zkEngine
|
|
44
|
+
});
|
|
45
|
+
if (error) {
|
|
46
|
+
console.error("claim creation failed:", error);
|
|
47
|
+
} else {
|
|
48
|
+
const ctx = claim?.context ? JSON.parse(claim.context) : {};
|
|
49
|
+
console.log(`receipt is valid for ${paramsJson.name} provider`);
|
|
50
|
+
if (ctx.extractedParameters) {
|
|
51
|
+
console.log("extracted params:", ctx.extractedParameters);
|
|
22
52
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
zkEngine
|
|
40
|
-
});
|
|
41
|
-
if (receipt.error) {
|
|
42
|
-
console.error('claim creation failed:', receipt.error);
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
const ctx = ((_a = receipt.claim) === null || _a === void 0 ? void 0 : _a.context)
|
|
46
|
-
? JSON.parse(receipt.claim.context)
|
|
47
|
-
: {};
|
|
48
|
-
console.log(`receipt is valid for ${paramsJson.name} provider`);
|
|
49
|
-
if (ctx.extractedParameters) {
|
|
50
|
-
console.log('extracted params:', ctx.extractedParameters);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
const decTranscript = await (0, server_1.decryptTranscript)((_b = receipt.request) === null || _b === void 0 ? void 0 : _b.transcript, __1.logger, zkEngine, (_c = receipt.request) === null || _c === void 0 ? void 0 : _c.fixedServerIV, (_d = receipt.request) === null || _d === void 0 ? void 0 : _d.fixedClientIV);
|
|
54
|
-
const transcriptStr = (0, __1.getTranscriptString)(decTranscript);
|
|
55
|
-
console.log('receipt:\n', transcriptStr);
|
|
56
|
-
const client = (0, __1.getAttestorClientFromPool)(attestorHostPort);
|
|
57
|
-
await client.terminateConnection();
|
|
53
|
+
}
|
|
54
|
+
if (!request) {
|
|
55
|
+
throw new Error("Missing request in claim");
|
|
56
|
+
}
|
|
57
|
+
const decTranscript = await decryptTranscript(
|
|
58
|
+
request?.transcript,
|
|
59
|
+
logger,
|
|
60
|
+
zkEngine,
|
|
61
|
+
request?.fixedServerIV,
|
|
62
|
+
request?.fixedClientIV
|
|
63
|
+
);
|
|
64
|
+
const transcriptStr = getTranscriptString(decTranscript);
|
|
65
|
+
console.log("receipt:\n", transcriptStr);
|
|
66
|
+
console.log("claim:\n", claim);
|
|
67
|
+
const client = getAttestorClientFromPool(attestorHostPort);
|
|
68
|
+
await client.terminateConnection();
|
|
58
69
|
}
|
|
59
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
60
70
|
async function getInputParameters() {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
return {
|
|
70
|
-
name,
|
|
71
|
-
params: JSON.parse(paramsStr),
|
|
72
|
-
secretParams: JSON.parse(secretParamsStr)
|
|
73
|
-
};
|
|
71
|
+
const paramsJsonFile = getCliArgument("json");
|
|
72
|
+
if (!paramsJsonFile) {
|
|
73
|
+
const name = getCliArgument("name");
|
|
74
|
+
const paramsStr = getCliArgument("params");
|
|
75
|
+
const secretParamsStr = getCliArgument("secretParams");
|
|
76
|
+
if (!name || !paramsStr || !secretParamsStr) {
|
|
77
|
+
throw new Error("Either provide --json argument for parameters JSON or provide separately with --name, --params & --secretParams");
|
|
74
78
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
79
|
+
return {
|
|
80
|
+
name,
|
|
81
|
+
params: JSON.parse(paramsStr),
|
|
82
|
+
secretParams: JSON.parse(secretParamsStr)
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
let fileContents = await readFile(paramsJsonFile, "utf8");
|
|
86
|
+
for (const variable in process.env) {
|
|
87
|
+
fileContents = fileContents.replace(
|
|
88
|
+
`{{${variable}}}`,
|
|
89
|
+
process.env[variable]
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
return JSON.parse(fileContents);
|
|
89
93
|
}
|
|
90
|
-
|
|
94
|
+
main().catch((err) => {
|
|
95
|
+
console.error("error in receipt gen", err);
|
|
96
|
+
}).finally(() => {
|
|
97
|
+
server?.close();
|
|
98
|
+
});
|
|
99
|
+
export {
|
|
100
|
+
main
|
|
101
|
+
};
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
const utils_1 = require("../utils");
|
|
5
|
-
const ENGINE = 'gnark';
|
|
1
|
+
import { hexlify } from "ethers";
|
|
2
|
+
import { logger, makeDefaultOPRFOperator } from "../utils/index.js";
|
|
3
|
+
const ENGINE = "gnark";
|
|
6
4
|
const TOTAL_KEYS = 10;
|
|
7
5
|
const THRESHOLD = 1;
|
|
8
6
|
async function main() {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
const op = makeDefaultOPRFOperator("chacha20", ENGINE, logger);
|
|
8
|
+
const {
|
|
9
|
+
publicKey,
|
|
10
|
+
privateKey,
|
|
11
|
+
shares
|
|
12
|
+
} = await op.generateThresholdKeys(TOTAL_KEYS, THRESHOLD);
|
|
13
|
+
logEnvValue("TOPRF_PUBLIC_KEY", publicKey);
|
|
14
|
+
logEnvValue("TOPRF_PRIVATE_KEY", privateKey);
|
|
15
|
+
for (const [i, share] of shares.entries()) {
|
|
16
|
+
console.log(`# Share ${i}`);
|
|
17
|
+
logEnvValue("TOPRF_SHARE_PUBLIC_KEY", share.publicKey);
|
|
18
|
+
logEnvValue("TOPRF_SHARE_PRIVATE_KEY", share.privateKey);
|
|
19
|
+
}
|
|
18
20
|
}
|
|
19
21
|
function logEnvValue(name, value) {
|
|
20
|
-
|
|
22
|
+
console.log(`${name}=${hexlify(value)}`);
|
|
21
23
|
}
|
|
22
24
|
void main();
|
|
23
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2VuZXJhdGUtdG9wcmYta2V5cy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zY3JpcHRzL2dlbmVyYXRlLXRvcHJmLWtleXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxtQ0FBK0I7QUFDL0IscUNBQTJEO0FBRTNELE1BQU0sTUFBTSxHQUFHLE9BQU8sQ0FBQTtBQUN0QixNQUFNLFVBQVUsR0FBRyxFQUFFLENBQUE7QUFDckIsTUFBTSxTQUFTLEdBQUcsQ0FBQyxDQUFBO0FBRW5CLEtBQUssVUFBVSxJQUFJO0lBQ2xCLE1BQU0sRUFBRSxHQUFHLElBQUEsK0JBQXVCLEVBQUMsVUFBVSxFQUFFLE1BQU0sRUFBRSxjQUFNLENBQUMsQ0FBQTtJQUM5RCxNQUFNLEVBQ0wsU0FBUyxFQUNULFVBQVUsRUFDVixNQUFNLEVBQ04sR0FBRyxNQUFNLEVBQUUsQ0FBQyxxQkFBcUIsQ0FBQyxVQUFVLEVBQUUsU0FBUyxDQUFDLENBQUE7SUFDekQsV0FBVyxDQUFDLGtCQUFrQixFQUFFLFNBQVMsQ0FBQyxDQUFBO0lBQzFDLFdBQVcsQ0FBQyxtQkFBbUIsRUFBRSxVQUFVLENBQUMsQ0FBQTtJQUU1QyxLQUFJLE1BQU0sQ0FBQyxDQUFDLEVBQUUsS0FBSyxDQUFDLElBQUksTUFBTSxDQUFDLE9BQU8sRUFBRSxFQUFFLENBQUM7UUFDMUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxXQUFXLENBQUMsRUFBRSxDQUFDLENBQUE7UUFDM0IsV0FBVyxDQUFDLHdCQUF3QixFQUFFLEtBQUssQ0FBQyxTQUFTLENBQUMsQ0FBQTtRQUN0RCxXQUFXLENBQUMseUJBQXlCLEVBQUUsS0FBSyxDQUFDLFVBQVUsQ0FBQyxDQUFBO0lBQ3pELENBQUM7QUFDRixDQUFDO0FBRUQsU0FBUyxXQUFXLENBQUMsSUFBWSxFQUFFLEtBQWlCO0lBQ25ELE9BQU8sQ0FBQyxHQUFHLENBQUMsR0FBRyxJQUFJLElBQUksZUFBTSxDQUFDLEtBQUssQ0FBQyxPQUFPLENBQUMsS0FBSyxDQUFDLEVBQUUsQ0FBQyxDQUFBO0FBQ3RELENBQUM7QUFFRCxLQUFLLElBQUksRUFBRSxDQUFBIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '#src/external-rpc/jsc-polyfills/index.ts';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import "../external-rpc/jsc-polyfills/index.js";
|
|
2
|
+
import { setCryptoImplementation } from "@reclaimprotocol/tls";
|
|
3
|
+
import { pureJsCrypto } from "@reclaimprotocol/tls/purejs-crypto";
|
|
4
|
+
import { handleIncomingMessage } from "../external-rpc/index.js";
|
|
5
|
+
import { B64_JSON_REVIVER } from "../utils/b64-json.js";
|
|
6
|
+
function readIncomingMsg() {
|
|
7
|
+
const cmd2 = readline();
|
|
8
|
+
return JSON.parse(cmd2, B64_JSON_REVIVER);
|
|
9
|
+
}
|
|
10
|
+
setCryptoImplementation(pureJsCrypto);
|
|
11
|
+
print("Input base URL for attestor");
|
|
12
|
+
const initCmd = readIncomingMsg();
|
|
13
|
+
if (initCmd.type !== "init") {
|
|
14
|
+
throw new Error("Expected init command");
|
|
15
|
+
}
|
|
16
|
+
globalThis.RPC_CHANNEL_NAME = "cli";
|
|
17
|
+
globalThis.ATTESTOR_BASE_URL = initCmd.attestorBaseUrl;
|
|
18
|
+
const channel = {
|
|
19
|
+
postMessage(message) {
|
|
20
|
+
print(message);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
globalThis[RPC_CHANNEL_NAME] = channel;
|
|
24
|
+
print("reading RPC messages...");
|
|
25
|
+
let cmd;
|
|
26
|
+
while (cmd = readIncomingMsg(), cmd.type !== "quit") {
|
|
27
|
+
if (cmd.type === "init") {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
handleIncomingMessage(cmd);
|
|
31
|
+
await new Promise((resolve) => {
|
|
32
|
+
setTimeout(resolve, 500);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
print("done");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import '
|
|
1
|
+
import 'src/server/utils/config-env';
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
require("../server/utils/config-env");
|
|
5
|
-
const register_1 = require("../avs/utils/register");
|
|
6
|
-
void (0, register_1.registerOperator)();
|
|
7
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVnaXN0ZXItYXZzLW9wZXJhdG9yLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3NjcmlwdHMvcmVnaXN0ZXItYXZzLW9wZXJhdG9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsc0RBQXNEO0FBQ3RELHVDQUFvQztBQUNwQyxxREFBeUQ7QUFFekQsS0FBSyxJQUFBLDJCQUFnQixHQUFFLENBQUEifQ==
|
|
1
|
+
import "src/server/utils/config-env";
|
|
2
|
+
import { registerOperator } from "../avs/utils/register.js";
|
|
3
|
+
void registerOperator();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import '
|
|
1
|
+
import '#src/server/utils/config-env.ts';
|