@reclaimprotocol/attestor-core 5.0.1-beta.13 → 5.0.1-beta.16

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 (134) hide show
  1. package/lib/external-rpc/index.js +17321 -3
  2. package/lib/index.d.ts +1 -0
  3. package/lib/index.js +15391 -11
  4. package/lib/scripts/build-browser-debug.d.ts +1 -0
  5. package/package.json +1 -1
  6. package/lib/avs/abis/avsDirectoryABI.js +0 -343
  7. package/lib/avs/abis/delegationABI.js +0 -4
  8. package/lib/avs/abis/registryABI.js +0 -728
  9. package/lib/avs/client/create-claim-on-avs.js +0 -168
  10. package/lib/avs/config.js +0 -26
  11. package/lib/avs/contracts/ReclaimServiceManager.js +0 -0
  12. package/lib/avs/contracts/common.js +0 -0
  13. package/lib/avs/contracts/factories/ReclaimServiceManager__factory.js +0 -1183
  14. package/lib/avs/contracts/factories/index.js +0 -4
  15. package/lib/avs/contracts/index.js +0 -6
  16. package/lib/avs/types/index.js +0 -0
  17. package/lib/avs/utils/contracts.js +0 -53
  18. package/lib/avs/utils/register.js +0 -74
  19. package/lib/avs/utils/tasks.js +0 -48
  20. package/lib/client/create-claim.js +0 -461
  21. package/lib/client/index.js +0 -3
  22. package/lib/client/tunnels/make-rpc-tcp-tunnel.js +0 -53
  23. package/lib/client/tunnels/make-rpc-tls-tunnel.js +0 -127
  24. package/lib/client/utils/attestor-pool.js +0 -24
  25. package/lib/client/utils/client-socket.js +0 -120
  26. package/lib/client/utils/message-handler.js +0 -97
  27. package/lib/config/index.js +0 -62
  28. package/lib/external-rpc/benchmark.js +0 -82
  29. package/lib/external-rpc/event-bus.js +0 -17
  30. package/lib/external-rpc/handle-incoming-msg.js +0 -241
  31. package/lib/external-rpc/jsc-polyfills/1.js +0 -80
  32. package/lib/external-rpc/jsc-polyfills/2.js +0 -15
  33. package/lib/external-rpc/jsc-polyfills/event.js +0 -19
  34. package/lib/external-rpc/jsc-polyfills/index.js +0 -2
  35. package/lib/external-rpc/jsc-polyfills/ws.js +0 -83
  36. package/lib/external-rpc/setup-browser.js +0 -33
  37. package/lib/external-rpc/setup-jsc.js +0 -22
  38. package/lib/external-rpc/types.js +0 -0
  39. package/lib/external-rpc/utils.js +0 -100
  40. package/lib/external-rpc/zk.js +0 -58
  41. package/lib/mechain/abis/governanceABI.js +0 -461
  42. package/lib/mechain/abis/taskABI.js +0 -512
  43. package/lib/mechain/client/create-claim-on-mechain.js +0 -33
  44. package/lib/mechain/client/index.js +0 -1
  45. package/lib/mechain/constants/index.js +0 -8
  46. package/lib/mechain/index.js +0 -2
  47. package/lib/mechain/types/index.js +0 -0
  48. package/lib/proto/api.js +0 -4250
  49. package/lib/proto/tee-bundle.js +0 -1296
  50. package/lib/providers/http/index.js +0 -640
  51. package/lib/providers/http/patch-parse5-tree.js +0 -34
  52. package/lib/providers/http/utils.js +0 -283
  53. package/lib/providers/index.js +0 -7
  54. package/lib/scripts/build-browser.js +0 -38
  55. package/lib/scripts/build-jsc.js +0 -47
  56. package/lib/scripts/build-lib.js +0 -47
  57. package/lib/scripts/check-avs-registration.js +0 -28
  58. package/lib/scripts/fallbacks/crypto.js +0 -4
  59. package/lib/scripts/fallbacks/empty.js +0 -4
  60. package/lib/scripts/fallbacks/re2.js +0 -7
  61. package/lib/scripts/fallbacks/snarkjs.js +0 -10
  62. package/lib/scripts/fallbacks/stwo.js +0 -159
  63. package/lib/scripts/generate-provider-types.js +0 -101
  64. package/lib/scripts/generate-receipt.js +0 -101
  65. package/lib/scripts/generate-toprf-keys.js +0 -24
  66. package/lib/scripts/jsc-cli-rpc.js +0 -35
  67. package/lib/scripts/register-avs-operator.js +0 -3
  68. package/lib/scripts/start-server.js +0 -11
  69. package/lib/scripts/update-avs-metadata.js +0 -20
  70. package/lib/scripts/utils.js +0 -10
  71. package/lib/scripts/whitelist-operator.js +0 -16
  72. package/lib/server/create-server.js +0 -105
  73. package/lib/server/handlers/claimTeeBundle.js +0 -232
  74. package/lib/server/handlers/claimTunnel.js +0 -80
  75. package/lib/server/handlers/completeClaimOnChain.js +0 -29
  76. package/lib/server/handlers/createClaimOnChain.js +0 -32
  77. package/lib/server/handlers/createTaskOnMechain.js +0 -57
  78. package/lib/server/handlers/createTunnel.js +0 -98
  79. package/lib/server/handlers/disconnectTunnel.js +0 -8
  80. package/lib/server/handlers/fetchCertificateBytes.js +0 -57
  81. package/lib/server/handlers/index.js +0 -25
  82. package/lib/server/handlers/init.js +0 -33
  83. package/lib/server/handlers/toprf.js +0 -19
  84. package/lib/server/index.js +0 -4
  85. package/lib/server/socket.js +0 -112
  86. package/lib/server/tunnels/make-tcp-tunnel.js +0 -202
  87. package/lib/server/utils/apm.js +0 -29
  88. package/lib/server/utils/assert-valid-claim-request.js +0 -354
  89. package/lib/server/utils/config-env.js +0 -4
  90. package/lib/server/utils/dns.js +0 -24
  91. package/lib/server/utils/gcp-attestation.js +0 -237
  92. package/lib/server/utils/generics.js +0 -45
  93. package/lib/server/utils/iso.js +0 -259
  94. package/lib/server/utils/keep-alive.js +0 -38
  95. package/lib/server/utils/nitro-attestation.js +0 -249
  96. package/lib/server/utils/oprf-raw.js +0 -61
  97. package/lib/server/utils/process-handshake.js +0 -233
  98. package/lib/server/utils/proxy-session.js +0 -6
  99. package/lib/server/utils/tee-oprf-mpc-verification.js +0 -86
  100. package/lib/server/utils/tee-oprf-verification.js +0 -151
  101. package/lib/server/utils/tee-transcript-reconstruction.js +0 -140
  102. package/lib/server/utils/tee-verification.js +0 -358
  103. package/lib/server/utils/validation.js +0 -45
  104. package/lib/types/bgp.js +0 -0
  105. package/lib/types/claims.js +0 -0
  106. package/lib/types/client.js +0 -0
  107. package/lib/types/general.js +0 -0
  108. package/lib/types/handlers.js +0 -0
  109. package/lib/types/index.js +0 -10
  110. package/lib/types/providers.gen.js +0 -16
  111. package/lib/types/providers.js +0 -0
  112. package/lib/types/rpc.js +0 -0
  113. package/lib/types/signatures.js +0 -0
  114. package/lib/types/tunnel.js +0 -0
  115. package/lib/types/zk.js +0 -0
  116. package/lib/utils/auth.js +0 -71
  117. package/lib/utils/b64-json.js +0 -17
  118. package/lib/utils/bgp-listener.js +0 -123
  119. package/lib/utils/claims.js +0 -89
  120. package/lib/utils/env.js +0 -19
  121. package/lib/utils/error.js +0 -54
  122. package/lib/utils/generics.js +0 -268
  123. package/lib/utils/http-parser.js +0 -201
  124. package/lib/utils/index.js +0 -13
  125. package/lib/utils/logger.js +0 -82
  126. package/lib/utils/prepare-packets.js +0 -69
  127. package/lib/utils/redactions.js +0 -135
  128. package/lib/utils/retries.js +0 -26
  129. package/lib/utils/signatures/eth.js +0 -31
  130. package/lib/utils/signatures/index.js +0 -12
  131. package/lib/utils/socket-base.js +0 -96
  132. package/lib/utils/tls.js +0 -58
  133. package/lib/utils/ws.js +0 -22
  134. package/lib/utils/zk.js +0 -625
