@reclaimprotocol/attestor-core 4.0.3 → 5.0.1-beta.2

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.
Files changed (297) hide show
  1. package/LICENSE +660 -660
  2. package/README.md +1 -2
  3. package/lib/avs/abis/avsDirectoryABI.js +341 -342
  4. package/lib/avs/abis/delegationABI.js +4 -5
  5. package/lib/avs/abis/registryABI.js +722 -723
  6. package/lib/avs/client/create-claim-on-avs.d.ts +5 -5
  7. package/lib/avs/client/create-claim-on-avs.js +160 -139
  8. package/lib/avs/config.d.ts +1 -1
  9. package/lib/avs/config.js +25 -23
  10. package/lib/avs/contracts/ReclaimServiceManager.d.ts +436 -532
  11. package/lib/avs/contracts/ReclaimServiceManager.js +0 -3
  12. package/lib/avs/contracts/common.d.ts +40 -11
  13. package/lib/avs/contracts/common.js +0 -3
  14. package/lib/avs/contracts/factories/ReclaimServiceManager__factory.d.ts +13 -11
  15. package/lib/avs/contracts/factories/ReclaimServiceManager__factory.js +1157 -1148
  16. package/lib/avs/contracts/factories/index.d.ts +1 -1
  17. package/lib/avs/contracts/factories/index.js +4 -9
  18. package/lib/avs/contracts/index.d.ts +3 -3
  19. package/lib/avs/contracts/index.js +6 -40
  20. package/lib/avs/types/index.d.ts +6 -6
  21. package/lib/avs/types/index.js +0 -3
  22. package/lib/avs/utils/contracts.d.ts +14 -14
  23. package/lib/avs/utils/contracts.js +50 -35
  24. package/lib/avs/utils/register.d.ts +3 -3
  25. package/lib/avs/utils/register.js +71 -79
  26. package/lib/avs/utils/tasks.d.ts +4 -4
  27. package/lib/avs/utils/tasks.js +44 -41
  28. package/lib/client/create-claim.d.ts +2 -2
  29. package/lib/client/create-claim.js +437 -400
  30. package/lib/client/index.d.ts +3 -3
  31. package/lib/client/index.js +3 -20
  32. package/lib/client/tunnels/make-rpc-tcp-tunnel.d.ts +2 -2
  33. package/lib/client/tunnels/make-rpc-tcp-tunnel.js +49 -56
  34. package/lib/client/tunnels/make-rpc-tls-tunnel.d.ts +4 -3
  35. package/lib/client/tunnels/make-rpc-tls-tunnel.js +123 -131
  36. package/lib/client/utils/attestor-pool.d.ts +3 -1
  37. package/lib/client/utils/attestor-pool.js +21 -25
  38. package/lib/client/utils/client-socket.d.ts +4 -4
  39. package/lib/client/utils/client-socket.js +114 -94
  40. package/lib/client/utils/message-handler.d.ts +2 -2
  41. package/lib/client/utils/message-handler.js +89 -86
  42. package/lib/config/index.d.ts +6 -3
  43. package/lib/config/index.js +60 -37
  44. package/lib/external-rpc/benchmark.d.ts +1 -0
  45. package/lib/external-rpc/benchmark.js +82 -0
  46. package/lib/external-rpc/event-bus.d.ts +7 -0
  47. package/lib/external-rpc/event-bus.js +17 -0
  48. package/lib/external-rpc/global.d.js +0 -0
  49. package/lib/external-rpc/handle-incoming-msg.d.ts +2 -0
  50. package/lib/external-rpc/handle-incoming-msg.js +241 -0
  51. package/lib/external-rpc/index.d.ts +3 -0
  52. package/lib/external-rpc/index.js +3 -0
  53. package/lib/external-rpc/jsc-polyfills/1.d.ts +14 -0
  54. package/lib/external-rpc/jsc-polyfills/1.js +80 -0
  55. package/lib/external-rpc/jsc-polyfills/2.js +15 -0
  56. package/lib/external-rpc/jsc-polyfills/event.d.ts +10 -0
  57. package/lib/external-rpc/jsc-polyfills/event.js +19 -0
  58. package/lib/external-rpc/jsc-polyfills/index.d.ts +2 -0
  59. package/lib/external-rpc/jsc-polyfills/index.js +2 -0
  60. package/lib/external-rpc/jsc-polyfills/ws.d.ts +21 -0
  61. package/lib/external-rpc/jsc-polyfills/ws.js +83 -0
  62. package/lib/external-rpc/setup-browser.d.ts +6 -0
  63. package/lib/external-rpc/setup-browser.js +33 -0
  64. package/lib/external-rpc/setup-jsc.d.ts +24 -0
  65. package/lib/external-rpc/setup-jsc.js +22 -0
  66. package/lib/{window-rpc → external-rpc}/types.d.ts +56 -35
  67. package/lib/external-rpc/types.js +0 -0
  68. package/lib/external-rpc/utils.d.ts +20 -0
  69. package/lib/external-rpc/utils.js +100 -0
  70. package/lib/external-rpc/zk.d.ts +14 -0
  71. package/lib/external-rpc/zk.js +58 -0
  72. package/lib/index.d.ts +8 -9
  73. package/lib/index.js +12 -49
  74. package/lib/mechain/abis/governanceABI.js +460 -461
  75. package/lib/mechain/abis/taskABI.js +505 -506
  76. package/lib/mechain/client/create-claim-on-mechain.d.ts +3 -3
  77. package/lib/mechain/client/create-claim-on-mechain.js +31 -30
  78. package/lib/mechain/client/index.d.ts +1 -1
  79. package/lib/mechain/client/index.js +1 -18
  80. package/lib/mechain/constants/index.js +8 -7
  81. package/lib/mechain/index.d.ts +2 -2
  82. package/lib/mechain/index.js +2 -19
  83. package/lib/mechain/types/index.d.ts +2 -2
  84. package/lib/mechain/types/index.js +0 -3
  85. package/lib/proto/api.d.ts +182 -39
  86. package/lib/proto/api.js +4105 -3555
  87. package/lib/proto/tee-bundle.d.ts +156 -0
  88. package/lib/proto/tee-bundle.js +1296 -0
  89. package/lib/providers/http/index.d.ts +16 -1
  90. package/lib/providers/http/index.js +603 -576
  91. package/lib/providers/http/patch-parse5-tree.d.ts +6 -0
  92. package/lib/providers/http/patch-parse5-tree.js +34 -0
  93. package/lib/providers/http/utils.d.ts +7 -4
  94. package/lib/providers/http/utils.js +240 -317
  95. package/lib/providers/index.d.ts +1 -1
  96. package/lib/providers/index.js +5 -9
  97. package/lib/scripts/check-avs-registration.d.ts +1 -1
  98. package/lib/scripts/check-avs-registration.js +24 -25
  99. package/lib/scripts/fallbacks/crypto.d.ts +1 -0
  100. package/lib/scripts/fallbacks/crypto.js +4 -0
  101. package/lib/scripts/fallbacks/empty.d.ts +3 -0
  102. package/lib/scripts/fallbacks/empty.js +4 -0
  103. package/lib/scripts/fallbacks/re2.d.ts +1 -0
  104. package/lib/scripts/fallbacks/re2.js +7 -0
  105. package/lib/scripts/fallbacks/snarkjs.d.ts +1 -0
  106. package/lib/scripts/fallbacks/snarkjs.js +10 -0
  107. package/lib/scripts/fallbacks/stwo.d.ts +6 -0
  108. package/lib/scripts/fallbacks/stwo.js +159 -0
  109. package/lib/scripts/generate-provider-types.js +92 -73
  110. package/lib/scripts/generate-receipt.d.ts +2 -2
  111. package/lib/scripts/generate-receipt.js +94 -83
  112. package/lib/scripts/generate-toprf-keys.js +17 -16
  113. package/lib/scripts/jsc-cli-rpc.d.ts +1 -0
  114. package/lib/scripts/jsc-cli-rpc.js +35 -0
  115. package/lib/scripts/register-avs-operator.d.ts +1 -1
  116. package/lib/scripts/register-avs-operator.js +3 -7
  117. package/lib/scripts/start-server.d.ts +1 -1
  118. package/lib/scripts/start-server.js +9 -11
  119. package/lib/scripts/update-avs-metadata.d.ts +1 -1
  120. package/lib/scripts/update-avs-metadata.js +17 -19
  121. package/lib/scripts/utils.js +8 -9
  122. package/lib/scripts/whitelist-operator.d.ts +1 -1
  123. package/lib/scripts/whitelist-operator.js +13 -15
  124. package/lib/server/create-server.d.ts +3 -2
  125. package/lib/server/create-server.js +98 -85
  126. package/lib/server/handlers/claimTeeBundle.d.ts +6 -0
  127. package/lib/server/handlers/claimTeeBundle.js +232 -0
  128. package/lib/server/handlers/claimTunnel.d.ts +1 -1
  129. package/lib/server/handlers/claimTunnel.js +75 -73
  130. package/lib/server/handlers/completeClaimOnChain.d.ts +1 -1
  131. package/lib/server/handlers/completeClaimOnChain.js +27 -26
  132. package/lib/server/handlers/createClaimOnChain.d.ts +1 -1
  133. package/lib/server/handlers/createClaimOnChain.js +30 -29
  134. package/lib/server/handlers/createTaskOnMechain.d.ts +1 -1
  135. package/lib/server/handlers/createTaskOnMechain.js +54 -49
  136. package/lib/server/handlers/createTunnel.d.ts +1 -1
  137. package/lib/server/handlers/createTunnel.js +91 -94
  138. package/lib/server/handlers/disconnectTunnel.d.ts +1 -1
  139. package/lib/server/handlers/disconnectTunnel.js +6 -8
  140. package/lib/server/handlers/fetchCertificateBytes.d.ts +2 -0
  141. package/lib/server/handlers/fetchCertificateBytes.js +57 -0
  142. package/lib/server/handlers/index.d.ts +1 -1
  143. package/lib/server/handlers/index.js +24 -21
  144. package/lib/server/handlers/init.d.ts +1 -1
  145. package/lib/server/handlers/init.js +31 -34
  146. package/lib/server/handlers/toprf.d.ts +1 -1
  147. package/lib/server/handlers/toprf.js +17 -19
  148. package/lib/server/index.d.ts +4 -4
  149. package/lib/server/index.js +4 -21
  150. package/lib/server/socket.d.ts +7 -7
  151. package/lib/server/socket.js +104 -106
  152. package/lib/server/tunnels/make-tcp-tunnel.d.ts +5 -3
  153. package/lib/server/tunnels/make-tcp-tunnel.js +189 -162
  154. package/lib/server/utils/apm.d.ts +1 -1
  155. package/lib/server/utils/apm.js +26 -40
  156. package/lib/server/utils/assert-valid-claim-request.d.ts +6 -5
  157. package/lib/server/utils/assert-valid-claim-request.js +339 -185
  158. package/lib/server/utils/config-env.js +4 -7
  159. package/lib/server/utils/dns.js +18 -16
  160. package/lib/server/utils/gcp-attestation.d.ts +17 -0
  161. package/lib/server/utils/gcp-attestation.js +237 -0
  162. package/lib/server/utils/generics.d.ts +3 -3
  163. package/lib/server/utils/generics.js +37 -51
  164. package/lib/server/utils/iso.js +255 -256
  165. package/lib/server/utils/keep-alive.d.ts +2 -2
  166. package/lib/server/utils/keep-alive.js +36 -40
  167. package/lib/server/utils/nitro-attestation.d.ts +33 -0
  168. package/lib/server/utils/nitro-attestation.js +249 -0
  169. package/lib/server/utils/oprf-raw.d.ts +21 -0
  170. package/lib/server/utils/oprf-raw.js +61 -0
  171. package/lib/server/utils/process-handshake.d.ts +3 -3
  172. package/lib/server/utils/process-handshake.js +217 -175
  173. package/lib/server/utils/proxy-session.d.ts +1 -0
  174. package/lib/server/utils/proxy-session.js +6 -0
  175. package/lib/server/utils/tee-oprf-mpc-verification.d.ts +16 -0
  176. package/lib/server/utils/tee-oprf-mpc-verification.js +86 -0
  177. package/lib/server/utils/tee-oprf-verification.d.ts +24 -0
  178. package/lib/server/utils/tee-oprf-verification.js +151 -0
  179. package/lib/server/utils/tee-transcript-reconstruction.d.ts +24 -0
  180. package/lib/server/utils/tee-transcript-reconstruction.js +140 -0
  181. package/lib/server/utils/tee-verification.d.ts +28 -0
  182. package/lib/server/utils/tee-verification.js +358 -0
  183. package/lib/{utils → server/utils}/validation.d.ts +1 -1
  184. package/lib/server/utils/validation.js +45 -0
  185. package/lib/types/bgp.js +0 -3
  186. package/lib/types/claims.d.ts +7 -10
  187. package/lib/types/claims.js +0 -3
  188. package/lib/types/client.d.ts +5 -5
  189. package/lib/types/client.js +0 -3
  190. package/lib/types/general.d.ts +29 -4
  191. package/lib/types/general.js +0 -3
  192. package/lib/types/handlers.d.ts +3 -3
  193. package/lib/types/handlers.js +0 -3
  194. package/lib/types/index.d.ts +10 -10
  195. package/lib/types/index.js +10 -27
  196. package/lib/types/providers.d.ts +15 -4
  197. package/lib/types/providers.gen.d.ts +15 -1
  198. package/lib/types/providers.gen.js +15 -13
  199. package/lib/types/providers.js +0 -3
  200. package/lib/types/rpc.d.ts +2 -2
  201. package/lib/types/rpc.js +0 -3
  202. package/lib/types/signatures.js +0 -3
  203. package/lib/types/tunnel.d.ts +2 -2
  204. package/lib/types/tunnel.js +0 -3
  205. package/lib/types/zk.d.ts +17 -2
  206. package/lib/types/zk.js +0 -3
  207. package/lib/utils/auth.d.ts +2 -1
  208. package/lib/utils/auth.js +66 -59
  209. package/lib/utils/b64-json.js +13 -19
  210. package/lib/utils/bgp-listener.d.ts +1 -1
  211. package/lib/utils/bgp-listener.js +111 -114
  212. package/lib/utils/claims.d.ts +3 -3
  213. package/lib/utils/claims.js +78 -101
  214. package/lib/utils/env.js +15 -16
  215. package/lib/utils/error.d.ts +6 -7
  216. package/lib/utils/error.js +50 -39
  217. package/lib/utils/generics.d.ts +15 -13
  218. package/lib/utils/generics.js +217 -297
  219. package/lib/utils/http-parser.d.ts +1 -1
  220. package/lib/utils/http-parser.js +186 -237
  221. package/lib/utils/index.d.ts +13 -12
  222. package/lib/utils/index.js +13 -29
  223. package/lib/utils/logger.d.ts +1 -1
  224. package/lib/utils/logger.js +69 -87
  225. package/lib/utils/prepare-packets.d.ts +3 -3
  226. package/lib/utils/prepare-packets.js +66 -58
  227. package/lib/utils/redactions.d.ts +20 -1
  228. package/lib/utils/redactions.js +116 -129
  229. package/lib/utils/retries.d.ts +1 -1
  230. package/lib/utils/retries.js +24 -26
  231. package/lib/utils/signatures/eth.d.ts +1 -1
  232. package/lib/utils/signatures/eth.js +28 -30
  233. package/lib/utils/signatures/index.d.ts +3 -3
  234. package/lib/utils/signatures/index.js +11 -10
  235. package/lib/utils/socket-base.d.ts +6 -5
  236. package/lib/utils/socket-base.js +89 -88
  237. package/lib/utils/tls.d.ts +1 -1
  238. package/lib/utils/tls.js +54 -28
  239. package/lib/utils/ws.d.ts +1 -6
  240. package/lib/utils/ws.js +17 -33
  241. package/lib/utils/zk.d.ts +28 -12
  242. package/lib/utils/zk.js +587 -406
  243. package/package.json +72 -60
  244. package/lib/avs/tests/test.operator.d.ts +0 -11
  245. package/lib/avs/tests/test.operator.js +0 -313
  246. package/lib/avs/tests/utils.d.ts +0 -2
  247. package/lib/avs/tests/utils.js +0 -50
  248. package/lib/scripts/verify-root-ca.d.ts +0 -1
  249. package/lib/scripts/verify-root-ca.js +0 -51
  250. package/lib/tests/describe-with-server.d.ts +0 -20
  251. package/lib/tests/describe-with-server.js +0 -64
  252. package/lib/tests/mock-provider-server.d.ts +0 -13
  253. package/lib/tests/mock-provider-server.js +0 -65
  254. package/lib/tests/mocks.d.ts +0 -4
  255. package/lib/tests/mocks.js +0 -23
  256. package/lib/tests/test.auth.js +0 -75
  257. package/lib/tests/test.bgp-listener.js +0 -169
  258. package/lib/tests/test.claim-creation.js +0 -280
  259. package/lib/tests/test.http-parser.d.ts +0 -1
  260. package/lib/tests/test.http-parser.js +0 -120
  261. package/lib/tests/test.http-provider-utils.js +0 -2416
  262. package/lib/tests/test.http-provider.d.ts +0 -1
  263. package/lib/tests/test.http-provider.js +0 -114
  264. package/lib/tests/test.rpc-communication.d.ts +0 -1
  265. package/lib/tests/test.rpc-communication.js +0 -64
  266. package/lib/tests/test.rpc-tunnel.d.ts +0 -1
  267. package/lib/tests/test.rpc-tunnel.js +0 -172
  268. package/lib/tests/test.signatures.d.ts +0 -1
  269. package/lib/tests/test.signatures.js +0 -24
  270. package/lib/tests/test.tcp-tunnel.d.ts +0 -1
  271. package/lib/tests/test.tcp-tunnel.js +0 -64
  272. package/lib/tests/test.zk.d.ts +0 -1
  273. package/lib/tests/test.zk.js +0 -337
  274. package/lib/tests/utils.d.ts +0 -18
  275. package/lib/tests/utils.js +0 -64
  276. package/lib/utils/atomic-operations.d.ts +0 -24
  277. package/lib/utils/atomic-operations.js +0 -65
  278. package/lib/utils/benchmark.d.ts +0 -1
  279. package/lib/utils/benchmark.js +0 -70
  280. package/lib/utils/connection-state-machine.d.ts +0 -43
  281. package/lib/utils/connection-state-machine.js +0 -129
  282. package/lib/utils/resource-monitor.d.ts +0 -61
  283. package/lib/utils/resource-monitor.js +0 -107
  284. package/lib/utils/validation.js +0 -46
  285. package/lib/window-rpc/index.d.ts +0 -3
  286. package/lib/window-rpc/index.js +0 -20
  287. package/lib/window-rpc/setup-window-rpc.d.ts +0 -5
  288. package/lib/window-rpc/setup-window-rpc.js +0 -291
  289. package/lib/window-rpc/types.js +0 -3
  290. package/lib/window-rpc/utils.d.ts +0 -14
  291. package/lib/window-rpc/utils.js +0 -102
  292. package/lib/window-rpc/window-rpc-zk.d.ts +0 -15
  293. package/lib/window-rpc/window-rpc-zk.js +0 -85
  294. /package/lib/{tests/test.auth.d.ts → external-rpc/jsc-polyfills/2.d.ts} +0 -0
  295. /package/lib/{tests/test.bgp-listener.d.ts → scripts/build-browser.d.ts} +0 -0
  296. /package/lib/{tests/test.claim-creation.d.ts → scripts/build-jsc.d.ts} +0 -0
  297. /package/lib/{tests/test.http-provider-utils.d.ts → scripts/build-lib.d.ts} +0 -0
