@zhoujun_aptos/octopus-ts-sdk-min 0.22.6 → 0.22.8
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 +62 -17
- package/dist/common/index.js +427 -222
- package/dist/common/index.js.map +1 -1
- package/dist/esm/index.d.mts +62 -17
- package/dist/esm/index.mjs +427 -223
- package/dist/esm/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/common/index.d.ts
CHANGED
|
@@ -150,12 +150,46 @@ declare function keygen$3(schemeId?: number): DecryptionKey$1;
|
|
|
150
150
|
declare function deriveEncryptionKey(dk: DecryptionKey$1): EncryptionKey$1;
|
|
151
151
|
declare function encrypt$3(ek: EncryptionKey$1, msg: Uint8Array): Ciphertext$5;
|
|
152
152
|
declare function encryptWithRandomness$2(ek: EncryptionKey$1, msg: Uint8Array, randomness: Uint8Array): Ciphertext$5;
|
|
153
|
-
declare function decrypt$
|
|
153
|
+
declare function decrypt$2(dk: DecryptionKey$1, ciphertext: Ciphertext$5): Uint8Array | undefined;
|
|
154
154
|
|
|
155
155
|
declare const index$5_SCHEME_SIMPLE_ELGAMAL_RISTRETTO255: typeof SCHEME_SIMPLE_ELGAMAL_RISTRETTO255;
|
|
156
156
|
declare const index$5_deriveEncryptionKey: typeof deriveEncryptionKey;
|
|
157
157
|
declare namespace index$5 {
|
|
158
|
-
export { Ciphertext$5 as Ciphertext, DecryptionKey$1 as DecryptionKey, EncryptionKey$1 as EncryptionKey, index$5_SCHEME_SIMPLE_ELGAMAL_RISTRETTO255 as SCHEME_SIMPLE_ELGAMAL_RISTRETTO255, decrypt$
|
|
158
|
+
export { Ciphertext$5 as Ciphertext, DecryptionKey$1 as DecryptionKey, EncryptionKey$1 as EncryptionKey, index$5_SCHEME_SIMPLE_ELGAMAL_RISTRETTO255 as SCHEME_SIMPLE_ELGAMAL_RISTRETTO255, decrypt$2 as decrypt, index$5_deriveEncryptionKey as deriveEncryptionKey, encrypt$3 as encrypt, encryptWithRandomness$2 as encryptWithRandomness, keygen$3 as keygen };
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
declare class Result<T> {
|
|
162
|
+
isOk: boolean;
|
|
163
|
+
okValue?: T;
|
|
164
|
+
errValue?: any;
|
|
165
|
+
extra?: any;
|
|
166
|
+
private constructor();
|
|
167
|
+
static Ok<T>(args: {
|
|
168
|
+
value: T;
|
|
169
|
+
extra?: any;
|
|
170
|
+
}): Result<T>;
|
|
171
|
+
static Err<T>(args: {
|
|
172
|
+
error: any;
|
|
173
|
+
extra?: any;
|
|
174
|
+
}): Result<T>;
|
|
175
|
+
/**
|
|
176
|
+
* You write a closure that either returns a T or throws, and we wrap it to return a Result<T>.
|
|
177
|
+
* Your closure is also given an `extra` dictionary to record additional context.
|
|
178
|
+
*/
|
|
179
|
+
static capture<T>({ task, recordsExecutionTimeMs }: {
|
|
180
|
+
task: (extra: Record<string, any>) => T;
|
|
181
|
+
recordsExecutionTimeMs: boolean;
|
|
182
|
+
}): Result<T>;
|
|
183
|
+
/**
|
|
184
|
+
* You write an async closure that either returns a T or throws, and we wrap it to return a Result<T>.
|
|
185
|
+
* Your closure is also given an `extra` dictionary to record additional context.
|
|
186
|
+
*/
|
|
187
|
+
static captureAsync<T>({ task, recordsExecutionTimeMs }: {
|
|
188
|
+
task: (extra: Record<string, any>) => Promise<T>;
|
|
189
|
+
recordsExecutionTimeMs: boolean;
|
|
190
|
+
}): Promise<Result<T>>;
|
|
191
|
+
unwrapOrThrow(tothrow: any): T;
|
|
192
|
+
unwrapErrOrThrow(tothrow: any): any | undefined;
|
|
159
193
|
}
|
|
160
194
|
|
|
161
195
|
declare const SCHEME_OTP_HAMC_BONEH_FRANKLIN_BLS12381_SHORT_PK = 0;
|
|
@@ -208,8 +242,12 @@ declare function derivePublicKey(privateKey: MasterPrivateKey): MasterPublicKey;
|
|
|
208
242
|
declare function encrypt$2(publicKey: MasterPublicKey, id: Uint8Array, plaintext: Uint8Array): Ciphertext$4;
|
|
209
243
|
/** Do NOT use this, unless you are a maintainer. Use `encrypt` instead. */
|
|
210
244
|
declare function encryptWithRandomness$1(publicKey: MasterPublicKey, id: Uint8Array, plaintext: Uint8Array, randomness: Uint8Array): Ciphertext$4;
|
|
245
|
+
/** @deprecated Use tryExtract instead */
|
|
211
246
|
declare function extract(privateKey: MasterPrivateKey, id: Uint8Array): IdentityPrivateKey;
|
|
212
|
-
declare function
|
|
247
|
+
declare function tryExtract$1(privateKey: MasterPrivateKey, id: Uint8Array): Result<IdentityPrivateKey>;
|
|
248
|
+
/** @deprecated Use tryDecrypt instead */
|
|
249
|
+
declare function decrypt$1(identityKey: IdentityPrivateKey, ciphertext: Ciphertext$4): Uint8Array | undefined;
|
|
250
|
+
declare function tryDecrypt$2(identityKey: IdentityPrivateKey, ciphertext: Ciphertext$4): Result<Uint8Array>;
|
|
213
251
|
|
|
214
252
|
type index$4_IdentityPrivateKey = IdentityPrivateKey;
|
|
215
253
|
declare const index$4_IdentityPrivateKey: typeof IdentityPrivateKey;
|
|
@@ -221,7 +259,7 @@ declare const index$4_SCHEME_OTP_HAMC_BONEH_FRANKLIN_BLS12381_SHORT_PK: typeof S
|
|
|
221
259
|
declare const index$4_derivePublicKey: typeof derivePublicKey;
|
|
222
260
|
declare const index$4_extract: typeof extract;
|
|
223
261
|
declare namespace index$4 {
|
|
224
|
-
export { Ciphertext$4 as Ciphertext, index$4_IdentityPrivateKey as IdentityPrivateKey, index$4_MasterPrivateKey as MasterPrivateKey, index$4_MasterPublicKey as MasterPublicKey, index$4_SCHEME_OTP_HAMC_BONEH_FRANKLIN_BLS12381_SHORT_PK as SCHEME_OTP_HAMC_BONEH_FRANKLIN_BLS12381_SHORT_PK, decrypt$
|
|
262
|
+
export { Ciphertext$4 as Ciphertext, index$4_IdentityPrivateKey as IdentityPrivateKey, index$4_MasterPrivateKey as MasterPrivateKey, index$4_MasterPublicKey as MasterPublicKey, index$4_SCHEME_OTP_HAMC_BONEH_FRANKLIN_BLS12381_SHORT_PK as SCHEME_OTP_HAMC_BONEH_FRANKLIN_BLS12381_SHORT_PK, decrypt$1 as decrypt, index$4_derivePublicKey as derivePublicKey, encrypt$2 as encrypt, encryptWithRandomness$1 as encryptWithRandomness, index$4_extract as extract, keygen$2 as keygen, tryDecrypt$2 as tryDecrypt, tryExtract$1 as tryExtract };
|
|
225
263
|
}
|
|
226
264
|
|
|
227
265
|
declare class SchnorrRistretto255SigningKey {
|
|
@@ -325,14 +363,17 @@ declare class Ciphertext$3 {
|
|
|
325
363
|
declare function keygen(scheme?: number): Key;
|
|
326
364
|
declare function encrypt$1(key: Key, plaintext: Uint8Array): Ciphertext$3;
|
|
327
365
|
declare function encryptWithRandomness(key: Key, plaintext: Uint8Array, randomness: Uint8Array): Ciphertext$3;
|
|
328
|
-
|
|
366
|
+
/** @deprecated Use tryDecrypt instead */
|
|
367
|
+
declare function decrypt(key: Key, ciphertext: Ciphertext$3): Uint8Array | undefined;
|
|
368
|
+
declare function tryDecrypt$1(key: Key, ciphertext: Ciphertext$3): Result<Uint8Array>;
|
|
329
369
|
|
|
330
370
|
type index$2_Key = Key;
|
|
331
371
|
declare const index$2_Key: typeof Key;
|
|
372
|
+
declare const index$2_decrypt: typeof decrypt;
|
|
332
373
|
declare const index$2_encryptWithRandomness: typeof encryptWithRandomness;
|
|
333
374
|
declare const index$2_keygen: typeof keygen;
|
|
334
375
|
declare namespace index$2 {
|
|
335
|
-
export { Ciphertext$3 as Ciphertext, index$2_Key as Key,
|
|
376
|
+
export { Ciphertext$3 as Ciphertext, index$2_Key as Key, index$2_decrypt as decrypt, encrypt$1 as encrypt, index$2_encryptWithRandomness as encryptWithRandomness, index$2_keygen as keygen, tryDecrypt$1 as tryDecrypt };
|
|
336
377
|
}
|
|
337
378
|
|
|
338
379
|
declare class WorkerConfig {
|
|
@@ -352,7 +393,9 @@ declare class WorkerConfig {
|
|
|
352
393
|
toPrettyJson(): string;
|
|
353
394
|
}
|
|
354
395
|
declare function view(aptos: Aptos, worker: AccountAddress): Promise<WorkerConfig>;
|
|
396
|
+
/** @deprecated Use getAsync instead */
|
|
355
397
|
declare function get(workerEndpoint: string): Promise<WorkerConfig>;
|
|
398
|
+
declare function getAsync(workerEndpoint: string): Promise<Result<WorkerConfig>>;
|
|
356
399
|
declare function randWorker(): {
|
|
357
400
|
addr: AccountAddress;
|
|
358
401
|
config: WorkerConfig;
|
|
@@ -364,10 +407,11 @@ declare function randWorker(): {
|
|
|
364
407
|
type worker_config_WorkerConfig = WorkerConfig;
|
|
365
408
|
declare const worker_config_WorkerConfig: typeof WorkerConfig;
|
|
366
409
|
declare const worker_config_get: typeof get;
|
|
410
|
+
declare const worker_config_getAsync: typeof getAsync;
|
|
367
411
|
declare const worker_config_randWorker: typeof randWorker;
|
|
368
412
|
declare const worker_config_view: typeof view;
|
|
369
413
|
declare namespace worker_config {
|
|
370
|
-
export { worker_config_WorkerConfig as WorkerConfig, worker_config_get as get, worker_config_randWorker as randWorker, worker_config_view as view };
|
|
414
|
+
export { worker_config_WorkerConfig as WorkerConfig, worker_config_get as get, worker_config_getAsync as getAsync, worker_config_randWorker as randWorker, worker_config_view as view };
|
|
371
415
|
}
|
|
372
416
|
|
|
373
417
|
/**
|
|
@@ -800,7 +844,7 @@ declare class EncryptionKey {
|
|
|
800
844
|
});
|
|
801
845
|
static fetch({ committee }: {
|
|
802
846
|
committee: Committee;
|
|
803
|
-
}): Promise<EncryptionKey
|
|
847
|
+
}): Promise<Result<EncryptionKey>>;
|
|
804
848
|
}
|
|
805
849
|
declare class DecryptionKey {
|
|
806
850
|
ibeDecryptionKeys: (IdentityPrivateKey | null)[];
|
|
@@ -810,7 +854,8 @@ declare class DecryptionKey {
|
|
|
810
854
|
contractId: ContractID;
|
|
811
855
|
domain: Uint8Array;
|
|
812
856
|
proof: ProofOfPermission;
|
|
813
|
-
}): Promise<DecryptionKey
|
|
857
|
+
}): Promise<Result<DecryptionKey>>;
|
|
858
|
+
private static fetchDecKeyShare;
|
|
814
859
|
}
|
|
815
860
|
declare class Ciphertext {
|
|
816
861
|
aesCiph: Ciphertext$3;
|
|
@@ -879,17 +924,17 @@ declare function encrypt({ committee, encryptionKey, contractId, domain, plainte
|
|
|
879
924
|
fullDecryptionDomain: FullDecryptionDomain;
|
|
880
925
|
ciphertext: Ciphertext;
|
|
881
926
|
};
|
|
882
|
-
declare function
|
|
927
|
+
declare function tryDecrypt({ decryptionKey, ciphertext }: {
|
|
883
928
|
decryptionKey: DecryptionKey;
|
|
884
929
|
ciphertext: Ciphertext;
|
|
885
|
-
}): Uint8Array
|
|
886
|
-
declare function
|
|
930
|
+
}): Result<Uint8Array>;
|
|
931
|
+
declare function tryExtract({ ibeMsk, committee, contractId, domain, proof }: {
|
|
887
932
|
ibeMsk: MasterPrivateKey;
|
|
888
933
|
committee: Committee;
|
|
889
934
|
contractId: ContractID;
|
|
890
935
|
domain: Uint8Array;
|
|
891
936
|
proof: ProofOfPermission;
|
|
892
|
-
}): Promise<IdentityPrivateKey
|
|
937
|
+
}): Promise<Result<IdentityPrivateKey>>;
|
|
893
938
|
|
|
894
939
|
type index_Ciphertext = Ciphertext;
|
|
895
940
|
declare const index_Ciphertext: typeof Ciphertext;
|
|
@@ -905,11 +950,11 @@ type index_FullDecryptionDomain = FullDecryptionDomain;
|
|
|
905
950
|
declare const index_FullDecryptionDomain: typeof FullDecryptionDomain;
|
|
906
951
|
type index_ProofOfPermission = ProofOfPermission;
|
|
907
952
|
declare const index_ProofOfPermission: typeof ProofOfPermission;
|
|
908
|
-
declare const index_decrypt: typeof decrypt;
|
|
909
953
|
declare const index_encrypt: typeof encrypt;
|
|
910
|
-
declare const
|
|
954
|
+
declare const index_tryDecrypt: typeof tryDecrypt;
|
|
955
|
+
declare const index_tryExtract: typeof tryExtract;
|
|
911
956
|
declare namespace index {
|
|
912
|
-
export { index_Ciphertext as Ciphertext, index_Committee as Committee, index_ContractID as ContractID, index_DecryptionKey as DecryptionKey, index_EncryptionKey as EncryptionKey, index_FullDecryptionDomain as FullDecryptionDomain, index_ProofOfPermission as ProofOfPermission,
|
|
957
|
+
export { index_Ciphertext as Ciphertext, index_Committee as Committee, index_ContractID as ContractID, index_DecryptionKey as DecryptionKey, index_EncryptionKey as EncryptionKey, index_FullDecryptionDomain as FullDecryptionDomain, index_ProofOfPermission as ProofOfPermission, index_encrypt as encrypt, index_tryDecrypt as tryDecrypt, index_tryExtract as tryExtract };
|
|
913
958
|
}
|
|
914
959
|
|
|
915
960
|
declare const CONTRACT_ADDRESS_HEX: string;
|
|
@@ -963,4 +1008,4 @@ declare class WorkerTask {
|
|
|
963
1008
|
};
|
|
964
1009
|
}
|
|
965
1010
|
|
|
966
|
-
export { elgamal as ElGamal, index$5 as Enc, group as Group, index$4 as IBE, index$3 as Sig, silent_setup_encryption as SilentSetupEncryption, index$1 as SilentSetupEncryptionXChain, index$2 as Sym, index as ThresholdIbe, utils as Utils, worker_config as WorkerConfig, WorkerTask };
|
|
1011
|
+
export { elgamal as ElGamal, index$5 as Enc, group as Group, index$4 as IBE, Result, index$3 as Sig, silent_setup_encryption as SilentSetupEncryption, index$1 as SilentSetupEncryptionXChain, index$2 as Sym, index as ThresholdIbe, utils as Utils, worker_config as WorkerConfig, WorkerTask };
|