@super-protocol/sdk-js 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/BlockchainConnector.d.ts +48 -0
- package/build/BlockchainConnector.js +259 -0
- package/build/TIIGenerator.d.ts +21 -0
- package/build/TIIGenerator.js +251 -0
- package/build/constants.d.ts +7 -0
- package/build/constants.js +10 -0
- package/build/contracts/ActiveOffersList.json +131 -0
- package/build/contracts/ActiveOrdersList.json +74 -0
- package/build/contracts/Marks.json +79 -0
- package/build/contracts/Offers.json +999 -0
- package/build/contracts/Orders.json +984 -0
- package/build/contracts/Providers.json +440 -0
- package/build/contracts/ProvidersOffers.json +254 -0
- package/build/contracts/Staking.json +323 -0
- package/build/contracts/Superpro.json +197 -0
- package/build/contracts/SuperproToken.json +356 -0
- package/build/crypto/Crypto.d.ts +37 -0
- package/build/crypto/Crypto.js +181 -0
- package/build/crypto/index.d.ts +2 -0
- package/build/crypto/index.js +7 -0
- package/build/crypto/nodejs/AES.d.ts +24 -0
- package/build/crypto/nodejs/AES.js +152 -0
- package/build/crypto/nodejs/ARIA.d.ts +24 -0
- package/build/crypto/nodejs/ARIA.js +151 -0
- package/build/crypto/nodejs/ECIES.d.ts +6 -0
- package/build/crypto/nodejs/ECIES.js +94 -0
- package/build/crypto/nodejs/NativeCrypto.d.ts +54 -0
- package/build/crypto/nodejs/NativeCrypto.js +214 -0
- package/build/crypto/nodejs/RSA-Hybrid.d.ts +15 -0
- package/build/crypto/nodejs/RSA-Hybrid.js +153 -0
- package/build/index.d.ts +65 -0
- package/build/index.js +117 -0
- package/build/logger.d.ts +4 -0
- package/build/logger.js +8 -0
- package/build/models/Ballot.d.ts +13 -0
- package/build/models/Ballot.js +76 -0
- package/build/models/Offer.d.ts +70 -0
- package/build/models/Offer.js +273 -0
- package/build/models/Order.d.ts +125 -0
- package/build/models/Order.js +540 -0
- package/build/models/Provider.d.ts +40 -0
- package/build/models/Provider.js +167 -0
- package/build/models/TCB.d.ts +80 -0
- package/build/models/TCB.js +315 -0
- package/build/models/TeeOffer.d.ts +118 -0
- package/build/models/TeeOffer.js +436 -0
- package/build/proto/Compression.d.ts +33 -0
- package/build/proto/Compression.js +146 -0
- package/build/proto/TRI.d.ts +122 -0
- package/build/proto/TRI.js +316 -0
- package/build/providers/storage/ChunksDownloadDecorator.d.ts +38 -0
- package/build/providers/storage/ChunksDownloadDecorator.js +284 -0
- package/build/providers/storage/IStorageProvider.d.ts +17 -0
- package/build/providers/storage/IStorageProvider.js +2 -0
- package/build/providers/storage/StorjStorageProvider.d.ts +26 -0
- package/build/providers/storage/StorjStorageProvider.js +389 -0
- package/build/providers/storage/getStorageProvider.d.ts +4 -0
- package/build/providers/storage/getStorageProvider.js +16 -0
- package/build/staticModels/ActiveOffers.d.ts +29 -0
- package/build/staticModels/ActiveOffers.js +144 -0
- package/build/staticModels/ActiveOrders.d.ts +21 -0
- package/build/staticModels/ActiveOrders.js +120 -0
- package/build/staticModels/Consensus.d.ts +63 -0
- package/build/staticModels/Consensus.js +373 -0
- package/build/staticModels/Epochs.d.ts +23 -0
- package/build/staticModels/Epochs.js +97 -0
- package/build/staticModels/LastBlocks.d.ts +25 -0
- package/build/staticModels/LastBlocks.js +96 -0
- package/build/staticModels/Marks.d.ts +13 -0
- package/build/staticModels/Marks.js +113 -0
- package/build/staticModels/OffersFactory.d.ts +37 -0
- package/build/staticModels/OffersFactory.js +227 -0
- package/build/staticModels/OrdersFactory.d.ts +137 -0
- package/build/staticModels/OrdersFactory.js +539 -0
- package/build/staticModels/ProviderRegistry.d.ts +81 -0
- package/build/staticModels/ProviderRegistry.js +311 -0
- package/build/staticModels/Staking.d.ts +26 -0
- package/build/staticModels/Staking.js +132 -0
- package/build/staticModels/Superpro.d.ts +20 -0
- package/build/staticModels/Superpro.js +99 -0
- package/build/staticModels/SuperproToken.d.ts +30 -0
- package/build/staticModels/SuperproToken.js +125 -0
- package/build/staticModels/Suspicious.d.ts +26 -0
- package/build/staticModels/Suspicious.js +99 -0
- package/build/staticModels/TeeOffersFactory.d.ts +36 -0
- package/build/staticModels/TeeOffersFactory.js +206 -0
- package/build/staticModels/Voting.d.ts +35 -0
- package/build/staticModels/Voting.js +111 -0
- package/build/store.d.ts +12 -0
- package/build/store.js +13 -0
- package/build/types/Ballot.d.ts +75 -0
- package/build/types/Ballot.js +49 -0
- package/build/types/Epoch.d.ts +21 -0
- package/build/types/Epoch.js +18 -0
- package/build/types/Events.d.ts +18 -0
- package/build/types/Events.js +2 -0
- package/build/types/Marks.d.ts +5 -0
- package/build/types/Marks.js +9 -0
- package/build/types/Offer.d.ts +63 -0
- package/build/types/Offer.js +41 -0
- package/build/types/Order.d.ts +61 -0
- package/build/types/Order.js +36 -0
- package/build/types/Origins.d.ts +12 -0
- package/build/types/Origins.js +10 -0
- package/build/types/Provider.d.ts +25 -0
- package/build/types/Provider.js +19 -0
- package/build/types/Staking.d.ts +27 -0
- package/build/types/Staking.js +22 -0
- package/build/types/Superpro.d.ts +24 -0
- package/build/types/Superpro.js +29 -0
- package/build/types/TcbData.d.ts +26 -0
- package/build/types/TcbData.js +21 -0
- package/build/types/TeeOffer.d.ts +22 -0
- package/build/types/TeeOffer.js +15 -0
- package/build/types/Web3.d.ts +26 -0
- package/build/types/Web3.js +2 -0
- package/build/types/blockchainConnector/StorageAccess.d.ts +8 -0
- package/build/types/blockchainConnector/StorageAccess.js +2 -0
- package/build/types/storage/StorageAccess.d.ts +6 -0
- package/build/types/storage/StorageAccess.js +2 -0
- package/build/types/storage/StorageFileAccess.d.ts +5 -0
- package/build/types/storage/StorageFileAccess.js +2 -0
- package/build/types/storage/StorageObject.d.ts +8 -0
- package/build/types/storage/StorageObject.js +2 -0
- package/build/utils/NonceTracker.d.ts +12 -0
- package/build/utils/NonceTracker.js +84 -0
- package/build/utils/TxManager.d.ts +21 -0
- package/build/utils/TxManager.js +159 -0
- package/build/utils.d.ts +38 -0
- package/build/utils.js +195 -0
- package/package.json +68 -0
- package/readme.md +40 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
/// <reference types="node" />
|
|
4
|
+
import { ReadStream, WriteStream } from 'fs';
|
|
5
|
+
import { Cipher, Decipher } from 'crypto';
|
|
6
|
+
import { Encoding, EncryptionWithMacIV } from "@super-protocol/dto-js";
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
declare class NativeCrypto {
|
|
11
|
+
/**
|
|
12
|
+
* Here would be better to check cipher type using
|
|
13
|
+
* ```
|
|
14
|
+
* getCipherInfo(cipher)!.mode === 'mode'
|
|
15
|
+
* ```
|
|
16
|
+
* but it doesn't work in browser
|
|
17
|
+
*/
|
|
18
|
+
static readonly isCCM: (cipher: string) => boolean;
|
|
19
|
+
static readonly isGCM: (cipher: string) => boolean;
|
|
20
|
+
static readonly isOCB: (cipher: string) => boolean;
|
|
21
|
+
static readonly isECB: (cipher: string) => boolean;
|
|
22
|
+
static readonly isRC4: (cipher: string) => boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Here would be better to check cipher type using
|
|
25
|
+
* ```
|
|
26
|
+
* getCipherInfo(cipher)!.keyLength
|
|
27
|
+
* ```
|
|
28
|
+
* but it doesn't work in browser
|
|
29
|
+
*/
|
|
30
|
+
static getKeyLength(cipher: string): number;
|
|
31
|
+
/**
|
|
32
|
+
* Here would be better to check cipher type using
|
|
33
|
+
* ```
|
|
34
|
+
* getCipherInfo(cipher)!.ivLength
|
|
35
|
+
* ```
|
|
36
|
+
* but it doesn't work in browser
|
|
37
|
+
*/
|
|
38
|
+
static getIVLength(cipher: string): number;
|
|
39
|
+
static createKey(cipher: string): Buffer;
|
|
40
|
+
static createIV(cipher: string): Buffer;
|
|
41
|
+
static createCipher(cipher: string, key: Buffer, iv: Buffer): Cipher;
|
|
42
|
+
static createDecipher(cipher: string, key: Buffer, iv?: Buffer, mac?: Buffer): Decipher;
|
|
43
|
+
static encrypt(key: Buffer, content: string, cipherName: string, outputEncoding?: Encoding, inputEncoding?: BufferEncoding): Partial<EncryptionWithMacIV>;
|
|
44
|
+
static encryptStream(key: Buffer, inputStream: ReadStream, outputStream: WriteStream, cipherName: any, encoding?: Encoding): Promise<Partial<EncryptionWithMacIV>>;
|
|
45
|
+
static decrypt(key: Buffer, content: string, cipherName: string, params?: {
|
|
46
|
+
iv: Buffer;
|
|
47
|
+
mac?: Buffer;
|
|
48
|
+
}, inputEncoding?: Encoding, outputEncoding?: BufferEncoding): string;
|
|
49
|
+
static decryptStream(key: Buffer, inputStream: ReadStream, outputStream: WriteStream, cipherName: string, params?: {
|
|
50
|
+
iv: Buffer;
|
|
51
|
+
mac: Buffer;
|
|
52
|
+
}): Promise<void>;
|
|
53
|
+
}
|
|
54
|
+
export default NativeCrypto;
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var crypto_1 = require("crypto");
|
|
40
|
+
var events_1 = require("events");
|
|
41
|
+
var dto_js_1 = require("@super-protocol/dto-js");
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
*/
|
|
45
|
+
var NativeCrypto = /** @class */ (function () {
|
|
46
|
+
function NativeCrypto() {
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Here would be better to check cipher type using
|
|
50
|
+
* ```
|
|
51
|
+
* getCipherInfo(cipher)!.keyLength
|
|
52
|
+
* ```
|
|
53
|
+
* but it doesn't work in browser
|
|
54
|
+
*/
|
|
55
|
+
NativeCrypto.getKeyLength = function (cipher) {
|
|
56
|
+
if (/256\-xts/.test(cipher)) {
|
|
57
|
+
return 64;
|
|
58
|
+
}
|
|
59
|
+
if (/256|128\-xts|chacha20/.test(cipher)
|
|
60
|
+
&& cipher !== 'aes-128-cbc-hmac-sha256') {
|
|
61
|
+
return 32;
|
|
62
|
+
}
|
|
63
|
+
if (/192|des\-ede3|desx|des3$/.test(cipher) ||
|
|
64
|
+
cipher === 'id-smime-alg-cms3deswrap') {
|
|
65
|
+
return 24;
|
|
66
|
+
}
|
|
67
|
+
if (/128|des\-ede/.test(cipher)) {
|
|
68
|
+
return 16;
|
|
69
|
+
}
|
|
70
|
+
if (/64|des/.test(cipher)) {
|
|
71
|
+
return 8;
|
|
72
|
+
}
|
|
73
|
+
if (/40/.test(cipher)) {
|
|
74
|
+
return 5;
|
|
75
|
+
}
|
|
76
|
+
return 16;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Here would be better to check cipher type using
|
|
80
|
+
* ```
|
|
81
|
+
* getCipherInfo(cipher)!.ivLength
|
|
82
|
+
* ```
|
|
83
|
+
* but it doesn't work in browser
|
|
84
|
+
*/
|
|
85
|
+
NativeCrypto.getIVLength = function (cipher) {
|
|
86
|
+
if (this.isCCM(cipher) || this.isGCM(cipher) || this.isOCB(cipher)) {
|
|
87
|
+
return 12;
|
|
88
|
+
}
|
|
89
|
+
if (/wrap\-pad/.test(cipher)) {
|
|
90
|
+
return 4;
|
|
91
|
+
}
|
|
92
|
+
if (/wrap|cast|des|bf|blowfish|idea|rc2/.test(cipher)) {
|
|
93
|
+
return 8;
|
|
94
|
+
}
|
|
95
|
+
return 16;
|
|
96
|
+
};
|
|
97
|
+
NativeCrypto.createKey = function (cipher) {
|
|
98
|
+
var length = this.getKeyLength(cipher);
|
|
99
|
+
return (0, crypto_1.randomBytes)(length);
|
|
100
|
+
};
|
|
101
|
+
NativeCrypto.createIV = function (cipher) {
|
|
102
|
+
var length = this.getIVLength(cipher);
|
|
103
|
+
return (0, crypto_1.randomBytes)(length);
|
|
104
|
+
};
|
|
105
|
+
NativeCrypto.createCipher = function (cipher, key, iv) {
|
|
106
|
+
if (this.isECB(cipher) || this.isRC4(cipher)) {
|
|
107
|
+
return (0, crypto_1.createCipher)(cipher, key);
|
|
108
|
+
}
|
|
109
|
+
if (this.isCCM(cipher) || this.isOCB(cipher)) {
|
|
110
|
+
var options = {
|
|
111
|
+
authTagLength: 16,
|
|
112
|
+
};
|
|
113
|
+
return (0, crypto_1.createCipheriv)(cipher, key, iv, options);
|
|
114
|
+
}
|
|
115
|
+
return (0, crypto_1.createCipheriv)(cipher, key, iv);
|
|
116
|
+
};
|
|
117
|
+
NativeCrypto.createDecipher = function (cipher, key, iv, mac) {
|
|
118
|
+
if (iv) {
|
|
119
|
+
var options = {};
|
|
120
|
+
if (this.isCCM(cipher) || this.isOCB(cipher)) {
|
|
121
|
+
options.authTagLength = 16;
|
|
122
|
+
}
|
|
123
|
+
var decipher = (0, crypto_1.createDecipheriv)(cipher, key, iv, options);
|
|
124
|
+
if (mac) {
|
|
125
|
+
decipher.setAuthTag(mac);
|
|
126
|
+
}
|
|
127
|
+
return decipher;
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
return (0, crypto_1.createDecipher)(cipher, key);
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
NativeCrypto.encrypt = function (key, content, cipherName, outputEncoding,
|
|
134
|
+
// TODO: replace BufferEncoding with Encoding
|
|
135
|
+
inputEncoding) {
|
|
136
|
+
if (outputEncoding === void 0) { outputEncoding = dto_js_1.Encoding.base64; }
|
|
137
|
+
if (inputEncoding === void 0) { inputEncoding = 'binary'; }
|
|
138
|
+
var iv = this.createIV(cipherName);
|
|
139
|
+
var result = {};
|
|
140
|
+
var cipher = this.createCipher(cipherName, key, iv);
|
|
141
|
+
result.ciphertext = cipher.update(content, inputEncoding, outputEncoding);
|
|
142
|
+
result.ciphertext += cipher.final(outputEncoding);
|
|
143
|
+
if (!this.isECB(cipherName) && !this.isRC4(cipherName)) {
|
|
144
|
+
result.iv = iv.toString(outputEncoding);
|
|
145
|
+
}
|
|
146
|
+
if (this.isCCM(cipherName) || this.isGCM(cipherName) || this.isOCB(cipherName)) {
|
|
147
|
+
result.mac = cipher.getAuthTag().toString(outputEncoding);
|
|
148
|
+
}
|
|
149
|
+
return result;
|
|
150
|
+
};
|
|
151
|
+
NativeCrypto.encryptStream = function (key, inputStream, outputStream, cipherName, encoding) {
|
|
152
|
+
if (encoding === void 0) { encoding = dto_js_1.Encoding.base64; }
|
|
153
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
154
|
+
var iv, result, cipher;
|
|
155
|
+
return __generator(this, function (_a) {
|
|
156
|
+
switch (_a.label) {
|
|
157
|
+
case 0:
|
|
158
|
+
iv = this.createIV(cipherName);
|
|
159
|
+
result = {};
|
|
160
|
+
cipher = this.createCipher(cipherName, key, iv);
|
|
161
|
+
inputStream.pipe(cipher).pipe(outputStream);
|
|
162
|
+
return [4 /*yield*/, (0, events_1.once)(outputStream, "finish")];
|
|
163
|
+
case 1:
|
|
164
|
+
_a.sent();
|
|
165
|
+
result.iv = iv.toString(encoding);
|
|
166
|
+
if (this.isCCM(cipherName) || this.isGCM(cipherName)) {
|
|
167
|
+
result.mac = cipher.getAuthTag().toString(encoding);
|
|
168
|
+
}
|
|
169
|
+
return [2 /*return*/, result];
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
NativeCrypto.decrypt = function (key, content, cipherName, params, inputEncoding,
|
|
175
|
+
// TODO: replace BufferEncoding with Encoding
|
|
176
|
+
outputEncoding) {
|
|
177
|
+
if (inputEncoding === void 0) { inputEncoding = dto_js_1.Encoding.base64; }
|
|
178
|
+
if (outputEncoding === void 0) { outputEncoding = 'binary'; }
|
|
179
|
+
var decipher = this.createDecipher(cipherName, key, params === null || params === void 0 ? void 0 : params.iv, params === null || params === void 0 ? void 0 : params.mac);
|
|
180
|
+
var decrypted = decipher.update(content, inputEncoding, outputEncoding);
|
|
181
|
+
decrypted += decipher.final(outputEncoding);
|
|
182
|
+
return decrypted;
|
|
183
|
+
};
|
|
184
|
+
NativeCrypto.decryptStream = function (key, inputStream, outputStream, cipherName, params) {
|
|
185
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
186
|
+
var decipher;
|
|
187
|
+
return __generator(this, function (_a) {
|
|
188
|
+
switch (_a.label) {
|
|
189
|
+
case 0:
|
|
190
|
+
decipher = this.createDecipher(cipherName, key, params === null || params === void 0 ? void 0 : params.iv, params === null || params === void 0 ? void 0 : params.mac);
|
|
191
|
+
inputStream.pipe(decipher).pipe(outputStream);
|
|
192
|
+
return [4 /*yield*/, (0, events_1.once)(outputStream, "finish")];
|
|
193
|
+
case 1:
|
|
194
|
+
_a.sent();
|
|
195
|
+
return [2 /*return*/];
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* Here would be better to check cipher type using
|
|
202
|
+
* ```
|
|
203
|
+
* getCipherInfo(cipher)!.mode === 'mode'
|
|
204
|
+
* ```
|
|
205
|
+
* but it doesn't work in browser
|
|
206
|
+
*/
|
|
207
|
+
NativeCrypto.isCCM = function (cipher) { return /ccm/i.test(cipher) || cipher === 'chacha20-poly1305'; };
|
|
208
|
+
NativeCrypto.isGCM = function (cipher) { return /gcm/i.test(cipher); };
|
|
209
|
+
NativeCrypto.isOCB = function (cipher) { return /ocb/i.test(cipher); };
|
|
210
|
+
NativeCrypto.isECB = function (cipher) { return /ecb/i.test(cipher) || cipher === 'des-ede' || cipher === 'des-ede3'; };
|
|
211
|
+
NativeCrypto.isRC4 = function (cipher) { return /^rc4/i.test(cipher); };
|
|
212
|
+
return NativeCrypto;
|
|
213
|
+
}());
|
|
214
|
+
exports.default = NativeCrypto;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { ReadStream, WriteStream } from "fs";
|
|
4
|
+
import { Encryption, RSAHybridEncryption } from "@super-protocol/dto-js";
|
|
5
|
+
import { KeyObject } from "crypto";
|
|
6
|
+
declare class RSAHybrid {
|
|
7
|
+
static getKeyFingerprint(key: KeyObject): string;
|
|
8
|
+
private static publicEncrypt;
|
|
9
|
+
private static privateDecrypt;
|
|
10
|
+
static encrypt(content: string, encryption: Encryption): RSAHybridEncryption;
|
|
11
|
+
static encryptStream(inputStream: ReadStream, outputStream: WriteStream, encryption: Encryption): Promise<RSAHybridEncryption>;
|
|
12
|
+
static decrypt(encryption: RSAHybridEncryption): string;
|
|
13
|
+
static decryptStream(inputStream: ReadStream, outputStream: WriteStream, encryption: RSAHybridEncryption): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export default RSAHybrid;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (_) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
+
};
|
|
52
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
+
var dto_js_1 = require("@super-protocol/dto-js");
|
|
54
|
+
var crypto_1 = require("crypto");
|
|
55
|
+
var NativeCrypto_1 = __importDefault(require("./NativeCrypto"));
|
|
56
|
+
var RSAHybrid = /** @class */ (function () {
|
|
57
|
+
function RSAHybrid() {
|
|
58
|
+
}
|
|
59
|
+
RSAHybrid.getKeyFingerprint = function (key) {
|
|
60
|
+
var jsonKey = key.export({ format: "jwk" });
|
|
61
|
+
var buffer = Buffer.concat([
|
|
62
|
+
Buffer.from("ssh-rsa"),
|
|
63
|
+
Buffer.from(jsonKey.e || ""),
|
|
64
|
+
Buffer.from(jsonKey.n || ""),
|
|
65
|
+
]);
|
|
66
|
+
var hex = (0, crypto_1.createHash)("md5").update(buffer).digest("hex");
|
|
67
|
+
return hex.match(/.{2}/g).join(":");
|
|
68
|
+
};
|
|
69
|
+
RSAHybrid.publicEncrypt = function (rsaKey, aesKey) {
|
|
70
|
+
var _a;
|
|
71
|
+
var publicKey = (0, crypto_1.createPublicKey)({
|
|
72
|
+
key: rsaKey,
|
|
73
|
+
format: "pem",
|
|
74
|
+
});
|
|
75
|
+
var encryptedKey = (0, crypto_1.publicEncrypt)({
|
|
76
|
+
key: publicKey,
|
|
77
|
+
padding: crypto_1.constants.RSA_PKCS1_OAEP_PADDING,
|
|
78
|
+
oaepHash: "sha256",
|
|
79
|
+
}, Buffer.from(aesKey));
|
|
80
|
+
var keyFingerprint = this.getKeyFingerprint(publicKey);
|
|
81
|
+
return _a = {},
|
|
82
|
+
_a[keyFingerprint] = encryptedKey.toString("base64"),
|
|
83
|
+
_a;
|
|
84
|
+
};
|
|
85
|
+
RSAHybrid.privateDecrypt = function (rsaKey, keys) {
|
|
86
|
+
var privateKey = (0, crypto_1.createPrivateKey)({
|
|
87
|
+
key: rsaKey,
|
|
88
|
+
format: "pem",
|
|
89
|
+
});
|
|
90
|
+
var keyFingerprint = this.getKeyFingerprint(privateKey);
|
|
91
|
+
var encryptedKey = keys[keyFingerprint];
|
|
92
|
+
var aesKey = (0, crypto_1.privateDecrypt)({
|
|
93
|
+
key: privateKey,
|
|
94
|
+
padding: crypto_1.constants.RSA_PKCS1_OAEP_PADDING,
|
|
95
|
+
oaepHash: "sha256",
|
|
96
|
+
}, Buffer.from(encryptedKey, "base64"));
|
|
97
|
+
return aesKey;
|
|
98
|
+
};
|
|
99
|
+
RSAHybrid.encrypt = function (content, encryption) {
|
|
100
|
+
var aesKey = (0, crypto_1.randomBytes)(32);
|
|
101
|
+
var keys = this.publicEncrypt(encryption.key, aesKey);
|
|
102
|
+
var encrypted = NativeCrypto_1.default.encrypt(aesKey, content, dto_js_1.Cipher.AES_256_GCM, encryption.encoding);
|
|
103
|
+
return __assign(__assign({}, encrypted), { encoding: encryption.encoding, algo: dto_js_1.CryptoAlgorithm.RSAHybrid, cipher: dto_js_1.Cipher.RSA_OAEP_AES_GCM, keys: JSON.stringify(keys) });
|
|
104
|
+
};
|
|
105
|
+
RSAHybrid.encryptStream = function (inputStream, outputStream, encryption) {
|
|
106
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
107
|
+
var aesKey, keys, encrypted;
|
|
108
|
+
return __generator(this, function (_a) {
|
|
109
|
+
switch (_a.label) {
|
|
110
|
+
case 0:
|
|
111
|
+
aesKey = (0, crypto_1.randomBytes)(32);
|
|
112
|
+
keys = this.publicEncrypt(encryption.key, aesKey);
|
|
113
|
+
return [4 /*yield*/, NativeCrypto_1.default.encryptStream(aesKey, inputStream, outputStream, dto_js_1.Cipher.AES_256_GCM, encryption.encoding)];
|
|
114
|
+
case 1:
|
|
115
|
+
encrypted = (_a.sent());
|
|
116
|
+
return [2 /*return*/, __assign(__assign({}, encrypted), { encoding: encryption.encoding, algo: dto_js_1.CryptoAlgorithm.RSAHybrid, cipher: dto_js_1.Cipher.RSA_OAEP_AES_GCM, keys: JSON.stringify(keys) })];
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
RSAHybrid.decrypt = function (encryption) {
|
|
122
|
+
var iv = Buffer.from(encryption.iv, encryption.encoding);
|
|
123
|
+
var mac = Buffer.from(encryption.mac, encryption.encoding);
|
|
124
|
+
var aesKey = this.privateDecrypt(encryption.key, JSON.parse(encryption.keys));
|
|
125
|
+
var decrypted = NativeCrypto_1.default.decrypt(aesKey, encryption.ciphertext, dto_js_1.Cipher.AES_256_GCM, {
|
|
126
|
+
iv: iv,
|
|
127
|
+
mac: mac,
|
|
128
|
+
}, encryption.encoding);
|
|
129
|
+
return decrypted;
|
|
130
|
+
};
|
|
131
|
+
RSAHybrid.decryptStream = function (inputStream, outputStream, encryption) {
|
|
132
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
133
|
+
var iv, mac, aesKey;
|
|
134
|
+
return __generator(this, function (_a) {
|
|
135
|
+
switch (_a.label) {
|
|
136
|
+
case 0:
|
|
137
|
+
iv = Buffer.from(encryption.iv, encryption.encoding);
|
|
138
|
+
mac = Buffer.from(encryption.mac, encryption.encoding);
|
|
139
|
+
aesKey = this.privateDecrypt(encryption.key, JSON.parse(encryption.keys));
|
|
140
|
+
return [4 /*yield*/, NativeCrypto_1.default.decryptStream(aesKey, inputStream, outputStream, dto_js_1.Cipher.AES_256_GCM, {
|
|
141
|
+
iv: iv,
|
|
142
|
+
mac: mac,
|
|
143
|
+
})];
|
|
144
|
+
case 1:
|
|
145
|
+
_a.sent();
|
|
146
|
+
return [2 /*return*/];
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
};
|
|
151
|
+
return RSAHybrid;
|
|
152
|
+
}());
|
|
153
|
+
exports.default = RSAHybrid;
|
package/build/index.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import BlockchainConnector from "./BlockchainConnector";
|
|
2
|
+
export default BlockchainConnector;
|
|
3
|
+
export * from "./BlockchainConnector";
|
|
4
|
+
export { default as Crypto } from "./crypto";
|
|
5
|
+
export { default as TIIGenerator } from "./TIIGenerator";
|
|
6
|
+
export * from "./TIIGenerator";
|
|
7
|
+
export { default as Consensus } from "./staticModels/Consensus";
|
|
8
|
+
export * from "./staticModels/Consensus";
|
|
9
|
+
export { default as LastBlocks } from "./staticModels/LastBlocks";
|
|
10
|
+
export * from "./staticModels/LastBlocks";
|
|
11
|
+
export { default as Suspicious } from "./staticModels/Suspicious";
|
|
12
|
+
export * from "./staticModels/Suspicious";
|
|
13
|
+
export { default as OrdersFactory } from "./staticModels/OrdersFactory";
|
|
14
|
+
export * from "./staticModels/OrdersFactory";
|
|
15
|
+
export { default as ActiveOrders } from "./staticModels/ActiveOrders";
|
|
16
|
+
export * from "./staticModels/ActiveOrders";
|
|
17
|
+
export { default as ActiveOffers } from "./staticModels/ActiveOffers";
|
|
18
|
+
export * from "./staticModels/ActiveOffers";
|
|
19
|
+
export { default as OffersFactory } from "./staticModels/OffersFactory";
|
|
20
|
+
export * from "./staticModels/OffersFactory";
|
|
21
|
+
export { default as TeeOffersFactory } from "./staticModels/TeeOffersFactory";
|
|
22
|
+
export * from "./staticModels/TeeOffersFactory";
|
|
23
|
+
export { default as ProviderRegistry } from "./staticModels/ProviderRegistry";
|
|
24
|
+
export * from "./staticModels/ProviderRegistry";
|
|
25
|
+
export { default as Staking } from "./staticModels/Staking";
|
|
26
|
+
export * from "./staticModels/Staking";
|
|
27
|
+
export { default as Voting } from "./staticModels/Voting";
|
|
28
|
+
export * from "./staticModels/Voting";
|
|
29
|
+
export { default as SuperproToken } from "./staticModels/SuperproToken";
|
|
30
|
+
export * from "./staticModels/SuperproToken";
|
|
31
|
+
export { default as Superpro } from "./staticModels/Superpro";
|
|
32
|
+
export * from "./staticModels/Superpro";
|
|
33
|
+
export { default as Epochs } from "./staticModels/Epochs";
|
|
34
|
+
export * from "./staticModels/Epochs";
|
|
35
|
+
export { default as Marks } from "./staticModels/Marks";
|
|
36
|
+
export * from "./staticModels/Marks";
|
|
37
|
+
export { default as Order } from "./models/Order";
|
|
38
|
+
export * from "./models/Order";
|
|
39
|
+
export { default as Provider } from "./models/Provider";
|
|
40
|
+
export * from "./models/Provider";
|
|
41
|
+
export { default as TeeOffer } from "./models/TeeOffer";
|
|
42
|
+
export * from "./models/TeeOffer";
|
|
43
|
+
export { default as Offer } from "./models/Offer";
|
|
44
|
+
export * from "./models/Offer";
|
|
45
|
+
export { default as Ballot } from "./models/Ballot";
|
|
46
|
+
export * from "./models/Ballot";
|
|
47
|
+
export { default as TCB } from "./models/TCB";
|
|
48
|
+
export * from "./models/TCB";
|
|
49
|
+
export * from "./types/Offer";
|
|
50
|
+
export * from "./types/Epoch";
|
|
51
|
+
export * from "./types/Marks";
|
|
52
|
+
export * from "./types/Order";
|
|
53
|
+
export * from "./types/TeeOffer";
|
|
54
|
+
export * from "./types/Provider";
|
|
55
|
+
export * from "./types/Staking";
|
|
56
|
+
export * from "./types/Ballot";
|
|
57
|
+
export * from "./types/Superpro";
|
|
58
|
+
export * from "./types/TcbData";
|
|
59
|
+
export * from "./types/Origins";
|
|
60
|
+
export * as ChunkedStorageProvider from "./providers/storage/ChunksDownloadDecorator";
|
|
61
|
+
export { default as StorageFileAccess } from "./types/storage/StorageFileAccess";
|
|
62
|
+
export { default as StorageObject } from "./types/storage/StorageObject";
|
|
63
|
+
export { default as StorageAccess } from "./types/storage/StorageAccess";
|
|
64
|
+
export { default as getStorageProvider } from "./providers/storage/getStorageProvider";
|
|
65
|
+
export { default as IStorageProvider } from "./providers/storage/IStorageProvider";
|
package/build/index.js
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
|
+
};
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
+
};
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.getStorageProvider = exports.ChunkedStorageProvider = exports.TCB = exports.Ballot = exports.Offer = exports.TeeOffer = exports.Provider = exports.Order = exports.Marks = exports.Epochs = exports.Superpro = exports.SuperproToken = exports.Voting = exports.Staking = exports.ProviderRegistry = exports.TeeOffersFactory = exports.OffersFactory = exports.ActiveOffers = exports.ActiveOrders = exports.OrdersFactory = exports.Suspicious = exports.LastBlocks = exports.Consensus = exports.TIIGenerator = exports.Crypto = void 0;
|
|
33
|
+
var BlockchainConnector_1 = __importDefault(require("./BlockchainConnector"));
|
|
34
|
+
exports.default = BlockchainConnector_1.default;
|
|
35
|
+
__exportStar(require("./BlockchainConnector"), exports);
|
|
36
|
+
var crypto_1 = require("./crypto");
|
|
37
|
+
Object.defineProperty(exports, "Crypto", { enumerable: true, get: function () { return __importDefault(crypto_1).default; } });
|
|
38
|
+
var TIIGenerator_1 = require("./TIIGenerator");
|
|
39
|
+
Object.defineProperty(exports, "TIIGenerator", { enumerable: true, get: function () { return __importDefault(TIIGenerator_1).default; } });
|
|
40
|
+
__exportStar(require("./TIIGenerator"), exports);
|
|
41
|
+
var Consensus_1 = require("./staticModels/Consensus");
|
|
42
|
+
Object.defineProperty(exports, "Consensus", { enumerable: true, get: function () { return __importDefault(Consensus_1).default; } });
|
|
43
|
+
__exportStar(require("./staticModels/Consensus"), exports);
|
|
44
|
+
var LastBlocks_1 = require("./staticModels/LastBlocks");
|
|
45
|
+
Object.defineProperty(exports, "LastBlocks", { enumerable: true, get: function () { return __importDefault(LastBlocks_1).default; } });
|
|
46
|
+
__exportStar(require("./staticModels/LastBlocks"), exports);
|
|
47
|
+
var Suspicious_1 = require("./staticModels/Suspicious");
|
|
48
|
+
Object.defineProperty(exports, "Suspicious", { enumerable: true, get: function () { return __importDefault(Suspicious_1).default; } });
|
|
49
|
+
__exportStar(require("./staticModels/Suspicious"), exports);
|
|
50
|
+
var OrdersFactory_1 = require("./staticModels/OrdersFactory");
|
|
51
|
+
Object.defineProperty(exports, "OrdersFactory", { enumerable: true, get: function () { return __importDefault(OrdersFactory_1).default; } });
|
|
52
|
+
__exportStar(require("./staticModels/OrdersFactory"), exports);
|
|
53
|
+
var ActiveOrders_1 = require("./staticModels/ActiveOrders");
|
|
54
|
+
Object.defineProperty(exports, "ActiveOrders", { enumerable: true, get: function () { return __importDefault(ActiveOrders_1).default; } });
|
|
55
|
+
__exportStar(require("./staticModels/ActiveOrders"), exports);
|
|
56
|
+
var ActiveOffers_1 = require("./staticModels/ActiveOffers");
|
|
57
|
+
Object.defineProperty(exports, "ActiveOffers", { enumerable: true, get: function () { return __importDefault(ActiveOffers_1).default; } });
|
|
58
|
+
__exportStar(require("./staticModels/ActiveOffers"), exports);
|
|
59
|
+
var OffersFactory_1 = require("./staticModels/OffersFactory");
|
|
60
|
+
Object.defineProperty(exports, "OffersFactory", { enumerable: true, get: function () { return __importDefault(OffersFactory_1).default; } });
|
|
61
|
+
__exportStar(require("./staticModels/OffersFactory"), exports);
|
|
62
|
+
var TeeOffersFactory_1 = require("./staticModels/TeeOffersFactory");
|
|
63
|
+
Object.defineProperty(exports, "TeeOffersFactory", { enumerable: true, get: function () { return __importDefault(TeeOffersFactory_1).default; } });
|
|
64
|
+
__exportStar(require("./staticModels/TeeOffersFactory"), exports);
|
|
65
|
+
var ProviderRegistry_1 = require("./staticModels/ProviderRegistry");
|
|
66
|
+
Object.defineProperty(exports, "ProviderRegistry", { enumerable: true, get: function () { return __importDefault(ProviderRegistry_1).default; } });
|
|
67
|
+
__exportStar(require("./staticModels/ProviderRegistry"), exports);
|
|
68
|
+
var Staking_1 = require("./staticModels/Staking");
|
|
69
|
+
Object.defineProperty(exports, "Staking", { enumerable: true, get: function () { return __importDefault(Staking_1).default; } });
|
|
70
|
+
__exportStar(require("./staticModels/Staking"), exports);
|
|
71
|
+
var Voting_1 = require("./staticModels/Voting");
|
|
72
|
+
Object.defineProperty(exports, "Voting", { enumerable: true, get: function () { return __importDefault(Voting_1).default; } });
|
|
73
|
+
__exportStar(require("./staticModels/Voting"), exports);
|
|
74
|
+
var SuperproToken_1 = require("./staticModels/SuperproToken");
|
|
75
|
+
Object.defineProperty(exports, "SuperproToken", { enumerable: true, get: function () { return __importDefault(SuperproToken_1).default; } });
|
|
76
|
+
__exportStar(require("./staticModels/SuperproToken"), exports);
|
|
77
|
+
var Superpro_1 = require("./staticModels/Superpro");
|
|
78
|
+
Object.defineProperty(exports, "Superpro", { enumerable: true, get: function () { return __importDefault(Superpro_1).default; } });
|
|
79
|
+
__exportStar(require("./staticModels/Superpro"), exports);
|
|
80
|
+
var Epochs_1 = require("./staticModels/Epochs");
|
|
81
|
+
Object.defineProperty(exports, "Epochs", { enumerable: true, get: function () { return __importDefault(Epochs_1).default; } });
|
|
82
|
+
__exportStar(require("./staticModels/Epochs"), exports);
|
|
83
|
+
var Marks_1 = require("./staticModels/Marks");
|
|
84
|
+
Object.defineProperty(exports, "Marks", { enumerable: true, get: function () { return __importDefault(Marks_1).default; } });
|
|
85
|
+
__exportStar(require("./staticModels/Marks"), exports);
|
|
86
|
+
var Order_1 = require("./models/Order");
|
|
87
|
+
Object.defineProperty(exports, "Order", { enumerable: true, get: function () { return __importDefault(Order_1).default; } });
|
|
88
|
+
__exportStar(require("./models/Order"), exports);
|
|
89
|
+
var Provider_1 = require("./models/Provider");
|
|
90
|
+
Object.defineProperty(exports, "Provider", { enumerable: true, get: function () { return __importDefault(Provider_1).default; } });
|
|
91
|
+
__exportStar(require("./models/Provider"), exports);
|
|
92
|
+
var TeeOffer_1 = require("./models/TeeOffer");
|
|
93
|
+
Object.defineProperty(exports, "TeeOffer", { enumerable: true, get: function () { return __importDefault(TeeOffer_1).default; } });
|
|
94
|
+
__exportStar(require("./models/TeeOffer"), exports);
|
|
95
|
+
var Offer_1 = require("./models/Offer");
|
|
96
|
+
Object.defineProperty(exports, "Offer", { enumerable: true, get: function () { return __importDefault(Offer_1).default; } });
|
|
97
|
+
__exportStar(require("./models/Offer"), exports);
|
|
98
|
+
var Ballot_1 = require("./models/Ballot");
|
|
99
|
+
Object.defineProperty(exports, "Ballot", { enumerable: true, get: function () { return __importDefault(Ballot_1).default; } });
|
|
100
|
+
__exportStar(require("./models/Ballot"), exports);
|
|
101
|
+
var TCB_1 = require("./models/TCB");
|
|
102
|
+
Object.defineProperty(exports, "TCB", { enumerable: true, get: function () { return __importDefault(TCB_1).default; } });
|
|
103
|
+
__exportStar(require("./models/TCB"), exports);
|
|
104
|
+
__exportStar(require("./types/Offer"), exports);
|
|
105
|
+
__exportStar(require("./types/Epoch"), exports);
|
|
106
|
+
__exportStar(require("./types/Marks"), exports);
|
|
107
|
+
__exportStar(require("./types/Order"), exports);
|
|
108
|
+
__exportStar(require("./types/TeeOffer"), exports);
|
|
109
|
+
__exportStar(require("./types/Provider"), exports);
|
|
110
|
+
__exportStar(require("./types/Staking"), exports);
|
|
111
|
+
__exportStar(require("./types/Ballot"), exports);
|
|
112
|
+
__exportStar(require("./types/Superpro"), exports);
|
|
113
|
+
__exportStar(require("./types/TcbData"), exports);
|
|
114
|
+
__exportStar(require("./types/Origins"), exports);
|
|
115
|
+
exports.ChunkedStorageProvider = __importStar(require("./providers/storage/ChunksDownloadDecorator"));
|
|
116
|
+
var getStorageProvider_1 = require("./providers/storage/getStorageProvider");
|
|
117
|
+
Object.defineProperty(exports, "getStorageProvider", { enumerable: true, get: function () { return __importDefault(getStorageProvider_1).default; } });
|
package/build/logger.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var pino_1 = __importDefault(require("pino"));
|
|
7
|
+
var logger = (0, pino_1.default)({ level: process.env.LOG_LEVEL || "trace" });
|
|
8
|
+
exports.default = logger;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BallotInfo } from "../types/Ballot";
|
|
2
|
+
declare class Ballot {
|
|
3
|
+
address: string;
|
|
4
|
+
private contract;
|
|
5
|
+
private logger;
|
|
6
|
+
ballotInfo?: BallotInfo;
|
|
7
|
+
constructor(address: string);
|
|
8
|
+
/**
|
|
9
|
+
* Function for fetching order info from blockchain
|
|
10
|
+
*/
|
|
11
|
+
getBallotInfo(): Promise<BallotInfo>;
|
|
12
|
+
}
|
|
13
|
+
export default Ballot;
|