@zhoujun_aptos/octopus-ts-sdk-min 0.22.3 → 0.22.5
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/dist/common/index.d.ts +966 -0
- package/dist/common/index.js +4491 -0
- package/dist/common/index.js.map +1 -0
- package/dist/esm/index.d.mts +966 -0
- package/dist/esm/index.mjs +4449 -0
- package/dist/esm/index.mjs.map +1 -0
- package/package.json +22 -8
- package/dist/elgamal.d.ts +0 -31
- package/dist/elgamal.d.ts.map +0 -1
- package/dist/elgamal.js +0 -96
- package/dist/elgamal.js.map +0 -1
- package/dist/enc/index.d.ts +0 -42
- package/dist/enc/index.d.ts.map +0 -1
- package/dist/enc/index.js +0 -211
- package/dist/enc/index.js.map +0 -1
- package/dist/enc/simple_elgamal_ristretto255.d.ts +0 -28
- package/dist/enc/simple_elgamal_ristretto255.d.ts.map +0 -1
- package/dist/enc/simple_elgamal_ristretto255.js +0 -173
- package/dist/enc/simple_elgamal_ristretto255.js.map +0 -1
- package/dist/group.d.ts +0 -39
- package/dist/group.d.ts.map +0 -1
- package/dist/group.js +0 -165
- package/dist/group.js.map +0 -1
- package/dist/ibe/index.d.ts +0 -54
- package/dist/ibe/index.d.ts.map +0 -1
- package/dist/ibe/index.js +0 -280
- package/dist/ibe/index.js.map +0 -1
- package/dist/ibe/otp_hmac_boneh_franklin_bls12381_short_pk.d.ts +0 -38
- package/dist/ibe/otp_hmac_boneh_franklin_bls12381_short_pk.d.ts.map +0 -1
- package/dist/ibe/otp_hmac_boneh_franklin_bls12381_short_pk.js +0 -155
- package/dist/ibe/otp_hmac_boneh_franklin_bls12381_short_pk.js.map +0 -1
- package/dist/index.d.ts +0 -13
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -50
- package/dist/index.js.map +0 -1
- package/dist/shamir_gf256.d.ts +0 -61
- package/dist/shamir_gf256.d.ts.map +0 -1
- package/dist/shamir_gf256.js +0 -295
- package/dist/shamir_gf256.js.map +0 -1
- package/dist/sig/index.d.ts +0 -42
- package/dist/sig/index.d.ts.map +0 -1
- package/dist/sig/index.js +0 -212
- package/dist/sig/index.js.map +0 -1
- package/dist/sig/schnorr_ristretto255.d.ts +0 -29
- package/dist/sig/schnorr_ristretto255.d.ts.map +0 -1
- package/dist/sig/schnorr_ristretto255.js +0 -142
- package/dist/sig/schnorr_ristretto255.js.map +0 -1
- package/dist/silent_setup_encryption.d.ts +0 -93
- package/dist/silent_setup_encryption.d.ts.map +0 -1
- package/dist/silent_setup_encryption.js +0 -342
- package/dist/silent_setup_encryption.js.map +0 -1
- package/dist/silent_setup_encryption_xchain/aptos.d.ts +0 -40
- package/dist/silent_setup_encryption_xchain/aptos.d.ts.map +0 -1
- package/dist/silent_setup_encryption_xchain/aptos.js +0 -125
- package/dist/silent_setup_encryption_xchain/aptos.js.map +0 -1
- package/dist/silent_setup_encryption_xchain/index.d.ts +0 -116
- package/dist/silent_setup_encryption_xchain/index.d.ts.map +0 -1
- package/dist/silent_setup_encryption_xchain/index.js +0 -471
- package/dist/silent_setup_encryption_xchain/index.js.map +0 -1
- package/dist/silent_setup_encryption_xchain/solana.d.ts +0 -42
- package/dist/silent_setup_encryption_xchain/solana.d.ts.map +0 -1
- package/dist/silent_setup_encryption_xchain/solana.js +0 -145
- package/dist/silent_setup_encryption_xchain/solana.js.map +0 -1
- package/dist/sym/aes256gcm.d.ts +0 -27
- package/dist/sym/aes256gcm.d.ts.map +0 -1
- package/dist/sym/aes256gcm.js +0 -107
- package/dist/sym/aes256gcm.js.map +0 -1
- package/dist/sym/index.d.ts +0 -27
- package/dist/sym/index.d.ts.map +0 -1
- package/dist/sym/index.js +0 -154
- package/dist/sym/index.js.map +0 -1
- package/dist/threshold-ibe/aptos.d.ts +0 -42
- package/dist/threshold-ibe/aptos.d.ts.map +0 -1
- package/dist/threshold-ibe/aptos.js +0 -327
- package/dist/threshold-ibe/aptos.js.map +0 -1
- package/dist/threshold-ibe/index.d.ts +0 -147
- package/dist/threshold-ibe/index.d.ts.map +0 -1
- package/dist/threshold-ibe/index.js +0 -453
- package/dist/threshold-ibe/index.js.map +0 -1
- package/dist/threshold-ibe/solana.d.ts +0 -38
- package/dist/threshold-ibe/solana.d.ts.map +0 -1
- package/dist/threshold-ibe/solana.js +0 -197
- package/dist/threshold-ibe/solana.js.map +0 -1
- package/dist/utils.d.ts +0 -12
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -130
- package/dist/utils.js.map +0 -1
- package/dist/worker_config.d.ts +0 -30
- package/dist/worker_config.d.ts.map +0 -1
- package/dist/worker_config.js +0 -142
- package/dist/worker_config.js.map +0 -1
- package/dist/worker_task.d.ts +0 -29
- package/dist/worker_task.d.ts.map +0 -1
- package/dist/worker_task.js +0 -178
- package/dist/worker_task.js.map +0 -1
|
@@ -1,342 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* This file contains Aptos-specific implementations for silent setup encryption.
|
|
4
|
-
* For cross-chain support, use `silent_setup_encryption_xchain.ts` instead.
|
|
5
|
-
*/
|
|
6
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
-
if (k2 === undefined) k2 = k;
|
|
8
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
-
}
|
|
12
|
-
Object.defineProperty(o, k2, desc);
|
|
13
|
-
}) : (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
o[k2] = m[k];
|
|
16
|
-
}));
|
|
17
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
-
}) : function(o, v) {
|
|
20
|
-
o["default"] = v;
|
|
21
|
-
});
|
|
22
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
-
var ownKeys = function(o) {
|
|
24
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
-
var ar = [];
|
|
26
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
-
return ar;
|
|
28
|
-
};
|
|
29
|
-
return ownKeys(o);
|
|
30
|
-
};
|
|
31
|
-
return function (mod) {
|
|
32
|
-
if (mod && mod.__esModule) return mod;
|
|
33
|
-
var result = {};
|
|
34
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
-
__setModuleDefault(result, mod);
|
|
36
|
-
return result;
|
|
37
|
-
};
|
|
38
|
-
})();
|
|
39
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.RequestForDecryptionKey = exports.Decryptor = exports.Encryptor = exports.Ciphertext = exports.DecryptionContext = exports.EncryptionContext = void 0;
|
|
41
|
-
const ts_sdk_1 = require("@aptos-labs/ts-sdk");
|
|
42
|
-
const utils_1 = require("@noble/curves/utils");
|
|
43
|
-
const IBE = __importStar(require("./ibe"));
|
|
44
|
-
const ShamirGF256 = __importStar(require("./shamir_gf256"));
|
|
45
|
-
const Sym = __importStar(require("./sym"));
|
|
46
|
-
const WorkerConfig = __importStar(require("./worker_config"));
|
|
47
|
-
const worker_task_1 = require("./worker_task");
|
|
48
|
-
class EncryptionContext {
|
|
49
|
-
workers;
|
|
50
|
-
threshold;
|
|
51
|
-
moduleAddr;
|
|
52
|
-
moduleName;
|
|
53
|
-
constructor({ workers, threshold, moduleAddr, moduleName }) {
|
|
54
|
-
this.workers = workers;
|
|
55
|
-
this.threshold = threshold;
|
|
56
|
-
this.moduleAddr = moduleAddr;
|
|
57
|
-
this.moduleName = moduleName;
|
|
58
|
-
}
|
|
59
|
-
serialize(serializer) {
|
|
60
|
-
serializer.serializeVector(this.workers);
|
|
61
|
-
serializer.serializeU64(this.threshold);
|
|
62
|
-
serializer.serialize(this.moduleAddr);
|
|
63
|
-
serializer.serializeStr(this.moduleName);
|
|
64
|
-
}
|
|
65
|
-
toBytes() {
|
|
66
|
-
const serializer = new ts_sdk_1.Serializer();
|
|
67
|
-
this.serialize(serializer);
|
|
68
|
-
return serializer.toUint8Array();
|
|
69
|
-
}
|
|
70
|
-
async loadEncryptor(aptos) {
|
|
71
|
-
const workerConfigs = await Promise.all(this.workers.map(async (worker) => {
|
|
72
|
-
const config = await WorkerConfig.view(aptos, worker);
|
|
73
|
-
return config;
|
|
74
|
-
}));
|
|
75
|
-
return new Encryptor(this, workerConfigs);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
exports.EncryptionContext = EncryptionContext;
|
|
79
|
-
class DecryptionContext {
|
|
80
|
-
workers;
|
|
81
|
-
threshold;
|
|
82
|
-
moduleAddr;
|
|
83
|
-
moduleName;
|
|
84
|
-
domain;
|
|
85
|
-
constructor({ workers, threshold, moduleAddr, moduleName, domain }) {
|
|
86
|
-
this.workers = workers;
|
|
87
|
-
this.threshold = threshold;
|
|
88
|
-
this.moduleAddr = moduleAddr;
|
|
89
|
-
this.moduleName = moduleName;
|
|
90
|
-
this.domain = domain;
|
|
91
|
-
}
|
|
92
|
-
static dummy() {
|
|
93
|
-
return new DecryptionContext({
|
|
94
|
-
workers: [],
|
|
95
|
-
threshold: 0,
|
|
96
|
-
moduleAddr: ts_sdk_1.AccountAddress.fromString("0x0"),
|
|
97
|
-
moduleName: "",
|
|
98
|
-
domain: new Uint8Array(0),
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
static deserialize(deserializer) {
|
|
102
|
-
const workers = deserializer.deserializeVector(ts_sdk_1.AccountAddress);
|
|
103
|
-
const threshold = Number(deserializer.deserializeU64());
|
|
104
|
-
const moduleAddr = deserializer.deserialize(ts_sdk_1.AccountAddress);
|
|
105
|
-
const moduleName = deserializer.deserializeStr();
|
|
106
|
-
const domain = deserializer.deserializeBytes();
|
|
107
|
-
return new DecryptionContext({ workers, threshold, moduleAddr, moduleName, domain });
|
|
108
|
-
}
|
|
109
|
-
serialize(serializer) {
|
|
110
|
-
serializer.serializeVector(this.workers);
|
|
111
|
-
serializer.serializeU64(this.threshold);
|
|
112
|
-
serializer.serialize(this.moduleAddr);
|
|
113
|
-
serializer.serializeStr(this.moduleName);
|
|
114
|
-
serializer.serializeBytes(this.domain);
|
|
115
|
-
}
|
|
116
|
-
toBytes() {
|
|
117
|
-
const serializer = new ts_sdk_1.Serializer();
|
|
118
|
-
this.serialize(serializer);
|
|
119
|
-
return serializer.toUint8Array();
|
|
120
|
-
}
|
|
121
|
-
toHex() {
|
|
122
|
-
return (0, utils_1.bytesToHex)(this.toBytes());
|
|
123
|
-
}
|
|
124
|
-
toWalletSignMessage() {
|
|
125
|
-
return JSON.stringify({
|
|
126
|
-
messageType: "ThresholdDecryptionRequestV0",
|
|
127
|
-
workers: this.workers.map(w => w.toString()),
|
|
128
|
-
threshold: this.threshold,
|
|
129
|
-
moduleAddr: this.moduleAddr.toString(),
|
|
130
|
-
moduleName: this.moduleName,
|
|
131
|
-
domain: `0x${(0, utils_1.bytesToHex)(this.domain)}`
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
async loadDecryptor({ aptos, userAddr, publicKey, signature }) {
|
|
135
|
-
const decKeyLoadResults = await Promise.all(this.workers.map(async (worker) => {
|
|
136
|
-
const config = await WorkerConfig.view(aptos, worker);
|
|
137
|
-
const task = worker_task_1.WorkerTask.newSilentSetupDecryptionKey(this, userAddr, publicKey, signature);
|
|
138
|
-
const controller = new AbortController();
|
|
139
|
-
const timeoutId = setTimeout(() => controller.abort(), 5000);
|
|
140
|
-
var response = null;
|
|
141
|
-
try {
|
|
142
|
-
response = await fetch(config.endpoint, {
|
|
143
|
-
method: "POST",
|
|
144
|
-
body: task.toHex(),
|
|
145
|
-
signal: controller.signal
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
catch (error) {
|
|
149
|
-
clearTimeout(timeoutId);
|
|
150
|
-
}
|
|
151
|
-
if (response == null) {
|
|
152
|
-
return new WorkerTimedOut();
|
|
153
|
-
}
|
|
154
|
-
const responseBody = await response.text();
|
|
155
|
-
if (response.status !== 200) {
|
|
156
|
-
return new WorkerRejected(response.status, responseBody);
|
|
157
|
-
}
|
|
158
|
-
try {
|
|
159
|
-
return IBE.IdentityPrivateKey.fromHex(responseBody);
|
|
160
|
-
}
|
|
161
|
-
catch (error) {
|
|
162
|
-
return new CouldNotParseDecryptionKey(responseBody);
|
|
163
|
-
}
|
|
164
|
-
}));
|
|
165
|
-
const numSharesCollected = decKeyLoadResults.filter((loadResult) => loadResult instanceof IBE.IdentityPrivateKey).length;
|
|
166
|
-
if (numSharesCollected < this.threshold) {
|
|
167
|
-
const workerResults = this.workers.map((worker, i) => {
|
|
168
|
-
const result = decKeyLoadResults[i];
|
|
169
|
-
return `${worker}: ${result instanceof IBE.IdentityPrivateKey ? 'Success' : result.toDisplayString()}`;
|
|
170
|
-
}).join(', ');
|
|
171
|
-
throw new Error(`Failed to collect enough shares to decrypt. Collected ${numSharesCollected} shares, but needed ${this.threshold} shares. Worker results: ${workerResults}`);
|
|
172
|
-
}
|
|
173
|
-
const decKeys = decKeyLoadResults.map((loadResult) => loadResult instanceof IBE.IdentityPrivateKey ? loadResult : null);
|
|
174
|
-
return new Decryptor(this, decKeys);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
exports.DecryptionContext = DecryptionContext;
|
|
178
|
-
class Ciphertext {
|
|
179
|
-
decryptionContext;
|
|
180
|
-
aesCiph;
|
|
181
|
-
ibeCiphs;
|
|
182
|
-
constructor(decryptionContext, aesCiph, ibeCiphs) {
|
|
183
|
-
this.decryptionContext = decryptionContext;
|
|
184
|
-
this.aesCiph = aesCiph;
|
|
185
|
-
this.ibeCiphs = ibeCiphs;
|
|
186
|
-
}
|
|
187
|
-
static dummy() {
|
|
188
|
-
return new Ciphertext(DecryptionContext.dummy(), Sym.Ciphertext.dummy(), []);
|
|
189
|
-
}
|
|
190
|
-
static deserialize(deserializer) {
|
|
191
|
-
const decryptionContext = DecryptionContext.deserialize(deserializer);
|
|
192
|
-
const aesCiph = Sym.Ciphertext.deserialize(deserializer);
|
|
193
|
-
const ibeCiphs = deserializer.deserializeVector(IBE.Ciphertext);
|
|
194
|
-
return new Ciphertext(decryptionContext, aesCiph, ibeCiphs);
|
|
195
|
-
}
|
|
196
|
-
static fromBytes(bytes) {
|
|
197
|
-
const deserializer = new ts_sdk_1.Deserializer(bytes);
|
|
198
|
-
const ret = Ciphertext.deserialize(deserializer);
|
|
199
|
-
if (deserializer.remaining() !== 0) {
|
|
200
|
-
throw new Error("Ciphertext deserialization failed: extra bytes");
|
|
201
|
-
}
|
|
202
|
-
return ret;
|
|
203
|
-
}
|
|
204
|
-
static fromHex(hex) {
|
|
205
|
-
return Ciphertext.fromBytes((0, utils_1.hexToBytes)(hex));
|
|
206
|
-
}
|
|
207
|
-
serialize(serializer) {
|
|
208
|
-
this.decryptionContext.serialize(serializer);
|
|
209
|
-
this.aesCiph.serialize(serializer);
|
|
210
|
-
serializer.serializeU32AsUleb128(this.ibeCiphs.length);
|
|
211
|
-
this.ibeCiphs.forEach(ibeCiph => ibeCiph.serialize(serializer));
|
|
212
|
-
}
|
|
213
|
-
toBytes() {
|
|
214
|
-
const serializer = new ts_sdk_1.Serializer();
|
|
215
|
-
this.serialize(serializer);
|
|
216
|
-
return serializer.toUint8Array();
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
exports.Ciphertext = Ciphertext;
|
|
220
|
-
class Encryptor {
|
|
221
|
-
domain;
|
|
222
|
-
workerConfigs;
|
|
223
|
-
constructor(domain, workerConfigs) {
|
|
224
|
-
this.domain = domain;
|
|
225
|
-
this.workerConfigs = workerConfigs;
|
|
226
|
-
}
|
|
227
|
-
encrypt({ domain, plaintext }) {
|
|
228
|
-
const decCtxt = new DecryptionContext({
|
|
229
|
-
workers: this.domain.workers,
|
|
230
|
-
threshold: this.domain.threshold,
|
|
231
|
-
moduleAddr: this.domain.moduleAddr,
|
|
232
|
-
moduleName: this.domain.moduleName,
|
|
233
|
-
domain: domain,
|
|
234
|
-
});
|
|
235
|
-
const symmKey = Sym.keygen();
|
|
236
|
-
const symmKeyShares = ShamirGF256.split(symmKey.toBytes(), this.domain.threshold, this.domain.workers.length);
|
|
237
|
-
const symmCiph = Sym.encrypt(symmKey, plaintext);
|
|
238
|
-
const ibeCiphs = symmKeyShares.map((share, idx) => IBE.encrypt(this.workerConfigs[idx].ibeMpk, decCtxt.toBytes(), share.payload));
|
|
239
|
-
return new Ciphertext(decCtxt, symmCiph, ibeCiphs);
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
exports.Encryptor = Encryptor;
|
|
243
|
-
class Decryptor {
|
|
244
|
-
ibeDecryptionKeys;
|
|
245
|
-
decryptionContext;
|
|
246
|
-
constructor(decryptionContext, ibeDecryptionKeys) {
|
|
247
|
-
this.decryptionContext = decryptionContext;
|
|
248
|
-
this.ibeDecryptionKeys = ibeDecryptionKeys;
|
|
249
|
-
}
|
|
250
|
-
decrypt(ciphertext) {
|
|
251
|
-
if (ciphertext.decryptionContext.toHex() !== this.decryptionContext.toHex()) {
|
|
252
|
-
throw new Error("Ciphertext does not match decryption domain");
|
|
253
|
-
}
|
|
254
|
-
const symmKeyShares = ciphertext.ibeCiphs.map((ibeCiph, idx) => {
|
|
255
|
-
if (this.ibeDecryptionKeys[idx] == null) {
|
|
256
|
-
console.log(`idx=${idx}, isk is null`);
|
|
257
|
-
return null;
|
|
258
|
-
}
|
|
259
|
-
const sharePayload = IBE.decrypt(this.ibeDecryptionKeys[idx], ibeCiph);
|
|
260
|
-
if (sharePayload == null) {
|
|
261
|
-
console.log(`idx=${idx}, sharePayload is null`);
|
|
262
|
-
return null;
|
|
263
|
-
}
|
|
264
|
-
return new ShamirGF256.Share(idx + 1, sharePayload);
|
|
265
|
-
}).filter((share) => share != null);
|
|
266
|
-
const symmKeyBytes = ShamirGF256.combine(symmKeyShares);
|
|
267
|
-
const symmKey = Sym.Key.fromBytes(symmKeyBytes);
|
|
268
|
-
return Sym.decrypt(symmKey, ciphertext.aesCiph);
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
exports.Decryptor = Decryptor;
|
|
272
|
-
class WorkerTimedOut {
|
|
273
|
-
toDisplayString() {
|
|
274
|
-
return 'Timed out';
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
class WorkerRejected {
|
|
278
|
-
statusCode;
|
|
279
|
-
responseBody;
|
|
280
|
-
constructor(statusCode, responseBody) {
|
|
281
|
-
this.statusCode = statusCode;
|
|
282
|
-
this.responseBody = responseBody;
|
|
283
|
-
}
|
|
284
|
-
toDisplayString() {
|
|
285
|
-
return `Rejected: ${this.statusCode} ${this.responseBody}`;
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
class CouldNotParseDecryptionKey {
|
|
289
|
-
originalHex;
|
|
290
|
-
constructor(originalHex) {
|
|
291
|
-
this.originalHex = originalHex;
|
|
292
|
-
}
|
|
293
|
-
toDisplayString() {
|
|
294
|
-
return `Could not parse decryption key: ${this.originalHex}`;
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
/**
|
|
298
|
-
* A message from a user to a MPC worker to request a decryption key.
|
|
299
|
-
*/
|
|
300
|
-
class RequestForDecryptionKey {
|
|
301
|
-
decryptionContext;
|
|
302
|
-
userAddr;
|
|
303
|
-
publicKey;
|
|
304
|
-
signature;
|
|
305
|
-
constructor(decryptionContext, userAddr, publicKey, signature) {
|
|
306
|
-
this.decryptionContext = decryptionContext;
|
|
307
|
-
this.userAddr = userAddr;
|
|
308
|
-
this.publicKey = publicKey;
|
|
309
|
-
this.signature = signature;
|
|
310
|
-
}
|
|
311
|
-
static deserialize(deserializer) {
|
|
312
|
-
const decryptionContext = DecryptionContext.deserialize(deserializer);
|
|
313
|
-
const userAddr = deserializer.deserialize(ts_sdk_1.AccountAddress);
|
|
314
|
-
const publicKey = deserializer.deserialize(ts_sdk_1.Ed25519PublicKey);
|
|
315
|
-
const signature = deserializer.deserialize(ts_sdk_1.Ed25519Signature);
|
|
316
|
-
return new RequestForDecryptionKey(decryptionContext, userAddr, publicKey, signature);
|
|
317
|
-
}
|
|
318
|
-
static fromBytes(bytes) {
|
|
319
|
-
const deserializer = new ts_sdk_1.Deserializer(bytes);
|
|
320
|
-
const ret = RequestForDecryptionKey.deserialize(deserializer);
|
|
321
|
-
return ret;
|
|
322
|
-
}
|
|
323
|
-
static fromHex(hex) {
|
|
324
|
-
return RequestForDecryptionKey.fromBytes((0, utils_1.hexToBytes)(hex));
|
|
325
|
-
}
|
|
326
|
-
serialize(serializer) {
|
|
327
|
-
this.decryptionContext.serialize(serializer);
|
|
328
|
-
serializer.serialize(this.userAddr);
|
|
329
|
-
serializer.serialize(this.publicKey);
|
|
330
|
-
serializer.serialize(this.signature);
|
|
331
|
-
}
|
|
332
|
-
toBytes() {
|
|
333
|
-
const serializer = new ts_sdk_1.Serializer();
|
|
334
|
-
this.serialize(serializer);
|
|
335
|
-
return serializer.toUint8Array();
|
|
336
|
-
}
|
|
337
|
-
toHex() {
|
|
338
|
-
return (0, utils_1.bytesToHex)(this.toBytes());
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
exports.RequestForDecryptionKey = RequestForDecryptionKey;
|
|
342
|
-
//# sourceMappingURL=silent_setup_encryption.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"silent_setup_encryption.js","sourceRoot":"","sources":["../src/silent_setup_encryption.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,+CAAyH;AACzH,+CAA6D;AAC7D,2CAA6B;AAC7B,4DAA8C;AAC9C,2CAA6B;AAC7B,8DAAgD;AAChD,+CAA2C;AAE3C,MAAa,iBAAiB;IAC1B,OAAO,CAAmB;IAC1B,S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CAAC;QAC7D,MAAM,SAAS,GAAG,YAAY,CAAC,WAAW,CAAC,yBAAgB,CAAC,CAAC;QAC7D,OAAO,IAAI,uBAAuB,CAAC,iBAAiB,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;IAC1F,CAAC;IAED,MAAM,CAAC,SAAS,CAAC,KAAiB;QAC9B,MAAM,YAAY,GAAG,IAAI,qBAAY,CAAC,KAAK,CAAC,CAAC;QAC7C,MAAM,GAAG,GAAG,uBAAuB,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;QAC9D,OAAO,GAAG,CAAC;IACf,CAAC;IAED,MAAM,CAAC,OAAO,CAAC,GAAW;QACtB,OAAO,uBAAuB,CAAC,SAAS,CAAC,IAAA,kBAAU,EAAC,GAAG,CAAC,CAAC,CAAC;IAC9D,CAAC;IAED,SAAS,CAAC,UAAsB;QAC5B,IAAI,CAAC,iBAAiB,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAC7C,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACpC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACrC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACzC,CAAC;IAED,OAAO;QACH,MAAM,UAAU,GAAG,IAAI,mBAAU,EAAE,CAAC;QACpC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAC3B,OAAO,UAAU,CAAC,YAAY,EAAE,CAAC;IACrC,CAAC;IAED,KAAK;QACD,OAAO,IAAA,kBAAU,EAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IACtC,CAAC;CACJ;AA/CD,0DA+CC"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { AccountAddress, Deserializer, Ed25519PublicKey, Ed25519Signature, Serializer } from "@aptos-labs/ts-sdk";
|
|
2
|
-
export declare class ContractID {
|
|
3
|
-
chainId: number;
|
|
4
|
-
moduleAddr: AccountAddress;
|
|
5
|
-
moduleName: string;
|
|
6
|
-
constructor(chainId: number, moduleAddr: AccountAddress, moduleName: string);
|
|
7
|
-
static dummy(): ContractID;
|
|
8
|
-
static deserialize(deserializer: Deserializer): ContractID;
|
|
9
|
-
static fromBytes(bytes: Uint8Array): ContractID;
|
|
10
|
-
static fromHex(hex: string): ContractID;
|
|
11
|
-
serialize(serializer: Serializer): void;
|
|
12
|
-
toBytes(): Uint8Array;
|
|
13
|
-
toHex(): string;
|
|
14
|
-
}
|
|
15
|
-
export declare const POP_SCHEME__V0 = 0;
|
|
16
|
-
export declare class ProofOfPermission {
|
|
17
|
-
scheme: number;
|
|
18
|
-
inner: any;
|
|
19
|
-
private constructor();
|
|
20
|
-
static newV0(v0: ProofOfPermissionV0): ProofOfPermission;
|
|
21
|
-
static deserialize(deserializer: Deserializer): ProofOfPermission;
|
|
22
|
-
static fromBytes(bytes: Uint8Array): ProofOfPermission;
|
|
23
|
-
static fromHex(hex: string): ProofOfPermission;
|
|
24
|
-
serialize(serializer: Serializer): void;
|
|
25
|
-
toBytes(): Uint8Array;
|
|
26
|
-
toHex(): string;
|
|
27
|
-
}
|
|
28
|
-
export declare class ProofOfPermissionV0 {
|
|
29
|
-
userAddr: AccountAddress;
|
|
30
|
-
publicKey: Ed25519PublicKey;
|
|
31
|
-
signature: Ed25519Signature;
|
|
32
|
-
constructor(userAddr: AccountAddress, publicKey: Ed25519PublicKey, signature: Ed25519Signature);
|
|
33
|
-
static deserialize(deserializer: Deserializer): ProofOfPermissionV0;
|
|
34
|
-
static fromBytes(bytes: Uint8Array): ProofOfPermissionV0;
|
|
35
|
-
static fromHex(hex: string): ProofOfPermissionV0;
|
|
36
|
-
serialize(serializer: Serializer): void;
|
|
37
|
-
toBytes(): Uint8Array;
|
|
38
|
-
toHex(): string;
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=aptos.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3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c,CAAC;IACzB,SAAS,EAAE,gBAAgB,CAAC;IAC5B,SAAS,EAAE,gBAAgB,CAAC;gBAEhB,QAAQ,EAAE,cAAc,EAAE,SAAS,EAAE,gBAAgB,EAAE,SAAS,EAAE,gBAAgB;IAM9F,MAAM,CAAC,WAAW,CAAC,YAAY,EAAE,YAAY,GAAG,mBAAmB;IAOnE,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,mBAAmB;IAKxD,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,mBAAmB;IAIhD,SAAS,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI;IAMvC,OAAO,IAAI,UAAU;IAMrB,KAAK,IAAI,MAAM;CAGlB"}
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ProofOfPermissionV0 = exports.ProofOfPermission = exports.POP_SCHEME__V0 = exports.ContractID = void 0;
|
|
4
|
-
const ts_sdk_1 = require("@aptos-labs/ts-sdk");
|
|
5
|
-
const utils_1 = require("@noble/hashes/utils");
|
|
6
|
-
class ContractID {
|
|
7
|
-
chainId; // u8
|
|
8
|
-
moduleAddr;
|
|
9
|
-
moduleName;
|
|
10
|
-
constructor(chainId, moduleAddr, moduleName) {
|
|
11
|
-
this.chainId = chainId;
|
|
12
|
-
this.moduleAddr = moduleAddr;
|
|
13
|
-
this.moduleName = moduleName;
|
|
14
|
-
}
|
|
15
|
-
static dummy() {
|
|
16
|
-
return new ContractID(0, ts_sdk_1.AccountAddress.fromString("0x0"), "");
|
|
17
|
-
}
|
|
18
|
-
static deserialize(deserializer) {
|
|
19
|
-
const chainId = deserializer.deserializeU8();
|
|
20
|
-
const moduleAddr = deserializer.deserialize(ts_sdk_1.AccountAddress);
|
|
21
|
-
const moduleName = deserializer.deserializeStr();
|
|
22
|
-
return new ContractID(chainId, moduleAddr, moduleName);
|
|
23
|
-
}
|
|
24
|
-
static fromBytes(bytes) {
|
|
25
|
-
const deserializer = new ts_sdk_1.Deserializer(bytes);
|
|
26
|
-
return ContractID.deserialize(deserializer);
|
|
27
|
-
}
|
|
28
|
-
static fromHex(hex) {
|
|
29
|
-
return ContractID.fromBytes((0, utils_1.hexToBytes)(hex));
|
|
30
|
-
}
|
|
31
|
-
serialize(serializer) {
|
|
32
|
-
serializer.serializeU8(this.chainId);
|
|
33
|
-
serializer.serialize(this.moduleAddr);
|
|
34
|
-
serializer.serializeStr(this.moduleName);
|
|
35
|
-
}
|
|
36
|
-
toBytes() {
|
|
37
|
-
const serializer = new ts_sdk_1.Serializer();
|
|
38
|
-
this.serialize(serializer);
|
|
39
|
-
return serializer.toUint8Array();
|
|
40
|
-
}
|
|
41
|
-
toHex() {
|
|
42
|
-
return (0, utils_1.bytesToHex)(this.toBytes());
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
exports.ContractID = ContractID;
|
|
46
|
-
exports.POP_SCHEME__V0 = 0;
|
|
47
|
-
class ProofOfPermission {
|
|
48
|
-
scheme;
|
|
49
|
-
inner;
|
|
50
|
-
constructor(scheme, inner) {
|
|
51
|
-
this.scheme = scheme;
|
|
52
|
-
this.inner = inner;
|
|
53
|
-
}
|
|
54
|
-
static newV0(v0) {
|
|
55
|
-
return new ProofOfPermission(exports.POP_SCHEME__V0, v0);
|
|
56
|
-
}
|
|
57
|
-
static deserialize(deserializer) {
|
|
58
|
-
const scheme = deserializer.deserializeU8();
|
|
59
|
-
if (scheme === exports.POP_SCHEME__V0) {
|
|
60
|
-
const inner = ProofOfPermissionV0.deserialize(deserializer);
|
|
61
|
-
return new ProofOfPermission(scheme, inner);
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
throw new Error(`Unknown scheme: ${scheme}`);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
static fromBytes(bytes) {
|
|
68
|
-
const deserializer = new ts_sdk_1.Deserializer(bytes);
|
|
69
|
-
return ProofOfPermission.deserialize(deserializer);
|
|
70
|
-
}
|
|
71
|
-
static fromHex(hex) {
|
|
72
|
-
return ProofOfPermission.fromBytes((0, utils_1.hexToBytes)(hex));
|
|
73
|
-
}
|
|
74
|
-
serialize(serializer) {
|
|
75
|
-
serializer.serializeU8(this.scheme);
|
|
76
|
-
this.inner.serialize(serializer);
|
|
77
|
-
}
|
|
78
|
-
toBytes() {
|
|
79
|
-
const serializer = new ts_sdk_1.Serializer();
|
|
80
|
-
this.serialize(serializer);
|
|
81
|
-
return serializer.toUint8Array();
|
|
82
|
-
}
|
|
83
|
-
toHex() {
|
|
84
|
-
return (0, utils_1.bytesToHex)(this.toBytes());
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
exports.ProofOfPermission = ProofOfPermission;
|
|
88
|
-
class ProofOfPermissionV0 {
|
|
89
|
-
userAddr;
|
|
90
|
-
publicKey;
|
|
91
|
-
signature;
|
|
92
|
-
constructor(userAddr, publicKey, signature) {
|
|
93
|
-
this.userAddr = userAddr;
|
|
94
|
-
this.publicKey = publicKey;
|
|
95
|
-
this.signature = signature;
|
|
96
|
-
}
|
|
97
|
-
static deserialize(deserializer) {
|
|
98
|
-
const userAddr = deserializer.deserialize(ts_sdk_1.AccountAddress);
|
|
99
|
-
const publicKey = deserializer.deserialize(ts_sdk_1.Ed25519PublicKey);
|
|
100
|
-
const signature = deserializer.deserialize(ts_sdk_1.Ed25519Signature);
|
|
101
|
-
return new ProofOfPermissionV0(userAddr, publicKey, signature);
|
|
102
|
-
}
|
|
103
|
-
static fromBytes(bytes) {
|
|
104
|
-
const deserializer = new ts_sdk_1.Deserializer(bytes);
|
|
105
|
-
return ProofOfPermissionV0.deserialize(deserializer);
|
|
106
|
-
}
|
|
107
|
-
static fromHex(hex) {
|
|
108
|
-
return ProofOfPermissionV0.fromBytes((0, utils_1.hexToBytes)(hex));
|
|
109
|
-
}
|
|
110
|
-
serialize(serializer) {
|
|
111
|
-
serializer.serialize(this.userAddr);
|
|
112
|
-
serializer.serialize(this.publicKey);
|
|
113
|
-
serializer.serialize(this.signature);
|
|
114
|
-
}
|
|
115
|
-
toBytes() {
|
|
116
|
-
const serializer = new ts_sdk_1.Serializer();
|
|
117
|
-
this.serialize(serializer);
|
|
118
|
-
return serializer.toUint8Array();
|
|
119
|
-
}
|
|
120
|
-
toHex() {
|
|
121
|
-
return (0, utils_1.bytesToHex)(this.toBytes());
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
exports.ProofOfPermissionV0 = ProofOfPermissionV0;
|
|
125
|
-
//# sourceMappingURL=aptos.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"aptos.js","sourceRoot":"","sources":["../../src/silent_setup_encryption_xchain/aptos.ts"],"names":[],"mappings":";;;AAAA,+CAAkH;AAClH,+CAA6D;AAE7D,MAAa,UAAU;IACnB,OAAO,CAAS,CAAC,KAAK;IACtB,UAAU,CAAiB;IAC3B,UAAU,CAAS;IAEnB,YAAY,OAAe,EAAE,UAA0B,EAAE,UAAkB;QACvE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IACjC,CAAC;IAED,MAAM,CAAC,KAAK;QACR,OAAO,IAAI,UAAU,CAAC,CAAC,EAAE,uBAAc,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;IACnE,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,YAA0B;QACzC,MAAM,OAAO,GAAG,YAAY,CAAC,aAAa,EAAE,CAAC;QAC7C,MAAM,UAAU,GAAG,YAAY,CAAC,WAAW,CAAC,uBAAc,CAAC,CAAC;QAC5D,MAAM,UAAU,GAAG,YAAY,CAAC,cAAc,EAAE,CAAC;QACjD,OAAO,IAAI,UAAU,CAAC,OAAO,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;IAC3D,CAAC;IAED,MAAM,CAAC,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WorkerConfig } from "..";
|
|
3
|
-
import * as IBE from "../ibe";
|
|
4
|
-
import * as Sym from "../sym";
|
|
5
|
-
import { ContractID as AptosContractID, ProofOfPermission as AptosProofOfPermission } from "./aptos";
|
|
6
|
-
import { ContractID as SolanaContractID, ProofOfPermission as SolanaProofOfPermission } from "./solana";
|
|
7
|
-
export declare const SCHEME_APTOS = 0;
|
|
8
|
-
export declare const SCHEME_SOLANA = 1;
|
|
9
|
-
export declare class ContractID {
|
|
10
|
-
scheme: number;
|
|
11
|
-
inner: any;
|
|
12
|
-
private constructor();
|
|
13
|
-
static newAptos(id: AptosContractID): ContractID;
|
|
14
|
-
static newSolana(id: SolanaContractID): ContractID;
|
|
15
|
-
static dummy(): ContractID;
|
|
16
|
-
static deserialize(deserializer: Deserializer): ContractID;
|
|
17
|
-
static fromBytes(bytes: Uint8Array): ContractID;
|
|
18
|
-
static fromHex(hex: string): ContractID;
|
|
19
|
-
serialize(serializer: Serializer): void;
|
|
20
|
-
toBytes(): Uint8Array;
|
|
21
|
-
toHex(): string;
|
|
22
|
-
}
|
|
23
|
-
export declare class ProofOfPermission {
|
|
24
|
-
scheme: number;
|
|
25
|
-
inner: any;
|
|
26
|
-
private constructor();
|
|
27
|
-
static newAptos(id: AptosProofOfPermission): ProofOfPermission;
|
|
28
|
-
static newSolana(id: SolanaProofOfPermission): ProofOfPermission;
|
|
29
|
-
static deserialize(deserializer: Deserializer): ProofOfPermission;
|
|
30
|
-
static fromBytes(bytes: Uint8Array): ProofOfPermission;
|
|
31
|
-
static fromHex(hex: string): ProofOfPermission;
|
|
32
|
-
serialize(serializer: Serializer): void;
|
|
33
|
-
toBytes(): Uint8Array;
|
|
34
|
-
toHex(): string;
|
|
35
|
-
}
|
|
36
|
-
export declare class EncryptionContext {
|
|
37
|
-
workers: string[];
|
|
38
|
-
threshold: number;
|
|
39
|
-
contractId: ContractID;
|
|
40
|
-
constructor({ workers, threshold, contractId }: {
|
|
41
|
-
workers: string[];
|
|
42
|
-
threshold: number;
|
|
43
|
-
contractId: ContractID;
|
|
44
|
-
});
|
|
45
|
-
static deserialize(deserializer: Deserializer): EncryptionContext;
|
|
46
|
-
static fromBytes(bytes: Uint8Array): EncryptionContext;
|
|
47
|
-
static fromHex(hex: string): EncryptionContext;
|
|
48
|
-
serialize(serializer: Serializer): void;
|
|
49
|
-
toBytes(): Uint8Array;
|
|
50
|
-
toHex(): string;
|
|
51
|
-
loadEncryptor(): Promise<Encryptor>;
|
|
52
|
-
}
|
|
53
|
-
export declare class DecryptionContext {
|
|
54
|
-
workers: string[];
|
|
55
|
-
threshold: number;
|
|
56
|
-
contractId: ContractID;
|
|
57
|
-
domain: Uint8Array;
|
|
58
|
-
constructor({ workers, threshold, contractId, domain }: {
|
|
59
|
-
workers: string[];
|
|
60
|
-
threshold: number;
|
|
61
|
-
contractId: ContractID;
|
|
62
|
-
domain: Uint8Array;
|
|
63
|
-
});
|
|
64
|
-
static dummy(): DecryptionContext;
|
|
65
|
-
static deserialize(deserializer: Deserializer): DecryptionContext;
|
|
66
|
-
static fromBytes(bytes: Uint8Array): DecryptionContext;
|
|
67
|
-
static fromHex(hex: string): DecryptionContext;
|
|
68
|
-
serialize(serializer: Serializer): void;
|
|
69
|
-
toBytes(): Uint8Array;
|
|
70
|
-
toHex(): string;
|
|
71
|
-
loadDecryptor(proof: ProofOfPermission): Promise<Decryptor>;
|
|
72
|
-
}
|
|
73
|
-
export declare class Ciphertext {
|
|
74
|
-
decryptionContext: DecryptionContext;
|
|
75
|
-
aesCiph: Sym.Ciphertext;
|
|
76
|
-
ibeCiphs: IBE.Ciphertext[];
|
|
77
|
-
constructor(decryptionContext: DecryptionContext, aesCiph: Sym.Ciphertext, ibeCiphs: IBE.Ciphertext[]);
|
|
78
|
-
static dummy(): Ciphertext;
|
|
79
|
-
static deserialize(deserializer: Deserializer): Ciphertext;
|
|
80
|
-
static fromBytes(bytes: Uint8Array): Ciphertext;
|
|
81
|
-
static fromHex(hex: string): Ciphertext;
|
|
82
|
-
serialize(serializer: Serializer): void;
|
|
83
|
-
toBytes(): Uint8Array;
|
|
84
|
-
}
|
|
85
|
-
export declare class Encryptor {
|
|
86
|
-
domain: EncryptionContext;
|
|
87
|
-
workerConfigs: WorkerConfig.WorkerConfig[];
|
|
88
|
-
constructor(domain: EncryptionContext, workerConfigs: WorkerConfig.WorkerConfig[]);
|
|
89
|
-
encrypt({ domain, plaintext }: {
|
|
90
|
-
domain: Uint8Array;
|
|
91
|
-
plaintext: Uint8Array;
|
|
92
|
-
}): Ciphertext;
|
|
93
|
-
}
|
|
94
|
-
export declare class Decryptor {
|
|
95
|
-
ibeDecryptionKeys: (IBE.IdentityPrivateKey | null)[];
|
|
96
|
-
decryptionContext: DecryptionContext;
|
|
97
|
-
constructor(decryptionContext: DecryptionContext, ibeDecryptionKeys: (IBE.IdentityPrivateKey | null)[]);
|
|
98
|
-
decrypt(ciphertext: Ciphertext): Uint8Array | undefined;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* A message from a user to a MPC worker to request a decryption key.
|
|
102
|
-
*/
|
|
103
|
-
export declare class RequestForDecryptionKey {
|
|
104
|
-
decryptionContext: DecryptionContext;
|
|
105
|
-
proofOfPermission: ProofOfPermission;
|
|
106
|
-
constructor(decryptionContext: DecryptionContext, proofOfPermission: ProofOfPermission);
|
|
107
|
-
static deserialize(deserializer: Deserializer): RequestForDecryptionKey;
|
|
108
|
-
static fromBytes(bytes: Uint8Array): RequestForDecryptionKey;
|
|
109
|
-
static fromHex(hex: string): RequestForDecryptionKey;
|
|
110
|
-
serialize(serializer: Serializer): void;
|
|
111
|
-
toBytes(): Uint8Array;
|
|
112
|
-
toHex(): string;
|
|
113
|
-
}
|
|
114
|
-
export * as Aptos from "./aptos";
|
|
115
|
-
export * as Solana from "./solana";
|
|
116
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/silent_setup_encry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