|
1 | 1 | "use strict";
|
2 |
| -/* eslint-disable */ |
| 2 | +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. |
| 3 | +// versions: |
| 4 | +// protoc-gen-ts_proto v2.7.0 |
| 5 | +// protoc v6.30.2 |
| 6 | +// source: envelope.proto |
3 | 7 | Object.defineProperty(exports, "__esModule", { value: true });
|
4 | 8 | exports.Signature = exports.Envelope = void 0;
|
5 |
| -function createBaseEnvelope() { |
6 |
| - return { payload: Buffer.alloc(0), payloadType: "", signatures: [] }; |
7 |
| -} |
8 | 9 | exports.Envelope = {
|
9 | 10 | fromJSON(object) {
|
10 | 11 | return {
|
11 | 12 | payload: isSet(object.payload) ? Buffer.from(bytesFromBase64(object.payload)) : Buffer.alloc(0),
|
12 |
| - payloadType: isSet(object.payloadType) ? String(object.payloadType) : "", |
13 |
| - signatures: Array.isArray(object?.signatures) ? object.signatures.map((e) => exports.Signature.fromJSON(e)) : [], |
| 13 | + payloadType: isSet(object.payloadType) ? globalThis.String(object.payloadType) : "", |
| 14 | + signatures: globalThis.Array.isArray(object?.signatures) |
| 15 | + ? object.signatures.map((e) => exports.Signature.fromJSON(e)) |
| 16 | + : [], |
14 | 17 | };
|
15 | 18 | },
|
16 | 19 | toJSON(message) {
|
17 | 20 | const obj = {};
|
18 |
| - message.payload !== undefined && |
19 |
| - (obj.payload = base64FromBytes(message.payload !== undefined ? message.payload : Buffer.alloc(0))); |
20 |
| - message.payloadType !== undefined && (obj.payloadType = message.payloadType); |
21 |
| - if (message.signatures) { |
22 |
| - obj.signatures = message.signatures.map((e) => e ? exports.Signature.toJSON(e) : undefined); |
| 21 | + if (message.payload.length !== 0) { |
| 22 | + obj.payload = base64FromBytes(message.payload); |
| 23 | + } |
| 24 | + if (message.payloadType !== "") { |
| 25 | + obj.payloadType = message.payloadType; |
23 | 26 | }
|
24 |
| - else { |
25 |
| - obj.signatures = []; |
| 27 | + if (message.signatures?.length) { |
| 28 | + obj.signatures = message.signatures.map((e) => exports.Signature.toJSON(e)); |
26 | 29 | }
|
27 | 30 | return obj;
|
28 | 31 | },
|
29 | 32 | };
|
30 |
| -function createBaseSignature() { |
31 |
| - return { sig: Buffer.alloc(0), keyid: "" }; |
32 |
| -} |
33 | 33 | exports.Signature = {
|
34 | 34 | fromJSON(object) {
|
35 | 35 | return {
|
36 | 36 | sig: isSet(object.sig) ? Buffer.from(bytesFromBase64(object.sig)) : Buffer.alloc(0),
|
37 |
| - keyid: isSet(object.keyid) ? String(object.keyid) : "", |
| 37 | + keyid: isSet(object.keyid) ? globalThis.String(object.keyid) : "", |
38 | 38 | };
|
39 | 39 | },
|
40 | 40 | toJSON(message) {
|
41 | 41 | const obj = {};
|
42 |
| - message.sig !== undefined && (obj.sig = base64FromBytes(message.sig !== undefined ? message.sig : Buffer.alloc(0))); |
43 |
| - message.keyid !== undefined && (obj.keyid = message.keyid); |
| 42 | + if (message.sig.length !== 0) { |
| 43 | + obj.sig = base64FromBytes(message.sig); |
| 44 | + } |
| 45 | + if (message.keyid !== "") { |
| 46 | + obj.keyid = message.keyid; |
| 47 | + } |
44 | 48 | return obj;
|
45 | 49 | },
|
46 | 50 | };
|
47 |
| -var tsProtoGlobalThis = (() => { |
48 |
| - if (typeof globalThis !== "undefined") { |
49 |
| - return globalThis; |
50 |
| - } |
51 |
| - if (typeof self !== "undefined") { |
52 |
| - return self; |
53 |
| - } |
54 |
| - if (typeof window !== "undefined") { |
55 |
| - return window; |
56 |
| - } |
57 |
| - if (typeof global !== "undefined") { |
58 |
| - return global; |
59 |
| - } |
60 |
| - throw "Unable to locate global object"; |
61 |
| -})(); |
62 | 51 | function bytesFromBase64(b64) {
|
63 |
| - if (tsProtoGlobalThis.Buffer) { |
64 |
| - return Uint8Array.from(tsProtoGlobalThis.Buffer.from(b64, "base64")); |
65 |
| - } |
66 |
| - else { |
67 |
| - const bin = tsProtoGlobalThis.atob(b64); |
68 |
| - const arr = new Uint8Array(bin.length); |
69 |
| - for (let i = 0; i < bin.length; ++i) { |
70 |
| - arr[i] = bin.charCodeAt(i); |
71 |
| - } |
72 |
| - return arr; |
73 |
| - } |
| 52 | + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); |
74 | 53 | }
|
75 | 54 | function base64FromBytes(arr) {
|
76 |
| - if (tsProtoGlobalThis.Buffer) { |
77 |
| - return tsProtoGlobalThis.Buffer.from(arr).toString("base64"); |
78 |
| - } |
79 |
| - else { |
80 |
| - const bin = []; |
81 |
| - arr.forEach((byte) => { |
82 |
| - bin.push(String.fromCharCode(byte)); |
83 |
| - }); |
84 |
| - return tsProtoGlobalThis.btoa(bin.join("")); |
85 |
| - } |
| 55 | + return globalThis.Buffer.from(arr).toString("base64"); |
86 | 56 | }
|
87 | 57 | function isSet(value) {
|
88 | 58 | return value !== null && value !== undefined;
|
|
0 commit comments