@tideorg/js 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. package/LICENSE +333 -0
  2. package/README.md +12 -0
  3. package/dist/Clients/ClientBase.d.ts +24 -0
  4. package/dist/Clients/ClientBase.d.ts.map +1 -0
  5. package/dist/Clients/ClientBase.js +160 -0
  6. package/dist/Clients/NetworkClient.d.ts +11 -0
  7. package/dist/Clients/NetworkClient.d.ts.map +1 -0
  8. package/dist/Clients/NetworkClient.js +68 -0
  9. package/dist/Clients/NodeClient.d.ts +34 -0
  10. package/dist/Clients/NodeClient.d.ts.map +1 -0
  11. package/dist/Clients/NodeClient.js +191 -0
  12. package/dist/Clients/VoucherClient.d.ts +8 -0
  13. package/dist/Clients/VoucherClient.d.ts.map +1 -0
  14. package/dist/Clients/VoucherClient.js +36 -0
  15. package/dist/Clients/index.d.ts +5 -0
  16. package/dist/Clients/index.d.ts.map +1 -0
  17. package/dist/Clients/index.js +20 -0
  18. package/dist/Contracts/BaseContract.d.ts +47 -0
  19. package/dist/Contracts/BaseContract.d.ts.map +1 -0
  20. package/dist/Contracts/BaseContract.js +153 -0
  21. package/dist/Contracts/GenericRealmAccessThresholdRoleContract.d.ts +8 -0
  22. package/dist/Contracts/GenericRealmAccessThresholdRoleContract.d.ts.map +1 -0
  23. package/dist/Contracts/GenericRealmAccessThresholdRoleContract.js +21 -0
  24. package/dist/Contracts/GenericResourceAccessThresholdRoleContract.d.ts +8 -0
  25. package/dist/Contracts/GenericResourceAccessThresholdRoleContract.d.ts.map +1 -0
  26. package/dist/Contracts/GenericResourceAccessThresholdRoleContract.js +21 -0
  27. package/dist/Contracts/index.d.ts +4 -0
  28. package/dist/Contracts/index.d.ts.map +1 -0
  29. package/dist/Contracts/index.js +19 -0
  30. package/dist/Cryptide/Components/BaseComponent.d.ts +56 -0
  31. package/dist/Cryptide/Components/BaseComponent.d.ts.map +1 -0
  32. package/dist/Cryptide/Components/BaseComponent.js +176 -0
  33. package/dist/Cryptide/Components/ComponentRegistry.d.ts +18 -0
  34. package/dist/Cryptide/Components/ComponentRegistry.d.ts.map +1 -0
  35. package/dist/Cryptide/Components/ComponentRegistry.js +39 -0
  36. package/dist/Cryptide/Components/Schemes/AES/AESScheme.d.ts +5 -0
  37. package/dist/Cryptide/Components/Schemes/AES/AESScheme.d.ts.map +1 -0
  38. package/dist/Cryptide/Components/Schemes/AES/AESScheme.js +20 -0
  39. package/dist/Cryptide/Components/Schemes/AES/index.d.ts +2 -0
  40. package/dist/Cryptide/Components/Schemes/AES/index.d.ts.map +1 -0
  41. package/dist/Cryptide/Components/Schemes/AES/index.js +17 -0
  42. package/dist/Cryptide/Components/Schemes/BaseScheme.d.ts +7 -0
  43. package/dist/Cryptide/Components/Schemes/BaseScheme.d.ts.map +1 -0
  44. package/dist/Cryptide/Components/Schemes/BaseScheme.js +23 -0
  45. package/dist/Cryptide/Components/Schemes/Ed25519/Ed25519Components.d.ts +52 -0
  46. package/dist/Cryptide/Components/Schemes/Ed25519/Ed25519Components.d.ts.map +1 -0
  47. package/dist/Cryptide/Components/Schemes/Ed25519/Ed25519Components.js +171 -0
  48. package/dist/Cryptide/Components/Schemes/Ed25519/Ed25519Scheme.d.ts +13 -0
  49. package/dist/Cryptide/Components/Schemes/Ed25519/Ed25519Scheme.d.ts.map +1 -0
  50. package/dist/Cryptide/Components/Schemes/Ed25519/Ed25519Scheme.js +71 -0
  51. package/dist/Cryptide/Components/Schemes/Ed25519/index.d.ts +3 -0
  52. package/dist/Cryptide/Components/Schemes/Ed25519/index.d.ts.map +1 -0
  53. package/dist/Cryptide/Components/Schemes/Ed25519/index.js +18 -0
  54. package/dist/Cryptide/Components/Schemes/SchemeRegistry.d.ts +3 -0
  55. package/dist/Cryptide/Components/Schemes/SchemeRegistry.d.ts.map +1 -0
  56. package/dist/Cryptide/Components/Schemes/SchemeRegistry.js +22 -0
  57. package/dist/Cryptide/Components/Schemes/index.d.ts +5 -0
  58. package/dist/Cryptide/Components/Schemes/index.d.ts.map +1 -0
  59. package/dist/Cryptide/Components/Schemes/index.js +20 -0
  60. package/dist/Cryptide/Components/index.d.ts +4 -0
  61. package/dist/Cryptide/Components/index.d.ts.map +1 -0
  62. package/dist/Cryptide/Components/index.js +19 -0
  63. package/dist/Cryptide/Ed25519.d.ts +106 -0
  64. package/dist/Cryptide/Ed25519.d.ts.map +1 -0
  65. package/dist/Cryptide/Ed25519.js +522 -0
  66. package/dist/Cryptide/Encryption/AES.d.ts +6 -0
  67. package/dist/Cryptide/Encryption/AES.d.ts.map +1 -0
  68. package/dist/Cryptide/Encryption/AES.js +76 -0
  69. package/dist/Cryptide/Encryption/DH.d.ts +4 -0
  70. package/dist/Cryptide/Encryption/DH.d.ts.map +1 -0
  71. package/dist/Cryptide/Encryption/DH.js +38 -0
  72. package/dist/Cryptide/Encryption/ElGamal.d.ts +12 -0
  73. package/dist/Cryptide/Encryption/ElGamal.d.ts.map +1 -0
  74. package/dist/Cryptide/Encryption/ElGamal.js +61 -0
  75. package/dist/Cryptide/Encryption/index.d.ts +4 -0
  76. package/dist/Cryptide/Encryption/index.d.ts.map +1 -0
  77. package/dist/Cryptide/Encryption/index.js +19 -0
  78. package/dist/Cryptide/Hashing/H2P.d.ts +6 -0
  79. package/dist/Cryptide/Hashing/H2P.d.ts.map +1 -0
  80. package/dist/Cryptide/Hashing/H2P.js +235 -0
  81. package/dist/Cryptide/Hashing/Hash.d.ts +8 -0
  82. package/dist/Cryptide/Hashing/Hash.d.ts.map +1 -0
  83. package/dist/Cryptide/Hashing/Hash.js +43 -0
  84. package/dist/Cryptide/Hashing/index.d.ts +3 -0
  85. package/dist/Cryptide/Hashing/index.d.ts.map +1 -0
  86. package/dist/Cryptide/Hashing/index.js +18 -0
  87. package/dist/Cryptide/Interpolation.d.ts +20 -0
  88. package/dist/Cryptide/Interpolation.d.ts.map +1 -0
  89. package/dist/Cryptide/Interpolation.js +68 -0
  90. package/dist/Cryptide/Math.d.ts +11 -0
  91. package/dist/Cryptide/Math.d.ts.map +1 -0
  92. package/dist/Cryptide/Math.js +81 -0
  93. package/dist/Cryptide/Serialization.d.ts +66 -0
  94. package/dist/Cryptide/Serialization.d.ts.map +1 -0
  95. package/dist/Cryptide/Serialization.js +517 -0
  96. package/dist/Cryptide/Signing/BlindSig.d.ts +10 -0
  97. package/dist/Cryptide/Signing/BlindSig.d.ts.map +1 -0
  98. package/dist/Cryptide/Signing/BlindSig.js +41 -0
  99. package/dist/Cryptide/Signing/EdDSA.d.ts +14 -0
  100. package/dist/Cryptide/Signing/EdDSA.d.ts.map +1 -0
  101. package/dist/Cryptide/Signing/EdDSA.js +67 -0
  102. package/dist/Cryptide/Signing/TideSignature.d.ts +59 -0
  103. package/dist/Cryptide/Signing/TideSignature.d.ts.map +1 -0
  104. package/dist/Cryptide/Signing/TideSignature.js +118 -0
  105. package/dist/Cryptide/Signing/index.d.ts +4 -0
  106. package/dist/Cryptide/Signing/index.d.ts.map +1 -0
  107. package/dist/Cryptide/Signing/index.js +19 -0
  108. package/dist/Cryptide/TideKey.d.ts +17 -0
  109. package/dist/Cryptide/TideKey.d.ts.map +1 -0
  110. package/dist/Cryptide/TideKey.js +84 -0
  111. package/dist/Cryptide/TideMemoryObjects.d.ts +4 -0
  112. package/dist/Cryptide/TideMemoryObjects.d.ts.map +1 -0
  113. package/dist/Cryptide/TideMemoryObjects.js +32 -0
  114. package/dist/Cryptide/index.d.ts +11 -0
  115. package/dist/Cryptide/index.d.ts.map +1 -0
  116. package/dist/Cryptide/index.js +28 -0
  117. package/dist/Flow/DecryptionFlows/dVVKDecryptionFlow.d.ts +16 -0
  118. package/dist/Flow/DecryptionFlows/dVVKDecryptionFlow.d.ts.map +1 -0
  119. package/dist/Flow/DecryptionFlows/dVVKDecryptionFlow.js +47 -0
  120. package/dist/Flow/DecryptionFlows/index.d.ts +2 -0
  121. package/dist/Flow/DecryptionFlows/index.d.ts.map +1 -0
  122. package/dist/Flow/DecryptionFlows/index.js +17 -0
  123. package/dist/Flow/EncryptionFlows/AuthorizedEncryptionFlow.d.ts +13 -0
  124. package/dist/Flow/EncryptionFlows/AuthorizedEncryptionFlow.d.ts.map +1 -0
  125. package/dist/Flow/EncryptionFlows/AuthorizedEncryptionFlow.js +183 -0
  126. package/dist/Flow/EncryptionFlows/PolicyAuthorizedEncryptionFlow.d.ts +57 -0
  127. package/dist/Flow/EncryptionFlows/PolicyAuthorizedEncryptionFlow.d.ts.map +1 -0
  128. package/dist/Flow/EncryptionFlows/PolicyAuthorizedEncryptionFlow.js +220 -0
  129. package/dist/Flow/EncryptionFlows/index.d.ts +3 -0
  130. package/dist/Flow/EncryptionFlows/index.d.ts.map +1 -0
  131. package/dist/Flow/EncryptionFlows/index.js +18 -0
  132. package/dist/Flow/SigningFlows/AuthorizedSigningFlow.d.ts +12 -0
  133. package/dist/Flow/SigningFlows/AuthorizedSigningFlow.d.ts.map +1 -0
  134. package/dist/Flow/SigningFlows/AuthorizedSigningFlow.js +50 -0
  135. package/dist/Flow/SigningFlows/dTestVVkSigningFlow.d.ts +15 -0
  136. package/dist/Flow/SigningFlows/dTestVVkSigningFlow.d.ts.map +1 -0
  137. package/dist/Flow/SigningFlows/dTestVVkSigningFlow.js +67 -0
  138. package/dist/Flow/SigningFlows/dVVKSigningFlow.d.ts +17 -0
  139. package/dist/Flow/SigningFlows/dVVKSigningFlow.d.ts.map +1 -0
  140. package/dist/Flow/SigningFlows/dVVKSigningFlow.js +61 -0
  141. package/dist/Flow/SigningFlows/dVVKSigningFlow2Step.d.ts +28 -0
  142. package/dist/Flow/SigningFlows/dVVKSigningFlow2Step.d.ts.map +1 -0
  143. package/dist/Flow/SigningFlows/dVVKSigningFlow2Step.js +118 -0
  144. package/dist/Flow/SigningFlows/index.d.ts +5 -0
  145. package/dist/Flow/SigningFlows/index.d.ts.map +1 -0
  146. package/dist/Flow/SigningFlows/index.js +20 -0
  147. package/dist/Flow/VoucherFlows/VoucherFlow.d.ts +16 -0
  148. package/dist/Flow/VoucherFlows/VoucherFlow.d.ts.map +1 -0
  149. package/dist/Flow/VoucherFlows/VoucherFlow.js +34 -0
  150. package/dist/Flow/VoucherFlows/index.d.ts +2 -0
  151. package/dist/Flow/VoucherFlows/index.d.ts.map +1 -0
  152. package/dist/Flow/VoucherFlows/index.js +17 -0
  153. package/dist/Flow/index.d.ts +5 -0
  154. package/dist/Flow/index.d.ts.map +1 -0
  155. package/dist/Flow/index.js +20 -0
  156. package/dist/Math/KeyDecryption.d.ts +3 -0
  157. package/dist/Math/KeyDecryption.d.ts.map +1 -0
  158. package/dist/Math/KeyDecryption.js +24 -0
  159. package/dist/Math/KeySigning.d.ts +4 -0
  160. package/dist/Math/KeySigning.d.ts.map +1 -0
  161. package/dist/Math/KeySigning.js +28 -0
  162. package/dist/Math/index.d.ts +3 -0
  163. package/dist/Math/index.d.ts.map +1 -0
  164. package/dist/Math/index.js +18 -0
  165. package/dist/Models/AuthRequest.d.ts +14 -0
  166. package/dist/Models/AuthRequest.d.ts.map +1 -0
  167. package/dist/Models/AuthRequest.js +48 -0
  168. package/dist/Models/BaseTideRequest.d.ts +55 -0
  169. package/dist/Models/BaseTideRequest.d.ts.map +1 -0
  170. package/dist/Models/BaseTideRequest.js +299 -0
  171. package/dist/Models/CustomTideRequest.d.ts +19 -0
  172. package/dist/Models/CustomTideRequest.d.ts.map +1 -0
  173. package/dist/Models/CustomTideRequest.js +30 -0
  174. package/dist/Models/Datum.d.ts +11 -0
  175. package/dist/Models/Datum.d.ts.map +1 -0
  176. package/dist/Models/Datum.js +33 -0
  177. package/dist/Models/Doken.d.ts +33 -0
  178. package/dist/Models/Doken.d.ts.map +1 -0
  179. package/dist/Models/Doken.js +133 -0
  180. package/dist/Models/EnclaveEntry.d.ts +14 -0
  181. package/dist/Models/EnclaveEntry.d.ts.map +1 -0
  182. package/dist/Models/EnclaveEntry.js +49 -0
  183. package/dist/Models/Infos/KeyInfo.d.ts +24 -0
  184. package/dist/Models/Infos/KeyInfo.d.ts.map +1 -0
  185. package/dist/Models/Infos/KeyInfo.js +51 -0
  186. package/dist/Models/Infos/OrkInfo.d.ts +18 -0
  187. package/dist/Models/Infos/OrkInfo.d.ts.map +1 -0
  188. package/dist/Models/Infos/OrkInfo.js +58 -0
  189. package/dist/Models/Infos/index.d.ts +3 -0
  190. package/dist/Models/Infos/index.d.ts.map +1 -0
  191. package/dist/Models/Infos/index.js +18 -0
  192. package/dist/Models/ModelRegistry.d.ts +29 -0
  193. package/dist/Models/ModelRegistry.d.ts.map +1 -0
  194. package/dist/Models/ModelRegistry.js +321 -0
  195. package/dist/Models/Policy.d.ts +41 -0
  196. package/dist/Models/Policy.d.ts.map +1 -0
  197. package/dist/Models/Policy.js +317 -0
  198. package/dist/Models/PolicyProtectedSerializedField.d.ts +12 -0
  199. package/dist/Models/PolicyProtectedSerializedField.d.ts.map +1 -0
  200. package/dist/Models/PolicyProtectedSerializedField.js +50 -0
  201. package/dist/Models/Responses/Vendor/VoucherResponse.d.ts +12 -0
  202. package/dist/Models/Responses/Vendor/VoucherResponse.d.ts.map +1 -0
  203. package/dist/Models/Responses/Vendor/VoucherResponse.js +39 -0
  204. package/dist/Models/Responses/Vendor/index.d.ts +2 -0
  205. package/dist/Models/Responses/Vendor/index.d.ts.map +1 -0
  206. package/dist/Models/Responses/Vendor/index.js +17 -0
  207. package/dist/Models/Responses/index.d.ts +2 -0
  208. package/dist/Models/Responses/index.d.ts.map +1 -0
  209. package/dist/Models/Responses/index.js +17 -0
  210. package/dist/Models/SerializedField.d.ts +12 -0
  211. package/dist/Models/SerializedField.d.ts.map +1 -0
  212. package/dist/Models/SerializedField.js +50 -0
  213. package/dist/Models/VendorData.d.ts +12 -0
  214. package/dist/Models/VendorData.d.ts.map +1 -0
  215. package/dist/Models/VendorData.js +38 -0
  216. package/dist/Models/VendorSettings.d.ts +9 -0
  217. package/dist/Models/VendorSettings.d.ts.map +1 -0
  218. package/dist/Models/VendorSettings.js +32 -0
  219. package/dist/Models/index.d.ts +13 -0
  220. package/dist/Models/index.d.ts.map +1 -0
  221. package/dist/Models/index.js +30 -0
  222. package/dist/Tools/TideMemory.d.ts +10 -0
  223. package/dist/Tools/TideMemory.d.ts.map +1 -0
  224. package/dist/Tools/TideMemory.js +105 -0
  225. package/dist/Tools/Utils.d.ts +13 -0
  226. package/dist/Tools/Utils.d.ts.map +1 -0
  227. package/dist/Tools/Utils.js +244 -0
  228. package/dist/Tools/index.d.ts +3 -0
  229. package/dist/Tools/index.d.ts.map +1 -0
  230. package/dist/Tools/index.js +18 -0
  231. package/dist/index.d.ts +10 -0
  232. package/dist/index.d.ts.map +1 -0
  233. package/dist/index.js +26 -0
  234. package/package.json +27 -0