@@ -9,6 +9,10 @@ export interface HttpProviderParameters {
9
9
  * Specify the geographical location from where to proxy the request. 2-letter ISO country code or parameter (public or secret)
10
10
  */
11
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;
12
16
  /**
13
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
14
18
  */
@@ -74,7 +78,7 @@ export interface HttpProviderParameters {
74
78
  * Eg. if hash is enabled, the original value is "hello", and hashed is "a1b2c", then the attestor will only see "a1b2c".
75
79
  * Note: if a regex with named groups is provided, only the named groups will be hashed.
76
80
  */
77
- hash?: "oprf";
81
+ hash?: "oprf" | "oprf-mpc" | "oprf-raw";
78
82
  }[];
79
83
  /**
80
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
@@ -102,6 +106,11 @@ export declare const HttpProviderParametersJson: {
102
106
  nullable: boolean;
103
107
  description: string;
104
108
  };
109
+ proxySessionId: {
110
+ type: string;
111
+ nullable: boolean;
112
+ description: string;
113
+ };
105
114
  headers: {
106
115
  type: string;
107
116
  description: string;
@@ -289,6 +298,11 @@ export declare const PROVIDER_SCHEMAS: {
289
298
  nullable: boolean;
290
299
  description: string;
291
300
  };
301
+ proxySessionId: {
302
+ type: string;
303
+ nullable: boolean;
304
+ description: string;
305
+ };
292
306
  headers: {
293
307
  type: string;
294
308
  description: string;
@@ -1,14 +1,16 @@
1
- "use strict";
2
- /* eslint-disable */
3
- /* Generated file. Do not edit */
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.PROVIDER_SCHEMAS = exports.HttpProviderSecretParametersJson = exports.HttpProviderParametersJson = void 0;
6
- exports.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)" }, "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.\nIf the hash function produces more bytes than the original value, the hash will be truncated.\nEg. if hash is enabled, the original value is \"hello\", and hashed is \"a1b2c\", then the attestor will only see \"a1b2c\".\nNote: if a regex with named groups is provided, only the named groups will be hashed.", "enum": ["oprf"] } }, "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 };
7
- exports.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 };
8
- exports.PROVIDER_SCHEMAS = {
9
- http: {
10
- parameters: exports.HttpProviderParametersJson,
11
- secretParameters: exports.HttpProviderSecretParametersJson
12
- },
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
13
16
  };