@@ -1,1296 +0,0 @@
1
- import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
2
- const protobufPackage = "teeproto";
3
- const BodyType = {
4
- BODY_TYPE_UNSPECIFIED: 0,
5
- BODY_TYPE_K_OUTPUT: 1,
6
- BODY_TYPE_T_OUTPUT: 2,
7
- UNRECOGNIZED: -1
8
- };
9
- function bodyTypeFromJSON(object) {
10
- switch (object) {
11
- case 0:
12
- case "BODY_TYPE_UNSPECIFIED":
13
- return BodyType.BODY_TYPE_UNSPECIFIED;
14
- case 1:
15
- case "BODY_TYPE_K_OUTPUT":
16
- return BodyType.BODY_TYPE_K_OUTPUT;
17
- case 2:
18
- case "BODY_TYPE_T_OUTPUT":
19
- return BodyType.BODY_TYPE_T_OUTPUT;
20
- case -1:
21
- case "UNRECOGNIZED":
22
- default:
23
- return BodyType.UNRECOGNIZED;
24
- }
25
- }
26
- function bodyTypeToJSON(object) {
27
- switch (object) {
28
- case BodyType.BODY_TYPE_UNSPECIFIED:
29
- return "BODY_TYPE_UNSPECIFIED";
30
- case BodyType.BODY_TYPE_K_OUTPUT:
31
- return "BODY_TYPE_K_OUTPUT";
32
- case BodyType.BODY_TYPE_T_OUTPUT:
33
- return "BODY_TYPE_T_OUTPUT";
34
- case BodyType.UNRECOGNIZED:
35
- default:
36
- return "UNRECOGNIZED";
37
- }
38
- }
39
- function createBaseRequestRedactionRange() {
40
- return { start: 0, length: 0, type: "" };
41
- }
42
- const RequestRedactionRange = {
43
- encode(message, writer = new BinaryWriter()) {
44
- if (message.start !== 0) {
45
- writer.uint32(8).int32(message.start);
46
- }
47
- if (message.length !== 0) {
48
- writer.uint32(16).int32(message.length);
49
- }
50
- if (message.type !== "") {
51
- writer.uint32(26).string(message.type);
52
- }
53
- return writer;
54
- },
55
- decode(input, length) {
56
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
57
- let end = length === void 0 ? reader.len : reader.pos + length;
58
- const message = createBaseRequestRedactionRange();
59
- while (reader.pos < end) {
60
- const tag = reader.uint32();
61
- switch (tag >>> 3) {
62
- case 1: {
63
- if (tag !== 8) {
64
- break;
65
- }
66
- message.start = reader.int32();
67
- continue;
68
- }
69
- case 2: {
70
- if (tag !== 16) {
71
- break;
72
- }
73
- message.length = reader.int32();
74
- continue;
75
- }
76
- case 3: {
77
- if (tag !== 26) {
78
- break;
79
- }
80
- message.type = reader.string();
81
- continue;
82
- }
83
- }
84
- if ((tag & 7) === 4 || tag === 0) {
85
- break;
86
- }
87
- reader.skip(tag & 7);
88
- }
89
- return message;
90
- },
91
- fromJSON(object) {
92
- return {
93
- start: isSet(object.start) ? globalThis.Number(object.start) : 0,
94
- length: isSet(object.length) ? globalThis.Number(object.length) : 0,
95
- type: isSet(object.type) ? globalThis.String(object.type) : ""
96
- };
97
- },
98
- toJSON(message) {
99
- const obj = {};
100
- if (message.start !== 0) {
101
- obj.start = Math.round(message.start);
102
- }
103
- if (message.length !== 0) {
104
- obj.length = Math.round(message.length);
105
- }
106
- if (message.type !== "") {
107
- obj.type = message.type;
108
- }
109
- return obj;
110
- },
111
- create(base) {
112
- return RequestRedactionRange.fromPartial(base ?? {});
113
- },
114
- fromPartial(object) {
115
- const message = createBaseRequestRedactionRange();
116
- message.start = object.start ?? 0;
117
- message.length = object.length ?? 0;
118
- message.type = object.type ?? "";
119
- return message;
120
- }
121
- };
122
- function createBaseResponseRedactionRange() {
123
- return { start: 0, length: 0 };
124
- }
125
- const ResponseRedactionRange = {
126
- encode(message, writer = new BinaryWriter()) {
127
- if (message.start !== 0) {
128
- writer.uint32(8).int32(message.start);
129
- }
130
- if (message.length !== 0) {
131
- writer.uint32(16).int32(message.length);
132
- }
133
- return writer;
134
- },
135
- decode(input, length) {
136
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
137
- let end = length === void 0 ? reader.len : reader.pos + length;
138
- const message = createBaseResponseRedactionRange();
139
- while (reader.pos < end) {
140
- const tag = reader.uint32();
141
- switch (tag >>> 3) {
142
- case 1: {
143
- if (tag !== 8) {
144
- break;
145
- }
146
- message.start = reader.int32();
147
- continue;
148
- }
149
- case 2: {
150
- if (tag !== 16) {
151
- break;
152
- }
153
- message.length = reader.int32();
154
- continue;
155
- }
156
- }
157
- if ((tag & 7) === 4 || tag === 0) {
158
- break;
159
- }
160
- reader.skip(tag & 7);
161
- }
162
- return message;
163
- },
164
- fromJSON(object) {
165
- return {
166
- start: isSet(object.start) ? globalThis.Number(object.start) : 0,
167
- length: isSet(object.length) ? globalThis.Number(object.length) : 0
168
- };
169
- },
170
- toJSON(message) {
171
- const obj = {};
172
- if (message.start !== 0) {
173
- obj.start = Math.round(message.start);
174
- }
175
- if (message.length !== 0) {
176
- obj.length = Math.round(message.length);
177
- }
178
- return obj;
179
- },
180
- create(base) {
181
- return ResponseRedactionRange.fromPartial(base ?? {});
182
- },
183
- fromPartial(object) {
184
- const message = createBaseResponseRedactionRange();
185
- message.start = object.start ?? 0;
186
- message.length = object.length ?? 0;
187
- return message;
188
- }
189
- };
190
- function createBaseSignedRedactedDecryptionStream() {
191
- return { redactedStream: new Uint8Array(0), seqNum: 0 };
192
- }
193
- const SignedRedactedDecryptionStream = {
194
- encode(message, writer = new BinaryWriter()) {
195
- if (message.redactedStream.length !== 0) {
196
- writer.uint32(10).bytes(message.redactedStream);
197
- }
198
- if (message.seqNum !== 0) {
199
- writer.uint32(16).uint64(message.seqNum);
200
- }
201
- return writer;
202
- },
203
- decode(input, length) {
204
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
205
- let end = length === void 0 ? reader.len : reader.pos + length;
206
- const message = createBaseSignedRedactedDecryptionStream();
207
- while (reader.pos < end) {
208
- const tag = reader.uint32();
209
- switch (tag >>> 3) {
210
- case 1: {
211
- if (tag !== 10) {
212
- break;
213
- }
214
- message.redactedStream = reader.bytes();
215
- continue;
216
- }
217
- case 2: {
218
- if (tag !== 16) {
219
- break;
220
- }
221
- message.seqNum = longToNumber(reader.uint64());
222
- continue;
223
- }
224
- }
225
- if ((tag & 7) === 4 || tag === 0) {
226
- break;
227
- }
228
- reader.skip(tag & 7);
229
- }
230
- return message;
231
- },
232
- fromJSON(object) {
233
- return {
234
- redactedStream: isSet(object.redactedStream) ? bytesFromBase64(object.redactedStream) : new Uint8Array(0),
235
- seqNum: isSet(object.seqNum) ? globalThis.Number(object.seqNum) : 0
236
- };
237
- },
238
- toJSON(message) {
239
- const obj = {};
240
- if (message.redactedStream.length !== 0) {
241
- obj.redactedStream = base64FromBytes(message.redactedStream);
242
- }
243
- if (message.seqNum !== 0) {
244
- obj.seqNum = Math.round(message.seqNum);
245
- }
246
- return obj;
247
- },
248
- create(base) {
249
- return SignedRedactedDecryptionStream.fromPartial(base ?? {});
250
- },
251
- fromPartial(object) {
252
- const message = createBaseSignedRedactedDecryptionStream();
253
- message.redactedStream = object.redactedStream ?? new Uint8Array(0);
254
- message.seqNum = object.seqNum ?? 0;
255
- return message;
256
- }
257
- };
258
- function createBaseCertificateInfo() {
259
- return { commonName: "", issuerCommonName: "", notBeforeUnix: 0, notAfterUnix: 0, dnsNames: [] };
260
- }
261
- const CertificateInfo = {
262
- encode(message, writer = new BinaryWriter()) {
263
- if (message.commonName !== "") {
264
- writer.uint32(10).string(message.commonName);
265
- }
266
- if (message.issuerCommonName !== "") {
267
- writer.uint32(18).string(message.issuerCommonName);
268
- }
269
- if (message.notBeforeUnix !== 0) {
270
- writer.uint32(24).uint64(message.notBeforeUnix);
271
- }
272
- if (message.notAfterUnix !== 0) {
273
- writer.uint32(32).uint64(message.notAfterUnix);
274
- }
275
- for (const v of message.dnsNames) {
276
- writer.uint32(42).string(v);
277
- }
278
- return writer;
279
- },
280
- decode(input, length) {
281
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
282
- let end = length === void 0 ? reader.len : reader.pos + length;
283
- const message = createBaseCertificateInfo();
284
- while (reader.pos < end) {
285
- const tag = reader.uint32();
286
- switch (tag >>> 3) {
287
- case 1: {
288
- if (tag !== 10) {
289
- break;
290
- }
291
- message.commonName = reader.string();
292
- continue;
293
- }
294
- case 2: {
295
- if (tag !== 18) {
296
- break;
297
- }
298
- message.issuerCommonName = reader.string();
299
- continue;
300
- }
301
- case 3: {
302
- if (tag !== 24) {
303
- break;
304
- }
305
- message.notBeforeUnix = longToNumber(reader.uint64());
306
- continue;
307
- }
308
- case 4: {
309
- if (tag !== 32) {
310
- break;
311
- }
312
- message.notAfterUnix = longToNumber(reader.uint64());
313
- continue;
314
- }
315
- case 5: {
316
- if (tag !== 42) {
317
- break;
318
- }
319
- message.dnsNames.push(reader.string());
320
- continue;
321
- }
322
- }
323
- if ((tag & 7) === 4 || tag === 0) {
324
- break;
325
- }
326
- reader.skip(tag & 7);
327
- }
328
- return message;
329
- },
330
- fromJSON(object) {
331
- return {
332
- commonName: isSet(object.commonName) ? globalThis.String(object.commonName) : "",
333
- issuerCommonName: isSet(object.issuerCommonName) ? globalThis.String(object.issuerCommonName) : "",
334
- notBeforeUnix: isSet(object.notBeforeUnix) ? globalThis.Number(object.notBeforeUnix) : 0,
335
- notAfterUnix: isSet(object.notAfterUnix) ? globalThis.Number(object.notAfterUnix) : 0,
336
- dnsNames: globalThis.Array.isArray(object?.dnsNames) ? object.dnsNames.map((e) => globalThis.String(e)) : []
337
- };
338
- },
339
- toJSON(message) {
340
- const obj = {};
341
- if (message.commonName !== "") {
342
- obj.commonName = message.commonName;
343
- }
344
- if (message.issuerCommonName !== "") {
345
- obj.issuerCommonName = message.issuerCommonName;
346
- }
347
- if (message.notBeforeUnix !== 0) {
348
- obj.notBeforeUnix = Math.round(message.notBeforeUnix);
349
- }
350
- if (message.notAfterUnix !== 0) {
351
- obj.notAfterUnix = Math.round(message.notAfterUnix);
352
- }
353
- if (message.dnsNames?.length) {
354
- obj.dnsNames = message.dnsNames;
355
- }
356
- return obj;
357
- },
358
- create(base) {
359
- return CertificateInfo.fromPartial(base ?? {});
360
- },
361
- fromPartial(object) {
362
- const message = createBaseCertificateInfo();
363
- message.commonName = object.commonName ?? "";
364
- message.issuerCommonName = object.issuerCommonName ?? "";
365
- message.notBeforeUnix = object.notBeforeUnix ?? 0;
366
- message.notAfterUnix = object.notAfterUnix ?? 0;
367
- message.dnsNames = object.dnsNames?.map((e) => e) || [];
368
- return message;
369
- }
370
- };
371
- function createBaseHandshakeSecrets() {
372
- return { handshakeKey: new Uint8Array(0), handshakeIv: new Uint8Array(0), cipherSuite: 0, algorithm: "" };
373
- }
374
- const HandshakeSecrets = {
375
- encode(message, writer = new BinaryWriter()) {
376
- if (message.handshakeKey.length !== 0) {
377
- writer.uint32(10).bytes(message.handshakeKey);
378
- }
379
- if (message.handshakeIv.length !== 0) {
380
- writer.uint32(18).bytes(message.handshakeIv);
381
- }
382
- if (message.cipherSuite !== 0) {
383
- writer.uint32(24).uint32(message.cipherSuite);
384
- }
385
- if (message.algorithm !== "") {
386
- writer.uint32(34).string(message.algorithm);
387
- }
388
- return writer;
389
- },
390
- decode(input, length) {
391
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
392
- let end = length === void 0 ? reader.len : reader.pos + length;
393
- const message = createBaseHandshakeSecrets();
394
- while (reader.pos < end) {
395
- const tag = reader.uint32();
396
- switch (tag >>> 3) {
397
- case 1: {
398
- if (tag !== 10) {
399
- break;
400
- }
401
- message.handshakeKey = reader.bytes();
402
- continue;
403
- }
404
- case 2: {
405
- if (tag !== 18) {
406
- break;
407
- }
408
- message.handshakeIv = reader.bytes();
409
- continue;
410
- }
411
- case 3: {
412
- if (tag !== 24) {
413
- break;
414
- }
415
- message.cipherSuite = reader.uint32();
416
- continue;
417
- }
418
- case 4: {
419
- if (tag !== 34) {
420
- break;
421
- }
422
- message.algorithm = reader.string();
423
- continue;
424
- }
425
- }
426
- if ((tag & 7) === 4 || tag === 0) {
427
- break;
428
- }
429
- reader.skip(tag & 7);
430
- }
431
- return message;
432
- },
433
- fromJSON(object) {
434
- return {
435
- handshakeKey: isSet(object.handshakeKey) ? bytesFromBase64(object.handshakeKey) : new Uint8Array(0),
436
- handshakeIv: isSet(object.handshakeIv) ? bytesFromBase64(object.handshakeIv) : new Uint8Array(0),
437
- cipherSuite: isSet(object.cipherSuite) ? globalThis.Number(object.cipherSuite) : 0,
438
- algorithm: isSet(object.algorithm) ? globalThis.String(object.algorithm) : ""
439
- };
440
- },
441
- toJSON(message) {
442
- const obj = {};
443
- if (message.handshakeKey.length !== 0) {
444
- obj.handshakeKey = base64FromBytes(message.handshakeKey);
445
- }
446
- if (message.handshakeIv.length !== 0) {
447
- obj.handshakeIv = base64FromBytes(message.handshakeIv);
448
- }
449
- if (message.cipherSuite !== 0) {
450
- obj.cipherSuite = Math.round(message.cipherSuite);
451
- }
452
- if (message.algorithm !== "") {
453
- obj.algorithm = message.algorithm;
454
- }
455
- return obj;
456
- },
457
- create(base) {
458
- return HandshakeSecrets.fromPartial(base ?? {});
459
- },
460
- fromPartial(object) {
461
- const message = createBaseHandshakeSecrets();
462
- message.handshakeKey = object.handshakeKey ?? new Uint8Array(0);
463
- message.handshakeIv = object.handshakeIv ?? new Uint8Array(0);
464
- message.cipherSuite = object.cipherSuite ?? 0;
465
- message.algorithm = object.algorithm ?? "";
466
- return message;
467
- }
468
- };
469
- function createBaseOpening() {
470
- return { proofStream: new Uint8Array(0) };
471
- }
472
- const Opening = {
473
- encode(message, writer = new BinaryWriter()) {
474
- if (message.proofStream.length !== 0) {
475
- writer.uint32(10).bytes(message.proofStream);
476
- }
477
- return writer;
478
- },
479
- decode(input, length) {
480
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
481
- let end = length === void 0 ? reader.len : reader.pos + length;
482
- const message = createBaseOpening();
483
- while (reader.pos < end) {
484
- const tag = reader.uint32();
485
- switch (tag >>> 3) {
486
- case 1: {
487
- if (tag !== 10) {
488
- break;
489
- }
490
- message.proofStream = reader.bytes();
491
- continue;
492
- }
493
- }
494
- if ((tag & 7) === 4 || tag === 0) {
495
- break;
496
- }
497
- reader.skip(tag & 7);
498
- }
499
- return message;
500
- },
501
- fromJSON(object) {
502
- return { proofStream: isSet(object.proofStream) ? bytesFromBase64(object.proofStream) : new Uint8Array(0) };
503
- },
504
- toJSON(message) {
505
- const obj = {};
506
- if (message.proofStream.length !== 0) {
507
- obj.proofStream = base64FromBytes(message.proofStream);
508
- }
509
- return obj;
510
- },
511
- create(base) {
512
- return Opening.fromPartial(base ?? {});
513
- },
514
- fromPartial(object) {
515
- const message = createBaseOpening();
516
- message.proofStream = object.proofStream ?? new Uint8Array(0);
517
- return message;
518
- }
519
- };
520
- function createBaseOPRFOutput() {
521
- return { tlsStart: 0, tlsLength: 0, hashOutput: new Uint8Array(0) };
522
- }
523
- const OPRFOutput = {
524
- encode(message, writer = new BinaryWriter()) {
525
- if (message.tlsStart !== 0) {
526
- writer.uint32(8).int32(message.tlsStart);
527
- }
528
- if (message.tlsLength !== 0) {
529
- writer.uint32(16).int32(message.tlsLength);
530
- }
531
- if (message.hashOutput.length !== 0) {
532
- writer.uint32(26).bytes(message.hashOutput);
533
- }
534
- return writer;
535
- },
536
- decode(input, length) {
537
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
538
- let end = length === void 0 ? reader.len : reader.pos + length;
539
- const message = createBaseOPRFOutput();
540
- while (reader.pos < end) {
541
- const tag = reader.uint32();
542
- switch (tag >>> 3) {
543
- case 1: {
544
- if (tag !== 8) {
545
- break;
546
- }
547
- message.tlsStart = reader.int32();
548
- continue;
549
- }
550
- case 2: {
551
- if (tag !== 16) {
552
- break;
553
- }
554
- message.tlsLength = reader.int32();
555
- continue;
556
- }
557
- case 3: {
558
- if (tag !== 26) {
559
- break;
560
- }
561
- message.hashOutput = reader.bytes();
562
- continue;
563
- }
564
- }
565
- if ((tag & 7) === 4 || tag === 0) {
566
- break;
567
- }
568
- reader.skip(tag & 7);
569
- }
570
- return message;
571
- },
572
- fromJSON(object) {
573
- return {
574
- tlsStart: isSet(object.tlsStart) ? globalThis.Number(object.tlsStart) : 0,
575
- tlsLength: isSet(object.tlsLength) ? globalThis.Number(object.tlsLength) : 0,
576
- hashOutput: isSet(object.hashOutput) ? bytesFromBase64(object.hashOutput) : new Uint8Array(0)
577
- };
578
- },
579
- toJSON(message) {
580
- const obj = {};
581
- if (message.tlsStart !== 0) {
582
- obj.tlsStart = Math.round(message.tlsStart);
583
- }
584
- if (message.tlsLength !== 0) {
585
- obj.tlsLength = Math.round(message.tlsLength);
586
- }
587
- if (message.hashOutput.length !== 0) {
588
- obj.hashOutput = base64FromBytes(message.hashOutput);
589
- }
590
- return obj;
591
- },
592
- create(base) {
593
- return OPRFOutput.fromPartial(base ?? {});
594
- },
595
- fromPartial(object) {
596
- const message = createBaseOPRFOutput();
597
- message.tlsStart = object.tlsStart ?? 0;
598
- message.tlsLength = object.tlsLength ?? 0;
599
- message.hashOutput = object.hashOutput ?? new Uint8Array(0);
600
- return message;
601
- }
602
- };
603
- function createBaseKOutputPayload() {
604
- return {
605
- redactedRequest: new Uint8Array(0),
606
- requestRedactionRanges: [],
607
- consolidatedResponseKeystream: new Uint8Array(0),
608
- certificateInfo: void 0,
609
- responseRedactionRanges: [],
610
- timestampMs: 0,
611
- sessionId: "",
612
- oprfOutputs: []
613
- };
614
- }
615
- const KOutputPayload = {
616
- encode(message, writer = new BinaryWriter()) {
617
- if (message.redactedRequest.length !== 0) {
618
- writer.uint32(10).bytes(message.redactedRequest);
619
- }
620
- for (const v of message.requestRedactionRanges) {
621
- RequestRedactionRange.encode(v, writer.uint32(18).fork()).join();
622
- }
623
- if (message.consolidatedResponseKeystream.length !== 0) {
624
- writer.uint32(26).bytes(message.consolidatedResponseKeystream);
625
- }
626
- if (message.certificateInfo !== void 0) {
627
- CertificateInfo.encode(message.certificateInfo, writer.uint32(34).fork()).join();
628
- }
629
- for (const v of message.responseRedactionRanges) {
630
- ResponseRedactionRange.encode(v, writer.uint32(42).fork()).join();
631
- }
632
- if (message.timestampMs !== 0) {
633
- writer.uint32(48).uint64(message.timestampMs);
634
- }
635
- if (message.sessionId !== "") {
636
- writer.uint32(58).string(message.sessionId);
637
- }
638
- for (const v of message.oprfOutputs) {
639
- OPRFOutput.encode(v, writer.uint32(82).fork()).join();
640
- }
641
- return writer;
642
- },
643
- decode(input, length) {
644
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
645
- let end = length === void 0 ? reader.len : reader.pos + length;
646
- const message = createBaseKOutputPayload();
647
- while (reader.pos < end) {
648
- const tag = reader.uint32();
649
- switch (tag >>> 3) {
650
- case 1: {
651
- if (tag !== 10) {
652
- break;
653
- }
654
- message.redactedRequest = reader.bytes();
655
- continue;
656
- }
657
- case 2: {
658
- if (tag !== 18) {
659
- break;
660
- }
661
- message.requestRedactionRanges.push(RequestRedactionRange.decode(reader, reader.uint32()));
662
- continue;
663
- }
664
- case 3: {
665
- if (tag !== 26) {
666
- break;
667
- }
668
- message.consolidatedResponseKeystream = reader.bytes();
669
- continue;
670
- }
671
- case 4: {
672
- if (tag !== 34) {
673
- break;
674
- }
675
- message.certificateInfo = CertificateInfo.decode(reader, reader.uint32());
676
- continue;
677
- }
678
- case 5: {
679
- if (tag !== 42) {
680
- break;
681
- }
682
- message.responseRedactionRanges.push(ResponseRedactionRange.decode(reader, reader.uint32()));
683
- continue;
684
- }
685
- case 6: {
686
- if (tag !== 48) {
687
- break;
688
- }
689
- message.timestampMs = longToNumber(reader.uint64());
690
- continue;
691
- }
692
- case 7: {
693
- if (tag !== 58) {
694
- break;
695
- }
696
- message.sessionId = reader.string();
697
- continue;
698
- }
699
- case 10: {
700
- if (tag !== 82) {
701
- break;
702
- }
703
- message.oprfOutputs.push(OPRFOutput.decode(reader, reader.uint32()));
704
- continue;
705
- }
706
- }
707
- if ((tag & 7) === 4 || tag === 0) {
708
- break;
709
- }
710
- reader.skip(tag & 7);
711
- }
712
- return message;
713
- },
714
- fromJSON(object) {
715
- return {
716
- redactedRequest: isSet(object.redactedRequest) ? bytesFromBase64(object.redactedRequest) : new Uint8Array(0),
717
- requestRedactionRanges: globalThis.Array.isArray(object?.requestRedactionRanges) ? object.requestRedactionRanges.map((e) => RequestRedactionRange.fromJSON(e)) : [],
718
- consolidatedResponseKeystream: isSet(object.consolidatedResponseKeystream) ? bytesFromBase64(object.consolidatedResponseKeystream) : new Uint8Array(0),
719
- certificateInfo: isSet(object.certificateInfo) ? CertificateInfo.fromJSON(object.certificateInfo) : void 0,
720
- responseRedactionRanges: globalThis.Array.isArray(object?.responseRedactionRanges) ? object.responseRedactionRanges.map((e) => ResponseRedactionRange.fromJSON(e)) : [],
721
- timestampMs: isSet(object.timestampMs) ? globalThis.Number(object.timestampMs) : 0,
722
- sessionId: isSet(object.sessionId) ? globalThis.String(object.sessionId) : "",
723
- oprfOutputs: globalThis.Array.isArray(object?.oprfOutputs) ? object.oprfOutputs.map((e) => OPRFOutput.fromJSON(e)) : []
724
- };
725
- },
726
- toJSON(message) {
727
- const obj = {};
728
- if (message.redactedRequest.length !== 0) {
729
- obj.redactedRequest = base64FromBytes(message.redactedRequest);
730
- }
731
- if (message.requestRedactionRanges?.length) {
732
- obj.requestRedactionRanges = message.requestRedactionRanges.map((e) => RequestRedactionRange.toJSON(e));
733
- }
734
- if (message.consolidatedResponseKeystream.length !== 0) {
735
- obj.consolidatedResponseKeystream = base64FromBytes(message.consolidatedResponseKeystream);
736
- }
737
- if (message.certificateInfo !== void 0) {
738
- obj.certificateInfo = CertificateInfo.toJSON(message.certificateInfo);
739
- }
740
- if (message.responseRedactionRanges?.length) {
741
- obj.responseRedactionRanges = message.responseRedactionRanges.map((e) => ResponseRedactionRange.toJSON(e));
742
- }
743
- if (message.timestampMs !== 0) {
744
- obj.timestampMs = Math.round(message.timestampMs);
745
- }
746
- if (message.sessionId !== "") {
747
- obj.sessionId = message.sessionId;
748
- }
749
- if (message.oprfOutputs?.length) {
750
- obj.oprfOutputs = message.oprfOutputs.map((e) => OPRFOutput.toJSON(e));
751
- }
752
- return obj;
753
- },
754
- create(base) {
755
- return KOutputPayload.fromPartial(base ?? {});
756
- },
757
- fromPartial(object) {
758
- const message = createBaseKOutputPayload();
759
- message.redactedRequest = object.redactedRequest ?? new Uint8Array(0);
760
- message.requestRedactionRanges = object.requestRedactionRanges?.map((e) => RequestRedactionRange.fromPartial(e)) || [];
761
- message.consolidatedResponseKeystream = object.consolidatedResponseKeystream ?? new Uint8Array(0);
762
- message.certificateInfo = object.certificateInfo !== void 0 && object.certificateInfo !== null ? CertificateInfo.fromPartial(object.certificateInfo) : void 0;
763
- message.responseRedactionRanges = object.responseRedactionRanges?.map((e) => ResponseRedactionRange.fromPartial(e)) || [];
764
- message.timestampMs = object.timestampMs ?? 0;
765
- message.sessionId = object.sessionId ?? "";
766
- message.oprfOutputs = object.oprfOutputs?.map((e) => OPRFOutput.fromPartial(e)) || [];
767
- return message;
768
- }
769
- };
770
- function createBaseTOutputPayload() {
771
- return {
772
- consolidatedResponseCiphertext: new Uint8Array(0),
773
- requestProofStreams: [],
774
- timestampMs: 0,
775
- sessionId: "",
776
- oprfOutputs: []
777
- };
778
- }
779
- const TOutputPayload = {
780
- encode(message, writer = new BinaryWriter()) {
781
- if (message.consolidatedResponseCiphertext.length !== 0) {
782
- writer.uint32(10).bytes(message.consolidatedResponseCiphertext);
783
- }
784
- for (const v of message.requestProofStreams) {
785
- writer.uint32(18).bytes(v);
786
- }
787
- if (message.timestampMs !== 0) {
788
- writer.uint32(24).uint64(message.timestampMs);
789
- }
790
- if (message.sessionId !== "") {
791
- writer.uint32(34).string(message.sessionId);
792
- }
793
- for (const v of message.oprfOutputs) {
794
- OPRFOutput.encode(v, writer.uint32(82).fork()).join();
795
- }
796
- return writer;
797
- },
798
- decode(input, length) {
799
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
800
- let end = length === void 0 ? reader.len : reader.pos + length;
801
- const message = createBaseTOutputPayload();
802
- while (reader.pos < end) {
803
- const tag = reader.uint32();
804
- switch (tag >>> 3) {
805
- case 1: {
806
- if (tag !== 10) {
807
- break;
808
- }
809
- message.consolidatedResponseCiphertext = reader.bytes();
810
- continue;
811
- }
812
- case 2: {
813
- if (tag !== 18) {
814
- break;
815
- }
816
- message.requestProofStreams.push(reader.bytes());
817
- continue;
818
- }
819
- case 3: {
820
- if (tag !== 24) {
821
- break;
822
- }
823
- message.timestampMs = longToNumber(reader.uint64());
824
- continue;
825
- }
826
- case 4: {
827
- if (tag !== 34) {
828
- break;
829
- }
830
- message.sessionId = reader.string();
831
- continue;
832
- }
833
- case 10: {
834
- if (tag !== 82) {
835
- break;
836
- }
837
- message.oprfOutputs.push(OPRFOutput.decode(reader, reader.uint32()));
838
- continue;
839
- }
840
- }
841
- if ((tag & 7) === 4 || tag === 0) {
842
- break;
843
- }
844
- reader.skip(tag & 7);
845
- }
846
- return message;
847
- },
848
- fromJSON(object) {
849
- return {
850
- consolidatedResponseCiphertext: isSet(object.consolidatedResponseCiphertext) ? bytesFromBase64(object.consolidatedResponseCiphertext) : new Uint8Array(0),
851
- requestProofStreams: globalThis.Array.isArray(object?.requestProofStreams) ? object.requestProofStreams.map((e) => bytesFromBase64(e)) : [],
852
- timestampMs: isSet(object.timestampMs) ? globalThis.Number(object.timestampMs) : 0,
853
- sessionId: isSet(object.sessionId) ? globalThis.String(object.sessionId) : "",
854
- oprfOutputs: globalThis.Array.isArray(object?.oprfOutputs) ? object.oprfOutputs.map((e) => OPRFOutput.fromJSON(e)) : []
855
- };
856
- },
857
- toJSON(message) {
858
- const obj = {};
859
- if (message.consolidatedResponseCiphertext.length !== 0) {
860
- obj.consolidatedResponseCiphertext = base64FromBytes(message.consolidatedResponseCiphertext);
861
- }
862
- if (message.requestProofStreams?.length) {
863
- obj.requestProofStreams = message.requestProofStreams.map((e) => base64FromBytes(e));
864
- }
865
- if (message.timestampMs !== 0) {
866
- obj.timestampMs = Math.round(message.timestampMs);
867
- }
868
- if (message.sessionId !== "") {
869
- obj.sessionId = message.sessionId;
870
- }
871
- if (message.oprfOutputs?.length) {
872
- obj.oprfOutputs = message.oprfOutputs.map((e) => OPRFOutput.toJSON(e));
873
- }
874
- return obj;
875
- },
876
- create(base) {
877
- return TOutputPayload.fromPartial(base ?? {});
878
- },
879
- fromPartial(object) {
880
- const message = createBaseTOutputPayload();
881
- message.consolidatedResponseCiphertext = object.consolidatedResponseCiphertext ?? new Uint8Array(0);
882
- message.requestProofStreams = object.requestProofStreams?.map((e) => e) || [];
883
- message.timestampMs = object.timestampMs ?? 0;
884
- message.sessionId = object.sessionId ?? "";
885
- message.oprfOutputs = object.oprfOutputs?.map((e) => OPRFOutput.fromPartial(e)) || [];
886
- return message;
887
- }
888
- };
889
- function createBaseAttestationReport() {
890
- return { type: "", report: new Uint8Array(0) };
891
- }
892
- const AttestationReport = {
893
- encode(message, writer = new BinaryWriter()) {
894
- if (message.type !== "") {
895
- writer.uint32(10).string(message.type);
896
- }
897
- if (message.report.length !== 0) {
898
- writer.uint32(18).bytes(message.report);
899
- }
900
- return writer;
901
- },
902
- decode(input, length) {
903
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
904
- let end = length === void 0 ? reader.len : reader.pos + length;
905
- const message = createBaseAttestationReport();
906
- while (reader.pos < end) {
907
- const tag = reader.uint32();
908
- switch (tag >>> 3) {
909
- case 1: {
910
- if (tag !== 10) {
911
- break;
912
- }
913
- message.type = reader.string();
914
- continue;
915
- }
916
- case 2: {
917
- if (tag !== 18) {
918
- break;
919
- }
920
- message.report = reader.bytes();
921
- continue;
922
- }
923
- }
924
- if ((tag & 7) === 4 || tag === 0) {
925
- break;
926
- }
927
- reader.skip(tag & 7);
928
- }
929
- return message;
930
- },
931
- fromJSON(object) {
932
- return {
933
- type: isSet(object.type) ? globalThis.String(object.type) : "",
934
- report: isSet(object.report) ? bytesFromBase64(object.report) : new Uint8Array(0)
935
- };
936
- },
937
- toJSON(message) {
938
- const obj = {};
939
- if (message.type !== "") {
940
- obj.type = message.type;
941
- }
942
- if (message.report.length !== 0) {
943
- obj.report = base64FromBytes(message.report);
944
- }
945
- return obj;
946
- },
947
- create(base) {
948
- return AttestationReport.fromPartial(base ?? {});
949
- },
950
- fromPartial(object) {
951
- const message = createBaseAttestationReport();
952
- message.type = object.type ?? "";
953
- message.report = object.report ?? new Uint8Array(0);
954
- return message;
955
- }
956
- };
957
- function createBaseSignedMessage() {
958
- return {
959
- bodyType: 0,
960
- body: new Uint8Array(0),
961
- ethAddress: new Uint8Array(0),
962
- signature: new Uint8Array(0),
963
- attestationReport: void 0
964
- };
965
- }
966
- const SignedMessage = {
967
- encode(message, writer = new BinaryWriter()) {
968
- if (message.bodyType !== 0) {
969
- writer.uint32(8).int32(message.bodyType);
970
- }
971
- if (message.body.length !== 0) {
972
- writer.uint32(18).bytes(message.body);
973
- }
974
- if (message.ethAddress.length !== 0) {
975
- writer.uint32(26).bytes(message.ethAddress);
976
- }
977
- if (message.signature.length !== 0) {
978
- writer.uint32(34).bytes(message.signature);
979
- }
980
- if (message.attestationReport !== void 0) {
981
- AttestationReport.encode(message.attestationReport, writer.uint32(42).fork()).join();
982
- }
983
- return writer;
984
- },
985
- decode(input, length) {
986
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
987
- let end = length === void 0 ? reader.len : reader.pos + length;
988
- const message = createBaseSignedMessage();
989
- while (reader.pos < end) {
990
- const tag = reader.uint32();
991
- switch (tag >>> 3) {
992
- case 1: {
993
- if (tag !== 8) {
994
- break;
995
- }
996
- message.bodyType = reader.int32();
997
- continue;
998
- }
999
- case 2: {
1000
- if (tag !== 18) {
1001
- break;
1002
- }
1003
- message.body = reader.bytes();
1004
- continue;
1005
- }
1006
- case 3: {
1007
- if (tag !== 26) {
1008
- break;
1009
- }
1010
- message.ethAddress = reader.bytes();
1011
- continue;
1012
- }
1013
- case 4: {
1014
- if (tag !== 34) {
1015
- break;
1016
- }
1017
- message.signature = reader.bytes();
1018
- continue;
1019
- }
1020
- case 5: {
1021
- if (tag !== 42) {
1022
- break;
1023
- }
1024
- message.attestationReport = AttestationReport.decode(reader, reader.uint32());
1025
- continue;
1026
- }
1027
- }
1028
- if ((tag & 7) === 4 || tag === 0) {
1029
- break;
1030
- }
1031
- reader.skip(tag & 7);
1032
- }
1033
- return message;
1034
- },
1035
- fromJSON(object) {
1036
- return {
1037
- bodyType: isSet(object.bodyType) ? bodyTypeFromJSON(object.bodyType) : 0,
1038
- body: isSet(object.body) ? bytesFromBase64(object.body) : new Uint8Array(0),
1039
- ethAddress: isSet(object.ethAddress) ? bytesFromBase64(object.ethAddress) : new Uint8Array(0),
1040
- signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(0),
1041
- attestationReport: isSet(object.attestationReport) ? AttestationReport.fromJSON(object.attestationReport) : void 0
1042
- };
1043
- },
1044
- toJSON(message) {
1045
- const obj = {};
1046
- if (message.bodyType !== 0) {
1047
- obj.bodyType = bodyTypeToJSON(message.bodyType);
1048
- }
1049
- if (message.body.length !== 0) {
1050
- obj.body = base64FromBytes(message.body);
1051
- }
1052
- if (message.ethAddress.length !== 0) {
1053
- obj.ethAddress = base64FromBytes(message.ethAddress);
1054
- }
1055
- if (message.signature.length !== 0) {
1056
- obj.signature = base64FromBytes(message.signature);
1057
- }
1058
- if (message.attestationReport !== void 0) {
1059
- obj.attestationReport = AttestationReport.toJSON(message.attestationReport);
1060
- }
1061
- return obj;
1062
- },
1063
- create(base) {
1064
- return SignedMessage.fromPartial(base ?? {});
1065
- },
1066
- fromPartial(object) {
1067
- const message = createBaseSignedMessage();
1068
- message.bodyType = object.bodyType ?? 0;
1069
- message.body = object.body ?? new Uint8Array(0);
1070
- message.ethAddress = object.ethAddress ?? new Uint8Array(0);
1071
- message.signature = object.signature ?? new Uint8Array(0);
1072
- message.attestationReport = object.attestationReport !== void 0 && object.attestationReport !== null ? AttestationReport.fromPartial(object.attestationReport) : void 0;
1073
- return message;
1074
- }
1075
- };
1076
- function createBaseOPRFVerificationData() {
1077
- return { streamPos: 0, streamLength: 0, publicSignalsJson: new Uint8Array(0) };
1078
- }
1079
- const OPRFVerificationData = {
1080
- encode(message, writer = new BinaryWriter()) {
1081
- if (message.streamPos !== 0) {
1082
- writer.uint32(8).uint32(message.streamPos);
1083
- }
1084
- if (message.streamLength !== 0) {
1085
- writer.uint32(16).uint32(message.streamLength);
1086
- }
1087
- if (message.publicSignalsJson.length !== 0) {
1088
- writer.uint32(26).bytes(message.publicSignalsJson);
1089
- }
1090
- return writer;
1091
- },
1092
- decode(input, length) {
1093
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1094
- let end = length === void 0 ? reader.len : reader.pos + length;
1095
- const message = createBaseOPRFVerificationData();
1096
- while (reader.pos < end) {
1097
- const tag = reader.uint32();
1098
- switch (tag >>> 3) {
1099
- case 1: {
1100
- if (tag !== 8) {
1101
- break;
1102
- }
1103
- message.streamPos = reader.uint32();
1104
- continue;
1105
- }
1106
- case 2: {
1107
- if (tag !== 16) {
1108
- break;
1109
- }
1110
- message.streamLength = reader.uint32();
1111
- continue;
1112
- }
1113
- case 3: {
1114
- if (tag !== 26) {
1115
- break;
1116
- }
1117
- message.publicSignalsJson = reader.bytes();
1118
- continue;
1119
- }
1120
- }
1121
- if ((tag & 7) === 4 || tag === 0) {
1122
- break;
1123
- }
1124
- reader.skip(tag & 7);
1125
- }
1126
- return message;
1127
- },
1128
- fromJSON(object) {
1129
- return {
1130
- streamPos: isSet(object.streamPos) ? globalThis.Number(object.streamPos) : 0,
1131
- streamLength: isSet(object.streamLength) ? globalThis.Number(object.streamLength) : 0,
1132
- publicSignalsJson: isSet(object.publicSignalsJson) ? bytesFromBase64(object.publicSignalsJson) : new Uint8Array(0)
1133
- };
1134
- },
1135
- toJSON(message) {
1136
- const obj = {};
1137
- if (message.streamPos !== 0) {
1138
- obj.streamPos = Math.round(message.streamPos);
1139
- }
1140
- if (message.streamLength !== 0) {
1141
- obj.streamLength = Math.round(message.streamLength);
1142
- }
1143
- if (message.publicSignalsJson.length !== 0) {
1144
- obj.publicSignalsJson = base64FromBytes(message.publicSignalsJson);
1145
- }
1146
- return obj;
1147
- },
1148
- create(base) {
1149
- return OPRFVerificationData.fromPartial(base ?? {});
1150
- },
1151
- fromPartial(object) {
1152
- const message = createBaseOPRFVerificationData();
1153
- message.streamPos = object.streamPos ?? 0;
1154
- message.streamLength = object.streamLength ?? 0;
1155
- message.publicSignalsJson = object.publicSignalsJson ?? new Uint8Array(0);
1156
- return message;
1157
- }
1158
- };
1159
- function createBaseVerificationBundle() {
1160
- return { teekSigned: void 0, teetSigned: void 0, oprfVerifications: [] };
1161
- }
1162
- const VerificationBundle = {
1163
- encode(message, writer = new BinaryWriter()) {
1164
- if (message.teekSigned !== void 0) {
1165
- SignedMessage.encode(message.teekSigned, writer.uint32(10).fork()).join();
1166
- }
1167
- if (message.teetSigned !== void 0) {
1168
- SignedMessage.encode(message.teetSigned, writer.uint32(18).fork()).join();
1169
- }
1170
- for (const v of message.oprfVerifications) {
1171
- OPRFVerificationData.encode(v, writer.uint32(26).fork()).join();
1172
- }
1173
- return writer;
1174
- },
1175
- decode(input, length) {
1176
- const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1177
- let end = length === void 0 ? reader.len : reader.pos + length;
1178
- const message = createBaseVerificationBundle();
1179
- while (reader.pos < end) {
1180
- const tag = reader.uint32();
1181
- switch (tag >>> 3) {
1182
- case 1: {
1183
- if (tag !== 10) {
1184
- break;
1185
- }
1186
- message.teekSigned = SignedMessage.decode(reader, reader.uint32());
1187
- continue;
1188
- }
1189
- case 2: {
1190
- if (tag !== 18) {
1191
- break;
1192
- }
1193
- message.teetSigned = SignedMessage.decode(reader, reader.uint32());
1194
- continue;
1195
- }
1196
- case 3: {
1197
- if (tag !== 26) {
1198
- break;
1199
- }
1200
- message.oprfVerifications.push(OPRFVerificationData.decode(reader, reader.uint32()));
1201
- continue;
1202
- }
1203
- }
1204
- if ((tag & 7) === 4 || tag === 0) {
1205
- break;
1206
- }
1207
- reader.skip(tag & 7);
1208
- }
1209
- return message;
1210
- },
1211
- fromJSON(object) {
1212
- return {
1213
- teekSigned: isSet(object.teekSigned) ? SignedMessage.fromJSON(object.teekSigned) : void 0,
1214
- teetSigned: isSet(object.teetSigned) ? SignedMessage.fromJSON(object.teetSigned) : void 0,
1215
- oprfVerifications: globalThis.Array.isArray(object?.oprfVerifications) ? object.oprfVerifications.map((e) => OPRFVerificationData.fromJSON(e)) : []
1216
- };
1217
- },
1218
- toJSON(message) {
1219
- const obj = {};
1220
- if (message.teekSigned !== void 0) {
1221
- obj.teekSigned = SignedMessage.toJSON(message.teekSigned);
1222
- }
1223
- if (message.teetSigned !== void 0) {
1224
- obj.teetSigned = SignedMessage.toJSON(message.teetSigned);
1225
- }
1226
- if (message.oprfVerifications?.length) {
1227
- obj.oprfVerifications = message.oprfVerifications.map((e) => OPRFVerificationData.toJSON(e));
1228
- }
1229
- return obj;
1230
- },
1231
- create(base) {
1232
- return VerificationBundle.fromPartial(base ?? {});
1233
- },
1234
- fromPartial(object) {
1235
- const message = createBaseVerificationBundle();
1236
- message.teekSigned = object.teekSigned !== void 0 && object.teekSigned !== null ? SignedMessage.fromPartial(object.teekSigned) : void 0;
1237
- message.teetSigned = object.teetSigned !== void 0 && object.teetSigned !== null ? SignedMessage.fromPartial(object.teetSigned) : void 0;
1238
- message.oprfVerifications = object.oprfVerifications?.map((e) => OPRFVerificationData.fromPartial(e)) || [];
1239
- return message;
1240
- }
1241
- };
1242
- function bytesFromBase64(b64) {
1243
- if (globalThis.Buffer) {
1244
- return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
1245
- } else {
1246
- const bin = globalThis.atob(b64);
1247
- const arr = new Uint8Array(bin.length);
1248
- for (let i = 0; i < bin.length; ++i) {
1249
- arr[i] = bin.charCodeAt(i);
1250
- }
1251
- return arr;
1252
- }
1253
- }
1254
- function base64FromBytes(arr) {
1255
- if (globalThis.Buffer) {
1256
- return globalThis.Buffer.from(arr).toString("base64");
1257
- } else {
1258
- const bin = [];
1259
- arr.forEach((byte) => {
1260
- bin.push(globalThis.String.fromCharCode(byte));
1261
- });
1262
- return globalThis.btoa(bin.join(""));
1263
- }
1264
- }
1265
- function longToNumber(int64) {
1266
- const num = globalThis.Number(int64.toString());
1267
- if (num > globalThis.Number.MAX_SAFE_INTEGER) {
1268
- throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
1269
- }
1270
- if (num < globalThis.Number.MIN_SAFE_INTEGER) {
1271
- throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
1272
- }
1273
- return num;
1274
- }
1275
- function isSet(value) {
1276
- return value !== null && value !== void 0;
1277
- }
1278
- export {
1279
- AttestationReport,
1280
- BodyType,
1281
- CertificateInfo,
1282
- HandshakeSecrets,
1283
- KOutputPayload,
1284
- OPRFOutput,
1285
- OPRFVerificationData,
1286
- Opening,
1287
- RequestRedactionRange,
1288
- ResponseRedactionRange,
1289
- SignedMessage,
1290
- SignedRedactedDecryptionStream,
1291
- TOutputPayload,
1292
- VerificationBundle,
1293
- bodyTypeFromJSON,
1294
- bodyTypeToJSON,
1295
- protobufPackage
1296
- };