@@ -0,0 +1,317 @@
1
+ import { TideMemory } from "../Tools/TideMemory";
2
+ import { BigIntToByteArray, BigIntFromByteArray, StringFromUint8Array, StringToUint8Array } from "../Cryptide/Serialization";
3
+ export var ApprovalType;
4
+ (function (ApprovalType) {
5
+ ApprovalType[ApprovalType["EXPLICIT"] = 0] = "EXPLICIT";
6
+ ApprovalType[ApprovalType["IMPLICIT"] = 1] = "IMPLICIT";
7
+ })(ApprovalType || (ApprovalType = {}));
8
+ export var ExecutionType;
9
+ (function (ExecutionType) {
10
+ ExecutionType[ExecutionType["PRIVATE"] = 0] = "PRIVATE";
11
+ ExecutionType[ExecutionType["PUBLIC"] = 1] = "PUBLIC";
12
+ })(ExecutionType || (ExecutionType = {}));
13
+ export class Policy {
14
+ constructor(data) {
15
+ if (typeof data["version"] !== "string")
16
+ throw 'Version is not a string';
17
+ // if Policy is constructed directly (not via a subclass), enforce latest version
18
+ if (new.target === Policy) {
19
+ if (data["version"] !== Policy.latestVersion) {
20
+ throw 'Breaking changes made to Policies. Update how you create a policy in your application';
21
+ }
22
+ }
23
+ this.version = data["version"];
24
+ if (typeof data["contractId"] !== "string")
25
+ throw 'ContractId is not a string';
26
+ this.contractId = data["contractId"];
27
+ if (!Array.isArray(data["modelId"]) && typeof data["modelId"] !== "string")
28
+ throw 'ModelId is not a string';
29
+ this.modelIds = typeof data["modelId"] === "string" ? [data["modelId"]] : data["modelId"];
30
+ if (typeof data["keyId"] !== "string")
31
+ throw 'KeyId is not a string';
32
+ this.keyId = data["keyId"];
33
+ this.approvalType = data.approvalType;
34
+ this.executionType = data.executionType;
35
+ if (!data["params"])
36
+ throw 'Params is null';
37
+ this.params = data["params"] instanceof PolicyParameters ? data["params"] : new PolicyParameters(data["params"]);
38
+ this.dataToVerify = TideMemory.CreateFromArray([
39
+ StringToUint8Array(this.version),
40
+ StringToUint8Array(this.contractId),
41
+ TideMemory.CreateFromArray(this.modelIds.map(i => StringToUint8Array(i))),
42
+ StringToUint8Array(this.keyId),
43
+ StringToUint8Array(ApprovalType[this.approvalType]),
44
+ StringToUint8Array(ExecutionType[this.executionType]),
45
+ this.params.toBytes()
46
+ ]);
47
+ }
48
+ static from(data) {
49
+ const d = new TideMemory(data.length);
50
+ d.set(data);
51
+ const dataToVerify = d.GetValue(0);
52
+ const version = StringFromUint8Array(dataToVerify.GetValue(0));
53
+ if (version != Policy.latestVersion) {
54
+ // old version
55
+ switch (version) {
56
+ case PolicyV1.thisVersion:
57
+ return PolicyV1.from(d);
58
+ case PolicyV2.thisVersion:
59
+ return PolicyV2.from(d);
60
+ default:
61
+ throw Error("Unknown policy version: " + version);
62
+ }
63
+ }
64
+ const contractId = StringFromUint8Array(dataToVerify.GetValue(1));
65
+ const modelIdSection = dataToVerify.GetValue(2);
66
+ const modelIds = [];
67
+ let returnObj = { result: undefined };
68
+ for (let i = 0; modelIdSection.TryGetValue(i, returnObj); i++) {
69
+ modelIds.push(StringFromUint8Array(returnObj.result));
70
+ }
71
+ const keyId = StringFromUint8Array(dataToVerify.GetValue(3));
72
+ const approvalType = ApprovalType[StringFromUint8Array(dataToVerify.GetValue(4))];
73
+ const executionType = ExecutionType[StringFromUint8Array(dataToVerify.GetValue(5))];
74
+ const params = new PolicyParameters(dataToVerify.GetValue(6));
75
+ const p = new Policy({
76
+ version,
77
+ contractId,
78
+ modelId: modelIds,
79
+ keyId,
80
+ approvalType,
81
+ executionType,
82
+ params
83
+ });
84
+ const sigRes = { result: undefined };
85
+ if (d.TryGetValue(1, sigRes)) {
86
+ p.signature = sigRes.result;
87
+ }
88
+ return p;
89
+ }
90
+ toBytes() {
91
+ let d = [
92
+ TideMemory.CreateFromArray([
93
+ StringToUint8Array(this.version),
94
+ StringToUint8Array(this.contractId),
95
+ TideMemory.CreateFromArray(this.modelIds.map(i => StringToUint8Array(i))),
96
+ StringToUint8Array(this.keyId),
97
+ StringToUint8Array(ApprovalType[this.approvalType]),
98
+ StringToUint8Array(ExecutionType[this.executionType]),
99
+ this.params.toBytes()
100
+ ])
101
+ ];
102
+ if (this.signature)
103
+ d.push(this.signature);
104
+ return TideMemory.CreateFromArray(d);
105
+ }
106
+ }
107
+ Policy.latestVersion = "3";
108
+ export class PolicyParameters {
109
+ constructor(data) {
110
+ if (data instanceof Uint8Array) {
111
+ this.entries = PolicyParameters.fromBytes(data);
112
+ }
113
+ else {
114
+ this.entries = new Map(data);
115
+ }
116
+ }
117
+ static fromBytes(data) {
118
+ let params = new Map();
119
+ let i = 0;
120
+ const value = { result: undefined };
121
+ // Create TideMemory instance to access TryGetValue
122
+ const tideData = new TideMemory(data.length);
123
+ tideData.set(data);
124
+ // Try to get values at sequential indices
125
+ while (tideData.TryGetValue(i, value)) {
126
+ const nameBytes = value.result.GetValue(0);
127
+ const name = StringFromUint8Array(nameBytes);
128
+ const typeBytes = value.result.GetValue(1);
129
+ const type = StringFromUint8Array(typeBytes);
130
+ const dataBytes = value.result.GetValue(2);
131
+ let datum;
132
+ switch (type) {
133
+ case "str":
134
+ datum = StringFromUint8Array(dataBytes);
135
+ break;
136
+ case "num":
137
+ const numView = new DataView(dataBytes.buffer, dataBytes.byteOffset, dataBytes.byteLength);
138
+ datum = numView.getInt32(0, true); // little-endian
139
+ break;
140
+ case "bnum":
141
+ // Convert bytes to BigInt (little-endian)
142
+ datum = BigIntFromByteArray(dataBytes);
143
+ break;
144
+ case "bln":
145
+ datum = dataBytes[0] === 1;
146
+ break;
147
+ case "byt":
148
+ datum = new Uint8Array(dataBytes);
149
+ break;
150
+ default:
151
+ throw new Error(`Could not find type of ${type}`);
152
+ }
153
+ params.set(name, datum);
154
+ i++;
155
+ }
156
+ return params;
157
+ }
158
+ tryGetParameter(key) {
159
+ try {
160
+ return [true, this.getParameter(key)];
161
+ }
162
+ catch {
163
+ return [false, null];
164
+ }
165
+ }
166
+ getParameter(key) {
167
+ if (!this.entries.has(key)) {
168
+ throw new Error(`Parameter '${key}' not found`);
169
+ }
170
+ const value = this.entries.get(key);
171
+ const actualType = value instanceof Uint8Array ? 'Uint8Array' : typeof value;
172
+ // Type checking logic
173
+ let expectedType;
174
+ if (value instanceof Uint8Array) {
175
+ expectedType = 'Uint8Array';
176
+ }
177
+ else {
178
+ expectedType = typeof value;
179
+ }
180
+ // Validate the type matches what was requested
181
+ // We can't directly check T at runtime, so we infer from the value type
182
+ const isCorrectType = (typeof value === 'string' && value.constructor === String) ||
183
+ (typeof value === 'number' && value.constructor === Number) ||
184
+ (typeof value === 'bigint' && value.constructor === BigInt) ||
185
+ (typeof value === 'boolean' && value.constructor === Boolean) ||
186
+ (value instanceof Uint8Array);
187
+ if (!isCorrectType) {
188
+ throw new Error(`Parameter '${key}' exists but has unexpected type '${actualType}'`);
189
+ }
190
+ return value;
191
+ }
192
+ toBytes() {
193
+ let params = [];
194
+ for (const [key, value] of this.entries) {
195
+ const nameBytes = StringToUint8Array(key);
196
+ let dataBytes, typeStr;
197
+ if (typeof value === 'string') {
198
+ dataBytes = StringToUint8Array(value);
199
+ typeStr = "str";
200
+ }
201
+ else if (typeof value === 'number' && Number.isInteger(value)) {
202
+ const buffer = new ArrayBuffer(4);
203
+ const view = new DataView(buffer);
204
+ view.setInt32(0, value, true); // little-endian
205
+ dataBytes = new Uint8Array(buffer);
206
+ typeStr = "num";
207
+ }
208
+ else if (typeof value === 'bigint') {
209
+ dataBytes = BigIntToByteArray(value);
210
+ typeStr = "bnum";
211
+ }
212
+ else if (typeof value === 'boolean') {
213
+ dataBytes = new Uint8Array([value ? 1 : 0]);
214
+ typeStr = "bln";
215
+ }
216
+ else if (value instanceof Uint8Array) {
217
+ dataBytes = value;
218
+ typeStr = "byt";
219
+ }
220
+ else {
221
+ throw new Error(`Could not serialize key '${key}' of type '${typeof value}'`);
222
+ }
223
+ const typeBytes = StringToUint8Array(typeStr);
224
+ const paramMemory = TideMemory.CreateFromArray([nameBytes, typeBytes, dataBytes]);
225
+ params.push(paramMemory);
226
+ }
227
+ return TideMemory.CreateFromArray(params);
228
+ }
229
+ }
230
+ class PolicyV2 extends Policy {
231
+ static from(data) {
232
+ const dataToVerify = data.GetValue(0);
233
+ const v = StringFromUint8Array(dataToVerify.GetValue(0));
234
+ if (v != PolicyV2.thisVersion) {
235
+ throw Error("Dev error");
236
+ }
237
+ const contractId = StringFromUint8Array(dataToVerify.GetValue(1));
238
+ const modelId = StringFromUint8Array(dataToVerify.GetValue(2));
239
+ const keyId = StringFromUint8Array(dataToVerify.GetValue(3));
240
+ const approvalType = ApprovalType[StringFromUint8Array(dataToVerify.GetValue(4))];
241
+ const executionType = ExecutionType[StringFromUint8Array(dataToVerify.GetValue(5))];
242
+ const params = new PolicyParameters(dataToVerify.GetValue(6));
243
+ const p = new PolicyV2({
244
+ version: v,
245
+ contractId,
246
+ modelId,
247
+ keyId,
248
+ approvalType: approvalType,
249
+ executionType: executionType,
250
+ params
251
+ });
252
+ const sigRes = { result: undefined };
253
+ if (data.TryGetValue(1, sigRes)) {
254
+ p.signature = sigRes.result;
255
+ }
256
+ return p;
257
+ }
258
+ toBytes() {
259
+ let d = [
260
+ TideMemory.CreateFromArray([
261
+ StringToUint8Array(this.version),
262
+ StringToUint8Array(this.contractId),
263
+ StringToUint8Array(this.modelIds[0]),
264
+ StringToUint8Array(this.keyId),
265
+ StringToUint8Array(ApprovalType[this.approvalType]),
266
+ StringToUint8Array(ExecutionType[this.executionType]),
267
+ this.params.toBytes()
268
+ ])
269
+ ];
270
+ if (this.signature)
271
+ d.push(this.signature);
272
+ return TideMemory.CreateFromArray(d);
273
+ }
274
+ }
275
+ PolicyV2.thisVersion = "2";
276
+ class PolicyV1 extends Policy {
277
+ static from(data) {
278
+ const dataToVerify = data.GetValue(0);
279
+ const v = StringFromUint8Array(dataToVerify.GetValue(0));
280
+ if (v != PolicyV1.thisVersion) {
281
+ throw Error("Dev error");
282
+ }
283
+ const contractId = StringFromUint8Array(dataToVerify.GetValue(1));
284
+ const modelId = StringFromUint8Array(dataToVerify.GetValue(2));
285
+ const keyId = StringFromUint8Array(dataToVerify.GetValue(3));
286
+ const params = new PolicyParameters(dataToVerify.GetValue(4));
287
+ const p = new PolicyV1({
288
+ version: v,
289
+ contractId,
290
+ modelId,
291
+ keyId,
292
+ approvalType: ApprovalType.EXPLICIT, // didn't exist on v1 so this is default
293
+ executionType: ExecutionType.PUBLIC, // didn't exist on v1 so this is default
294
+ params
295
+ });
296
+ const sigRes = { result: undefined };
297
+ if (data.TryGetValue(1, sigRes)) {
298
+ p.signature = sigRes.result;
299
+ }
300
+ return p;
301
+ }
302
+ toBytes() {
303
+ let d = [
304
+ TideMemory.CreateFromArray([
305
+ StringToUint8Array(PolicyV1.thisVersion),
306
+ StringToUint8Array(this.contractId),
307
+ StringToUint8Array(this.modelIds[0]),
308
+ StringToUint8Array(this.keyId),
309
+ this.params.toBytes()
310
+ ])
311
+ ];
312
+ if (this.signature)
313
+ d.push(this.signature);
314
+ return TideMemory.CreateFromArray(d);
315
+ }
316
+ }
317
+ PolicyV1.thisVersion = "1";
@@ -0,0 +1,12 @@
1
+ import { TideMemory } from "../Tools/TideMemory";
2
+ export default class PolicyProtectedSerializedField {
3
+ static version: number;
4
+ static create(encData: Uint8Array, timestamp: number | Uint8Array, encKey?: Uint8Array, signature?: Uint8Array): TideMemory;
5
+ static deserialize(serializedField: Uint8Array): {
6
+ encFieldChk: Uint8Array<ArrayBufferLike>;
7
+ timestamp: Uint8Array<ArrayBufferLike>;
8
+ encKey: Uint8Array<ArrayBufferLike>;
9
+ signature: Uint8Array<ArrayBufferLike>;
10
+ };
11
+ }
12
+ //# sourceMappingURL=PolicyProtectedSerializedField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PolicyProtectedSerializedField.d.ts","sourceRoot":"","sources":["../../Models/PolicyProtectedSerializedField.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,MAAM,CAAC,OAAO,OAAO,8BAA8B;IAC/C,MAAM,CAAC,OAAO,SAAK;IACnB,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,GAAG,UAAU,EAAE,MAAM,GAAE,UAAiB,EAAE,SAAS,GAAE,UAAiB;IAY1H,MAAM,CAAC,WAAW,CAAC,eAAe,EAAE,UAAU;;;;;;CAqBjD"}
@@ -0,0 +1,50 @@
1
+ //
2
+ // Tide Protocol - Infrastructure for a TRUE Zero-Trust paradigm
3
+ // Copyright (C) 2022 Tide Foundation Ltd
4
+ //
5
+ // This program is free software and is subject to the terms of
6
+ // the Tide Community Open Code License as published by the
7
+ // Tide Foundation Limited. You may modify it and redistribute
8
+ // it in accordance with and subject to the terms of that License.
9
+ // This program is distributed WITHOUT WARRANTY of any kind,
10
+ // including without any implied warranty of MERCHANTABILITY or
11
+ // FITNESS FOR A PARTICULAR PURPOSE.
12
+ // See the Tide Community Open Code License for more details.
13
+ // You should have received a copy of the Tide Community Open
14
+ // Code License along with this program.
15
+ // If not, see https://tide.org/licenses_tcoc2-0-0-en
16
+ //
17
+ import { Uint8ArrayToNumber, numberToUint8Array } from "../Cryptide/Serialization";
18
+ import { Serialization } from "../Cryptide/index";
19
+ import { TideMemory } from "../Tools/TideMemory";
20
+ class PolicyProtectedSerializedField {
21
+ static create(encData, timestamp, encKey = null, signature = null) {
22
+ const versionByte = numberToUint8Array(this.version, 1); // 1 byte
23
+ const timestampBits = typeof (timestamp) === "number" ? numberToUint8Array(timestamp, 8) : timestamp; // 64 bits (8 bytes)- let's hope Tide is still around past 2038 (otherwise i could've saved 32 bits here) https://en.wikipedia.org/wiki/Year_2038_problem
24
+ return TideMemory.CreateFromArray([
25
+ versionByte,
26
+ encData,
27
+ timestampBits,
28
+ encKey == null ? new Uint8Array() : encKey,
29
+ signature == null ? new Uint8Array() : signature
30
+ ]);
31
+ }
32
+ static deserialize(serializedField) {
33
+ // Make sure version is 1
34
+ const version = Uint8ArrayToNumber(Serialization.GetValue(serializedField, 0));
35
+ if (version != this.version)
36
+ throw Error("Serialized tide data must be version " + this.version);
37
+ const encFieldChk = Serialization.GetValue(serializedField, 1);
38
+ const timestamp = Serialization.GetValue(serializedField, 2); // keep as array until JS HANDLES 64 BIT NUMBERS!
39
+ const encKey = Serialization.GetValue(serializedField, 3);
40
+ const signature = Serialization.GetValue(serializedField, 4);
41
+ return {
42
+ encFieldChk: encFieldChk,
43
+ timestamp: timestamp,
44
+ encKey: encKey.length == 0 ? null : encKey,
45
+ signature: signature.length == 0 ? null : signature
46
+ };
47
+ }
48
+ }
49
+ PolicyProtectedSerializedField.version = 2;
50
+ export default PolicyProtectedSerializedField;
@@ -0,0 +1,12 @@
1
+ export default class VoucherResponse {
2
+ voucherPacks: string[];
3
+ qPub: string;
4
+ payerPub: string;
5
+ Yhat: string;
6
+ blurerK: string;
7
+ UDeObf: string;
8
+ constructor(voucherPacks: string[], qPub: string, payerPub: string, Yhat: string, blurerK: string, UDeObf: string);
9
+ static from(data: string, blurerK: string): VoucherResponse;
10
+ toORK(index: number): string;
11
+ }
12
+ //# sourceMappingURL=VoucherResponse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VoucherResponse.d.ts","sourceRoot":"","sources":["../../../../Models/Responses/Vendor/VoucherResponse.ts"],"names":[],"mappings":"AAiBA,MAAM,CAAC,OAAO,OAAO,eAAe;IAChC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;gBAEH,YAAY,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IASjH,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAKzC,KAAK,CAAC,KAAK,EAAE,MAAM;CAStB"}
@@ -0,0 +1,39 @@
1
+ //
2
+ // Tide Protocol - Infrastructure for a TRUE Zero-Trust paradigm
3
+ // Copyright (C) 2022 Tide Foundation Ltd
4
+ //
5
+ // This program is free software and is subject to the terms of
6
+ // the Tide Community Open Code License as published by the
7
+ // Tide Foundation Limited. You may modify it and redistribute
8
+ // it in accordance with and subject to the terms of that License.
9
+ // This program is distributed WITHOUT WARRANTY of any kind,
10
+ // including without any implied warranty of MERCHANTABILITY or
11
+ // FITNESS FOR A PARTICULAR PURPOSE.
12
+ // See the Tide Community Open Code License for more details.
13
+ // You should have received a copy of the Tide Community Open
14
+ // Code License along with this program.
15
+ // If not, see https://tide.org/licenses_tcoc2-0-0-en
16
+ //
17
+ export default class VoucherResponse {
18
+ constructor(voucherPacks, qPub, payerPub, Yhat, blurerK, UDeObf) {
19
+ this.voucherPacks = voucherPacks;
20
+ this.qPub = qPub;
21
+ this.payerPub = payerPub;
22
+ this.Yhat = Yhat;
23
+ this.blurerK = blurerK;
24
+ this.UDeObf = UDeObf;
25
+ }
26
+ static from(data, blurerK) {
27
+ const json = JSON.parse(data);
28
+ return new VoucherResponse(json.voucherPacks, json.QPub, json.PayerPub, json.YHat, blurerK, json.UDeObf);
29
+ }
30
+ toORK(index) {
31
+ return JSON.stringify({
32
+ VoucherPack: this.voucherPacks[index],
33
+ YHat: this.Yhat,
34
+ QPub: this.qPub,
35
+ BlurerK: this.blurerK,
36
+ PayerPublic: this.payerPub
37
+ });
38
+ }
39
+ }
@@ -0,0 +1,2 @@
1
+ export { default as VoucherResponse } from './VoucherResponse';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../Models/Responses/Vendor/index.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,17 @@
1
+ //
2
+ // Tide Protocol - Infrastructure for a TRUE Zero-Trust paradigm
3
+ // Copyright (C) 2022 Tide Foundation Ltd
4
+ //
5
+ // This program is free software and is subject to the terms of
6
+ // the Tide Community Open Code License as published by the
7
+ // Tide Foundation Limited. You may modify it and redistribute
8
+ // it in accordance with and subject to the terms of that License.
9
+ // This program is distributed WITHOUT WARRANTY of any kind,
10
+ // including without any implied warranty of MERCHANTABILITY or
11
+ // FITNESS FOR A PARTICULAR PURPOSE.
12
+ // See the Tide Community Open Code License for more details.
13
+ // You should have received a copy of the Tide Community Open
14
+ // Code License along with this program.
15
+ // If not, see https://tide.org/licenses_tcoc2-0-0-en
16
+ //
17
+ export { default as VoucherResponse } from './VoucherResponse';
@@ -0,0 +1,2 @@
1
+ export * as Vendor from './Vendor';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../Models/Responses/index.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC"}
@@ -0,0 +1,17 @@
1
+ //
2
+ // Tide Protocol - Infrastructure for a TRUE Zero-Trust paradigm
3
+ // Copyright (C) 2022 Tide Foundation Ltd
4
+ //
5
+ // This program is free software and is subject to the terms of
6
+ // the Tide Community Open Code License as published by the
7
+ // Tide Foundation Limited. You may modify it and redistribute
8
+ // it in accordance with and subject to the terms of that License.
9
+ // This program is distributed WITHOUT WARRANTY of any kind,
10
+ // including without any implied warranty of MERCHANTABILITY or
11
+ // FITNESS FOR A PARTICULAR PURPOSE.
12
+ // See the Tide Community Open Code License for more details.
13
+ // You should have received a copy of the Tide Community Open
14
+ // Code License along with this program.
15
+ // If not, see https://tide.org/licenses_tcoc2-0-0-en
16
+ //
17
+ export * as Vendor from './Vendor';
@@ -0,0 +1,12 @@
1
+ import { TideMemory } from "../Tools/TideMemory";
2
+ export default class SerializedField {
3
+ static version: number;
4
+ static create(encData: Uint8Array, timestamp: number, encKey?: Uint8Array, signature?: Uint8Array): TideMemory;
5
+ static deserialize(serializedField: Uint8Array): {
6
+ encFieldChk: Uint8Array<ArrayBufferLike>;
7
+ timestamp: Uint8Array<ArrayBufferLike>;
8
+ encKey: Uint8Array<ArrayBufferLike>;
9
+ signature: Uint8Array<ArrayBufferLike>;
10
+ };
11
+ }
12
+ //# sourceMappingURL=SerializedField.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SerializedField.d.ts","sourceRoot":"","sources":["../../Models/SerializedField.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,MAAM,CAAC,OAAO,OAAO,eAAe;IAChC,MAAM,CAAC,OAAO,SAAK;IACnB,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAE,UAAiB,EAAE,SAAS,GAAE,UAAiB;IAY7G,MAAM,CAAC,WAAW,CAAC,eAAe,EAAE,UAAU;;;;;;CAqBjD"}
@@ -0,0 +1,50 @@
1
+ //
2
+ // Tide Protocol - Infrastructure for a TRUE Zero-Trust paradigm
3
+ // Copyright (C) 2022 Tide Foundation Ltd
4
+ //
5
+ // This program is free software and is subject to the terms of
6
+ // the Tide Community Open Code License as published by the
7
+ // Tide Foundation Limited. You may modify it and redistribute
8
+ // it in accordance with and subject to the terms of that License.
9
+ // This program is distributed WITHOUT WARRANTY of any kind,
10
+ // including without any implied warranty of MERCHANTABILITY or
11
+ // FITNESS FOR A PARTICULAR PURPOSE.
12
+ // See the Tide Community Open Code License for more details.
13
+ // You should have received a copy of the Tide Community Open
14
+ // Code License along with this program.
15
+ // If not, see https://tide.org/licenses_tcoc2-0-0-en
16
+ //
17
+ import { Uint8ArrayToNumber, numberToUint8Array } from "../Cryptide/Serialization";
18
+ import { Serialization } from "../Cryptide/index";
19
+ import { TideMemory } from "../Tools/TideMemory";
20
+ class SerializedField {
21
+ static create(encData, timestamp, encKey = null, signature = null) {
22
+ const versionByte = numberToUint8Array(this.version, 1); // 1 byte
23
+ const timestampBits = numberToUint8Array(timestamp, 8); // 64 bits (8 bytes)- let's hope Tide is still around past 2038 (otherwise i could've saved 32 bits here) https://en.wikipedia.org/wiki/Year_2038_problem
24
+ return TideMemory.CreateFromArray([
25
+ versionByte,
26
+ encData,
27
+ timestampBits,
28
+ encKey == null ? new Uint8Array() : encKey,
29
+ signature == null ? new Uint8Array() : signature
30
+ ]);
31
+ }
32
+ static deserialize(serializedField) {
33
+ // Make sure version is 1
34
+ const version = Uint8ArrayToNumber(Serialization.GetValue(serializedField, 0));
35
+ if (version != this.version)
36
+ throw Error("Serialized tide data must be version " + this.version);
37
+ const encFieldChk = Serialization.GetValue(serializedField, 1);
38
+ const timestamp = Serialization.GetValue(serializedField, 2); // keep as array until JS HANDLES 64 BIT NUMBERS!
39
+ const encKey = Serialization.GetValue(serializedField, 3);
40
+ const signature = Serialization.GetValue(serializedField, 4);
41
+ return {
42
+ encFieldChk: encFieldChk,
43
+ timestamp: timestamp,
44
+ encKey: encKey.length == 0 ? null : encKey,
45
+ signature: signature.length == 0 ? null : signature
46
+ };
47
+ }
48
+ }
49
+ SerializedField.version = 1;
50
+ export default SerializedField;
@@ -0,0 +1,12 @@
1
+ import { Point } from "../Cryptide/Ed25519";
2
+ import AuthRequest from "./AuthRequest";
3
+ export default class VendorData {
4
+ VUID: string;
5
+ gCMKAuth: Point;
6
+ blindSig: string;
7
+ AuthToken: AuthRequest;
8
+ constructor(VUID: string, gCMKAuth: Point, blindSig: string, AuthToken: AuthRequest);
9
+ toString(): string;
10
+ static from(data: string): VendorData;
11
+ }
12
+ //# sourceMappingURL=VendorData.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VendorData.d.ts","sourceRoot":"","sources":["../../Models/VendorData.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,MAAM,CAAC,OAAO,OAAO,UAAU;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,KAAK,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,WAAW,CAAC;gBAEX,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW;IAOnF,QAAQ;IASR,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM;CAI3B"}
@@ -0,0 +1,38 @@
1
+ //
2
+ // Tide Protocol - Infrastructure for a TRUE Zero-Trust paradigm
3
+ // Copyright (C) 2022 Tide Foundation Ltd
4
+ //
5
+ // This program is free software and is subject to the terms of
6
+ // the Tide Community Open Code License as published by the
7
+ // Tide Foundation Limited. You may modify it and redistribute
8
+ // it in accordance with and subject to the terms of that License.
9
+ // This program is distributed WITHOUT WARRANTY of any kind,
10
+ // including without any implied warranty of MERCHANTABILITY or
11
+ // FITNESS FOR A PARTICULAR PURPOSE.
12
+ // See the Tide Community Open Code License for more details.
13
+ // You should have received a copy of the Tide Community Open
14
+ // Code License along with this program.
15
+ // If not, see https://tide.org/licenses_tcoc2-0-0-en
16
+ //
17
+ import { Ed25519PublicComponent } from "../Cryptide/Components/Schemes/Ed25519/Ed25519Components";
18
+ import AuthRequest from "./AuthRequest";
19
+ export default class VendorData {
20
+ constructor(VUID, gCMKAuth, blindSig, AuthToken) {
21
+ this.VUID = VUID;
22
+ this.gCMKAuth = gCMKAuth;
23
+ this.blindSig = blindSig;
24
+ this.AuthToken = AuthToken;
25
+ }
26
+ toString() {
27
+ return JSON.stringify({
28
+ 'VUID': this.VUID,
29
+ 'gCMKAuth': new Ed25519PublicComponent(this.gCMKAuth).Serialize().ToString(),
30
+ 'blindSig': this.blindSig,
31
+ 'AuthToken': this.AuthToken.toString()
32
+ });
33
+ }
34
+ static from(data) {
35
+ const json = JSON.parse(data);
36
+ return new VendorData(json.VUID, json.gCMKAuth, json.blindSig, AuthRequest.from(json.AuthToken));
37
+ }
38
+ }
@@ -0,0 +1,9 @@
1
+ export default class VendorSettings {
2
+ regOn: boolean;
3
+ backupOn: boolean;
4
+ imageURL: string;
5
+ logoURL: string;
6
+ constructor(regOn: boolean, backupOn: boolean, imageURL: string, logoURL: string);
7
+ toString(): string;
8
+ }
9
+ //# sourceMappingURL=VendorSettings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VendorSettings.d.ts","sourceRoot":"","sources":["../../Models/VendorSettings.ts"],"names":[],"mappings":"AAiBA,MAAM,CAAC,OAAO,OAAO,cAAc;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;gBAEJ,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAMhF,QAAQ;CAQX"}