14
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvdmlkZXJzLmdlbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90eXBlcy9wcm92aWRlcnMuZ2VuLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxvQkFBb0I7QUFDcEIsaUNBQWlDOzs7QUF5RnBCLFFBQUEsMEJBQTBCLEdBQUcsRUFBQyxPQUFPLE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QVMsRUFBQyxFQUFDLE1BQU0sRUFBQyxRQUFRLEVBQUMsYUFBYSxFQUFDLGtEQUFrRCxFQUFDLHNCQUFzQixFQUFDLEVBQUMsTUFBTSxFQUFDLFFBQVEsRUFBQyxFQUFDLEVBQUMsYUFBYSxFQUFDLEVBQUMsTUFBTSxFQUFDLFFBQVEsRUFBQyxhQUFhLEVBQUMsb0lBQW9JLEVBQUMsc0JBQXNCLEVBQUMsRUFBQyxNQUFNLEVBQUMsUUFBUSxFQUFDLEVBQUMsRUFBQyxFQUFDLHNCQUFzQixFQUFDLEtBQUssRUFBQyxDQUFBO0FBUTV3QixRQUFBLGdCQUFnQixHQUFHO0lBQy9CLElBQUksRUFBRTtRQUNMLFVBQVUsRUFBRSxrQ0FBMEI7UUFDdEMsZ0JBQWdCLEVBQUUsd0NBQWdDO0tBQ2xEO0NBQ0QsQ0FBQSJ9
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvdmlkZXJzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3R5cGVzL3Byb3ZpZGVycy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0=
@@ -1,5 +1,5 @@
1
- import type { RPCMessage, TunnelDisconnectEvent, TunnelMessage } from '../proto/api';
2
- import type { AttestorError } from '../utils/error';
1
+ import type { RPCMessage, TunnelDisconnectEvent, TunnelMessage } from '#src/proto/api.ts';
2
+ import type { AttestorError } from '#src/utils/error.ts';
3
3
  type ExtractPrefix<T, S extends string> = T extends `${infer _}${S}` ? _ : never;
