@reclaimprotocol/attestor-core 5.0.1-beta.12 → 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 -626
- 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,163 +0,0 @@
|
|
|
1
|
-
import type { IncomingMessage } from 'http';
|
|
2
|
-
import type { WebSocket as WSWebSocket } from 'ws';
|
|
3
|
-
import type { AuthenticationRequest, InitRequest, InitResponse, RPCMessage, RPCMessages, ServiceSignatureType, TunnelMessage } from '#src/proto/api.ts';
|
|
4
|
-
import type { BGPListener } from '#src/types/bgp.ts';
|
|
5
|
-
import type { Logger } from '#src/types/general.ts';
|
|
6
|
-
import type { RPCEvent, RPCEventMap, RPCEventType, RPCRequestData, RPCResponseData, RPCType } from '#src/types/rpc.ts';
|
|
7
|
-
import type { TCPSocketProperties, Tunnel } from '#src/types/tunnel.ts';
|
|
8
|
-
/**
|
|
9
|
-
* Any WebSocket implementation -- either the native
|
|
10
|
-
* WebSocket or the WebSocket from the `ws` package.
|
|
11
|
-
*/
|
|
12
|
-
export type AnyWebSocket = WebSocket | WSWebSocket;
|
|
13
|
-
export type MakeWebSocket = (url: string | URL) => AnyWebSocket;
|
|
14
|
-
export type AcceptNewConnectionOpts = {
|
|
15
|
-
req: IncomingMessage;
|
|
16
|
-
logger: Logger;
|
|
17
|
-
bgpListener?: BGPListener;
|
|
18
|
-
};
|
|
19
|
-
export type IAttestorClientInitParams = {
|
|
20
|
-
/**
|
|
21
|
-
* Attestor WS URL
|
|
22
|
-
*/
|
|
23
|
-
url: string | URL;
|
|
24
|
-
/**
|
|
25
|
-
* If the attestor being connected to has authentication
|
|
26
|
-
* enabled, provide the authentication request here, or a
|
|
27
|
-
* function that will return the authentication request.
|
|
28
|
-
*/
|
|
29
|
-
authRequest?: AuthenticationRequest | (() => Promise<AuthenticationRequest>);
|
|
30
|
-
};
|
|
31
|
-
export type IAttestorClientCreateOpts = {
|
|
32
|
-
/**
|
|
33
|
-
* Attestor WS URL
|
|
34
|
-
*/
|
|
35
|
-
url: string | URL;
|
|
36
|
-
authRequest?: AuthenticationRequest;
|
|
37
|
-
signatureType?: ServiceSignatureType;
|
|
38
|
-
logger?: Logger;
|
|
39
|
-
/**
|
|
40
|
-
* Initial messages to send to the server
|
|
41
|
-
* in the query parameter used to establish
|
|
42
|
-
* the connection.
|
|
43
|
-
*/
|
|
44
|
-
initMessages?: Partial<RPCMessage>[];
|
|
45
|
-
/**
|
|
46
|
-
* Provide a custom WebSocket implementation,
|
|
47
|
-
* will use the native WebSocket if not provided.
|
|
48
|
-
*/
|
|
49
|
-
makeWebSocket?: MakeWebSocket;
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* Base layer for the WebSocket connection on
|
|
53
|
-
* the client and server.
|
|
54
|
-
*/
|
|
55
|
-
export declare class IAttestorSocket {
|
|
56
|
-
metadata: InitRequest;
|
|
57
|
-
logger: Logger;
|
|
58
|
-
/**
|
|
59
|
-
* Is the WebSocket connection open?
|
|
60
|
-
*/
|
|
61
|
-
isOpen: boolean;
|
|
62
|
-
/**
|
|
63
|
-
* Has the WebSocket connection been closed
|
|
64
|
-
*/
|
|
65
|
-
isClosed: boolean;
|
|
66
|
-
/**
|
|
67
|
-
* Whether the WebSocket has been initialised
|
|
68
|
-
* by receiving an "init-response" message.
|
|
69
|
-
*/
|
|
70
|
-
isInitialised: boolean;
|
|
71
|
-
/**
|
|
72
|
-
* Sends RPC messages to the server in a single packet.
|
|
73
|
-
* If the ID is not provided, it will be generated.
|
|
74
|
-
*
|
|
75
|
-
* Promisify the `send` method if using the `ws` package's
|
|
76
|
-
* WebSocket implementation.
|
|
77
|
-
*/
|
|
78
|
-
sendMessage(...msgs: Partial<RPCMessage>[]): Promise<RPCMessages>;
|
|
79
|
-
/**
|
|
80
|
-
* Sends a "terminateConnectionAlert" message to the server
|
|
81
|
-
* with the specified error (if any), if the connection is
|
|
82
|
-
* still open and then closes the connection.
|
|
83
|
-
*/
|
|
84
|
-
terminateConnection(err?: Error): Promise<void>;
|
|
85
|
-
/**
|
|
86
|
-
* Use this to listen to events on the WebSocket.
|
|
87
|
-
*/
|
|
88
|
-
addEventListener<K extends RPCEventType>(type: K, listener: (data: RPCEvent<K>) => void): void;
|
|
89
|
-
removeEventListener<K extends RPCEventType>(type: K, listener: (data: RPCEvent<K>) => void): void;
|
|
90
|
-
/**
|
|
91
|
-
* Syntactic sugar for emitting events on the WebSocket.
|
|
92
|
-
* Wraps the `makeRpcEvent` call internally
|
|
93
|
-
*/
|
|
94
|
-
dispatchRPCEvent<K extends RPCEventType>(type: K, data: RPCEventMap[K]): void;
|
|
95
|
-
/**
|
|
96
|
-
* Starts processing RPC messages from the WebSocket
|
|
97
|
-
* & emits events for each message type. These can be
|
|
98
|
-
* captured by the `addEventListener` method.
|
|
99
|
-
*
|
|
100
|
-
* Will also listen to "error" & "close" events on the WebSocket
|
|
101
|
-
* and emit a "attestor-error" event with the error.
|
|
102
|
-
* So, you only need to listen to the "attestor-error"
|
|
103
|
-
* event to capture anything you're interested in.
|
|
104
|
-
*/
|
|
105
|
-
constructor(ws: WebSocket, metadata: InitRequest, logger: Logger);
|
|
106
|
-
}
|
|
107
|
-
export declare class IAttestorServerSocket extends IAttestorSocket {
|
|
108
|
-
/**
|
|
109
|
-
* Unique identifier for this WebSocket connection
|
|
110
|
-
*/
|
|
111
|
-
sessionId: number;
|
|
112
|
-
/**
|
|
113
|
-
* Set of tunnels this client created. Only available
|
|
114
|
-
* when WS is created by the server
|
|
115
|
-
*/
|
|
116
|
-
tunnels: {
|
|
117
|
-
[id: TunnelMessage['tunnelId']]: Tunnel<TCPSocketProperties>;
|
|
118
|
-
};
|
|
119
|
-
/**
|
|
120
|
-
* Fetches a tunnel by its ID.
|
|
121
|
-
* If the tunnel does not exist, it will throw an error.
|
|
122
|
-
*/
|
|
123
|
-
getTunnel(tunnelId: TunnelMessage['tunnelId']): Tunnel<TCPSocketProperties>;
|
|
124
|
-
removeTunnel(tunnelId: TunnelMessage['tunnelId']): void;
|
|
125
|
-
bgpListener?: BGPListener;
|
|
126
|
-
}
|
|
127
|
-
export declare class IAttestorClient extends IAttestorSocket {
|
|
128
|
-
initResponse?: InitResponse;
|
|
129
|
-
constructor(opts: IAttestorClientCreateOpts);
|
|
130
|
-
/**
|
|
131
|
-
* Waits for a particular message to come in.
|
|
132
|
-
* If the connection is closed before the message is received,
|
|
133
|
-
* the promise will reject.
|
|
134
|
-
*/
|
|
135
|
-
waitForResponse<T extends RPCType>(id: number, timeoutMs?: number): Promise<RPCResponseData<T>>;
|
|
136
|
-
/**
|
|
137
|
-
* Make an RPC request to the other end of the WebSocket.
|
|
138
|
-
*/
|
|
139
|
-
rpc<T extends RPCType>(type: T, request: Partial<RPCRequestData<T>>, timeoutMs?: number): Promise<RPCResponseData<T>>;
|
|
140
|
-
/**
|
|
141
|
-
* Waits for the "init" request to be responded to
|
|
142
|
-
*/
|
|
143
|
-
waitForInit(): Promise<void>;
|
|
144
|
-
}
|
|
145
|
-
interface WebSocketWithServerSocket {
|
|
146
|
-
/**
|
|
147
|
-
* Our RPC socket instance
|
|
148
|
-
*/
|
|
149
|
-
serverSocket?: IAttestorServerSocket;
|
|
150
|
-
/**
|
|
151
|
-
* Just promisified send
|
|
152
|
-
*/
|
|
153
|
-
sendPromise?: (data: Uint8Array) => Promise<void>;
|
|
154
|
-
}
|
|
155
|
-
declare module 'ws' {
|
|
156
|
-
namespace WebSocket {
|
|
157
|
-
interface WebSocket extends WebSocketWithServerSocket {
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
interface WebSocket extends WebSocketWithServerSocket {
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
export {};
|
|
File without changes
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import type { Logger as TLSLogger, TLSPacketContext, TLSProtocolVersion } from '@reclaimprotocol/tls';
|
|
2
|
-
import type { OPRFRawMarker, TOPRFProofParams } from '#src/types/zk.ts';
|
|
3
|
-
/**
|
|
4
|
-
* Represents a slice of any array or string
|
|
5
|
-
*/
|
|
6
|
-
export type ArraySlice = {
|
|
7
|
-
fromIndex: number;
|
|
8
|
-
toIndex: number;
|
|
9
|
-
};
|
|
10
|
-
export type RedactedOrHashedArraySlice = {
|
|
11
|
-
fromIndex: number;
|
|
12
|
-
toIndex: number;
|
|
13
|
-
/**
|
|
14
|
-
* By default, the data is redacted. Instead if you'd like
|
|
15
|
-
* a deterministic hash, set this to:
|
|
16
|
-
* - 'oprf' for client-side TOPRF with ZK proof
|
|
17
|
-
* - 'oprf-mpc' for TEE-to-TEE MPC OPRF
|
|
18
|
-
* - 'oprf-raw' for server-side OPRF (data revealed to attestor)
|
|
19
|
-
* @default undefined
|
|
20
|
-
*/
|
|
21
|
-
hash?: 'oprf' | 'oprf-mpc' | 'oprf-raw';
|
|
22
|
-
};
|
|
23
|
-
export type Logger = TLSLogger & {
|
|
24
|
-
fatal: (...args: any[]) => void;
|
|
25
|
-
child: (opts: {
|
|
26
|
-
[_: string]: any;
|
|
27
|
-
}) => Logger;
|
|
28
|
-
};
|
|
29
|
-
export type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'trace' | 'fatal';
|
|
30
|
-
export type ZKRevealInfo = {
|
|
31
|
-
type: 'zk';
|
|
32
|
-
redactedPlaintext: Uint8Array;
|
|
33
|
-
toprfs?: TOPRFProofParams[];
|
|
34
|
-
oprfRawMarkers?: OPRFRawMarker[];
|
|
35
|
-
overshotToprfFromPrevBlock?: {
|
|
36
|
-
length: number;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* If an oprf-raw marker from the previous block overshot into this block.
|
|
40
|
-
* The server will collect plaintext from this block to complete the OPRF.
|
|
41
|
-
*/
|
|
42
|
-
overshotOprfRawFromPrevBlock?: {
|
|
43
|
-
length: number;
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
export type MessageRevealInfo = {
|
|
47
|
-
type: 'complete';
|
|
48
|
-
} | ZKRevealInfo;
|
|
49
|
-
export type CompleteTLSPacket = TLSPacketContext & {
|
|
50
|
-
/**
|
|
51
|
-
* Full data that was sent/recv across the wire
|
|
52
|
-
*/
|
|
53
|
-
data: Uint8Array;
|
|
54
|
-
};
|
|
55
|
-
export type IDecryptedTranscriptMessage = {
|
|
56
|
-
sender: 'client' | 'server';
|
|
57
|
-
redacted: boolean;
|
|
58
|
-
message: Uint8Array;
|
|
59
|
-
plaintextLength: number;
|
|
60
|
-
recordHeader: Uint8Array;
|
|
61
|
-
};
|
|
62
|
-
export type IDecryptedTranscript = {
|
|
63
|
-
transcript: IDecryptedTranscriptMessage[];
|
|
64
|
-
tlsVersion: TLSProtocolVersion;
|
|
65
|
-
hostname: string;
|
|
66
|
-
/**
|
|
67
|
-
* oprf-raw replacements: original plaintext -> nullifier mappings
|
|
68
|
-
* for server-side parameter replacement
|
|
69
|
-
*/
|
|
70
|
-
oprfRawReplacements?: OPRFRawReplacement[];
|
|
71
|
-
};
|
|
72
|
-
export type OPRFRawReplacement = {
|
|
73
|
-
/** Original plaintext that was OPRF'd */
|
|
74
|
-
originalText: string;
|
|
75
|
-
/** OPRF nullifier string to replace with */
|
|
76
|
-
nullifierText: string;
|
|
77
|
-
};
|
|
File without changes
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Transaction } from 'elastic-apm-node';
|
|
2
|
-
import type { IAttestorServerSocket } from '#src/types/client.ts';
|
|
3
|
-
import type { Logger } from '#src/types/general.ts';
|
|
4
|
-
import type { RPCRequestData, RPCResponseData, RPCType } from '#src/types/rpc.ts';
|
|
5
|
-
export type RPCHandlerMetadata = {
|
|
6
|
-
logger: Logger;
|
|
7
|
-
tx?: Transaction;
|
|
8
|
-
client: IAttestorServerSocket;
|
|
9
|
-
};
|
|
10
|
-
export type RPCHandler<R extends RPCType> = (data: RPCRequestData<R>, ctx: RPCHandlerMetadata) => Promise<RPCResponseData<R>>;
|
|
File without changes
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from './providers.ts';
|
|
2
|
-
export * from './general.ts';
|
|
3
|
-
export * from './signatures.ts';
|
|
4
|
-
export * from './claims.ts';
|
|
5
|
-
export * from './zk.ts';
|
|
6
|
-
export * from './client.ts';
|
|
7
|
-
export * from './rpc.ts';
|
|
8
|
-
export * from './tunnel.ts';
|
|
9
|
-
export * from './handlers.ts';
|
|
10
|
-
export * from './bgp.ts';
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from "./providers.js";
|
|
2
|
-
export * from "./general.js";
|
|
3
|
-
export * from "./signatures.js";
|
|
4
|
-
export * from "./claims.js";
|
|
5
|
-
export * from "./zk.js";
|
|
6
|
-
export * from "./client.js";
|
|
7
|
-
export * from "./rpc.js";
|
|
8
|
-
export * from "./tunnel.js";
|
|
9
|
-
export * from "./handlers.js";
|
|
10
|
-
export * from "./bgp.js";
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import type { TLSConnectionOptions } from '@reclaimprotocol/tls';
|
|
2
|
-
import type { AttestorVersion, ProviderClaimData } from '#src/proto/api.ts';
|
|
3
|
-
import type { ArraySlice, Logger, RedactedOrHashedArraySlice } from '#src/types/general.ts';
|
|
4
|
-
import type { ProvidersConfig } from '#src/types/providers.gen.ts';
|
|
5
|
-
import type { Transcript } from '#src/types/tunnel.ts';
|
|
6
|
-
export type AttestorData = {
|
|
7
|
-
id: string;
|
|
8
|
-
url: string;
|
|
9
|
-
};
|
|
10
|
-
type CreateRequestResult = {
|
|
11
|
-
/**
|
|
12
|
-
* Raw request to be sent
|
|
13
|
-
* If a string, it is assumed to be an
|
|
14
|
-
* ASCII encoded string. If it contains
|
|
15
|
-
* non-ASCII characters, the redactions
|
|
16
|
-
* may not work as expected
|
|
17
|
-
*/
|
|
18
|
-
data: Uint8Array | string;
|
|
19
|
-
redactions: ArraySlice[];
|
|
20
|
-
};
|
|
21
|
-
export type ProviderName = keyof ProvidersConfig;
|
|
22
|
-
export type ProviderParams<T extends ProviderName> = ProvidersConfig[T]['parameters'];
|
|
23
|
-
export type ProviderSecretParams<T extends ProviderName> = ProvidersConfig[T]['secretParameters'];
|
|
24
|
-
export type RedactionMode = 'key-update' | 'zk';
|
|
25
|
-
export type ProviderField<Params, SecretParams, T> = T | ((params: Params, secretParams?: SecretParams) => T);
|
|
26
|
-
export type ProviderCtx = {
|
|
27
|
-
version: AttestorVersion;
|
|
28
|
-
};
|
|
29
|
-
type GetResponseRedactionsOpts<P> = {
|
|
30
|
-
response: Uint8Array;
|
|
31
|
-
params: P;
|
|
32
|
-
logger: Logger;
|
|
33
|
-
ctx: ProviderCtx;
|
|
34
|
-
};
|
|
35
|
-
type AssertValidProviderReceipt<P> = {
|
|
36
|
-
receipt: Transcript<Uint8Array>;
|
|
37
|
-
params: P;
|
|
38
|
-
logger: Logger;
|
|
39
|
-
ctx: ProviderCtx;
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* Generic interface for a provider that can be used to verify
|
|
43
|
-
* claims on a TLS receipt
|
|
44
|
-
*
|
|
45
|
-
* @notice "Params" are the parameters you want to claim against.
|
|
46
|
-
* These would typically be found in the response body
|
|
47
|
-
*
|
|
48
|
-
* @notice "SecretParams" are the parameters that are used to make the API request.
|
|
49
|
-
* These must be redacted in the request construction in "createRequest" & cannot be viewed by anyone
|
|
50
|
-
*/
|
|
51
|
-
export interface Provider<N extends ProviderName, Params = ProviderParams<N>, SecretParams = ProviderSecretParams<N>> {
|
|
52
|
-
/**
|
|
53
|
-
* host:port to connect to for this provider;
|
|
54
|
-
* the protocol establishes a connection to the first one
|
|
55
|
-
* when a request is received from a user.
|
|
56
|
-
*
|
|
57
|
-
* Run on attestor side when creating a new session
|
|
58
|
-
*
|
|
59
|
-
* Eg. "www.google.com:443", (p) => p.url.host
|
|
60
|
-
* */
|
|
61
|
-
hostPort: ProviderField<Params, SecretParams, string>;
|
|
62
|
-
/**
|
|
63
|
-
* Which geo location to send the request from
|
|
64
|
-
* Provide 2 letter country code, or a function
|
|
65
|
-
* that returns the country code
|
|
66
|
-
* @example "US", "IN"
|
|
67
|
-
*/
|
|
68
|
-
geoLocation?: ProviderField<Params, SecretParams, string | undefined>;
|
|
69
|
-
/**
|
|
70
|
-
* Session identifier for proxy IP persistence.
|
|
71
|
-
*
|
|
72
|
-
* When provided, ensures all requests within the same session
|
|
73
|
-
* are routed through the same proxy IP address. Useful for
|
|
74
|
-
* maintaining IP consistency across multiple requests.
|
|
75
|
-
*
|
|
76
|
-
* Can be a smallcase alphanumeric string of length 8-14 characters.
|
|
77
|
-
* @example "mystring12345", "something1234"
|
|
78
|
-
*/
|
|
79
|
-
proxySessionId?: ProviderField<Params, SecretParams, string | undefined>;
|
|
80
|
-
/** extra options to pass to the client like root CA certificates */
|
|
81
|
-
additionalClientOptions?: ProviderField<Params, SecretParams, TLSConnectionOptions | undefined>;
|
|
82
|
-
/**
|
|
83
|
-
* default redaction mode to use. If not specified,
|
|
84
|
-
* the default is 'key-update'.
|
|
85
|
-
*
|
|
86
|
-
* It's switched to 'zk' for TLS1.2 requests as TLS1.2
|
|
87
|
-
* don't support key updates
|
|
88
|
-
*
|
|
89
|
-
* @default 'key-update'
|
|
90
|
-
*/
|
|
91
|
-
writeRedactionMode?: ProviderField<Params, SecretParams, RedactionMode | undefined>;
|
|
92
|
-
/** generate the raw request to be sent to through the TLS receipt */
|
|
93
|
-
createRequest(secretParams: SecretParams, params: Params, logger: Logger): CreateRequestResult;
|
|
94
|
-
/**
|
|
95
|
-
* Return the slices of the response to redact
|
|
96
|
-
* Eg. if the response is "hello my secret is xyz",
|
|
97
|
-
* and you want to redact "xyz", you would return
|
|
98
|
-
* [{start: 17, end: 20}]
|
|
99
|
-
*
|
|
100
|
-
* This is run on the client side, to selct which portions of
|
|
101
|
-
* the server response to send to the attestor
|
|
102
|
-
* */
|
|
103
|
-
getResponseRedactions?(opts: GetResponseRedactionsOpts<Params>): RedactedOrHashedArraySlice[];
|
|
104
|
-
/**
|
|
105
|
-
* verify a generated TLS receipt against given parameters
|
|
106
|
-
* to ensure the receipt does contain the claims the
|
|
107
|
-
* user is claiming to have
|
|
108
|
-
*
|
|
109
|
-
* This is run on the attestor side.
|
|
110
|
-
* @param receipt application data messages exchanged in the TLS session
|
|
111
|
-
* @param params the parameters to verify the receipt against.
|
|
112
|
-
* Eg. `{"email": "abcd@gmail.com"}`
|
|
113
|
-
* @returns sucessful verification or throws an error message.
|
|
114
|
-
* Optionally return parameters extracted from the receipt
|
|
115
|
-
* that will then be included in the claim context
|
|
116
|
-
* */
|
|
117
|
-
assertValidProviderReceipt(opts: AssertValidProviderReceipt<Params>): void | Promise<void> | {
|
|
118
|
-
extractedParameters: {
|
|
119
|
-
[key: string]: string;
|
|
120
|
-
};
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
export type ProofGenerationStep = {
|
|
124
|
-
name: 'connecting';
|
|
125
|
-
} | {
|
|
126
|
-
name: 'sending-request-data';
|
|
127
|
-
} | {
|
|
128
|
-
name: 'waiting-for-response';
|
|
129
|
-
} | {
|
|
130
|
-
name: 'generating-zk-proofs';
|
|
131
|
-
proofsDone: number;
|
|
132
|
-
proofsTotal: number;
|
|
133
|
-
/**
|
|
134
|
-
* approximate time left in seconds.
|
|
135
|
-
* Only computed after the first block
|
|
136
|
-
* is done
|
|
137
|
-
* */
|
|
138
|
-
approxTimeLeftS?: number;
|
|
139
|
-
} | {
|
|
140
|
-
name: 'waiting-for-verification';
|
|
141
|
-
};
|
|
142
|
-
type StepData = {
|
|
143
|
-
timestampS: number;
|
|
144
|
-
epoch: number;
|
|
145
|
-
attestors: AttestorData[];
|
|
146
|
-
};
|
|
147
|
-
export type CreateStep = ({
|
|
148
|
-
name: 'creating';
|
|
149
|
-
} & StepData) | ({
|
|
150
|
-
name: 'attestor-progress';
|
|
151
|
-
currentAttestor: AttestorData;
|
|
152
|
-
step: ProofGenerationStep;
|
|
153
|
-
} & StepData) | {
|
|
154
|
-
name: 'attestor-done';
|
|
155
|
-
timestampS: number;
|
|
156
|
-
epoch: number;
|
|
157
|
-
attestorsLeft: AttestorData[];
|
|
158
|
-
claimData: ProviderClaimData;
|
|
159
|
-
signaturesDone: string[];
|
|
160
|
-
};
|
|
161
|
-
export {};
|