@reclaimprotocol/attestor-core 5.0.1-beta.11 → 5.0.1-beta.13
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/lib/avs/client/create-claim-on-avs.js +5 -5
- package/lib/avs/config.js +1 -1
- package/lib/avs/utils/contracts.js +5 -5
- package/lib/avs/utils/register.js +3 -3
- package/lib/avs/utils/tasks.js +1 -1
- package/lib/client/create-claim.js +10 -10
- package/lib/client/tunnels/make-rpc-tcp-tunnel.js +1 -1
- package/lib/client/tunnels/make-rpc-tls-tunnel.d.ts +1 -1
- package/lib/client/tunnels/make-rpc-tls-tunnel.js +4 -4
- package/lib/client/utils/attestor-pool.js +1 -1
- package/lib/client/utils/client-socket.js +5 -5
- package/lib/client/utils/message-handler.js +2 -2
- package/lib/config/index.js +1 -1
- package/lib/external-rpc/benchmark.js +4 -4
- package/lib/external-rpc/handle-incoming-msg.js +9 -9
- package/lib/external-rpc/jsc-polyfills/1.js +1 -1
- package/lib/external-rpc/jsc-polyfills/2.js +2 -2
- package/lib/external-rpc/jsc-polyfills/index.js +2 -2
- package/lib/external-rpc/jsc-polyfills/ws.js +1 -1
- package/lib/external-rpc/setup-browser.js +5 -5
- package/lib/external-rpc/setup-jsc.js +4 -4
- package/lib/external-rpc/utils.js +4 -4
- package/lib/external-rpc/zk.js +2 -2
- package/lib/mechain/client/create-claim-on-mechain.js +2 -2
- package/lib/providers/http/index.js +6 -6
- package/lib/providers/http/utils.js +3 -3
- package/lib/providers/index.js +1 -1
- package/lib/scripts/build-browser.js +38 -0
- package/lib/scripts/build-jsc.js +47 -0
- package/lib/scripts/build-lib.js +47 -0
- package/lib/scripts/check-avs-registration.js +1 -1
- package/lib/scripts/generate-provider-types.js +1 -1
- package/lib/scripts/generate-receipt.js +6 -6
- package/lib/scripts/generate-toprf-keys.js +1 -1
- package/lib/scripts/jsc-cli-rpc.js +3 -3
- package/lib/scripts/register-avs-operator.js +1 -1
- package/lib/scripts/start-server.js +3 -3
- package/lib/scripts/update-avs-metadata.js +2 -2
- package/lib/scripts/whitelist-operator.js +2 -2
- package/lib/server/create-server.js +9 -9
- package/lib/server/handlers/claimTeeBundle.js +11 -11
- package/lib/server/handlers/claimTunnel.js +6 -6
- package/lib/server/handlers/completeClaimOnChain.js +3 -3
- package/lib/server/handlers/createClaimOnChain.js +4 -4
- package/lib/server/handlers/createTaskOnMechain.js +4 -4
- package/lib/server/handlers/createTunnel.js +4 -4
- package/lib/server/handlers/fetchCertificateBytes.js +2 -2
- package/lib/server/handlers/index.js +10 -10
- package/lib/server/handlers/init.js +5 -5
- package/lib/server/handlers/toprf.js +2 -2
- package/lib/server/socket.js +7 -7
- package/lib/server/tunnels/make-tcp-tunnel.js +6 -6
- package/lib/server/utils/apm.js +2 -2
- package/lib/server/utils/assert-valid-claim-request.js +8 -8
- package/lib/server/utils/config-env.js +1 -1
- package/lib/server/utils/dns.js +1 -1
- package/lib/server/utils/generics.js +4 -4
- package/lib/server/utils/keep-alive.js +1 -1
- package/lib/server/utils/oprf-raw.js +3 -3
- package/lib/server/utils/process-handshake.js +2 -2
- package/lib/server/utils/proxy-session.d.ts +1 -1
- package/lib/server/utils/proxy-session.js +3 -1
- package/lib/server/utils/tee-oprf-mpc-verification.js +1 -1
- package/lib/server/utils/tee-oprf-verification.js +2 -2
- package/lib/server/utils/tee-transcript-reconstruction.js +3 -3
- package/lib/server/utils/tee-verification.js +6 -6
- package/lib/server/utils/validation.js +2 -2
- package/lib/types/general.d.ts +0 -1
- package/lib/utils/auth.js +6 -6
- package/lib/utils/bgp-listener.js +2 -2
- package/lib/utils/claims.js +3 -3
- package/lib/utils/error.js +1 -1
- package/lib/utils/generics.d.ts +1 -6
- package/lib/utils/generics.js +2 -6
- package/lib/utils/http-parser.js +3 -3
- package/lib/utils/index.d.ts +0 -1
- package/lib/utils/index.js +0 -1
- package/lib/utils/logger.js +1 -1
- package/lib/utils/prepare-packets.js +3 -3
- package/lib/utils/redactions.js +1 -1
- package/lib/utils/signatures/index.js +2 -2
- package/lib/utils/socket-base.js +3 -3
- package/lib/utils/tls.js +2 -2
- package/lib/utils/zk.js +8 -8
- package/package.json +3 -9
- package/lib/browser/avs/abis/avsDirectoryABI.d.ts +0 -60
- package/lib/browser/avs/abis/avsDirectoryABI.js +0 -343
- package/lib/browser/avs/abis/delegationABI.d.ts +0 -126
- package/lib/browser/avs/abis/delegationABI.js +0 -4
- package/lib/browser/avs/abis/registryABI.d.ts +0 -136
- package/lib/browser/avs/abis/registryABI.js +0 -728
- package/lib/browser/avs/client/create-claim-on-avs.d.ts +0 -12
- package/lib/browser/avs/client/create-claim-on-avs.js +0 -168
- package/lib/browser/avs/config.d.ts +0 -7
- package/lib/browser/avs/config.js +0 -26
- package/lib/browser/avs/contracts/ReclaimServiceManager.d.ts +0 -601
- package/lib/browser/avs/contracts/ReclaimServiceManager.js +0 -0
- package/lib/browser/avs/contracts/common.d.ts +0 -50
- package/lib/browser/avs/contracts/common.js +0 -0
- package/lib/browser/avs/contracts/factories/ReclaimServiceManager__factory.d.ts +0 -890
- package/lib/browser/avs/contracts/factories/ReclaimServiceManager__factory.js +0 -1183
- package/lib/browser/avs/contracts/factories/index.d.ts +0 -1
- package/lib/browser/avs/contracts/factories/index.js +0 -4
- package/lib/browser/avs/contracts/index.d.ts +0 -3
- package/lib/browser/avs/contracts/index.js +0 -6
- package/lib/browser/avs/types/index.d.ts +0 -55
- package/lib/browser/avs/types/index.js +0 -0
- package/lib/browser/avs/utils/contracts.d.ts +0 -21
- package/lib/browser/avs/utils/contracts.js +0 -53
- package/lib/browser/avs/utils/register.d.ts +0 -27
- package/lib/browser/avs/utils/register.js +0 -74
- package/lib/browser/avs/utils/tasks.d.ts +0 -22
- package/lib/browser/avs/utils/tasks.js +0 -48
- package/lib/browser/client/create-claim.d.ts +0 -5
- package/lib/browser/client/create-claim.js +0 -461
- package/lib/browser/client/index.d.ts +0 -3
- package/lib/browser/client/index.js +0 -3
- package/lib/browser/client/tunnels/make-rpc-tcp-tunnel.d.ts +0 -16
- package/lib/browser/client/tunnels/make-rpc-tcp-tunnel.js +0 -53
- package/lib/browser/client/tunnels/make-rpc-tls-tunnel.d.ts +0 -26
- package/lib/browser/client/tunnels/make-rpc-tls-tunnel.js +0 -127
- package/lib/browser/client/utils/attestor-pool.d.ts +0 -8
- package/lib/browser/client/utils/attestor-pool.js +0 -24
- package/lib/browser/client/utils/client-socket.d.ts +0 -11
- package/lib/browser/client/utils/client-socket.js +0 -120
- package/lib/browser/client/utils/message-handler.d.ts +0 -4
- package/lib/browser/client/utils/message-handler.js +0 -97
- package/lib/browser/config/index.d.ts +0 -31
- package/lib/browser/config/index.js +0 -62
- package/lib/browser/external-rpc/benchmark.d.ts +0 -1
- package/lib/browser/external-rpc/benchmark.js +0 -82
- package/lib/browser/external-rpc/event-bus.d.ts +0 -7
- package/lib/browser/external-rpc/event-bus.js +0 -17
- package/lib/browser/external-rpc/global.d.js +0 -0
- package/lib/browser/external-rpc/handle-incoming-msg.d.ts +0 -2
- package/lib/browser/external-rpc/handle-incoming-msg.js +0 -241
- package/lib/browser/external-rpc/index.d.ts +0 -3
- package/lib/browser/external-rpc/index.js +0 -3
- package/lib/browser/external-rpc/jsc-polyfills/1.d.ts +0 -14
- package/lib/browser/external-rpc/jsc-polyfills/1.js +0 -80
- package/lib/browser/external-rpc/jsc-polyfills/2.d.ts +0 -1
- package/lib/browser/external-rpc/jsc-polyfills/2.js +0 -15
- package/lib/browser/external-rpc/jsc-polyfills/event.d.ts +0 -10
- package/lib/browser/external-rpc/jsc-polyfills/event.js +0 -19
- package/lib/browser/external-rpc/jsc-polyfills/index.d.ts +0 -2
- package/lib/browser/external-rpc/jsc-polyfills/index.js +0 -2
- package/lib/browser/external-rpc/jsc-polyfills/ws.d.ts +0 -21
- package/lib/browser/external-rpc/jsc-polyfills/ws.js +0 -83
- package/lib/browser/external-rpc/setup-browser.d.ts +0 -6
- package/lib/browser/external-rpc/setup-browser.js +0 -33
- package/lib/browser/external-rpc/setup-jsc.d.ts +0 -24
- package/lib/browser/external-rpc/setup-jsc.js +0 -22
- package/lib/browser/external-rpc/types.d.ts +0 -213
- package/lib/browser/external-rpc/types.js +0 -0
- package/lib/browser/external-rpc/utils.d.ts +0 -20
- package/lib/browser/external-rpc/utils.js +0 -100
- package/lib/browser/external-rpc/zk.d.ts +0 -14
- package/lib/browser/external-rpc/zk.js +0 -58
- package/lib/browser/index.browser.js +0 -13
- package/lib/browser/index.d.ts +0 -9
- package/lib/browser/index.js +0 -13
- package/lib/browser/mechain/abis/governanceABI.d.ts +0 -50
- package/lib/browser/mechain/abis/governanceABI.js +0 -461
- package/lib/browser/mechain/abis/taskABI.d.ts +0 -157
- package/lib/browser/mechain/abis/taskABI.js +0 -512
- package/lib/browser/mechain/client/create-claim-on-mechain.d.ts +0 -10
- package/lib/browser/mechain/client/create-claim-on-mechain.js +0 -33
- package/lib/browser/mechain/client/index.d.ts +0 -1
- package/lib/browser/mechain/client/index.js +0 -1
- package/lib/browser/mechain/constants/index.d.ts +0 -3
- package/lib/browser/mechain/constants/index.js +0 -8
- package/lib/browser/mechain/index.d.ts +0 -2
- package/lib/browser/mechain/index.js +0 -2
- package/lib/browser/mechain/types/index.d.ts +0 -23
- package/lib/browser/mechain/types/index.js +0 -0
- package/lib/browser/proto/api.d.ts +0 -651
- package/lib/browser/proto/api.js +0 -4250
- package/lib/browser/proto/tee-bundle.d.ts +0 -156
- package/lib/browser/proto/tee-bundle.js +0 -1296
- package/lib/browser/providers/http/index.d.ts +0 -18
- package/lib/browser/providers/http/index.js +0 -640
- package/lib/browser/providers/http/patch-parse5-tree.d.ts +0 -6
- package/lib/browser/providers/http/patch-parse5-tree.js +0 -34
- package/lib/browser/providers/http/utils.d.ts +0 -77
- package/lib/browser/providers/http/utils.js +0 -283
- package/lib/browser/providers/index.d.ts +0 -4
- package/lib/browser/providers/index.js +0 -7
- package/lib/browser/scripts/fallbacks/crypto.js +0 -4
- package/lib/browser/scripts/fallbacks/empty.js +0 -4
- package/lib/browser/scripts/fallbacks/gnark.js +0 -15
- package/lib/browser/scripts/fallbacks/re2.js +0 -7
- package/lib/browser/scripts/fallbacks/snarkjs.js +0 -10
- package/lib/browser/scripts/fallbacks/zk-file-fetch.js +0 -50
- package/lib/browser/types/bgp.d.ts +0 -11
- package/lib/browser/types/bgp.js +0 -0
- package/lib/browser/types/claims.d.ts +0 -70
- package/lib/browser/types/claims.js +0 -0
- package/lib/browser/types/client.d.ts +0 -163
- package/lib/browser/types/client.js +0 -0
- package/lib/browser/types/general.d.ts +0 -77
- package/lib/browser/types/general.js +0 -0
- package/lib/browser/types/handlers.d.ts +0 -10
- package/lib/browser/types/handlers.js +0 -0
- package/lib/browser/types/index.d.ts +0 -10
- package/lib/browser/types/index.js +0 -10
- package/lib/browser/types/providers.d.ts +0 -161
- package/lib/browser/types/providers.gen.d.ts +0 -443
- package/lib/browser/types/providers.gen.js +0 -16
- package/lib/browser/types/providers.js +0 -0
- package/lib/browser/types/rpc.d.ts +0 -35
- package/lib/browser/types/rpc.js +0 -0
- package/lib/browser/types/signatures.d.ts +0 -28
- package/lib/browser/types/signatures.js +0 -0
- package/lib/browser/types/tunnel.d.ts +0 -18
- package/lib/browser/types/tunnel.js +0 -0
- package/lib/browser/types/zk.d.ts +0 -38
- package/lib/browser/types/zk.js +0 -0
- package/lib/browser/utils/auth.d.ts +0 -8
- package/lib/browser/utils/auth.js +0 -71
- package/lib/browser/utils/b64-json.d.ts +0 -2
- package/lib/browser/utils/b64-json.js +0 -17
- package/lib/browser/utils/claims.d.ts +0 -33
- package/lib/browser/utils/claims.js +0 -89
- package/lib/browser/utils/env.d.ts +0 -3
- package/lib/browser/utils/env.js +0 -19
- package/lib/browser/utils/error.d.ts +0 -26
- package/lib/browser/utils/error.js +0 -54
- package/lib/browser/utils/generics.d.ts +0 -119
- package/lib/browser/utils/generics.js +0 -272
- package/lib/browser/utils/http-parser.d.ts +0 -59
- package/lib/browser/utils/http-parser.js +0 -201
- package/lib/browser/utils/index.browser.js +0 -13
- package/lib/browser/utils/index.d.ts +0 -13
- package/lib/browser/utils/index.js +0 -13
- package/lib/browser/utils/logger.browser.js +0 -88
- package/lib/browser/utils/logger.d.ts +0 -14
- package/lib/browser/utils/logger.js +0 -88
- package/lib/browser/utils/prepare-packets.d.ts +0 -16
- package/lib/browser/utils/prepare-packets.js +0 -69
- package/lib/browser/utils/redactions.d.ts +0 -73
- package/lib/browser/utils/redactions.js +0 -135
- package/lib/browser/utils/retries.d.ts +0 -12
- package/lib/browser/utils/retries.js +0 -26
- package/lib/browser/utils/signatures/eth.d.ts +0 -2
- package/lib/browser/utils/signatures/eth.js +0 -31
- package/lib/browser/utils/signatures/index.d.ts +0 -5
- package/lib/browser/utils/signatures/index.js +0 -12
- package/lib/browser/utils/socket-base.d.ts +0 -23
- package/lib/browser/utils/socket-base.js +0 -96
- package/lib/browser/utils/tls-imports.d.ts +0 -21
- package/lib/browser/utils/tls-imports.js +0 -71
- package/lib/browser/utils/tls.d.ts +0 -2
- package/lib/browser/utils/tls.js +0 -58
- package/lib/browser/utils/ws.d.ts +0 -7
- package/lib/browser/utils/ws.js +0 -22
- package/lib/browser/utils/zk.d.ts +0 -71
- package/lib/browser/utils/zk.js +0 -623
- package/lib/external-rpc/global.d.js +0 -0
- package/lib/index.browser.d.ts +0 -9
- package/lib/scripts/fallbacks/gnark.d.ts +0 -7
- package/lib/scripts/fallbacks/gnark.js +0 -15
- package/lib/scripts/fallbacks/zk-file-fetch.d.ts +0 -24
- package/lib/scripts/fallbacks/zk-file-fetch.js +0 -50
- package/lib/utils/index.browser.d.ts +0 -13
- package/lib/utils/logger.browser.d.ts +0 -14
- package/lib/utils/tls-imports.d.ts +0 -21
- package/lib/utils/tls-imports.js +0 -71
- /package/lib/{browser/scripts → scripts}/fallbacks/stwo.js +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { createServer as createHttpServer } from "http";
|
|
2
2
|
import serveStatic from "serve-static";
|
|
3
3
|
import { WebSocketServer } from "ws";
|
|
4
|
-
import { API_SERVER_PORT, ATTESTOR_ADDRESS_PATHNAME, BROWSER_RPC_PATHNAME, WS_PATHNAME } from "
|
|
5
|
-
import { AttestorServerSocket } from "
|
|
6
|
-
import { getAttestorAddress } from "
|
|
7
|
-
import { addKeepAlive } from "
|
|
8
|
-
import { createBgpListener } from "
|
|
9
|
-
import { getEnvVariable } from "
|
|
10
|
-
import { logger as LOGGER } from "
|
|
11
|
-
import { SelectedServiceSignatureType } from "
|
|
12
|
-
import { promisifySend } from "
|
|
4
|
+
import { API_SERVER_PORT, ATTESTOR_ADDRESS_PATHNAME, BROWSER_RPC_PATHNAME, WS_PATHNAME } from "#src/config/index.js";
|
|
5
|
+
import { AttestorServerSocket } from "#src/server/socket.js";
|
|
6
|
+
import { getAttestorAddress } from "#src/server/utils/generics.js";
|
|
7
|
+
import { addKeepAlive } from "#src/server/utils/keep-alive.js";
|
|
8
|
+
import { createBgpListener } from "#src/utils/bgp-listener.js";
|
|
9
|
+
import { getEnvVariable } from "#src/utils/env.js";
|
|
10
|
+
import { logger as LOGGER } from "#src/utils/index.js";
|
|
11
|
+
import { SelectedServiceSignatureType } from "#src/utils/signatures/index.js";
|
|
12
|
+
import { promisifySend } from "#src/utils/ws.js";
|
|
13
13
|
const PORT = +(getEnvVariable("PORT") || API_SERVER_PORT);
|
|
14
14
|
const DISABLE_BGP_CHECKS = getEnvVariable("DISABLE_BGP_CHECKS") === "1";
|
|
15
15
|
const ATTESTOR_ADDRESS_JSON_RES = JSON.stringify({
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { ClaimTeeBundleResponse } from "
|
|
2
|
-
import { VerificationBundle } from "
|
|
3
|
-
import { substituteParamValues } from "
|
|
4
|
-
import { assertValidProviderTranscript } from "
|
|
5
|
-
import { getAttestorAddress, niceParseJsonObject, signAsAttestor } from "
|
|
6
|
-
import { verifyOprfMpcOutputs } from "
|
|
7
|
-
import { verifyOprfProofs } from "
|
|
8
|
-
import { reconstructTlsTranscript } from "
|
|
9
|
-
import { verifyTeeBundle } from "
|
|
10
|
-
import { AttestorError } from "
|
|
11
|
-
import { createSignDataForClaim, getIdentifierFromClaimInfo } from "
|
|
1
|
+
import { ClaimTeeBundleResponse } from "#src/proto/api.js";
|
|
2
|
+
import { VerificationBundle } from "#src/proto/tee-bundle.js";
|
|
3
|
+
import { substituteParamValues } from "#src/providers/http/index.js";
|
|
4
|
+
import { assertValidProviderTranscript } from "#src/server/utils/assert-valid-claim-request.js";
|
|
5
|
+
import { getAttestorAddress, niceParseJsonObject, signAsAttestor } from "#src/server/utils/generics.js";
|
|
6
|
+
import { verifyOprfMpcOutputs } from "#src/server/utils/tee-oprf-mpc-verification.js";
|
|
7
|
+
import { verifyOprfProofs } from "#src/server/utils/tee-oprf-verification.js";
|
|
8
|
+
import { reconstructTlsTranscript } from "#src/server/utils/tee-transcript-reconstruction.js";
|
|
9
|
+
import { verifyTeeBundle } from "#src/server/utils/tee-verification.js";
|
|
10
|
+
import { AttestorError } from "#src/utils/error.js";
|
|
11
|
+
import { createSignDataForClaim, getIdentifierFromClaimInfo } from "#src/utils/index.js";
|
|
12
12
|
const claimTeeBundle = async (teeBundleRequest, { logger, client }) => {
|
|
13
13
|
const {
|
|
14
14
|
verificationBundle,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { MAX_CLAIM_TIMESTAMP_DIFF_S } from "
|
|
2
|
-
import { ClaimTunnelResponse } from "
|
|
3
|
-
import { getApm } from "
|
|
4
|
-
import { assertTranscriptsMatch, assertValidClaimRequest } from "
|
|
5
|
-
import { getAttestorAddress, signAsAttestor } from "
|
|
6
|
-
import { AttestorError, createSignDataForClaim, getIdentifierFromClaimInfo, unixTimestampSeconds } from "
|
|
1
|
+
import { MAX_CLAIM_TIMESTAMP_DIFF_S } from "#src/config/index.js";
|
|
2
|
+
import { ClaimTunnelResponse } from "#src/proto/api.js";
|
|
3
|
+
import { getApm } from "#src/server/utils/apm.js";
|
|
4
|
+
import { assertTranscriptsMatch, assertValidClaimRequest } from "#src/server/utils/assert-valid-claim-request.js";
|
|
5
|
+
import { getAttestorAddress, signAsAttestor } from "#src/server/utils/generics.js";
|
|
6
|
+
import { AttestorError, createSignDataForClaim, getIdentifierFromClaimInfo, unixTimestampSeconds } from "#src/utils/index.js";
|
|
7
7
|
const claimTunnel = async (claimRequest, { tx, logger, client }) => {
|
|
8
8
|
const {
|
|
9
9
|
request,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EventLog } from "ethers";
|
|
2
|
-
import { getContracts } from "
|
|
3
|
-
import { getEnvVariable } from "
|
|
4
|
-
import { AttestorError, ethersStructToPlainObject } from "
|
|
2
|
+
import { getContracts } from "#src/avs/utils/contracts.js";
|
|
3
|
+
import { getEnvVariable } from "#src/utils/env.js";
|
|
4
|
+
import { AttestorError, ethersStructToPlainObject } from "#src/utils/index.js";
|
|
5
5
|
const ACCEPT_CLAIM_PAYMENT_REQUESTS = getEnvVariable("ACCEPT_CLAIM_PAYMENT_REQUESTS") === "1";
|
|
6
6
|
const completeClaimOnChain = async ({ chainId: chainIdNum, taskIndex, completedTaskJson }) => {
|
|
7
7
|
if (!ACCEPT_CLAIM_PAYMENT_REQUESTS) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getContracts } from "
|
|
2
|
-
import { createNewClaimRequestOnChain } from "
|
|
3
|
-
import { getEnvVariable } from "
|
|
4
|
-
import { AttestorError, ethersStructToPlainObject } from "
|
|
1
|
+
import { getContracts } from "#src/avs/utils/contracts.js";
|
|
2
|
+
import { createNewClaimRequestOnChain } from "#src/avs/utils/tasks.js";
|
|
3
|
+
import { getEnvVariable } from "#src/utils/env.js";
|
|
4
|
+
import { AttestorError, ethersStructToPlainObject } from "#src/utils/index.js";
|
|
5
5
|
const ACCEPT_CLAIM_PAYMENT_REQUESTS = getEnvVariable("ACCEPT_CLAIM_PAYMENT_REQUESTS") === "1";
|
|
6
6
|
const createClaimOnChain = async ({ chainId: chainIdNum, jsonCreateClaimRequest, requestSignature }) => {
|
|
7
7
|
if (!ACCEPT_CLAIM_PAYMENT_REQUESTS) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Contract, JsonRpcProvider, randomBytes, Wallet } from "ethers";
|
|
2
|
-
import { governanceABI } from "
|
|
3
|
-
import { taskABI } from "
|
|
4
|
-
import { GOVERNANCE_CONTRACT_ADDRESS, RPC_URL, TASK_CONTRACT_ADDRESS } from "
|
|
5
|
-
import { getEnvVariable } from "
|
|
2
|
+
import { governanceABI } from "#src/mechain/abis/governanceABI.js";
|
|
3
|
+
import { taskABI } from "#src/mechain/abis/taskABI.js";
|
|
4
|
+
import { GOVERNANCE_CONTRACT_ADDRESS, RPC_URL, TASK_CONTRACT_ADDRESS } from "#src/mechain/constants/index.js";
|
|
5
|
+
import { getEnvVariable } from "#src/utils/env.js";
|
|
6
6
|
const createTaskOnMechain = async ({
|
|
7
7
|
timestamp
|
|
8
8
|
}) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { makeTcpTunnel } from "
|
|
2
|
-
import { getApm } from "
|
|
3
|
-
import { resolveHostnames } from "
|
|
4
|
-
import { AttestorError } from "
|
|
1
|
+
import { makeTcpTunnel } from "#src/server/tunnels/make-tcp-tunnel.js";
|
|
2
|
+
import { getApm } from "#src/server/utils/apm.js";
|
|
3
|
+
import { resolveHostnames } from "#src/server/utils/dns.js";
|
|
4
|
+
import { AttestorError } from "#src/utils/index.js";
|
|
5
5
|
const createTunnel = async ({ id, ...opts }, { tx, logger, client }) => {
|
|
6
6
|
if (client.tunnels[id]) {
|
|
7
7
|
throw AttestorError.badRequest(`Tunnel "${id}" already exists`);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { concatenateUint8Arrays, loadX509FromPem } from "@reclaimprotocol/tls";
|
|
2
|
-
import { CERT_ALLOWED_MIMETYPES, MAX_CERT_SIZE_BYTES } from "
|
|
3
|
-
import { AttestorError } from "
|
|
2
|
+
import { CERT_ALLOWED_MIMETYPES, MAX_CERT_SIZE_BYTES } from "#src/config/index.js";
|
|
3
|
+
import { AttestorError } from "#src/utils/error.js";
|
|
4
4
|
const fetchCertificateBytes = async ({ url }) => {
|
|
5
5
|
const res = await fetch(url, {
|
|
6
6
|
redirect: "follow",
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { claimTeeBundle } from "
|
|
2
|
-
import { claimTunnel } from "
|
|
3
|
-
import { completeClaimOnChain } from "
|
|
4
|
-
import { createClaimOnChain } from "
|
|
5
|
-
import { createTaskOnMechain } from "
|
|
6
|
-
import { createTunnel } from "
|
|
7
|
-
import { disconnectTunnel } from "
|
|
8
|
-
import { fetchCertificateBytes } from "
|
|
9
|
-
import { init } from "
|
|
10
|
-
import { toprf } from "
|
|
1
|
+
import { claimTeeBundle } from "#src/server/handlers/claimTeeBundle.js";
|
|
2
|
+
import { claimTunnel } from "#src/server/handlers/claimTunnel.js";
|
|
3
|
+
import { completeClaimOnChain } from "#src/server/handlers/completeClaimOnChain.js";
|
|
4
|
+
import { createClaimOnChain } from "#src/server/handlers/createClaimOnChain.js";
|
|
5
|
+
import { createTaskOnMechain } from "#src/server/handlers/createTaskOnMechain.js";
|
|
6
|
+
import { createTunnel } from "#src/server/handlers/createTunnel.js";
|
|
7
|
+
import { disconnectTunnel } from "#src/server/handlers/disconnectTunnel.js";
|
|
8
|
+
import { fetchCertificateBytes } from "#src/server/handlers/fetchCertificateBytes.js";
|
|
9
|
+
import { init } from "#src/server/handlers/init.js";
|
|
10
|
+
import { toprf } from "#src/server/handlers/toprf.js";
|
|
11
11
|
const HANDLERS = {
|
|
12
12
|
createTunnel,
|
|
13
13
|
disconnectTunnel,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { getBytes } from "ethers";
|
|
2
|
-
import { getAttestorAddress } from "
|
|
3
|
-
import { assertValidAuthRequest } from "
|
|
4
|
-
import { getEnvVariable } from "
|
|
5
|
-
import { AttestorError } from "
|
|
6
|
-
import { SIGNATURES } from "
|
|
2
|
+
import { getAttestorAddress } from "#src/server/utils/generics.js";
|
|
3
|
+
import { assertValidAuthRequest } from "#src/utils/auth.js";
|
|
4
|
+
import { getEnvVariable } from "#src/utils/env.js";
|
|
5
|
+
import { AttestorError } from "#src/utils/index.js";
|
|
6
|
+
import { SIGNATURES } from "#src/utils/signatures/index.js";
|
|
7
7
|
const TOPRF_PUBLIC_KEY = getEnvVariable("TOPRF_PUBLIC_KEY");
|
|
8
8
|
const init = async (initRequest, { client }) => {
|
|
9
9
|
if (client.isInitialised) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getBytes } from "ethers";
|
|
2
|
-
import { getEnvVariable } from "
|
|
3
|
-
import { getEngineString, makeDefaultOPRFOperator } from "
|
|
2
|
+
import { getEnvVariable } from "#src/utils/env.js";
|
|
3
|
+
import { getEngineString, makeDefaultOPRFOperator } from "#src/utils/index.js";
|
|
4
4
|
const toprf = async ({ maskedData, engine }, { logger }) => {
|
|
5
5
|
const PRIVATE_KEY_STR = getEnvVariable("TOPRF_SHARE_PRIVATE_KEY");
|
|
6
6
|
const PUBLIC_KEY_STR = getEnvVariable("TOPRF_SHARE_PUBLIC_KEY");
|
package/lib/server/socket.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { promisify } from "util";
|
|
2
|
-
import { handleMessage } from "
|
|
3
|
-
import { DEFAULT_RPC_TIMEOUT_MS } from "
|
|
4
|
-
import { HANDLERS } from "
|
|
5
|
-
import { getApm } from "
|
|
6
|
-
import { getInitialMessagesFromQuery } from "
|
|
7
|
-
import { AttestorError, generateSessionId } from "
|
|
8
|
-
import { AttestorSocket } from "
|
|
2
|
+
import { handleMessage } from "#src/client/utils/message-handler.js";
|
|
3
|
+
import { DEFAULT_RPC_TIMEOUT_MS } from "#src/config/index.js";
|
|
4
|
+
import { HANDLERS } from "#src/server/handlers/index.js";
|
|
5
|
+
import { getApm } from "#src/server/utils/apm.js";
|
|
6
|
+
import { getInitialMessagesFromQuery } from "#src/server/utils/generics.js";
|
|
7
|
+
import { AttestorError, generateSessionId } from "#src/utils/index.js";
|
|
8
|
+
import { AttestorSocket } from "#src/utils/socket-base.js";
|
|
9
9
|
class AttestorServerSocket extends AttestorSocket {
|
|
10
10
|
tunnels = {};
|
|
11
11
|
sessionId;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { HttpsProxyAgent } from "https-proxy-agent";
|
|
2
2
|
import { Socket } from "net";
|
|
3
|
-
import { CONNECTION_TIMEOUT_MS } from "
|
|
4
|
-
import { resolveHostnames } from "
|
|
5
|
-
import { isValidCountryCode } from "
|
|
6
|
-
import { isValidProxySessionId } from "
|
|
7
|
-
import { getEnvVariable } from "
|
|
8
|
-
import { AttestorError } from "
|
|
3
|
+
import { CONNECTION_TIMEOUT_MS } from "#src/config/index.js";
|
|
4
|
+
import { resolveHostnames } from "#src/server/utils/dns.js";
|
|
5
|
+
import { isValidCountryCode } from "#src/server/utils/iso.js";
|
|
6
|
+
import { isValidProxySessionId } from "#src/server/utils/proxy-session.js";
|
|
7
|
+
import { getEnvVariable } from "#src/utils/env.js";
|
|
8
|
+
import { AttestorError } from "#src/utils/index.js";
|
|
9
9
|
const HTTPS_PROXY_URL = getEnvVariable("HTTPS_PROXY_URL");
|
|
10
10
|
const makeTcpTunnel = async ({
|
|
11
11
|
onClose,
|
package/lib/server/utils/apm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ElasticAPM from "elastic-apm-node";
|
|
2
|
-
import { getEnvVariable } from "
|
|
3
|
-
import { logger } from "
|
|
2
|
+
import { getEnvVariable } from "#src/utils/env.js";
|
|
3
|
+
import { logger } from "#src/utils/logger.js";
|
|
4
4
|
let apm;
|
|
5
5
|
function getApm() {
|
|
6
6
|
if (!getEnvVariable("ELASTIC_APM_SERVER_URL") || !getEnvVariable("ELASTIC_APM_SECRET_TOKEN")) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { areUint8ArraysEqual, concatenateUint8Arrays } from "@reclaimprotocol/tls";
|
|
2
|
-
import { ClaimTunnelRequest, TranscriptMessageSenderType } from "
|
|
3
|
-
import { providers } from "
|
|
4
|
-
import { niceParseJsonObject } from "
|
|
5
|
-
import { computeOPRFRaw } from "
|
|
6
|
-
import { processHandshake } from "
|
|
7
|
-
import { assertValidateProviderParams } from "
|
|
2
|
+
import { ClaimTunnelRequest, TranscriptMessageSenderType } from "#src/proto/api.js";
|
|
3
|
+
import { providers } from "#src/providers/index.js";
|
|
4
|
+
import { niceParseJsonObject } from "#src/server/utils/generics.js";
|
|
5
|
+
import { computeOPRFRaw } from "#src/server/utils/oprf-raw.js";
|
|
6
|
+
import { processHandshake } from "#src/server/utils/process-handshake.js";
|
|
7
|
+
import { assertValidateProviderParams } from "#src/server/utils/validation.js";
|
|
8
8
|
import {
|
|
9
9
|
AttestorError,
|
|
10
10
|
binaryHashToStr,
|
|
@@ -14,8 +14,8 @@ import {
|
|
|
14
14
|
hashProviderParams,
|
|
15
15
|
SIGNATURES,
|
|
16
16
|
verifyZkPacket
|
|
17
|
-
} from "
|
|
18
|
-
import { getEngineString } from "
|
|
17
|
+
} from "#src/utils/index.js";
|
|
18
|
+
import { getEngineString } from "#src/utils/zk.js";
|
|
19
19
|
async function assertValidClaimRequest(request, metadata, logger) {
|
|
20
20
|
const {
|
|
21
21
|
data,
|
package/lib/server/utils/dns.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { RPCMessages } from "
|
|
2
|
-
import { getEnvVariable } from "
|
|
3
|
-
import { AttestorError, strToUint8Array } from "
|
|
4
|
-
import { SIGNATURES } from "
|
|
1
|
+
import { RPCMessages } from "#src/proto/api.js";
|
|
2
|
+
import { getEnvVariable } from "#src/utils/env.js";
|
|
3
|
+
import { AttestorError, strToUint8Array } from "#src/utils/index.js";
|
|
4
|
+
import { SIGNATURES } from "#src/utils/signatures/index.js";
|
|
5
5
|
const PRIVATE_KEY = getEnvVariable("PRIVATE_KEY");
|
|
6
6
|
function signAsAttestor(data, scheme) {
|
|
7
7
|
const { sign } = SIGNATURES[scheme];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getBytes } from "ethers";
|
|
2
|
-
import { TOPRF_DOMAIN_SEPARATOR } from "
|
|
3
|
-
import { getEnvVariable } from "
|
|
4
|
-
import { makeDefaultOPRFOperator } from "
|
|
2
|
+
import { TOPRF_DOMAIN_SEPARATOR } from "#src/config/index.js";
|
|
3
|
+
import { getEnvVariable } from "#src/utils/env.js";
|
|
4
|
+
import { makeDefaultOPRFOperator } from "#src/utils/zk.js";
|
|
5
5
|
async function computeOPRFRaw(plaintext, markers, logger) {
|
|
6
6
|
if (!markers.length) {
|
|
7
7
|
return [];
|
|
@@ -13,8 +13,8 @@ import {
|
|
|
13
13
|
verifyCertificateChain,
|
|
14
14
|
verifyCertificateSignature
|
|
15
15
|
} from "@reclaimprotocol/tls";
|
|
16
|
-
import { TranscriptMessageSenderType } from "
|
|
17
|
-
import { decryptDirect } from "
|
|
16
|
+
import { TranscriptMessageSenderType } from "#src/proto/api.js";
|
|
17
|
+
import { decryptDirect } from "#src/utils/index.js";
|
|
18
18
|
const RECORD_LENGTH_BYTES = 3;
|
|
19
19
|
async function processHandshake(receipt, logger) {
|
|
20
20
|
const certificates = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare function isValidProxySessionId(sessionId: string): boolean;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
function isValidProxySessionId(sessionId) {
|
|
2
|
+
return typeof sessionId === "string" && sessionId.length >= 8 && sessionId.length < 15 && /^[a-z0-9]+$/.test(sessionId);
|
|
3
|
+
}
|
|
2
4
|
export {
|
|
3
5
|
isValidProxySessionId
|
|
4
6
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import bs58 from "bs58";
|
|
2
|
-
import { AttestorError } from "
|
|
3
|
-
import { makeDefaultOPRFOperator } from "
|
|
2
|
+
import { AttestorError } from "#src/utils/error.js";
|
|
3
|
+
import { makeDefaultOPRFOperator } from "#src/utils/zk.js";
|
|
4
4
|
async function verifyOprfProofs(bundleData, logger) {
|
|
5
5
|
if (!bundleData.oprfVerifications || bundleData.oprfVerifications.length === 0) {
|
|
6
6
|
logger.debug("No OPRF verifications present in bundle");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AttestorError } from "
|
|
2
|
-
import { REDACTION_CHAR_CODE } from "
|
|
1
|
+
import { AttestorError } from "#src/utils/error.js";
|
|
2
|
+
import { REDACTION_CHAR_CODE } from "#src/utils/index.js";
|
|
3
3
|
async function reconstructTlsTranscript(bundleData, logger, oprfResults) {
|
|
4
4
|
try {
|
|
5
5
|
const revealedRequest = reconstructRequest(bundleData, logger);
|
|
@@ -64,7 +64,7 @@ async function reconstructConsolidatedResponse(bundleData, logger, oprfResults)
|
|
|
64
64
|
let processedResponse = applyResponseRedactionRanges(reconstructedResponse, kOutputPayload.responseRedactionRanges, logger);
|
|
65
65
|
if (oprfResults && oprfResults.length > 0) {
|
|
66
66
|
logger.info(`Applying ${oprfResults.length} OPRF replacements before trimming`);
|
|
67
|
-
const { replaceOprfRanges } = await import("
|
|
67
|
+
const { replaceOprfRanges } = await import("#src/server/utils/tee-oprf-verification.js");
|
|
68
68
|
processedResponse = replaceOprfRanges(processedResponse, oprfResults, logger);
|
|
69
69
|
}
|
|
70
70
|
let leadingAsterisks = 0;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ServiceSignatureType } from "
|
|
2
|
-
import { BodyType, KOutputPayload, TOutputPayload, VerificationBundle } from "
|
|
3
|
-
import { validateGcpAttestationAndExtractKey } from "
|
|
4
|
-
import { validateNitroAttestationAndExtractKey } from "
|
|
5
|
-
import { AttestorError } from "
|
|
6
|
-
import { SIGNATURES } from "
|
|
1
|
+
import { ServiceSignatureType } from "#src/proto/api.js";
|
|
2
|
+
import { BodyType, KOutputPayload, TOutputPayload, VerificationBundle } from "#src/proto/tee-bundle.js";
|
|
3
|
+
import { validateGcpAttestationAndExtractKey } from "#src/server/utils/gcp-attestation.js";
|
|
4
|
+
import { validateNitroAttestationAndExtractKey } from "#src/server/utils/nitro-attestation.js";
|
|
5
|
+
import { AttestorError } from "#src/utils/error.js";
|
|
6
|
+
import { SIGNATURES } from "#src/utils/signatures/index.js";
|
|
7
7
|
async function verifyTeeBundle(bundleBytes, logger) {
|
|
8
8
|
const bundle = parseVerificationBundle(bundleBytes);
|
|
9
9
|
validateBundleCompleteness(bundle);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Ajv } from "ajv";
|
|
2
|
-
import { PROVIDER_SCHEMAS } from "
|
|
3
|
-
import { AttestorError } from "
|
|
2
|
+
import { PROVIDER_SCHEMAS } from "#src/types/providers.gen.js";
|
|
3
|
+
import { AttestorError } from "#src/utils/error.js";
|
|
4
4
|
const PROVIDER_VALIDATOR_MAP = {};
|
|
5
5
|
const AJV = new Ajv({
|
|
6
6
|
allErrors: true,
|
package/lib/types/general.d.ts
CHANGED
package/lib/utils/auth.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { getBytes } from "ethers";
|
|
2
|
-
import { DEFAULT_AUTH_EXPIRY_S } from "
|
|
3
|
-
import { AuthenticatedUserData } from "
|
|
4
|
-
import { getEnvVariable } from "
|
|
5
|
-
import { AttestorError } from "
|
|
6
|
-
import { unixTimestampSeconds } from "
|
|
7
|
-
import { SelectedServiceSignature, SIGNATURES } from "
|
|
2
|
+
import { DEFAULT_AUTH_EXPIRY_S } from "#src/config/index.js";
|
|
3
|
+
import { AuthenticatedUserData } from "#src/proto/api.js";
|
|
4
|
+
import { getEnvVariable } from "#src/utils/env.js";
|
|
5
|
+
import { AttestorError } from "#src/utils/error.js";
|
|
6
|
+
import { unixTimestampSeconds } from "#src/utils/generics.js";
|
|
7
|
+
import { SelectedServiceSignature, SIGNATURES } from "#src/utils/signatures/index.js";
|
|
8
8
|
async function assertValidAuthRequest(request, signatureType) {
|
|
9
9
|
const publicKey = getEnvVariable("AUTHENTICATION_PUBLIC_KEY");
|
|
10
10
|
if (!request) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import CIDR from "ip-cidr";
|
|
2
|
-
import { BGP_WS_URL } from "
|
|
3
|
-
import { makeWebSocket } from "
|
|
2
|
+
import { BGP_WS_URL } from "#src/config/index.js";
|
|
3
|
+
import { makeWebSocket } from "#src/utils/ws.js";
|
|
4
4
|
const ANNOUNCEMENT_OVERLAP = "announcement-overlap";
|
|
5
5
|
class BGPAnnouncementOverlapEvent extends Event {
|
|
6
6
|
data;
|
package/lib/utils/claims.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import canonicalize from "canonicalize";
|
|
2
2
|
import { keccak256 } from "ethers";
|
|
3
|
-
import { DEFAULT_METADATA } from "
|
|
4
|
-
import { ClaimTunnelResponse } from "
|
|
5
|
-
import { SIGNATURES, strToUint8Array } from "
|
|
3
|
+
import { DEFAULT_METADATA } from "#src/config/index.js";
|
|
4
|
+
import { ClaimTunnelResponse } from "#src/proto/api.js";
|
|
5
|
+
import { SIGNATURES, strToUint8Array } from "#src/utils/index.js";
|
|
6
6
|
function createSignDataForClaim(data) {
|
|
7
7
|
const lines = [
|
|
8
8
|
getIdentifierFromClaimInfo(data),
|
package/lib/utils/error.js
CHANGED
package/lib/utils/generics.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CipherSuite, TLSProtocolVersion } from '@reclaimprotocol/tls';
|
|
2
|
-
import { uint8ArrayToBinaryStr } from '
|
|
2
|
+
import { uint8ArrayToBinaryStr } from '@reclaimprotocol/tls';
|
|
3
3
|
import { RPCMessage, RPCMessages } from '#src/proto/api.ts';
|
|
4
4
|
import type { CompleteTLSPacket, IDecryptedTranscript, IDecryptedTranscriptMessage, ProviderField, RPCEvent, RPCEventMap, RPCEventType, RPCType, Transcript } from '#src/types/index.ts';
|
|
5
5
|
export { uint8ArrayToBinaryStr };
|
|
@@ -112,8 +112,3 @@ export declare function packRpcMessages(...msgs: Partial<RPCMessage>[]): RPCMess
|
|
|
112
112
|
*/
|
|
113
113
|
export declare function ethersStructToPlainObject<T>(struct: T): T;
|
|
114
114
|
export declare function isTls13Suite(suite: CipherSuite): suite is "TLS_CHACHA20_POLY1305_SHA256" | "TLS_AES_256_GCM_SHA384" | "TLS_AES_128_GCM_SHA256";
|
|
115
|
-
/**
|
|
116
|
-
* Validates a proxy session ID format.
|
|
117
|
-
* Must be 8-14 lowercase alphanumeric characters.
|
|
118
|
-
*/
|
|
119
|
-
export declare function isValidProxySessionId(sessionId: string): boolean;
|
package/lib/utils/generics.js
CHANGED
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
SUPPORTED_CIPHER_SUITE_MAP,
|
|
8
8
|
uint8ArrayToBinaryStr,
|
|
9
9
|
uint8ArrayToDataView
|
|
10
|
-
} from "
|
|
10
|
+
} from "@reclaimprotocol/tls";
|
|
11
11
|
import { REDACTION_CHAR_CODE } from "@reclaimprotocol/zk-symmetric-crypto";
|
|
12
|
-
import { RPCMessage, RPCMessages } from "
|
|
12
|
+
import { RPCMessage, RPCMessages } from "#src/proto/api.js";
|
|
13
13
|
const DEFAULT_REDACTION_DATA = new Uint8Array(4).fill(REDACTION_CHAR_CODE);
|
|
14
14
|
function uint8ArrayToStr(arr) {
|
|
15
15
|
return new TextDecoder().decode(arr);
|
|
@@ -238,9 +238,6 @@ function ethersStructToPlainObject(struct) {
|
|
|
238
238
|
function isTls13Suite(suite) {
|
|
239
239
|
return suite === "TLS_AES_128_GCM_SHA256" || suite === "TLS_AES_256_GCM_SHA384" || suite === "TLS_CHACHA20_POLY1305_SHA256";
|
|
240
240
|
}
|
|
241
|
-
function isValidProxySessionId(sessionId) {
|
|
242
|
-
return typeof sessionId === "string" && sessionId.length >= 8 && sessionId.length < 15 && /^[a-z0-9]+$/.test(sessionId);
|
|
243
|
-
}
|
|
244
241
|
export {
|
|
245
242
|
decryptDirect,
|
|
246
243
|
ethersStructToPlainObject,
|
|
@@ -262,7 +259,6 @@ export {
|
|
|
262
259
|
getZkAlgorithmForCipherSuite,
|
|
263
260
|
isApplicationData,
|
|
264
261
|
isTls13Suite,
|
|
265
|
-
isValidProxySessionId,
|
|
266
262
|
makeRpcEvent,
|
|
267
263
|
packRpcMessages,
|
|
268
264
|
strToUint8Array,
|
package/lib/utils/http-parser.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { asciiToUint8Array, concatenateUint8Arrays } from "
|
|
2
|
-
import { findIndexInUint8Array, uint8ArrayToStr } from "
|
|
3
|
-
import { REDACTION_CHAR_CODE } from "
|
|
1
|
+
import { asciiToUint8Array, concatenateUint8Arrays } from "@reclaimprotocol/tls";
|
|
2
|
+
import { findIndexInUint8Array, uint8ArrayToStr } from "#src/utils/generics.js";
|
|
3
|
+
import { REDACTION_CHAR_CODE } from "#src/utils/redactions.js";
|
|
4
4
|
const HTTP_HEADER_LINE_END = asciiToUint8Array("\r\n");
|
|
5
5
|
function makeHttpResponseParser() {
|
|
6
6
|
const res = {
|
package/lib/utils/index.d.ts
CHANGED
package/lib/utils/index.js
CHANGED
package/lib/utils/logger.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { pino, stdTimeFunctions } from "pino";
|
|
2
|
-
import { getEnvVariable } from "
|
|
2
|
+
import { getEnvVariable } from "#src/utils/env.js";
|
|
3
3
|
const PII_PROPERTIES = ["ownerPrivateKey", "secretParams"];
|
|
4
4
|
const redactedText = "[REDACTED]";
|
|
5
5
|
const envLevel = getEnvVariable("LOG_LEVEL");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { concatenateUint8Arrays, crypto } from "
|
|
1
|
+
import { concatenateUint8Arrays, crypto } from "@reclaimprotocol/tls";
|
|
2
2
|
import {
|
|
3
3
|
TranscriptMessageSenderType
|
|
4
|
-
} from "
|
|
5
|
-
import { makeZkProofGenerator } from "
|
|
4
|
+
} from "#src/proto/api.js";
|
|
5
|
+
import { makeZkProofGenerator } from "#src/utils/zk.js";
|
|
6
6
|
async function preparePacketsForReveal(tlsTranscript, reveals, { onZkProgress, ...opts }) {
|
|
7
7
|
const transcript = [];
|
|
8
8
|
const proofGenerator = await makeZkProofGenerator(opts);
|
package/lib/utils/redactions.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { base64Encode } from "@bufbuild/protobuf/wire";
|
|
2
|
-
import { concatenateUint8Arrays } from "
|
|
2
|
+
import { concatenateUint8Arrays } from "@reclaimprotocol/tls";
|
|
3
3
|
const REDACTION_CHAR = "*";
|
|
4
4
|
const REDACTION_CHAR_CODE = REDACTION_CHAR.charCodeAt(0);
|
|
5
5
|
function isRedactionCongruent(redacted, original) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ServiceSignatureType } from "
|
|
2
|
-
import { ETH_SIGNATURE_PROVIDER } from "
|
|
1
|
+
import { ServiceSignatureType } from "#src/proto/api.js";
|
|
2
|
+
import { ETH_SIGNATURE_PROVIDER } from "#src/utils/signatures/eth.js";
|
|
3
3
|
const SIGNATURES = {
|
|
4
4
|
[ServiceSignatureType.SERVICE_SIGNATURE_TYPE_ETH]: ETH_SIGNATURE_PROVIDER
|
|
5
5
|
};
|
package/lib/utils/socket-base.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { wsMessageHandler } from "
|
|
2
|
-
import { RPCMessages } from "
|
|
3
|
-
import { AttestorError, makeRpcEvent, packRpcMessages } from "
|
|
1
|
+
import { wsMessageHandler } from "#src/client/utils/message-handler.js";
|
|
2
|
+
import { RPCMessages } from "#src/proto/api.js";
|
|
3
|
+
import { AttestorError, makeRpcEvent, packRpcMessages } from "#src/utils/index.js";
|
|
4
4
|
class AttestorSocket {
|
|
5
5
|
eventTarget = new EventTarget();
|
|
6
6
|
socket;
|
package/lib/utils/tls.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SUPPORTED_NAMED_CURVES } from "
|
|
2
|
-
import { detectEnvironment } from "
|
|
1
|
+
import { SUPPORTED_NAMED_CURVES } from "@reclaimprotocol/tls";
|
|
2
|
+
import { detectEnvironment } from "#src/utils/env.js";
|
|
3
3
|
const ZK_CIPHER_SUITES = [
|
|
4
4
|
// chacha-20
|
|
5
5
|
"TLS_CHACHA20_POLY1305_SHA256",
|