4
4
  export type RPCType = ExtractPrefix<keyof RPCMessage, 'Request'>;
5
5
  type RPCRequestType<T extends RPCType> = `${T}Request`;
package/lib/types/rpc.js CHANGED
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicnBjLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3R5cGVzL3JwYy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0=
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2lnbmF0dXJlcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90eXBlcy9zaWduYXR1cmVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIifQ==
@@ -1,4 +1,4 @@
1
- import type { CreateTunnelRequest } from '../proto/api';
1
+ import type { CreateTunnelRequest } from '#src/proto/api.ts';
2
2
  export type MakeTunnelBaseOpts<O> = O & {
3
3
  onClose?(err?: Error): void;
4
4
  onMessage?(data: Uint8Array): void;
@@ -14,5 +14,5 @@ export type Transcript<T> = {
14
14
  }[];
15
15
  export type TCPSocketProperties = {
16
16
  transcript: Transcript<Uint8Array>;
17
- createRequest: Pick<CreateTunnelRequest, 'host' | 'port' | 'geoLocation'>;
17
+ createRequest: Pick<CreateTunnelRequest, 'host' | 'port' | 'geoLocation' | 'proxySessionId'>;
18
18
  };
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHVubmVsLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3R5cGVzL3R1bm5lbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0=
package/lib/types/zk.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { EncryptionAlgorithm, OPRFOperator, ZKEngine, ZKOperator } from '@reclaimprotocol/zk-symmetric-crypto';
2
- import { TOPRFPayload } from '../proto/api';
1
+ import type { EncryptionAlgorithm, OPRFOperator, ZKEngine, ZKOperator } from '@reclaimprotocol/zk-symmetric-crypto';
2
+ import type { TOPRFPayload } from '#src/proto/api.ts';
3
3
  export type ZKOperators = {
4
4
  [E in EncryptionAlgorithm]?: ZKOperator;
5
5
  };
@@ -20,4 +20,19 @@ export type PrepareZKProofsBaseOpts = {
20
20
  export type TOPRFProofParams = TOPRFPayload & {
21
21
  mask: Uint8Array;
22
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
+ };
23
38
  };
package/lib/types/zk.js CHANGED
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiemsuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdHlwZXMvemsudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9
@@ -1,4 +1,5 @@
1
- import { AuthenticatedUserData, AuthenticationRequest, ServiceSignatureType } from '../proto/api';
1
+ import type { AuthenticationRequest, ServiceSignatureType } from '#src/proto/api.ts';
2
+ import { AuthenticatedUserData } from '#src/proto/api.ts';
2
3
  export declare function assertValidAuthRequest(request: AuthenticationRequest | undefined, signatureType: ServiceSignatureType): Promise<void>;
3
4
  /**
4
5
  * Create an authentication request with the given data and private key,
package/lib/utils/auth.js CHANGED
@@ -1,64 +1,71 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.assertValidAuthRequest = assertValidAuthRequest;
4
- exports.createAuthRequest = createAuthRequest;
5
- const ethers_1 = require("ethers");
6
- const config_1 = require("../config");
7
- const api_1 = require("../proto/api");
8
- const env_1 = require("../utils/env");
9
- const error_1 = require("../utils/error");
10
- const generics_1 = require("../utils/generics");
11
- const signatures_1 = require("../utils/signatures");
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";
12
8
  async function assertValidAuthRequest(request, signatureType) {
13
- const publicKey = (0, env_1.getEnvVariable)('AUTHENTICATION_PUBLIC_KEY');
14
- // nothing to verify
15
- if (!request) {
16
- // if pub key is provided -- but user didn't attempt to
17
- // authenticate, then we should throw an error
18
- if (publicKey) {
19
- throw new error_1.AttestorError('ERROR_AUTHENTICATION_FAILED', 'User must be authenticated');
20
- }
21
- return;
22
- }
23
- if (!publicKey) {
24
- throw new error_1.AttestorError('ERROR_BAD_REQUEST', 'The attestor is not configured for authentication');
25
- }
26
- const { signature, data } = request;
27
- if (!data) {
28
- throw new error_1.AttestorError('ERROR_AUTHENTICATION_FAILED', 'Missing data in auth request');
29
- }
30
- if (data.expiresAt < (0, generics_1.unixTimestampSeconds)()) {
31
- throw new error_1.AttestorError('ERROR_AUTHENTICATION_FAILED', 'Authentication request has expired');
32
- }
33
- const proto = api_1.AuthenticatedUserData.encode(data).finish();
34
- const signatureAlg = signatures_1.SIGNATURES[signatureType];
35
- const address = signatureAlg.getAddress(await ethers_1.ethers.utils.arrayify(publicKey));
36
- const verified = await signatureAlg
37
- .verify(proto, signature, address);
38
- if (!verified) {
39
- throw new error_1.AttestorError('ERROR_AUTHENTICATION_FAILED', 'Signature verification failed');
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
+ );
40
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
+ }
41
50
  }
42
- /**
43
- * Create an authentication request with the given data and private key,
44
- * which can then be used to authenticate with the service.
45
- */
46
51
  async function createAuthRequest(_data, privateKey) {
47
- const createdAt = (0, generics_1.unixTimestampSeconds)();
48
- const data = {
49
- createdAt,
50
- expiresAt: createdAt + config_1.DEFAULT_AUTH_EXPIRY_S,
51
- id: '',
52
- hostWhitelist: [],
53
- ..._data,
54
- };
55
- const proto = api_1.AuthenticatedUserData.encode(data).finish();
56
- const signature = await signatures_1.SelectedServiceSignature
57
- .sign(proto, privateKey);
58
- const request = {
59
- data,
60
- signature
61
- };
62
- return request;
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;
63
67
  }
64
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXV0aC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9hdXRoLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBUUEsd0RBc0RDO0FBTUQsOENBcUJDO0FBekZELG1DQUErQjtBQUMvQix1Q0FBa0Q7QUFDbEQsdUNBQWtHO0FBQ2xHLHVDQUE4QztBQUM5QywyQ0FBK0M7QUFDL0MsaURBQXlEO0FBQ3pELHFEQUEyRTtBQUVwRSxLQUFLLFVBQVUsc0JBQXNCLENBQzNDLE9BQTBDLEVBQzFDLGFBQW1DO0lBRW5DLE1BQU0sU0FBUyxHQUFHLElBQUEsb0JBQWMsRUFBQywyQkFBMkIsQ0FBQyxDQUFBO0lBQzdELG9CQUFvQjtJQUNwQixJQUFHLENBQUMsT0FBTyxFQUFFLENBQUM7UUFDYix1REFBdUQ7UUFDdkQsOENBQThDO1FBQzlDLElBQUcsU0FBUyxFQUFFLENBQUM7WUFDZCxNQUFNLElBQUkscUJBQWEsQ0FDdEIsNkJBQTZCLEVBQzdCLDRCQUE0QixDQUM1QixDQUFBO1FBQ0YsQ0FBQztRQUVELE9BQU07SUFDUCxDQUFDO0lBRUQsSUFBRyxDQUFDLFNBQVMsRUFBRSxDQUFDO1FBQ2YsTUFBTSxJQUFJLHFCQUFhLENBQ3RCLG1CQUFtQixFQUNuQixtREFBbUQsQ0FDbkQsQ0FBQTtJQUNGLENBQUM7SUFFRCxNQUFNLEVBQUUsU0FBUyxFQUFFLElBQUksRUFBRSxHQUFHLE9BQU8sQ0FBQTtJQUNuQyxJQUFHLENBQUMsSUFBSSxFQUFFLENBQUM7UUFDVixNQU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BRTtRQUNOLGFBQWEsRUFBRSxFQUFFO1FBQ2pCLEdBQUcsS0FBSztLQUNSLENBQUE7SUFDRCxNQUFNLEtBQUssR0FBRywyQkFBcUIsQ0FBQyxNQUFNLENBQUMsSUFBSSxDQUFDLENBQUMsTUFBTSxFQUFFLENBQUE7SUFDekQsTUFBTSxTQUFTLEdBQUcsTUFBTSxxQ0FBd0I7U0FDOUMsSUFBSSxDQUFDLEtBQUssRUFBRSxVQUFVLENBQUMsQ0FBQTtJQUN6QixNQUFNLE9BQU8sR0FBMEI7UUFDdEMsSUFBSTtRQUNKLFNBQVM7S0FDVCxDQUFBO0lBRUQsT0FBTyxPQUFPLENBQUE7QUFDZixDQUFDIn0=
68
+ export {
69
+ assertValidAuthRequest,
70
+ createAuthRequest
71
+ };
@@ -1,23 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.B64_JSON_REVIVER = exports.B64_JSON_REPLACER = void 0;
4
- const utils_1 = require("ethers/lib/utils");
1
+ import { decodeBase64, encodeBase64 } from "ethers";
5
2
  const B64_JSON_REPLACER = (key, value) => {
6
- if (value instanceof Uint8Array
7
- || (typeof value === 'object'
8
- && value
9
- && 'buffer' in value
10
- && value.buffer instanceof ArrayBuffer)) {
11
- return { type: 'uint8array', value: utils_1.base64.encode(value) };
12
- }
13
- return value;
3
+ if (value instanceof Uint8Array || typeof value === "object" && value && "buffer" in value && value.buffer instanceof ArrayBuffer) {
4
+ return { type: "uint8array", value: encodeBase64(value) };
5
+ }
6
+ return value;
14
7
  };
15
- exports.B64_JSON_REPLACER = B64_JSON_REPLACER;
16
8
  const B64_JSON_REVIVER = (key, value) => {
17
- if ((value === null || value === void 0 ? void 0 : value.type) === 'uint8array') {
18
- return utils_1.base64.decode(value.value);
19
- }
20
- return value;
9
+ if (value?.type === "uint8array") {
10
+ return decodeBase64(value.value);
11
+ }
12
+ return value;
13
+ };
14
+ export {
15
+ B64_JSON_REPLACER,
16
+ B64_JSON_REVI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@
1
1
  import type { Logger } from 'pino';
2
- import { BGPListener } from '../types';
2
+ import type { BGPListener } from '#src/types/index.ts';
3
3
  /**
4
4
  * Listens for BGP announcements and emits events whenever
5
5
  * an announcement overlaps with a target IP.
@@ -1,126 +1,123 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createBgpListener = createBgpListener;
7
- const ip_cidr_1 = __importDefault(require("ip-cidr"));
8
- const config_1 = require("../config");
9
- const ws_1 = require("../utils/ws");
10
- const ANNOUNCEMENT_OVERLAP = 'announcement-overlap';
1
+ import CIDR from "ip-cidr";
2
+ import { BGP_WS_URL } from "../config/index.js";
3
+ import { makeWebSocket } from "../utils/ws.js";
4
+ const ANNOUNCEMENT_OVERLAP = "announcement-overlap";
11
5
  class BGPAnnouncementOverlapEvent extends Event {
12
- constructor(data) {
13
- super(ANNOUNCEMENT_OVERLAP);
14
- this.data = data;
15
- }
6
+ data;
7
+ constructor(data) {
8
+ super(ANNOUNCEMENT_OVERLAP);
9
+ this.data = data;
10
+ }
16
11
  }
17
- /**
18
- * Listens for BGP announcements and emits events whenever
19
- * an announcement overlaps with a target IP.
20
- */
21
12
  function createBgpListener(logger) {
22
- let ws;
23
- let closed = false;
24
- const targetIps = new Set();
25
- const eventTarget = new EventTarget();
26
- openWs();
27
- return {
28
- onOverlap(ips, callback) {
29
- for (const ip of ips) {
30
- targetIps.add(ip);
31
- }
32
- eventTarget.addEventListener(ANNOUNCEMENT_OVERLAP, _callback);
33
- return () => {
34
- for (const ip of ips) {
35
- targetIps.delete(ip);
36
- }
37
- eventTarget.removeEventListener(ANNOUNCEMENT_OVERLAP, _callback);
38
- };
39
- function _callback(event) {
40
- callback(event.data);
41
- }
42
- },
43
- close() {
44
- ws.onclose = null;
45
- ws.onerror = null;
46
- ws.close();
47
- closed = true;
13
+ let ws;
14
+ let closed = false;
15
+ const targetIps = /* @__PURE__ */ new Set();
16
+ const eventTarget = new EventTarget();
17
+ openWs();
18
+ return {
19
+ onOverlap(ips, callback) {
20
+ for (const ip of ips) {
21
+ targetIps.add(ip);
22
+ }
23
+ eventTarget.addEventListener(
24
+ ANNOUNCEMENT_OVERLAP,
25
+ _callback
26
+ );
27
+ return () => {
28
+ for (const ip of ips) {
29
+ targetIps.delete(ip);
48
30
  }
31
+ eventTarget.removeEventListener(
32
+ ANNOUNCEMENT_OVERLAP,
33
+ _callback
34
+ );
35
+ };
36
+ function _callback(event) {
37
+ callback(event.data);
38
+ }
39
+ },
40
+ close() {
41
+ ws.onclose = null;
42
+ ws.onerror = null;
43
+ ws.close();
44
+ closed = true;
45
+ }
46
+ };
47
+ function openWs() {
48
+ logger.debug("connecting to BGP websocket");
49
+ ws = makeWebSocket(BGP_WS_URL);
50
+ ws.onopen = onOpen;
51
+ ws.onerror = (ev) => onClose(ev);
52
+ ws.onclose = () => onClose(new Error("Unexpected close"));
53
+ ws.onmessage = ({ data }) => {
54
+ const str = typeof data === "string" ? data : data.toString();
55
+ try {
56
+ onMessage(str);
57
+ } catch (err) {
58
+ logger.error({ data, err }, "error processing BGP message");
59
+ }
49
60
  };
50
- function openWs() {
51
- logger.debug('connecting to BGP websocket');
52
- ws = (0, ws_1.makeWebSocket)(config_1.BGP_WS_URL);
53
- ws.onopen = onOpen;
54
- ws.onerror = (err) => onClose(err);
55
- ws.onclose = () => onClose(new Error('Unexpected close'));
56
- ws.onmessage = ({ data }) => {
57
- const str = typeof data === 'string' ? data : data.toString();
58
- try {
59
- onMessage(str);
60
- }
61
- catch (err) {
62
- logger.error({ data, err }, 'error processing BGP message');
63
- }
64
- };
61
+ }
62
+ function onOpen() {
63
+ const subscriptionMessage = {
64
+ type: "ris_subscribe",
65
+ data: {
66
+ type: "UPDATE"
67
+ }
68
+ };
69
+ ws.send(JSON.stringify(subscriptionMessage));
70
+ logger.info("connected to BGP websocket");
71
+ }
72
+ function onClose(err) {
73
+ if (closed) {
74
+ return;
65
75
  }
66
- function onOpen() {
67
- const subscriptionMessage = {
68
- type: 'ris_subscribe',
69
- data: {
70
- type: 'UPDATE',
71
- },
72
- };
73
- ws.send(JSON.stringify(subscriptionMessage));
74
- logger.info('connected to BGP websocket');
76
+ logger.info({ err }, "BGP websocket closed");
77
+ if (!err) {
78
+ return;
75
79
  }
76
- function onClose(err) {
77
- if (closed) {
78
- return;
79
- }
80
- logger.info({ err }, 'BGP websocket closed');
81
- if (!err) {
82
- return;
83
- }
84
- logger.info('reconnecting to BGP websocket');
85
- openWs();
80
+ logger.info("reconnecting to BGP websocket");
81
+ openWs();
82
+ }
83
+ function onMessage(message) {
84
+ const data = JSON.parse(message);
85
+ const announcements = data?.data?.announcements;
86
+ logger.trace({ data }, "got BGP update");
87
+ if (!Array.isArray(announcements)) {
88
+ return;
86
89
  }
87
- function onMessage(message) {
88
- var _a, _b;
89
- const data = JSON.parse(message);
90
- const announcements = (_a = data === null || data === void 0 ? void 0 : data.data) === null || _a === void 0 ? void 0 : _a.announcements;
91
- logger.trace({ data }, 'got BGP update');
92
- if (!Array.isArray(announcements)) {
93
- return;
94
- }
95
- const asPath = (_b = data === null || data === void 0 ? void 0 : data.data) === null || _b === void 0 ? void 0 : _b.path;
96
- for (const announcement of announcements) {
97
- const prefixes = announcement === null || announcement === void 0 ? void 0 : announcement.prefixes;
98
- const nextHop = announcement === null || announcement === void 0 ? void 0 : announcement['next_hop'];
99
- const hasPrefixes = (prefixes === null || prefixes === void 0 ? void 0 : prefixes.length) && (nextHop || asPath);
100
- if (!hasPrefixes) {
101
- return;
102
- }
103
- for (const prefix of prefixes) {
104
- if (!overlapsTargetIps(prefix)) {
105
- continue;
106
- }
107
- // emit event
108
- eventTarget.dispatchEvent(new BGPAnnouncementOverlapEvent({ prefix }));
109
- }
90
+ const asPath = data?.data?.path;
91
+ for (const announcement of announcements) {
92
+ const prefixes = announcement?.prefixes;
93
+ const nextHop = announcement?.["next_hop"];
94
+ const hasPrefixes = prefixes?.length && (nextHop || asPath);
95
+ if (!hasPrefixes) {
96
+ return;
97
+ }
98
+ for (const prefix of prefixes) {
99
+ if (!overlapsTargetIps(prefix)) {
100
+ continue;
110
101
  }
102
+ eventTarget.dispatchEvent(
103
+ new BGPAnnouncementOverlapEvent({ prefix })
104
+ );
105
+ }
111
106
  }
112
- function overlapsTargetIps(prefix) {
113
- // ignore all prefixes that end with /0
114
- if (prefix.endsWith('/0')) {
115
- return false;
116
- }
117
- const cidr = new ip_cidr_1.default(prefix);
118
- for (const ip of targetIps) {
119
- if (cidr.contains(ip)) {
120
- return true;
121
- }
122
- }
123
- return false;
107
+ }
108
+ function overlapsTargetIps(prefix) {
109
+ if (prefix.endsWith("/0")) {
110
+ return false;
111
+ }
112
+ const cidr = new CIDR(prefix);
113
+ for (const ip of targetIps) {
114
+ if (cidr.contains(ip)) {
115
+ return true;
116
+ }
124
117
  }
118
+ return false;
119
+ }
125
120
  }
126
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmdwLWxpc3RlbmVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3V0aWxzL2JncC1saXN0ZW5lci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQWtCQSw4Q0F1SUM7QUF6SkQsc0RBQTBCO0FBRTFCLHVDQUF1QztBQUV2QyxxQ0FBNEM7QUFFNUMsTUFBTSxvQkFBb0IsR0FBRyxzQkFBc0IsQ0FBQTtBQUVuRCxNQUFNLDJCQUE0QixTQUFRLEtBQUs7SUFDOUMsWUFBNEIsSUFBZ0M7UUFDM0QsS0FBSyxDQUFDLG9CQUFvQixDQUFDLENBQUE7UUFEQSxTQUFJLEdBQUosSUFBSSxDQUE0QjtJQUU1RCxDQUFDO0NBQ0Q7QUFFRDs7O0dBR0c7QUFDSCxTQUFnQixpQkFBaUIsQ0FBQyxNQUFjO0lBQy9DLElBQUksRUFB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