@reclaimprotocol/attestor-core 5.0.1-beta.9 → 5.0.1
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/browser/resources/attestor-browser.min.mjs +4512 -0
- package/lib/client/tunnels/make-rpc-tls-tunnel.d.ts +1 -1
- package/lib/external-rpc/index.js +10399 -3
- package/lib/index.js +8323 -10
- package/lib/server/utils/proxy-session.d.ts +1 -1
- package/lib/types/general.d.ts +0 -1
- package/lib/utils/generics.d.ts +1 -6
- package/lib/utils/index.d.ts +0 -1
- package/package.json +8 -10
- package/lib/avs/abis/avsDirectoryABI.js +0 -343
- package/lib/avs/abis/delegationABI.js +0 -4
- package/lib/avs/abis/registryABI.js +0 -728
- package/lib/avs/client/create-claim-on-avs.js +0 -168
- package/lib/avs/config.js +0 -26
- package/lib/avs/contracts/ReclaimServiceManager.js +0 -0
- package/lib/avs/contracts/common.js +0 -0
- package/lib/avs/contracts/factories/ReclaimServiceManager__factory.js +0 -1183
- package/lib/avs/contracts/factories/index.js +0 -4
- package/lib/avs/contracts/index.js +0 -6
- package/lib/avs/types/index.js +0 -0
- package/lib/avs/utils/contracts.js +0 -53
- package/lib/avs/utils/register.js +0 -74
- package/lib/avs/utils/tasks.js +0 -48
- 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/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 -625
- package/lib/client/create-claim.js +0 -461
- package/lib/client/index.js +0 -3
- package/lib/client/tunnels/make-rpc-tcp-tunnel.js +0 -53
- package/lib/client/tunnels/make-rpc-tls-tunnel.js +0 -127
- package/lib/client/utils/attestor-pool.js +0 -24
- package/lib/client/utils/client-socket.js +0 -120
- package/lib/client/utils/message-handler.js +0 -97
- package/lib/config/index.js +0 -62
- package/lib/external-rpc/benchmark.js +0 -82
- package/lib/external-rpc/event-bus.js +0 -17
- package/lib/external-rpc/global.d.js +0 -0
- package/lib/external-rpc/handle-incoming-msg.js +0 -241
- package/lib/external-rpc/jsc-polyfills/1.js +0 -80
- package/lib/external-rpc/jsc-polyfills/2.js +0 -15
- package/lib/external-rpc/jsc-polyfills/event.js +0 -19
- package/lib/external-rpc/jsc-polyfills/index.js +0 -2
- package/lib/external-rpc/jsc-polyfills/ws.js +0 -83
- package/lib/external-rpc/setup-browser.js +0 -33
- package/lib/external-rpc/setup-jsc.js +0 -22
- package/lib/external-rpc/types.js +0 -0
- package/lib/external-rpc/utils.js +0 -100
- package/lib/external-rpc/zk.js +0 -58
- package/lib/index.browser.d.ts +0 -9
- package/lib/mechain/abis/governanceABI.js +0 -461
- package/lib/mechain/abis/taskABI.js +0 -512
- package/lib/mechain/client/create-claim-on-mechain.js +0 -33
- package/lib/mechain/client/index.js +0 -1
- package/lib/mechain/constants/index.js +0 -8
- package/lib/mechain/index.js +0 -2
- package/lib/mechain/types/index.js +0 -0
- package/lib/proto/api.js +0 -4250
- package/lib/proto/tee-bundle.js +0 -1296
- package/lib/providers/http/index.js +0 -640
- package/lib/providers/http/patch-parse5-tree.js +0 -34
- package/lib/providers/http/utils.js +0 -283
- package/lib/providers/index.js +0 -7
- package/lib/scripts/check-avs-registration.js +0 -28
- package/lib/scripts/fallbacks/crypto.js +0 -4
- package/lib/scripts/fallbacks/empty.js +0 -4
- package/lib/scripts/fallbacks/re2.js +0 -7
- package/lib/scripts/fallbacks/snarkjs.js +0 -10
- package/lib/scripts/fallbacks/stwo.js +0 -159
- package/lib/scripts/generate-provider-types.js +0 -101
- package/lib/scripts/generate-receipt.js +0 -101
- package/lib/scripts/generate-toprf-keys.js +0 -24
- package/lib/scripts/jsc-cli-rpc.js +0 -35
- package/lib/scripts/register-avs-operator.js +0 -3
- package/lib/scripts/start-server.js +0 -11
- package/lib/scripts/update-avs-metadata.js +0 -20
- package/lib/scripts/utils.js +0 -10
- package/lib/scripts/whitelist-operator.js +0 -16
- package/lib/server/create-server.js +0 -105
- package/lib/server/handlers/claimTeeBundle.js +0 -232
- package/lib/server/handlers/claimTunnel.js +0 -80
- package/lib/server/handlers/completeClaimOnChain.js +0 -29
- package/lib/server/handlers/createClaimOnChain.js +0 -32
- package/lib/server/handlers/createTaskOnMechain.js +0 -57
- package/lib/server/handlers/createTunnel.js +0 -98
- package/lib/server/handlers/disconnectTunnel.js +0 -8
- package/lib/server/handlers/fetchCertificateBytes.js +0 -57
- package/lib/server/handlers/index.js +0 -25
- package/lib/server/handlers/init.js +0 -33
- package/lib/server/handlers/toprf.js +0 -19
- package/lib/server/index.js +0 -4
- package/lib/server/socket.js +0 -112
- package/lib/server/tunnels/make-tcp-tunnel.js +0 -202
- package/lib/server/utils/apm.js +0 -29
- package/lib/server/utils/assert-valid-claim-request.js +0 -354
- package/lib/server/utils/config-env.js +0 -4
- package/lib/server/utils/dns.js +0 -24
- package/lib/server/utils/gcp-attestation.js +0 -237
- package/lib/server/utils/generics.js +0 -45
- package/lib/server/utils/iso.js +0 -259
- package/lib/server/utils/keep-alive.js +0 -38
- package/lib/server/utils/nitro-attestation.js +0 -249
- package/lib/server/utils/oprf-raw.js +0 -61
- package/lib/server/utils/process-handshake.js +0 -233
- package/lib/server/utils/proxy-session.js +0 -4
- package/lib/server/utils/tee-oprf-mpc-verification.js +0 -86
- package/lib/server/utils/tee-oprf-verification.js +0 -151
- package/lib/server/utils/tee-transcript-reconstruction.js +0 -140
- package/lib/server/utils/tee-verification.js +0 -358
- package/lib/server/utils/validation.js +0 -45
- package/lib/types/bgp.js +0 -0
- package/lib/types/claims.js +0 -0
- package/lib/types/client.js +0 -0
- package/lib/types/general.js +0 -0
- package/lib/types/handlers.js +0 -0
- package/lib/types/index.js +0 -10
- package/lib/types/providers.gen.js +0 -16
- package/lib/types/providers.js +0 -0
- package/lib/types/rpc.js +0 -0
- package/lib/types/signatures.js +0 -0
- package/lib/types/tunnel.js +0 -0
- package/lib/types/zk.js +0 -0
- package/lib/utils/auth.js +0 -71
- package/lib/utils/b64-json.js +0 -17
- package/lib/utils/bgp-listener.js +0 -123
- package/lib/utils/claims.js +0 -89
- package/lib/utils/env.js +0 -19
- package/lib/utils/error.js +0 -54
- package/lib/utils/generics.js +0 -272
- package/lib/utils/http-parser.js +0 -201
- package/lib/utils/index.browser.d.ts +0 -13
- package/lib/utils/index.js +0 -14
- package/lib/utils/logger.browser.d.ts +0 -14
- package/lib/utils/logger.js +0 -82
- package/lib/utils/prepare-packets.js +0 -69
- package/lib/utils/redactions.js +0 -135
- package/lib/utils/retries.js +0 -26
- package/lib/utils/signatures/eth.js +0 -31
- package/lib/utils/signatures/index.js +0 -12
- package/lib/utils/socket-base.js +0 -96
- package/lib/utils/tls-imports.d.ts +0 -21
- package/lib/utils/tls-imports.js +0 -71
- package/lib/utils/tls.js +0 -58
- package/lib/utils/ws.js +0 -22
- package/lib/utils/zk.js +0 -625
|
@@ -1,443 +0,0 @@
|
|
|
1
|
-
type BinaryData = Uint8Array | string;
|
|
2
|
-
export interface HttpProviderParameters {
|
|
3
|
-
/**
|
|
4
|
-
* which URL does the request have to be made to Has to be a valid https URL for eg. https://amazon.in/orders?q=abcd
|
|
5
|
-
*/
|
|
6
|
-
url: string;
|
|
7
|
-
method: "GET" | "POST" | "PUT" | "PATCH";
|
|
8
|
-
/**
|
|
9
|
-
* Specify the geographical location from where to proxy the request. 2-letter ISO country code or parameter (public or secret)
|
|
10
|
-
*/
|
|
11
|
-
geoLocation?: string;
|
|
12
|
-
/**
|
|
13
|
-
* Specify the unique session id for allowing use of same proxy ip across multiple requests. Can be a smallcase alphanumeric string of length 8-14 characters. eg. "mystring12345", "something1234".
|
|
14
|
-
*/
|
|
15
|
-
proxySessionId?: string;
|
|
16
|
-
/**
|
|
17
|
-
* Any additional headers to be sent with the request Note: these will be revealed to the attestor & won't be redacted from the transcript. To add hidden headers, use 'secretParams.headers' instead
|
|
18
|
-
*/
|
|
19
|
-
headers?: {
|
|
20
|
-
[k: string]: string;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Body of the HTTP request
|
|
24
|
-
*/
|
|
25
|
-
body?: BinaryData;
|
|
26
|
-
/**
|
|
27
|
-
* If the API doesn't perform well with the "key-update" method of redaction, you can switch to "zk" mode by setting this to "zk"
|
|
28
|
-
*/
|
|
29
|
-
writeRedactionMode?: "zk" | "key-update";
|
|
30
|
-
/**
|
|
31
|
-
* Apply TLS configuration when creating the tunnel to the attestor.
|
|
32
|
-
*/
|
|
33
|
-
additionalClientOptions?: {
|
|
34
|
-
/**
|
|
35
|
-
* @minItems 1
|
|
36
|
-
*/
|
|
37
|
-
supportedProtocolVersions?: ("TLS1_2" | "TLS1_3")[];
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* The attestor will use this list to check that the redacted response does indeed match all the provided strings/regexes
|
|
41
|
-
*
|
|
42
|
-
* @minItems 1
|
|
43
|
-
*/
|
|
44
|
-
responseMatches: {
|
|
45
|
-
/**
|
|
46
|
-
* "regex": the response must match the regex "contains": the response must contain the provided
|
|
47
|
-
* string exactly
|
|
48
|
-
*/
|
|
49
|
-
value: string;
|
|
50
|
-
/**
|
|
51
|
-
* The string/regex to match against
|
|
52
|
-
*/
|
|
53
|
-
type: "regex" | "contains";
|
|
54
|
-
/**
|
|
55
|
-
* Inverses the matching logic. Fail when match is found and proceed otherwise
|
|
56
|
-
*/
|
|
57
|
-
invert?: boolean;
|
|
58
|
-
}[];
|
|
59
|
-
/**
|
|
60
|
-
* which portions to select from a response. These are selected in order, xpath => jsonPath => regex * These redactions are done client side and only the selected portions are sent to the attestor. The attestor will only be able to see the selected portions alongside the first line of the HTTP response (i.e. "HTTP/1.1 200 OK") * To disable any redactions, pass an empty array
|
|
61
|
-
*/
|
|
62
|
-
responseRedactions?: {
|
|
63
|
-
/**
|
|
64
|
-
* expect an HTML response, and to contain a certain xpath for eg. "/html/body/div.a1/div.a2/span.a5"
|
|
65
|
-
*/
|
|
66
|
-
xPath?: string;
|
|
67
|
-
/**
|
|
68
|
-
* expect a JSON response, retrieve the item at this path using dot notation for e.g. 'email.addresses.0'
|
|
69
|
-
*/
|
|
70
|
-
jsonPath?: string;
|
|
71
|
-
/**
|
|
72
|
-
* select a regex match from the response
|
|
73
|
-
*/
|
|
74
|
-
regex?: string;
|
|
75
|
-
/**
|
|
76
|
-
* If provided, the value inside will be hashed instead of being redacted. Useful for cases where the data inside is an identifiying piece of information that you don't want to reveal to the attestor, eg. an email address.
|
|
77
|
-
* If the hash function produces more bytes than the original value, the hash will be truncated.
|
|
78
|
-
* Eg. if hash is enabled, the original value is "hello", and hashed is "a1b2c", then the attestor will only see "a1b2c".
|
|
79
|
-
* Note: if a regex with named groups is provided, only the named groups will be hashed.
|
|
80
|
-
*/
|
|
81
|
-
hash?: "oprf" | "oprf-mpc" | "oprf-raw";
|
|
82
|
-
}[];
|
|
83
|
-
/**
|
|
84
|
-
* A map of parameter values which are user in form of {{param}} in URL, responseMatches, responseRedactions, body, geolocation. Those in URL, responseMatches & geo will be put into context and signed This value will NOT be included in provider hash
|
|
85
|
-
*/
|
|
86
|
-
paramValues?: {
|
|
87
|
-
[k: string]: string;
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
export declare const HttpProviderParametersJson: {
|
|
91
|
-
title: string;
|
|
92
|
-
type: string;
|
|
93
|
-
required: string[];
|
|
94
|
-
properties: {
|
|
95
|
-
url: {
|
|
96
|
-
type: string;
|
|
97
|
-
format: string;
|
|
98
|
-
description: string;
|
|
99
|
-
};
|
|
100
|
-
method: {
|
|
101
|
-
type: string;
|
|
102
|
-
enum: string[];
|
|
103
|
-
};
|
|
104
|
-
geoLocation: {
|
|
105
|
-
type: string;
|
|
106
|
-
nullable: boolean;
|
|
107
|
-
description: string;
|
|
108
|
-
};
|
|
109
|
-
proxySessionId: {
|
|
110
|
-
type: string;
|
|
111
|
-
nullable: boolean;
|
|
112
|
-
description: string;
|
|
113
|
-
};
|
|
114
|
-
headers: {
|
|
115
|
-
type: string;
|
|
116
|
-
description: string;
|
|
117
|
-
additionalProperties: {
|
|
118
|
-
type: string;
|
|
119
|
-
};
|
|
120
|
-
};
|
|
121
|
-
body: {
|
|
122
|
-
description: string;
|
|
123
|
-
oneOf: ({
|
|
124
|
-
type: string;
|
|
125
|
-
format: string;
|
|
126
|
-
} | {
|
|
127
|
-
type: string;
|
|
128
|
-
format?: undefined;
|
|
129
|
-
})[];
|
|
130
|
-
};
|
|
131
|
-
writeRedactionMode: {
|
|
132
|
-
type: string;
|
|
133
|
-
description: string;
|
|
134
|
-
enum: string[];
|
|
135
|
-
};
|
|
136
|
-
additionalClientOptions: {
|
|
137
|
-
type: string;
|
|
138
|
-
description: string;
|
|
139
|
-
nullable: boolean;
|
|
140
|
-
properties: {
|
|
141
|
-
supportedProtocolVersions: {
|
|
142
|
-
type: string;
|
|
143
|
-
minItems: number;
|
|
144
|
-
uniqueItems: boolean;
|
|
145
|
-
items: {
|
|
146
|
-
type: string;
|
|
147
|
-
enum: string[];
|
|
148
|
-
};
|
|
149
|
-
};
|
|
150
|
-
};
|
|
151
|
-
};
|
|
152
|
-
responseMatches: {
|
|
153
|
-
type: string;
|
|
154
|
-
minItems: number;
|
|
155
|
-
uniqueItems: boolean;
|
|
156
|
-
description: string;
|
|
157
|
-
items: {
|
|
158
|
-
type: string;
|
|
159
|
-
required: string[];
|
|
160
|
-
properties: {
|
|
161
|
-
value: {
|
|
162
|
-
type: string;
|
|
163
|
-
description: string;
|
|
164
|
-
};
|
|
165
|
-
type: {
|
|
166
|
-
type: string;
|
|
167
|
-
description: string;
|
|
168
|
-
enum: string[];
|
|
169
|
-
};
|
|
170
|
-
invert: {
|
|
171
|
-
type: string;
|
|
172
|
-
description: string;
|
|
173
|
-
};
|
|
174
|
-
};
|
|
175
|
-
additionalProperties: boolean;
|
|
176
|
-
};
|
|
177
|
-
};
|
|
178
|
-
responseRedactions: {
|
|
179
|
-
type: string;
|
|
180
|
-
uniqueItems: boolean;
|
|
181
|
-
description: string;
|
|
182
|
-
items: {
|
|
183
|
-
type: string;
|
|
184
|
-
properties: {
|
|
185
|
-
xPath: {
|
|
186
|
-
type: string;
|
|
187
|
-
nullable: boolean;
|
|
188
|
-
description: string;
|
|
189
|
-
};
|
|
190
|
-
jsonPath: {
|
|
191
|
-
type: string;
|
|
192
|
-
nullable: boolean;
|
|
193
|
-
description: string;
|
|
194
|
-
};
|
|
195
|
-
regex: {
|
|
196
|
-
type: string;
|
|
197
|
-
nullable: boolean;
|
|
198
|
-
description: string;
|
|
199
|
-
};
|
|
200
|
-
hash: {
|
|
201
|
-
type: string;
|
|
202
|
-
description: string;
|
|
203
|
-
enum: string[];
|
|
204
|
-
};
|
|
205
|
-
};
|
|
206
|
-
additionalProperties: boolean;
|
|
207
|
-
};
|
|
208
|
-
};
|
|
209
|
-
paramValues: {
|
|
210
|
-
type: string;
|
|
211
|
-
description: string;
|
|
212
|
-
additionalProperties: {
|
|
213
|
-
type: string;
|
|
214
|
-
};
|
|
215
|
-
};
|
|
216
|
-
};
|
|
217
|
-
additionalProperties: boolean;
|
|
218
|
-
};
|
|
219
|
-
/**
|
|
220
|
-
* Secret parameters to be used with HTTP provider. None of the values in this object will be shown to the attestor
|
|
221
|
-
*/
|
|
222
|
-
export interface HttpProviderSecretParameters {
|
|
223
|
-
/**
|
|
224
|
-
* cookie string for authorisation.
|
|
225
|
-
*/
|
|
226
|
-
cookieStr?: string;
|
|
227
|
-
/**
|
|
228
|
-
* authorisation header value
|
|
229
|
-
*/
|
|
230
|
-
authorisationHeader?: string;
|
|
231
|
-
/**
|
|
232
|
-
* Headers that need to be hidden from the attestor
|
|
233
|
-
*/
|
|
234
|
-
headers?: {
|
|
235
|
-
[k: string]: string;
|
|
236
|
-
};
|
|
237
|
-
/**
|
|
238
|
-
* A map of parameter values which are user in form of {{param}} in body these parameters will NOT be shown to attestor and extracted
|
|
239
|
-
*/
|
|
240
|
-
paramValues?: {
|
|
241
|
-
[k: string]: string;
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
export declare const HttpProviderSecretParametersJson: {
|
|
245
|
-
title: string;
|
|
246
|
-
type: string;
|
|
247
|
-
description: string;
|
|
248
|
-
properties: {
|
|
249
|
-
cookieStr: {
|
|
250
|
-
type: string;
|
|
251
|
-
description: string;
|
|
252
|
-
};
|
|
253
|
-
authorisationHeader: {
|
|
254
|
-
type: string;
|
|
255
|
-
description: string;
|
|
256
|
-
};
|
|
257
|
-
headers: {
|
|
258
|
-
type: string;
|
|
259
|
-
description: string;
|
|
260
|
-
additionalProperties: {
|
|
261
|
-
type: string;
|
|
262
|
-
};
|
|
263
|
-
};
|
|
264
|
-
paramValues: {
|
|
265
|
-
type: string;
|
|
266
|
-
description: string;
|
|
267
|
-
additionalProperties: {
|
|
268
|
-
type: string;
|
|
269
|
-
};
|
|
270
|
-
};
|
|
271
|
-
};
|
|
272
|
-
additionalProperties: boolean;
|
|
273
|
-
};
|
|
274
|
-
export interface ProvidersConfig {
|
|
275
|
-
http: {
|
|
276
|
-
parameters: HttpProviderParameters;
|
|
277
|
-
secretParameters: HttpProviderSecretParameters;
|
|
278
|
-
};
|
|
279
|
-
}
|
|
280
|
-
export declare const PROVIDER_SCHEMAS: {
|
|
281
|
-
http: {
|
|
282
|
-
parameters: {
|
|
283
|
-
title: string;
|
|
284
|
-
type: string;
|
|
285
|
-
required: string[];
|
|
286
|
-
properties: {
|
|
287
|
-
url: {
|
|
288
|
-
type: string;
|
|
289
|
-
format: string;
|
|
290
|
-
description: string;
|
|
291
|
-
};
|
|
292
|
-
method: {
|
|
293
|
-
type: string;
|
|
294
|
-
enum: string[];
|
|
295
|
-
};
|
|
296
|
-
geoLocation: {
|
|
297
|
-
type: string;
|
|
298
|
-
nullable: boolean;
|
|
299
|
-
description: string;
|
|
300
|
-
};
|
|
301
|
-
proxySessionId: {
|
|
302
|
-
type: string;
|
|
303
|
-
nullable: boolean;
|
|
304
|
-
description: string;
|
|
305
|
-
};
|
|
306
|
-
headers: {
|
|
307
|
-
type: string;
|
|
308
|
-
description: string;
|
|
309
|
-
additionalProperties: {
|
|
310
|
-
type: string;
|
|
311
|
-
};
|
|
312
|
-
};
|
|
313
|
-
body: {
|
|
314
|
-
description: string;
|
|
315
|
-
oneOf: ({
|
|
316
|
-
type: string;
|
|
317
|
-
format: string;
|
|
318
|
-
} | {
|
|
319
|
-
type: string;
|
|
320
|
-
format?: undefined;
|
|
321
|
-
})[];
|
|
322
|
-
};
|
|
323
|
-
writeRedactionMode: {
|
|
324
|
-
type: string;
|
|
325
|
-
description: string;
|
|
326
|
-
enum: string[];
|
|
327
|
-
};
|
|
328
|
-
additionalClientOptions: {
|
|
329
|
-
type: string;
|
|
330
|
-
description: string;
|
|
331
|
-
nullable: boolean;
|
|
332
|
-
properties: {
|
|
333
|
-
supportedProtocolVersions: {
|
|
334
|
-
type: string;
|
|
335
|
-
minItems: number;
|
|
336
|
-
uniqueItems: boolean;
|
|
337
|
-
items: {
|
|
338
|
-
type: string;
|
|
339
|
-
enum: string[];
|
|
340
|
-
};
|
|
341
|
-
};
|
|
342
|
-
};
|
|
343
|
-
};
|
|
344
|
-
responseMatches: {
|
|
345
|
-
type: string;
|
|
346
|
-
minItems: number;
|
|
347
|
-
uniqueItems: boolean;
|
|
348
|
-
description: string;
|
|
349
|
-
items: {
|
|
350
|
-
type: string;
|
|
351
|
-
required: string[];
|
|
352
|
-
properties: {
|
|
353
|
-
value: {
|
|
354
|
-
type: string;
|
|
355
|
-
description: string;
|
|
356
|
-
};
|
|
357
|
-
type: {
|
|
358
|
-
type: string;
|
|
359
|
-
description: string;
|
|
360
|
-
enum: string[];
|
|
361
|
-
};
|
|
362
|
-
invert: {
|
|
363
|
-
type: string;
|
|
364
|
-
description: string;
|
|
365
|
-
};
|
|
366
|
-
};
|
|
367
|
-
additionalProperties: boolean;
|
|
368
|
-
};
|
|
369
|
-
};
|
|
370
|
-
responseRedactions: {
|
|
371
|
-
type: string;
|
|
372
|
-
uniqueItems: boolean;
|
|
373
|
-
description: string;
|
|
374
|
-
items: {
|
|
375
|
-
type: string;
|
|
376
|
-
properties: {
|
|
377
|
-
xPath: {
|
|
378
|
-
type: string;
|
|
379
|
-
nullable: boolean;
|
|
380
|
-
description: string;
|
|
381
|
-
};
|
|
382
|
-
jsonPath: {
|
|
383
|
-
type: string;
|
|
384
|
-
nullable: boolean;
|
|
385
|
-
description: string;
|
|
386
|
-
};
|
|
387
|
-
regex: {
|
|
388
|
-
type: string;
|
|
389
|
-
nullable: boolean;
|
|
390
|
-
description: string;
|
|
391
|
-
};
|
|
392
|
-
hash: {
|
|
393
|
-
type: string;
|
|
394
|
-
description: string;
|
|
395
|
-
enum: string[];
|
|
396
|
-
};
|
|
397
|
-
};
|
|
398
|
-
additionalProperties: boolean;
|
|
399
|
-
};
|
|
400
|
-
};
|
|
401
|
-
paramValues: {
|
|
402
|
-
type: string;
|
|
403
|
-
description: string;
|
|
404
|
-
additionalProperties: {
|
|
405
|
-
type: string;
|
|
406
|
-
};
|
|
407
|
-
};
|
|
408
|
-
};
|
|
409
|
-
additionalProperties: boolean;
|
|
410
|
-
};
|
|
411
|
-
secretParameters: {
|
|
412
|
-
title: string;
|
|
413
|
-
type: string;
|
|
414
|
-
description: string;
|
|
415
|
-
properties: {
|
|
416
|
-
cookieStr: {
|
|
417
|
-
type: string;
|
|
418
|
-
description: string;
|
|
419
|
-
};
|
|
420
|
-
authorisationHeader: {
|
|
421
|
-
type: string;
|
|
422
|
-
description: string;
|
|
423
|
-
};
|
|
424
|
-
headers: {
|
|
425
|
-
type: string;
|
|
426
|
-
description: string;
|
|
427
|
-
additionalProperties: {
|
|
428
|
-
type: string;
|
|
429
|
-
};
|
|
430
|
-
};
|
|
431
|
-
paramValues: {
|
|
432
|
-
type: string;
|
|
433
|
-
description: string;
|
|
434
|
-
additionalProperties: {
|
|
435
|
-
type: string;
|
|
436
|
-
};
|
|
437
|
-
};
|
|
438
|
-
};
|
|
439
|
-
additionalProperties: boolean;
|
|
440
|
-
};
|
|
441
|
-
};
|
|
442
|
-
};
|
|
443
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
const HttpProviderParametersJson = { "title": "HttpProviderParameters", "type": "object", "required": ["url", "method", "responseMatches"], "properties": { "url": { "type": "string", "format": "url", "description": "which URL does the request have to be made to Has to be a valid https URL for eg. https://amazon.in/orders?q=abcd" }, "method": { "type": "string", "enum": ["GET", "POST", "PUT", "PATCH"] }, "geoLocation": { "type": "string", "nullable": true, "description": "Specify the geographical location from where to proxy the request. 2-letter ISO country code or parameter (public or secret)" }, "proxySessionId": { "type": "string", "nullable": true, "description": 'Specify the unique session id for allowing use of same proxy ip across multiple requests. Can be a smallcase alphanumeric string of length 8-14 characters. eg. "mystring12345", "something1234".' }, "headers": { "type": "object", "description": "Any additional headers to be sent with the request Note: these will be revealed to the attestor & won't be redacted from the transcript. To add hidden headers, use 'secretParams.headers' instead", "additionalProperties": { "type": "string" } }, "body": { "description": "Body of the HTTP request", "oneOf": [{ "type": "string", "format": "binary" }, { "type": "string" }] }, "writeRedactionMode": { "type": "string", "description": `If the API doesn't perform well with the "key-update" method of redaction, you can switch to "zk" mode by setting this to "zk"`, "enum": ["zk", "key-update"] }, "additionalClientOptions": { "type": "object", "description": "Apply TLS configuration when creating the tunnel to the attestor.", "nullable": true, "properties": { "supportedProtocolVersions": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "type": "string", "enum": ["TLS1_2", "TLS1_3"] } } } }, "responseMatches": { "type": "array", "minItems": 1, "uniqueItems": true, "description": "The attestor will use this list to check that the redacted response does indeed match all the provided strings/regexes", "items": { "type": "object", "required": ["value", "type"], "properties": { "value": { "type": "string", "description": '"regex": the response must match the regex "contains": the response must contain the provided\n string exactly' }, "type": { "type": "string", "description": "The string/regex to match against", "enum": ["regex", "contains"] }, "invert": { "type": "boolean", "description": "Inverses the matching logic. Fail when match is found and proceed otherwise" } }, "additionalProperties": false } }, "responseRedactions": { "type": "array", "uniqueItems": true, "description": 'which portions to select from a response. These are selected in order, xpath => jsonPath => regex * These redactions are done client side and only the selected portions are sent to the attestor. The attestor will only be able to see the selected portions alongside the first line of the HTTP response (i.e. "HTTP/1.1 200 OK") * To disable any redactions, pass an empty array', "items": { "type": "object", "properties": { "xPath": { "type": "string", "nullable": true, "description": 'expect an HTML response, and to contain a certain xpath for eg. "/html/body/div.a1/div.a2/span.a5"' }, "jsonPath": { "type": "string", "nullable": true, "description": "expect a JSON response, retrieve the item at this path using dot notation for e.g. 'email.addresses.0'" }, "regex": { "type": "string", "nullable": true, "description": "select a regex match from the response" }, "hash": { "type": "string", "description": `If provided, the value inside will be hashed instead of being redacted. Useful for cases where the data inside is an identifiying piece of information that you don't want to reveal to the attestor, eg. an email address.
|
|
2
|
-
If the hash function produces more bytes than the original value, the hash will be truncated.
|
|
3
|
-
Eg. if hash is enabled, the original value is "hello", and hashed is "a1b2c", then the attestor will only see "a1b2c".
|
|
4
|
-
Note: if a regex with named groups is provided, only the named groups will be hashed.`, "enum": ["oprf", "oprf-mpc", "oprf-raw"] } }, "additionalProperties": false } }, "paramValues": { "type": "object", "description": "A map of parameter values which are user in form of {{param}} in URL, responseMatches, responseRedactions, body, geolocation. Those in URL, responseMatches & geo will be put into context and signed This value will NOT be included in provider hash", "additionalProperties": { "type": "string" } } }, "additionalProperties": false };
|
|
5
|
-
const HttpProviderSecretParametersJson = { "title": "HttpProviderSecretParameters", "type": "object", "description": "Secret parameters to be used with HTTP provider. None of the values in this object will be shown to the attestor", "properties": { "cookieStr": { "type": "string", "description": "cookie string for authorisation." }, "authorisationHeader": { "type": "string", "description": "authorisation header value" }, "headers": { "type": "object", "description": "Headers that need to be hidden from the attestor", "additionalProperties": { "type": "string" } }, "paramValues": { "type": "object", "description": "A map of parameter values which are user in form of {{param}} in body these parameters will NOT be shown to attestor and extracted", "additionalProperties": { "type": "string" } } }, "additionalProperties": false };
|
|
6
|
-
const PROVIDER_SCHEMAS = {
|
|
7
|
-
http: {
|
|
8
|
-
parameters: HttpProviderParametersJson,
|
|
9
|
-
secretParameters: HttpProviderSecretParametersJson
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
export {
|
|
13
|
-
HttpProviderParametersJson,
|
|
14
|
-
HttpProviderSecretParametersJson,
|
|
15
|
-
PROVIDER_SCHEMAS
|
|
16
|
-
};
|
|
File without changes
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { RPCMessage, TunnelDisconnectEvent, TunnelMessage } from '#src/proto/api.ts';
|
|
2
|
-
import type { AttestorError } from '#src/utils/error.ts';
|
|
3
|
-
type ExtractPrefix<T, S extends string> = T extends `${infer _}${S}` ? _ : never;
|
|
4
|
-
export type RPCType = ExtractPrefix<keyof RPCMessage, 'Request'>;
|
|
5
|
-
type RPCRequestType<T extends RPCType> = `${T}Request`;
|
|
6
|
-
type RPCResponseType<T extends RPCType> = `${T}Response`;
|
|
7
|
-
export type RPCRequestData<T extends RPCType> = Exclude<RPCMessage[RPCRequestType<T>], undefined>;
|
|
8
|
-
export type RPCResponseData<T extends RPCType> = Exclude<RPCMessage[RPCResponseType<T>], undefined>;
|
|
9
|
-
export type RPCRequest<T extends RPCType> = {
|
|
10
|
-
requestId: RPCMessage['id'];
|
|
11
|
-
type: T;
|
|
12
|
-
data: RPCRequestData<T>;
|
|
13
|
-
respond(res: RPCResponseData<T> | AttestorError): void;
|
|
14
|
-
};
|
|
15
|
-
export type RPCResponse<T extends RPCType> = {
|
|
16
|
-
id: RPCMessage['id'];
|
|
17
|
-
type: T;
|
|
18
|
-
data: RPCResponseData<T>;
|
|
19
|
-
} | {
|
|
20
|
-
id: RPCMessage['id'];
|
|
21
|
-
error: AttestorError;
|
|
22
|
-
};
|
|
23
|
-
export type RPCEventMap = {
|
|
24
|
-
'connection-terminated': AttestorError;
|
|
25
|
-
'tunnel-message': TunnelMessage;
|
|
26
|
-
'tunnel-disconnect-event': TunnelDisconnectEvent;
|
|
27
|
-
'rpc-request': RPCRequest<RPCType>;
|
|
28
|
-
'rpc-response': RPCResponse<RPCType>;
|
|
29
|
-
};
|
|
30
|
-
export type RPCEventType = keyof RPCEventMap;
|
|
31
|
-
export interface RPCEvent<T extends RPCEventType> extends Event {
|
|
32
|
-
type: T;
|
|
33
|
-
data: RPCEventMap[T];
|
|
34
|
-
}
|
|
35
|
-
export {};
|
package/lib/browser/types/rpc.js
DELETED
|
File without changes
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export type PrivateKey = string;
|
|
2
|
-
type Awaitable<T> = T | Promise<T>;
|
|
3
|
-
export type ServiceSignatureProvider = {
|
|
4
|
-
/**
|
|
5
|
-
* Returns public key in compressed (compact) format used in Reclaim RPC calls
|
|
6
|
-
* @param privateKey corresponding private key in raw o hex form
|
|
7
|
-
*/
|
|
8
|
-
getPublicKey(privateKey: PrivateKey): Uint8Array;
|
|
9
|
-
/**
|
|
10
|
-
* Returns address corresponding to the provided public key
|
|
11
|
-
* @param publicKey raw o hex form, compressed or uncompressed
|
|
12
|
-
*/
|
|
13
|
-
getAddress(publicKey: Uint8Array): string;
|
|
14
|
-
/**
|
|
15
|
-
* Signs data with the provided private key
|
|
16
|
-
* @param data raw data to be signed
|
|
17
|
-
* @param privateKey private key in raw or hex format
|
|
18
|
-
*/
|
|
19
|
-
sign(data: Uint8Array, privateKey: PrivateKey): Awaitable<Uint8Array>;
|
|
20
|
-
/**
|
|
21
|
-
* Verifies signature against provided data and an address
|
|
22
|
-
* @param data raw data to be verified. Must be same as used in sign() call
|
|
23
|
-
* @param signature signature bytes or string
|
|
24
|
-
* @param addressBytes address corresponding to a public key
|
|
25
|
-
*/
|
|
26
|
-
verify(data: Uint8Array, signature: Uint8Array | string, addressBytes: Uint8Array | string): Awaitable<boolean>;
|
|
27
|
-
};
|
|
28
|
-
export {};
|
|
File without changes
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { CreateTunnelRequest } from '#src/proto/api.ts';
|
|
2
|
-
export type MakeTunnelBaseOpts<O> = O & {
|
|
3
|
-
onClose?(err?: Error): void;
|
|
4
|
-
onMessage?(data: Uint8Array): void;
|
|
5
|
-
};
|
|
6
|
-
export type Tunnel<E> = E & {
|
|
7
|
-
write(data: Uint8Array): void | Promise<void>;
|
|
8
|
-
close(err?: Error): void | Promise<void>;
|
|
9
|
-
};
|
|
10
|
-
export type MakeTunnelFn<O, E = {}> = (opts: MakeTunnelBaseOpts<O>) => (Tunnel<E> | Promise<Tunnel<E>>);
|
|
11
|
-
export type Transcript<T> = {
|
|
12
|
-
sender: 'client' | 'server';
|
|
13
|
-
message: T;
|
|
14
|
-
}[];
|
|
15
|
-
export type TCPSocketProperties = {
|
|
16
|
-
transcript: Transcript<Uint8Array>;
|
|
17
|
-
createRequest: Pick<CreateTunnelRequest, 'host' | 'port' | 'geoLocation' | 'proxySessionId'>;
|
|
18
|
-
};
|
|
File without changes
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { EncryptionAlgorithm, OPRFOperator, ZKEngine, ZKOperator } from '@reclaimprotocol/zk-symmetric-crypto';
|
|
2
|
-
import type { TOPRFPayload } from '#src/proto/api.ts';
|
|
3
|
-
export type ZKOperators = {
|
|
4
|
-
[E in EncryptionAlgorithm]?: ZKOperator;
|
|
5
|
-
};
|
|
6
|
-
export type OPRFOperators = {
|
|
7
|
-
[E in EncryptionAlgorithm]?: OPRFOperator;
|
|
8
|
-
};
|
|
9
|
-
export type PrepareZKProofsBaseOpts = {
|
|
10
|
-
/** get ZK operator for specified algorithm */
|
|
11
|
-
zkOperators?: ZKOperators;
|
|
12
|
-
oprfOperators?: OPRFOperators;
|
|
13
|
-
/**
|
|
14
|
-
* max number of ZK proofs to generate concurrently
|
|
15
|
-
* @default 10
|
|
16
|
-
*/
|
|
17
|
-
zkProofConcurrency?: number;
|
|
18
|
-
zkEngine?: ZKEngine;
|
|
19
|
-
};
|
|
20
|
-
export type TOPRFProofParams = TOPRFPayload & {
|
|
21
|
-
mask: Uint8Array;
|
|
22
|
-
plaintext: Uint8Array;
|
|
23
|
-
overshoot?: {
|
|
24
|
-
ciphertext: Uint8Array;
|
|
25
|
-
iv: Uint8Array;
|
|
26
|
-
recordNumber: number;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Marker for server-side OPRF computation (oprf-raw mode).
|
|
31
|
-
* Data is revealed to attestor who computes OPRF directly.
|
|
32
|
-
*/
|
|
33
|
-
export type OPRFRawMarker = {
|
|
34
|
-
dataLocation: {
|
|
35
|
-
fromIndex: number;
|
|
36
|
-
length: number;
|
|
37
|
-
};
|
|
38
|
-
};
|
package/lib/browser/types/zk.js
DELETED
|
File without changes
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { AuthenticationRequest, ServiceSignatureType } from '#src/proto/api.ts';
|
|
2
|
-
import { AuthenticatedUserData } from '#src/proto/api.ts';
|
|
3
|
-
export declare function assertValidAuthRequest(request: AuthenticationRequest | undefined, signatureType: ServiceSignatureType): Promise<void>;
|
|
4
|
-
/**
|
|
5
|
-
* Create an authentication request with the given data and private key,
|
|
6
|
-
* which can then be used to authenticate with the service.
|
|
7
|
-
*/
|
|
8
|
-
export declare function createAuthRequest(_data: Partial<AuthenticatedUserData>, privateKey: string): Promise<AuthenticationRequest>;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { getBytes } from "ethers";
|
|
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
|
-
async function assertValidAuthRequest(request, signatureType) {
|
|
9
|
-
const publicKey = getEnvVariable("AUTHENTICATION_PUBLIC_KEY");
|
|
10
|
-
if (!request) {
|
|
11
|
-
if (publicKey) {
|
|
12
|
-
throw new AttestorError(
|
|
13
|
-
"ERROR_AUTHENTICATION_FAILED",
|
|
14
|
-
"User must be authenticated"
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
if (!publicKey) {
|
|
20
|
-
throw new AttestorError(
|
|
21
|
-
"ERROR_BAD_REQUEST",
|
|
22
|
-
"The attestor is not configured for authentication"
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
const { signature, data } = request;
|
|
26
|
-
if (!data) {
|
|
27
|
-
throw new AttestorError(
|
|
28
|
-
"ERROR_AUTHENTICATION_FAILED",
|
|
29
|
-
"Missing data in auth request"
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
if (data.expiresAt < unixTimestampSeconds()) {
|
|
33
|
-
throw new AttestorError(
|
|
34
|
-
"ERROR_AUTHENTICATION_FAILED",
|
|
35
|
-
"Authentication request has expired"
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
const proto = AuthenticatedUserData.encode(data).finish();
|
|
39
|
-
const signatureAlg = SIGNATURES[signatureType];
|
|
40
|
-
const address = signatureAlg.getAddress(
|
|
41
|
-
getBytes(publicKey)
|
|
42
|
-
);
|
|
43
|
-
const verified = await signatureAlg.verify(proto, signature, address);
|
|
44
|
-
if (!verified) {
|
|
45
|
-
throw new AttestorError(
|
|
46
|
-
"ERROR_AUTHENTICATION_FAILED",
|
|
47
|
-
"Signature verification failed"
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
async function createAuthRequest(_data, privateKey) {
|
|
52
|
-
const createdAt = unixTimestampSeconds();
|
|
53
|
-
const data = {
|
|
54
|
-
createdAt,
|
|
55
|
-
expiresAt: createdAt + DEFAULT_AUTH_EXPIRY_S,
|
|
56
|
-
id: "",
|
|
57
|
-
hostWhitelist: [],
|
|
58
|
-
..._data
|
|
59
|
-
};
|
|
60
|
-
const proto = AuthenticatedUserData.encode(data).finish();
|
|
61
|
-
const signature = await SelectedServiceSignature.sign(proto, privateKey);
|
|
62
|
-
const request = {
|
|
63
|
-
data,
|
|
64
|
-
signature
|
|
65
|
-
};
|
|
66
|
-
return request;
|
|
67
|
-
}
|
|
68
|
-
export {
|
|
69
|
-
assertValidAuthRequest,
|
|
70
|
-
createAuthRequest
|
|
71
|
-
};
|