@reclaimprotocol/attestor-core 5.0.1-beta.3 → 5.0.1-beta.5
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/browser/avs/client/create-claim-on-avs.js +5 -5
- package/lib/browser/avs/config.js +1 -1
- package/lib/browser/avs/utils/contracts.js +5 -5
- package/lib/browser/avs/utils/register.js +3 -3
- package/lib/browser/avs/utils/tasks.js +1 -1
- package/lib/browser/client/create-claim.js +9 -9
- package/lib/browser/client/tunnels/make-rpc-tcp-tunnel.js +1 -1
- package/lib/browser/client/tunnels/make-rpc-tls-tunnel.js +3 -3
- package/lib/browser/client/utils/attestor-pool.js +1 -1
- package/lib/browser/client/utils/client-socket.js +5 -5
- package/lib/browser/client/utils/message-handler.js +2 -2
- package/lib/browser/config/index.js +1 -1
- package/lib/browser/external-rpc/benchmark.js +3 -3
- package/lib/browser/external-rpc/handle-incoming-msg.js +9 -9
- package/lib/browser/external-rpc/jsc-polyfills/2.js +2 -2
- package/lib/browser/external-rpc/jsc-polyfills/index.js +2 -2
- package/lib/browser/external-rpc/jsc-polyfills/ws.js +1 -1
- package/lib/browser/external-rpc/setup-browser.js +4 -4
- package/lib/browser/external-rpc/setup-jsc.js +3 -3
- package/lib/browser/external-rpc/utils.js +4 -4
- package/lib/browser/external-rpc/zk.js +2 -2
- package/lib/browser/mechain/client/create-claim-on-mechain.js +2 -2
- package/lib/browser/providers/http/index.js +5 -5
- package/lib/browser/providers/http/utils.js +2 -2
- package/lib/browser/providers/index.js +1 -1
- package/lib/browser/utils/auth.js +6 -6
- package/lib/browser/utils/claims.js +3 -3
- package/lib/browser/utils/error.js +1 -1
- package/lib/browser/utils/generics.js +1 -1
- package/lib/browser/utils/http-parser.js +2 -2
- package/lib/browser/utils/logger.browser.js +1 -1
- package/lib/browser/utils/logger.js +1 -1
- package/lib/browser/utils/prepare-packets.js +2 -2
- package/lib/browser/utils/signatures/index.js +2 -2
- package/lib/browser/utils/socket-base.js +3 -3
- package/lib/browser/utils/tls.js +1 -1
- package/lib/browser/utils/zk.js +7 -7
- package/package.json +5 -17
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { EventLog, hexlify, Wallet } from "ethers";
|
|
2
|
-
import { CHAIN_CONFIGS, SELECTED_CHAIN_ID } from "
|
|
3
|
-
import { initialiseContracts } from "
|
|
4
|
-
import { createNewClaimRequestOnChain, signClaimRequest } from "
|
|
5
|
-
import { createClaimOnAttestor as _createClaimOnAttestor, getAttestorClientFromPool } from "
|
|
6
|
-
import { AttestorError, canonicalStringify, getIdentifierFromClaimInfo, logger as LOGGER, unixTimestampSeconds } from "
|
|
2
|
+
import { CHAIN_CONFIGS, SELECTED_CHAIN_ID } from "../../avs/config.js";
|
|
3
|
+
import { initialiseContracts } from "../../avs/utils/contracts.js";
|
|
4
|
+
import { createNewClaimRequestOnChain, signClaimRequest } from "../../avs/utils/tasks.js";
|
|
5
|
+
import { createClaimOnAttestor as _createClaimOnAttestor, getAttestorClientFromPool } from "../../client/index.js";
|
|
6
|
+
import { AttestorError, canonicalStringify, getIdentifierFromClaimInfo, logger as LOGGER, unixTimestampSeconds } from "../../utils/index.js";
|
|
7
7
|
const EMPTY_CLAIM_USER_ID = hexlify(new Uint8Array(32));
|
|
8
8
|
async function createClaimOnAvs({
|
|
9
9
|
onStep,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Contract, JsonRpcProvider, Wallet } from "ethers";
|
|
2
|
-
import { avsDirectoryABI } from "
|
|
3
|
-
import { delegationABI } from "
|
|
4
|
-
import { registryABI } from "
|
|
5
|
-
import { CHAIN_CONFIGS, PRIVATE_KEY, SELECTED_CHAIN_ID } from "
|
|
6
|
-
import { ReclaimServiceManager__factory } from "
|
|
2
|
+
import { avsDirectoryABI } from "../../avs/abis/avsDirectoryABI.js";
|
|
3
|
+
import { delegationABI } from "../../avs/abis/delegationABI.js";
|
|
4
|
+
import { registryABI } from "../../avs/abis/registryABI.js";
|
|
5
|
+
import { CHAIN_CONFIGS, PRIVATE_KEY, SELECTED_CHAIN_ID } from "../../avs/config.js";
|
|
6
|
+
import { ReclaimServiceManager__factory } from "../../avs/contracts/index.js";
|
|
7
7
|
const configs = {};
|
|
8
8
|
function getContracts(chainId = SELECTED_CHAIN_ID) {
|
|
9
9
|
const config = CHAIN_CONFIGS[chainId];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { hexlify, randomBytes, SigningKey } from "ethers";
|
|
2
|
-
import { RECLAIM_PUBLIC_URL, SELECTED_CHAIN_ID } from "
|
|
3
|
-
import { getContracts } from "
|
|
4
|
-
import { logger as LOGGER } from "
|
|
2
|
+
import { RECLAIM_PUBLIC_URL, SELECTED_CHAIN_ID } from "../../avs/config.js";
|
|
3
|
+
import { getContracts } from "../../avs/utils/contracts.js";
|
|
4
|
+
import { logger as LOGGER } from "../../utils/index.js";
|
|
5
5
|
async function registerOperator({
|
|
6
6
|
logger = LOGGER,
|
|
7
7
|
chainId = SELECTED_CHAIN_ID,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { asciiToUint8Array } from "@reclaimprotocol/tls";
|
|
2
|
-
import { makeRpcTlsTunnel } from "
|
|
3
|
-
import { getAttestorClientFromPool } from "
|
|
4
|
-
import { DEFAULT_HTTPS_PORT, PROVIDER_CTX, TOPRF_DOMAIN_SEPARATOR } from "
|
|
5
|
-
import { ClaimTunnelRequest } from "
|
|
6
|
-
import { providers } from "
|
|
2
|
+
import { makeRpcTlsTunnel } from "../client/tunnels/make-rpc-tls-tunnel.js";
|
|
3
|
+
import { getAttestorClientFromPool } from "../client/utils/attestor-pool.js";
|
|
4
|
+
import { DEFAULT_HTTPS_PORT, PROVIDER_CTX, TOPRF_DOMAIN_SEPARATOR } from "../config/index.js";
|
|
5
|
+
import { ClaimTunnelRequest } from "../proto/api.js";
|
|
6
|
+
import { providers } from "../providers/index.js";
|
|
7
7
|
import {
|
|
8
8
|
AttestorError,
|
|
9
9
|
binaryHashToStr,
|
|
@@ -20,10 +20,10 @@ import {
|
|
|
20
20
|
redactSlices,
|
|
21
21
|
uint8ArrayToStr,
|
|
22
22
|
unixTimestampSeconds
|
|
23
|
-
} from "
|
|
24
|
-
import { executeWithRetries } from "
|
|
25
|
-
import { SIGNATURES } from "
|
|
26
|
-
import { getDefaultTlsOptions } from "
|
|
23
|
+
} from "../utils/index.js";
|
|
24
|
+
import { executeWithRetries } from "../utils/retries.js";
|
|
25
|
+
import { SIGNATURES } from "../utils/signatures/index.js";
|
|
26
|
+
import { getDefaultTlsOptions } from "../utils/tls.js";
|
|
27
27
|
function createClaimOnAttestor({
|
|
28
28
|
logger: _logger,
|
|
29
29
|
maxRetries = 3,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { concatenateUint8Arrays, makeTLSClient } from "@reclaimprotocol/tls";
|
|
2
|
-
import { makeRpcTcpTunnel } from "
|
|
3
|
-
import { DEFAULT_HTTPS_PORT } from "
|
|
4
|
-
import { generateRpcMessageId, generateTunnelId } from "
|
|
2
|
+
import { makeRpcTcpTunnel } from "../../client/tunnels/make-rpc-tcp-tunnel.js";
|
|
3
|
+
import { DEFAULT_HTTPS_PORT } from "../../config/index.js";
|
|
4
|
+
import { generateRpcMessageId, generateTunnelId } from "../../utils/index.js";
|
|
5
5
|
const makeRpcTlsTunnel = async ({
|
|
6
6
|
onMessage,
|
|
7
7
|
onClose,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { encodeBase64 } from "ethers";
|
|
2
|
-
import { DEFAULT_METADATA, DEFAULT_RPC_TIMEOUT_MS } from "
|
|
3
|
-
import { RPCMessages } from "
|
|
4
|
-
import { AttestorError, generateRpcMessageId, getRpcRequestType, logger as LOGGER, packRpcMessages } from "
|
|
5
|
-
import { AttestorSocket } from "
|
|
6
|
-
import { makeWebSocket as defaultMakeWebSocket } from "
|
|
2
|
+
import { DEFAULT_METADATA, DEFAULT_RPC_TIMEOUT_MS } from "../../config/index.js";
|
|
3
|
+
import { RPCMessages } from "../../proto/api.js";
|
|
4
|
+
import { AttestorError, generateRpcMessageId, getRpcRequestType, logger as LOGGER, packRpcMessages } from "../../utils/index.js";
|
|
5
|
+
import { AttestorSocket } from "../../utils/socket-base.js";
|
|
6
|
+
import { makeWebSocket as defaultMakeWebSocket } from "../../utils/ws.js";
|
|
7
7
|
class AttestorClient extends AttestorSocket {
|
|
8
8
|
waitForInitPromise;
|
|
9
9
|
initResponse;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RPCMessages } from "
|
|
2
|
-
import { AttestorError, extractArrayBufferFromWsData, getRpcRequest, getRpcRequestType, getRpcResponseType } from "
|
|
1
|
+
import { RPCMessages } from "../../proto/api.js";
|
|
2
|
+
import { AttestorError, extractArrayBufferFromWsData, getRpcRequest, getRpcRequestType, getRpcResponseType } from "../../utils/index.js";
|
|
3
3
|
async function wsMessageHandler(data) {
|
|
4
4
|
const buff = await extractArrayBufferFromWsData(data);
|
|
5
5
|
const { messages } = RPCMessages.decode(buff);
|
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
encryptWrappedRecord,
|
|
4
4
|
SUPPORTED_CIPHER_SUITE_MAP
|
|
5
5
|
} from "@reclaimprotocol/tls";
|
|
6
|
-
import { strToUint8Array } from "
|
|
7
|
-
import { logger } from "
|
|
8
|
-
import { makeZkProofGenerator } from "
|
|
6
|
+
import { strToUint8Array } from "../utils/generics.js";
|
|
7
|
+
import { logger } from "../utils/logger.js";
|
|
8
|
+
import { makeZkProofGenerator } from "../utils/zk.js";
|
|
9
9
|
const ZK_CIPHER_SUITES = [
|
|
10
10
|
"TLS_CHACHA20_POLY1305_SHA256",
|
|
11
11
|
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384",
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { hexlify } from "ethers";
|
|
2
|
-
import { createClaimOnAvs } from "
|
|
3
|
-
import { createClaimOnAttestor } from "
|
|
4
|
-
import { benchmark } from "
|
|
5
|
-
import { generateRpcRequestId, getCurrentMemoryUsage, getWsApiUrlFromBaseUrl, RPC_MSG_BRIDGE, sendMessageToApp, waitForResponse } from "
|
|
6
|
-
import { ALL_ENC_ALGORITHMS, makeExternalRpcOprfOperator, makeExternalRpcZkOperator } from "
|
|
7
|
-
import { createClaimOnMechain } from "
|
|
8
|
-
import { extractHTMLElement, extractJSONValueIndex, generateRequstAndResponseFromTranscript } from "
|
|
9
|
-
import { B64_JSON_REVIVER } from "
|
|
10
|
-
import { AttestorError, getIdentifierFromClaimInfo, logger, makeLogger, uint8ArrayToStr } from "
|
|
2
|
+
import { createClaimOnAvs } from "../avs/client/create-claim-on-avs.js";
|
|
3
|
+
import { createClaimOnAttestor } from "../client/index.js";
|
|
4
|
+
import { benchmark } from "../external-rpc/benchmark.js";
|
|
5
|
+
import { generateRpcRequestId, getCurrentMemoryUsage, getWsApiUrlFromBaseUrl, RPC_MSG_BRIDGE, sendMessageToApp, waitForResponse } from "../external-rpc/utils.js";
|
|
6
|
+
import { ALL_ENC_ALGORITHMS, makeExternalRpcOprfOperator, makeExternalRpcZkOperator } from "../external-rpc/zk.js";
|
|
7
|
+
import { createClaimOnMechain } from "../mechain/client/create-claim-on-mechain.js";
|
|
8
|
+
import { extractHTMLElement, extractJSONValueIndex, generateRequstAndResponseFromTranscript } from "../providers/http/utils.js";
|
|
9
|
+
import { B64_JSON_REVIVER } from "../utils/b64-json.js";
|
|
10
|
+
import { AttestorError, getIdentifierFromClaimInfo, logger, makeLogger, uint8ArrayToStr } from "../utils/index.js";
|
|
11
11
|
async function handleIncomingMessage(data) {
|
|
12
12
|
let id = "";
|
|
13
13
|
try {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { URL as WHATWG_URL } from "whatwg-url";
|
|
2
|
-
import { CloseEventPolyfill, ErrorEventPolyfill, EventPolyfill, MessageEventPolyfill } from "
|
|
3
|
-
import { RPCWebSocket } from "
|
|
2
|
+
import { CloseEventPolyfill, ErrorEventPolyfill, EventPolyfill, MessageEventPolyfill } from "../../external-rpc/jsc-polyfills/event.js";
|
|
3
|
+
import { RPCWebSocket } from "../../external-rpc/jsc-polyfills/ws.js";
|
|
4
4
|
if (typeof globalThis.URL === "undefined") {
|
|
5
5
|
globalThis.URL = WHATWG_URL;
|
|
6
6
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import "
|
|
1
|
+
import "../../external-rpc/jsc-polyfills/1.js";
|
|
2
|
+
import "../../external-rpc/jsc-polyfills/2.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { setCryptoImplementation } from "@reclaimprotocol/tls";
|
|
2
2
|
import { webcryptoCrypto } from "@reclaimprotocol/tls/webcrypto";
|
|
3
|
-
import { handleIncomingMessage } from "
|
|
4
|
-
import { getWsApiUrlFromBaseUrl } from "
|
|
5
|
-
import { logger, makeLogger } from "
|
|
3
|
+
import { handleIncomingMessage } from "../external-rpc/handle-incoming-msg.js";
|
|
4
|
+
import { getWsApiUrlFromBaseUrl } from "../external-rpc/utils.js";
|
|
5
|
+
import { logger, makeLogger } from "../utils/index.js";
|
|
6
6
|
makeLogger(true);
|
|
7
7
|
setCryptoImplementation(webcryptoCrypto);
|
|
8
8
|
function setupWindowRpc(baseUrl, channel = "attestor-core") {
|
|
@@ -27,7 +27,7 @@ function setupWindowRpc(baseUrl, channel = "attestor-core") {
|
|
|
27
27
|
}
|
|
28
28
|
logger.info({ defaultUrl: getWsApiUrlFromBaseUrl() }, "window RPC setup");
|
|
29
29
|
}
|
|
30
|
-
export * from "
|
|
30
|
+
export * from "../index.js";
|
|
31
31
|
export {
|
|
32
32
|
setupWindowRpc
|
|
33
33
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import "
|
|
1
|
+
import "../external-rpc/jsc-polyfills/index.js";
|
|
2
2
|
1;
|
|
3
3
|
import { setCryptoImplementation } from "@reclaimprotocol/tls";
|
|
4
4
|
import { pureJsCrypto } from "@reclaimprotocol/tls/purejs-crypto";
|
|
5
|
-
import * as AttestorRPCImport from "
|
|
6
|
-
import { makeLogger } from "
|
|
5
|
+
import * as AttestorRPCImport from "../external-rpc/index.js";
|
|
6
|
+
import { makeLogger } from "../utils/logger.js";
|
|
7
7
|
setCryptoImplementation(pureJsCrypto);
|
|
8
8
|
makeLogger(true);
|
|
9
9
|
function setupJsRpc(baseUrl, channel = "attestor-core") {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { WS_PATHNAME } from "
|
|
2
|
-
import { EventBus } from "
|
|
3
|
-
import { B64_JSON_REPLACER } from "
|
|
4
|
-
import { AttestorError } from "
|
|
1
|
+
import { WS_PATHNAME } from "../config/index.js";
|
|
2
|
+
import { EventBus } from "../external-rpc/event-bus.js";
|
|
3
|
+
import { B64_JSON_REPLACER } from "../utils/b64-json.js";
|
|
4
|
+
import { AttestorError } from "../utils/error.js";
|
|
5
5
|
const RPC_MSG_BRIDGE = new EventBus();
|
|
6
6
|
async function getCurrentMemoryUsage() {
|
|
7
7
|
if (!window.crossOriginIsolated) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { rpcRequest } from "
|
|
2
|
-
import { logger, makeDefaultZkOperator } from "
|
|
1
|
+
import { rpcRequest } from "../external-rpc/utils.js";
|
|
2
|
+
import { logger, makeDefaultZkOperator } from "../utils/index.js";
|
|
3
3
|
const ALL_ENC_ALGORITHMS = [
|
|
4
4
|
"aes-256-ctr",
|
|
5
5
|
"aes-128-ctr",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createClaimOnAttestor as _createClaimOnAttestor, getAttestorClientFromPool } from "
|
|
2
|
-
import { AttestorClient } from "
|
|
1
|
+
import { createClaimOnAttestor as _createClaimOnAttestor, getAttestorClientFromPool } from "../../client/index.js";
|
|
2
|
+
import { AttestorClient } from "../../client/index.js";
|
|
3
3
|
async function createClaimOnMechain({
|
|
4
4
|
createClaimOnAttestor = _createClaimOnAttestor,
|
|
5
5
|
onStep,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { areUint8ArraysEqual, concatenateUint8Arrays, uint8ArrayToBinaryStr } from "@reclaimprotocol/tls";
|
|
2
2
|
import { encodeBase64 } from "ethers";
|
|
3
|
-
import { DEFAULT_HTTPS_PORT, RECLAIM_USER_AGENT } from "
|
|
4
|
-
import { AttestorVersion } from "
|
|
3
|
+
import { DEFAULT_HTTPS_PORT, RECLAIM_USER_AGENT } from "../../config/index.js";
|
|
4
|
+
import { AttestorVersion } from "../../proto/api.js";
|
|
5
5
|
import {
|
|
6
6
|
buildHeaders,
|
|
7
7
|
convertResponsePosToAbsolutePos,
|
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
makeRegex,
|
|
12
12
|
matchRedactedStrings,
|
|
13
13
|
parseHttpResponse
|
|
14
|
-
} from "
|
|
15
|
-
import { isValidProxySessionId } from "
|
|
14
|
+
} from "../../providers/http/utils.js";
|
|
15
|
+
import { isValidProxySessionId } from "../../server/utils/proxy-session.js";
|
|
16
16
|
import {
|
|
17
17
|
findIndexInUint8Array,
|
|
18
18
|
getHttpRequestDataFromTranscript,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
REDACTION_CHAR_CODE,
|
|
21
21
|
strToUint8Array,
|
|
22
22
|
uint8ArrayToStr
|
|
23
|
-
} from "
|
|
23
|
+
} from "../../utils/index.js";
|
|
24
24
|
const OK_HTTP_HEADER = "HTTP/1.1 200";
|
|
25
25
|
const dateHeaderRegex = "[dD]ate: ((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (?:[0-3][0-9]) (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (?:[0-9]{4}) (?:[01][0-9]|2[0-3])(?::[0-5][0-9]){2} GMT)";
|
|
26
26
|
const dateDiff = 1e3 * 60 * 10;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "
|
|
1
|
+
import "../../providers/http/patch-parse5-tree.js";
|
|
2
2
|
import { concatenateUint8Arrays } from "@reclaimprotocol/tls";
|
|
3
3
|
import {
|
|
4
4
|
ArrayExpression,
|
|
@@ -13,7 +13,7 @@ import { parse } from "parse5";
|
|
|
13
13
|
import { adapter as htmlAdapter } from "parse5-htmlparser2-tree-adapter";
|
|
14
14
|
import RE2 from "re2";
|
|
15
15
|
import xpath from "xpath";
|
|
16
|
-
import { getHttpRequestDataFromTranscript, isApplicationData, makeHttpResponseParser, REDACTION_CHAR_CODE } from "
|
|
16
|
+
import { getHttpRequestDataFromTranscript, isApplicationData, makeHttpResponseParser, REDACTION_CHAR_CODE } from "../../utils/index.js";
|
|
17
17
|
function extractHTMLElement(html, xpathExpression, contentsOnly) {
|
|
18
18
|
const { start, end } = extractHTMLElementIndex(html, xpathExpression, contentsOnly);
|
|
19
19
|
return html.slice(start, end);
|
|
@@ -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 "../config/index.js";
|
|
3
|
+
import { AuthenticatedUserData } from "../proto/api.js";
|
|
4
|
+
import { getEnvVariable } from "../utils/env.js";
|
|
5
|
+
import { AttestorError } from "../utils/error.js";
|
|
6
|
+
import { unixTimestampSeconds } from "../utils/generics.js";
|
|
7
|
+
import { SelectedServiceSignature, SIGNATURES } from "../utils/signatures/index.js";
|
|
8
8
|
async function assertValidAuthRequest(request, signatureType) {
|
|
9
9
|
const publicKey = getEnvVariable("AUTHENTICATION_PUBLIC_KEY");
|
|
10
10
|
if (!request) {
|
|
@@ -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 "../config/index.js";
|
|
4
|
+
import { ClaimTunnelResponse } from "../proto/api.js";
|
|
5
|
+
import { SIGNATURES, strToUint8Array } from "../utils/index.js";
|
|
6
6
|
function createSignDataForClaim(data) {
|
|
7
7
|
const lines = [
|
|
8
8
|
getIdentifierFromClaimInfo(data),
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
uint8ArrayToDataView
|
|
10
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 "../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);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { asciiToUint8Array, concatenateUint8Arrays } from "@reclaimprotocol/tls";
|
|
2
|
-
import { findIndexInUint8Array, uint8ArrayToStr } from "
|
|
3
|
-
import { REDACTION_CHAR_CODE } from "
|
|
2
|
+
import { findIndexInUint8Array, uint8ArrayToStr } from "../utils/generics.js";
|
|
3
|
+
import { REDACTION_CHAR_CODE } from "../utils/redactions.js";
|
|
4
4
|
const HTTP_HEADER_LINE_END = asciiToUint8Array("\r\n");
|
|
5
5
|
function makeHttpResponseParser() {
|
|
6
6
|
const res = {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { concatenateUint8Arrays, crypto } from "@reclaimprotocol/tls";
|
|
2
2
|
import {
|
|
3
3
|
TranscriptMessageSenderType
|
|
4
|
-
} from "
|
|
5
|
-
import { makeZkProofGenerator } from "
|
|
4
|
+
} from "../proto/api.js";
|
|
5
|
+
import { makeZkProofGenerator } from "../utils/zk.js";
|
|
6
6
|
async function preparePacketsForReveal(tlsTranscript, reveals, { onZkProgress, ...opts }) {
|
|
7
7
|
const transcript = [];
|
|
8
8
|
const proofGenerator = await makeZkProofGenerator(opts);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ServiceSignatureType } from "
|
|
2
|
-
import { ETH_SIGNATURE_PROVIDER } from "
|
|
1
|
+
import { ServiceSignatureType } from "../../proto/api.js";
|
|
2
|
+
import { ETH_SIGNATURE_PROVIDER } from "../../utils/signatures/eth.js";
|
|
3
3
|
const SIGNATURES = {
|
|
4
4
|
[ServiceSignatureType.SERVICE_SIGNATURE_TYPE_ETH]: ETH_SIGNATURE_PROVIDER
|
|
5
5
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { wsMessageHandler } from "
|
|
2
|
-
import { RPCMessages } from "
|
|
3
|
-
import { AttestorError, makeRpcEvent, packRpcMessages } from "
|
|
1
|
+
import { wsMessageHandler } from "../client/utils/message-handler.js";
|
|
2
|
+
import { RPCMessages } from "../proto/api.js";
|
|
3
|
+
import { AttestorError, makeRpcEvent, packRpcMessages } from "../utils/index.js";
|
|
4
4
|
class AttestorSocket {
|
|
5
5
|
eventTarget = new EventTarget();
|
|
6
6
|
socket;
|
package/lib/browser/utils/tls.js
CHANGED
package/lib/browser/utils/zk.js
CHANGED
|
@@ -16,19 +16,19 @@ import {
|
|
|
16
16
|
DEFAULT_REMOTE_FILE_FETCH_BASE_URL,
|
|
17
17
|
DEFAULT_ZK_CONCURRENCY,
|
|
18
18
|
TOPRF_DOMAIN_SEPARATOR
|
|
19
|
-
} from "
|
|
20
|
-
import { ZKProofEngine } from "
|
|
21
|
-
import { detectEnvironment, getEnvVariable } from "
|
|
22
|
-
import { AttestorError } from "
|
|
19
|
+
} from "../config/index.js";
|
|
20
|
+
import { ZKProofEngine } from "../proto/api.js";
|
|
21
|
+
import { detectEnvironment, getEnvVariable } from "../utils/env.js";
|
|
22
|
+
import { AttestorError } from "../utils/error.js";
|
|
23
23
|
import {
|
|
24
24
|
getPureCiphertext,
|
|
25
25
|
getRecordIV,
|
|
26
26
|
getZkAlgorithmForCipherSuite,
|
|
27
27
|
isTls13Suite,
|
|
28
28
|
strToUint8Array
|
|
29
|
-
} from "
|
|
30
|
-
import { logger as LOGGER } from "
|
|
31
|
-
import { binaryHashToStr, isFullyRedacted, isRedactionCongruent, REDACTION_CHAR_CODE } from "
|
|
29
|
+
} from "../utils/generics.js";
|
|
30
|
+
import { logger as LOGGER } from "../utils/logger.js";
|
|
31
|
+
import { binaryHashToStr, isFullyRedacted, isRedactionCongruent, REDACTION_CHAR_CODE } from "../utils/redactions.js";
|
|
32
32
|
const ZK_CONCURRENCY = +(getEnvVariable("ZK_CONCURRENCY") || DEFAULT_ZK_CONCURRENCY);
|
|
33
33
|
async function makeZkProofGenerator({
|
|
34
34
|
zkOperators,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reclaimprotocol/attestor-core",
|
|
3
|
-
"version": "5.0.1-beta.
|
|
3
|
+
"version": "5.0.1-beta.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"imports": {
|
|
@@ -8,27 +8,15 @@
|
|
|
8
8
|
},
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
|
-
"browser": {
|
|
12
|
-
"types": "./lib/browser/index.d.ts",
|
|
13
|
-
"default": "./lib/browser/index.js"
|
|
14
|
-
},
|
|
15
|
-
"node": {
|
|
16
|
-
"types": "./lib/index.d.ts",
|
|
17
|
-
"default": "./lib/index.js"
|
|
18
|
-
},
|
|
19
11
|
"types": "./lib/index.d.ts",
|
|
12
|
+
"browser": "./lib/browser/index.js",
|
|
13
|
+
"node": "./lib/index.js",
|
|
20
14
|
"default": "./lib/index.js"
|
|
21
15
|
},
|
|
22
16
|
"./external-rpc": {
|
|
23
|
-
"browser": {
|
|
24
|
-
"types": "./lib/browser/external-rpc/index.d.ts",
|
|
25
|
-
"default": "./lib/browser/external-rpc/index.js"
|
|
26
|
-
},
|
|
27
|
-
"node": {
|
|
28
|
-
"types": "./lib/external-rpc/index.d.ts",
|
|
29
|
-
"default": "./lib/external-rpc/index.js"
|
|
30
|
-
},
|
|
31
17
|
"types": "./lib/external-rpc/index.d.ts",
|
|
18
|
+
"browser": "./lib/browser/external-rpc/index.js",
|
|
19
|
+
"node": "./lib/external-rpc/index.js",
|
|
32
20
|
"default": "./lib/external-rpc/index.js"
|
|
33
21
|
}
|
|
34
22
|
},
|