node-tkms 0.11.0-rc3 → 0.11.0-rc5
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/kms_lib.d.ts +42 -37
- package/kms_lib.js +116 -140
- package/kms_lib_bg.wasm +0 -0
- package/package.json +1 -1
- package/LICENSE +0 -28
package/kms_lib.d.ts
CHANGED
|
@@ -39,12 +39,13 @@ export function cryptobox_decrypt(ct: CryptoBoxCt, my_sk: PrivateEncKey, their_p
|
|
|
39
39
|
* It can be set to null if `verify` is false.
|
|
40
40
|
* Otherwise the caller needs to give the following JS object.
|
|
41
41
|
* Note that `client_address` and `eip712_verifying_contract` follow EIP-55.
|
|
42
|
+
* The signature field is not needed.
|
|
42
43
|
* ```
|
|
43
44
|
* {
|
|
44
|
-
* signature:
|
|
45
|
+
* signature: undefined,
|
|
45
46
|
* client_address: '0x17853A630aAe15AED549B2B874de08B73C0F59c5',
|
|
46
47
|
* enc_key: '2000000000000000df2fcacb774f03187f3802a27259f45c06d33cefa68d9c53426b15ad531aa822',
|
|
47
|
-
*
|
|
48
|
+
* ciphertext_handles: [ '0748b542afe2353c86cb707e3d21044b0be1fd18efc7cbaa6a415af055bfb358' ]
|
|
48
49
|
* eip712_verifying_contract: '0x66f9664f97F2b50F62D13eA064982f936dE76657'
|
|
49
50
|
* }
|
|
50
51
|
* ```
|
|
@@ -113,7 +114,7 @@ export function process_reencryption_resp_from_js(client: Client, request: any,
|
|
|
113
114
|
*/
|
|
114
115
|
export function process_reencryption_resp(client: Client, request: ParsedReencryptionRequest | undefined, eip712_domain: Eip712DomainMsg | undefined, agg_resp: (ReencryptionResponse)[], enc_pk: PublicEncKey, enc_sk: PrivateEncKey, verify: boolean): (TypedPlaintext)[];
|
|
115
116
|
/**
|
|
116
|
-
* The plaintext types that can be encrypted in a
|
|
117
|
+
* The plaintext types that can be encrypted in a HTTPZ ciphertext.
|
|
117
118
|
*/
|
|
118
119
|
export enum FheType {
|
|
119
120
|
Ebool = 0,
|
|
@@ -188,17 +189,20 @@ export class PublicSigKey {
|
|
|
188
189
|
export class ReencryptionRequest {
|
|
189
190
|
private constructor();
|
|
190
191
|
free(): void;
|
|
191
|
-
payload?: ReencryptionRequestPayload;
|
|
192
|
-
domain?: Eip712DomainMsg;
|
|
193
192
|
/**
|
|
194
|
-
* The ID
|
|
193
|
+
* The 32 Byte / 256 Bit ID of the user decryption request, without `0x` prefix.
|
|
195
194
|
* Future queries for the result must use this request ID.
|
|
196
195
|
*/
|
|
197
196
|
request_id?: RequestId;
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
197
|
+
/**
|
|
198
|
+
* The list of ciphertexts to reencrypt.
|
|
199
|
+
*/
|
|
200
|
+
typed_ciphertexts: (TypedCiphertext)[];
|
|
201
|
+
/**
|
|
202
|
+
* The 32 Byte / 256 Bit key id to use for decryption. This is the request_id used for key
|
|
203
|
+
* generation
|
|
204
|
+
*/
|
|
205
|
+
key_id?: RequestId;
|
|
202
206
|
/**
|
|
203
207
|
* The client's (blockchain wallet) address,
|
|
204
208
|
* encoded using EIP-55.
|
|
@@ -210,22 +214,24 @@ export class ReencryptionRequestPayload {
|
|
|
210
214
|
* Montgomery point.
|
|
211
215
|
*/
|
|
212
216
|
enc_key: Uint8Array;
|
|
213
|
-
|
|
214
|
-
* The key id to use for decryption. Will be the request_id used during key
|
|
215
|
-
* generation
|
|
216
|
-
*/
|
|
217
|
-
key_id?: RequestId;
|
|
218
|
-
/**
|
|
219
|
-
* The list of ciphertexts to reencrypt.
|
|
220
|
-
*/
|
|
221
|
-
typed_ciphertexts: (TypedCiphertext)[];
|
|
217
|
+
domain?: Eip712DomainMsg;
|
|
222
218
|
}
|
|
223
219
|
export class ReencryptionResponse {
|
|
224
220
|
private constructor();
|
|
225
221
|
free(): void;
|
|
226
222
|
signature: Uint8Array;
|
|
227
223
|
/**
|
|
228
|
-
*
|
|
224
|
+
* This is the external signature created from the Eip712 domain
|
|
225
|
+
* on the structure, where reencryptedShare is bincode::serialize(&payload)
|
|
226
|
+
* struct UserDecryptResponseVerification {
|
|
227
|
+
* bytes publicKey;
|
|
228
|
+
* uint256\[\] ctHandles;
|
|
229
|
+
* bytes reencryptedShare;
|
|
230
|
+
* }
|
|
231
|
+
*/
|
|
232
|
+
external_signature: Uint8Array;
|
|
233
|
+
/**
|
|
234
|
+
* The actual \[ReencryptionResponsePayload\].
|
|
229
235
|
*/
|
|
230
236
|
payload?: ReencryptionResponsePayload;
|
|
231
237
|
}
|
|
@@ -233,18 +239,22 @@ export class ReencryptionResponsePayload {
|
|
|
233
239
|
private constructor();
|
|
234
240
|
free(): void;
|
|
235
241
|
/**
|
|
236
|
-
* The server's signature verification key.
|
|
237
|
-
* Encoded using SEC1.
|
|
242
|
+
* The server's signature verification key, Encoded using SEC1.
|
|
238
243
|
* Needed to validate the response, but MUST also be linked to a list of
|
|
239
244
|
* trusted keys.
|
|
240
245
|
*/
|
|
241
246
|
verification_key: Uint8Array;
|
|
242
247
|
/**
|
|
243
|
-
* The concatenation of two digests:
|
|
244
|
-
* (eip712_signing_hash(pk, domain) || ciphertext digest).
|
|
245
248
|
* This is needed to ensure the response corresponds to the request.
|
|
249
|
+
* It is the digest of UserDecryptionLinker hashed using EIP712
|
|
250
|
+
* under the given domain in the request.
|
|
246
251
|
*/
|
|
247
252
|
digest: Uint8Array;
|
|
253
|
+
/**
|
|
254
|
+
* The resulting signcrypted ciphertexts, each ciphertext
|
|
255
|
+
* must be decrypted and then reconstructed with the other shares
|
|
256
|
+
* to produce the final plaintext.
|
|
257
|
+
*/
|
|
248
258
|
signcrypted_ciphertexts: (TypedSigncryptedCiphertext)[];
|
|
249
259
|
/**
|
|
250
260
|
* The ID of the MPC party doing the reencryption. Used for polynomial
|
|
@@ -255,20 +265,10 @@ export class ReencryptionResponsePayload {
|
|
|
255
265
|
* The degree of the sharing scheme used.
|
|
256
266
|
*/
|
|
257
267
|
degree: number;
|
|
258
|
-
/**
|
|
259
|
-
* This is the external signature created from the Eip712 domain
|
|
260
|
-
* on the structure, where reencryptedShare is bincode::serialize(&signcrypted_ciphertexts)
|
|
261
|
-
* struct UserDecryptionResult {
|
|
262
|
-
* bytes publicKey;
|
|
263
|
-
* uint256\[\] handles;
|
|
264
|
-
* bytes reencryptedShare;
|
|
265
|
-
* }
|
|
266
|
-
*/
|
|
267
|
-
external_signature: Uint8Array;
|
|
268
268
|
}
|
|
269
269
|
/**
|
|
270
|
-
* Simple response to return
|
|
271
|
-
* later on.
|
|
270
|
+
* Simple response to return a 32 Byte / 256 Bit ID, to be used to retrieve the computed result
|
|
271
|
+
* later on. This string does NOT contain a `0x` prefix.
|
|
272
272
|
*/
|
|
273
273
|
export class RequestId {
|
|
274
274
|
private constructor();
|
|
@@ -279,7 +279,7 @@ export class TypedCiphertext {
|
|
|
279
279
|
private constructor();
|
|
280
280
|
free(): void;
|
|
281
281
|
/**
|
|
282
|
-
* The actual ciphertext to decrypt, taken directly from
|
|
282
|
+
* The actual ciphertext to decrypt, taken directly from HTTPZ.
|
|
283
283
|
*/
|
|
284
284
|
ciphertext: Uint8Array;
|
|
285
285
|
/**
|
|
@@ -290,6 +290,11 @@ export class TypedCiphertext {
|
|
|
290
290
|
* The external handle of the ciphertext (the handle used in the copro).
|
|
291
291
|
*/
|
|
292
292
|
external_handle: Uint8Array;
|
|
293
|
+
/**
|
|
294
|
+
* The ciphertext format, see CiphertextFormat documentation for details.
|
|
295
|
+
* CiphertextFormat::default() is used if unspecified.
|
|
296
|
+
*/
|
|
297
|
+
ciphertext_format: number;
|
|
293
298
|
}
|
|
294
299
|
/**
|
|
295
300
|
* The typed plaintext type, which is the result of decryption.
|
package/kms_lib.js
CHANGED
|
@@ -455,12 +455,13 @@ module.exports.cryptobox_decrypt = function(ct, my_sk, their_pk) {
|
|
|
455
455
|
* It can be set to null if `verify` is false.
|
|
456
456
|
* Otherwise the caller needs to give the following JS object.
|
|
457
457
|
* Note that `client_address` and `eip712_verifying_contract` follow EIP-55.
|
|
458
|
+
* The signature field is not needed.
|
|
458
459
|
* ```
|
|
459
460
|
* {
|
|
460
|
-
* signature:
|
|
461
|
+
* signature: undefined,
|
|
461
462
|
* client_address: '0x17853A630aAe15AED549B2B874de08B73C0F59c5',
|
|
462
463
|
* enc_key: '2000000000000000df2fcacb774f03187f3802a27259f45c06d33cefa68d9c53426b15ad531aa822',
|
|
463
|
-
*
|
|
464
|
+
* ciphertext_handles: [ '0748b542afe2353c86cb707e3d21044b0be1fd18efc7cbaa6a415af055bfb358' ]
|
|
464
465
|
* eip712_verifying_contract: '0x66f9664f97F2b50F62D13eA064982f936dE76657'
|
|
465
466
|
* }
|
|
466
467
|
* ```
|
|
@@ -581,7 +582,7 @@ module.exports.process_reencryption_resp = function(client, request, eip712_doma
|
|
|
581
582
|
};
|
|
582
583
|
|
|
583
584
|
/**
|
|
584
|
-
* The plaintext types that can be encrypted in a
|
|
585
|
+
* The plaintext types that can be encrypted in a HTTPZ ciphertext.
|
|
585
586
|
* @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11}
|
|
586
587
|
*/
|
|
587
588
|
module.exports.FheType = Object.freeze({
|
|
@@ -971,90 +972,67 @@ class ReencryptionRequest {
|
|
|
971
972
|
wasm.__wbg_reencryptionrequest_free(ptr, 0);
|
|
972
973
|
}
|
|
973
974
|
/**
|
|
974
|
-
*
|
|
975
|
+
* The 32 Byte / 256 Bit ID of the user decryption request, without `0x` prefix.
|
|
976
|
+
* Future queries for the result must use this request ID.
|
|
977
|
+
* @returns {RequestId | undefined}
|
|
975
978
|
*/
|
|
976
|
-
get
|
|
977
|
-
const ret = wasm.
|
|
978
|
-
return ret === 0 ? undefined :
|
|
979
|
+
get request_id() {
|
|
980
|
+
const ret = wasm.__wbg_get_reencryptionrequest_request_id(this.__wbg_ptr);
|
|
981
|
+
return ret === 0 ? undefined : RequestId.__wrap(ret);
|
|
979
982
|
}
|
|
980
983
|
/**
|
|
981
|
-
*
|
|
984
|
+
* The 32 Byte / 256 Bit ID of the user decryption request, without `0x` prefix.
|
|
985
|
+
* Future queries for the result must use this request ID.
|
|
986
|
+
* @param {RequestId | undefined} [arg0]
|
|
982
987
|
*/
|
|
983
|
-
set
|
|
988
|
+
set request_id(arg0) {
|
|
984
989
|
let ptr0 = 0;
|
|
985
990
|
if (!isLikeNone(arg0)) {
|
|
986
|
-
_assertClass(arg0,
|
|
991
|
+
_assertClass(arg0, RequestId);
|
|
987
992
|
ptr0 = arg0.__destroy_into_raw();
|
|
988
993
|
}
|
|
989
|
-
wasm.
|
|
994
|
+
wasm.__wbg_set_reencryptionrequest_request_id(this.__wbg_ptr, ptr0);
|
|
990
995
|
}
|
|
991
996
|
/**
|
|
992
|
-
*
|
|
997
|
+
* The list of ciphertexts to reencrypt.
|
|
998
|
+
* @returns {(TypedCiphertext)[]}
|
|
993
999
|
*/
|
|
994
|
-
get
|
|
995
|
-
const ret = wasm.
|
|
996
|
-
|
|
1000
|
+
get typed_ciphertexts() {
|
|
1001
|
+
const ret = wasm.__wbg_get_reencryptionrequest_typed_ciphertexts(this.__wbg_ptr);
|
|
1002
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
1003
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1004
|
+
return v1;
|
|
997
1005
|
}
|
|
998
1006
|
/**
|
|
999
|
-
*
|
|
1007
|
+
* The list of ciphertexts to reencrypt.
|
|
1008
|
+
* @param {(TypedCiphertext)[]} arg0
|
|
1000
1009
|
*/
|
|
1001
|
-
set
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
ptr0 = arg0.__destroy_into_raw();
|
|
1006
|
-
}
|
|
1007
|
-
wasm.__wbg_set_reencryptionrequest_domain(this.__wbg_ptr, ptr0);
|
|
1010
|
+
set typed_ciphertexts(arg0) {
|
|
1011
|
+
const ptr0 = passArrayJsValueToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
1012
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1013
|
+
wasm.__wbg_set_reencryptionrequest_typed_ciphertexts(this.__wbg_ptr, ptr0, len0);
|
|
1008
1014
|
}
|
|
1009
1015
|
/**
|
|
1010
|
-
* The
|
|
1011
|
-
*
|
|
1016
|
+
* The 32 Byte / 256 Bit key id to use for decryption. This is the request_id used for key
|
|
1017
|
+
* generation
|
|
1012
1018
|
* @returns {RequestId | undefined}
|
|
1013
1019
|
*/
|
|
1014
|
-
get
|
|
1015
|
-
const ret = wasm.
|
|
1020
|
+
get key_id() {
|
|
1021
|
+
const ret = wasm.__wbg_get_reencryptionrequest_key_id(this.__wbg_ptr);
|
|
1016
1022
|
return ret === 0 ? undefined : RequestId.__wrap(ret);
|
|
1017
1023
|
}
|
|
1018
1024
|
/**
|
|
1019
|
-
* The
|
|
1020
|
-
*
|
|
1025
|
+
* The 32 Byte / 256 Bit key id to use for decryption. This is the request_id used for key
|
|
1026
|
+
* generation
|
|
1021
1027
|
* @param {RequestId | undefined} [arg0]
|
|
1022
1028
|
*/
|
|
1023
|
-
set
|
|
1029
|
+
set key_id(arg0) {
|
|
1024
1030
|
let ptr0 = 0;
|
|
1025
1031
|
if (!isLikeNone(arg0)) {
|
|
1026
1032
|
_assertClass(arg0, RequestId);
|
|
1027
1033
|
ptr0 = arg0.__destroy_into_raw();
|
|
1028
1034
|
}
|
|
1029
|
-
wasm.
|
|
1030
|
-
}
|
|
1031
|
-
}
|
|
1032
|
-
module.exports.ReencryptionRequest = ReencryptionRequest;
|
|
1033
|
-
|
|
1034
|
-
const ReencryptionRequestPayloadFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1035
|
-
? { register: () => {}, unregister: () => {} }
|
|
1036
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_reencryptionrequestpayload_free(ptr >>> 0, 1));
|
|
1037
|
-
|
|
1038
|
-
class ReencryptionRequestPayload {
|
|
1039
|
-
|
|
1040
|
-
static __wrap(ptr) {
|
|
1041
|
-
ptr = ptr >>> 0;
|
|
1042
|
-
const obj = Object.create(ReencryptionRequestPayload.prototype);
|
|
1043
|
-
obj.__wbg_ptr = ptr;
|
|
1044
|
-
ReencryptionRequestPayloadFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1045
|
-
return obj;
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
|
-
__destroy_into_raw() {
|
|
1049
|
-
const ptr = this.__wbg_ptr;
|
|
1050
|
-
this.__wbg_ptr = 0;
|
|
1051
|
-
ReencryptionRequestPayloadFinalization.unregister(this);
|
|
1052
|
-
return ptr;
|
|
1053
|
-
}
|
|
1054
|
-
|
|
1055
|
-
free() {
|
|
1056
|
-
const ptr = this.__destroy_into_raw();
|
|
1057
|
-
wasm.__wbg_reencryptionrequestpayload_free(ptr, 0);
|
|
1035
|
+
wasm.__wbg_set_reencryptionrequest_key_id(this.__wbg_ptr, ptr0);
|
|
1058
1036
|
}
|
|
1059
1037
|
/**
|
|
1060
1038
|
* The client's (blockchain wallet) address,
|
|
@@ -1065,7 +1043,7 @@ class ReencryptionRequestPayload {
|
|
|
1065
1043
|
let deferred1_0;
|
|
1066
1044
|
let deferred1_1;
|
|
1067
1045
|
try {
|
|
1068
|
-
const ret = wasm.
|
|
1046
|
+
const ret = wasm.__wbg_get_reencryptionrequest_client_address(this.__wbg_ptr);
|
|
1069
1047
|
deferred1_0 = ret[0];
|
|
1070
1048
|
deferred1_1 = ret[1];
|
|
1071
1049
|
return getStringFromWasm0(ret[0], ret[1]);
|
|
@@ -1081,7 +1059,7 @@ class ReencryptionRequestPayload {
|
|
|
1081
1059
|
set client_address(arg0) {
|
|
1082
1060
|
const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1083
1061
|
const len0 = WASM_VECTOR_LEN;
|
|
1084
|
-
wasm.
|
|
1062
|
+
wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
|
|
1085
1063
|
}
|
|
1086
1064
|
/**
|
|
1087
1065
|
* Encoding of the user's public encryption key for this request.
|
|
@@ -1090,7 +1068,7 @@ class ReencryptionRequestPayload {
|
|
|
1090
1068
|
* @returns {Uint8Array}
|
|
1091
1069
|
*/
|
|
1092
1070
|
get enc_key() {
|
|
1093
|
-
const ret = wasm.
|
|
1071
|
+
const ret = wasm.__wbg_get_reencryptionrequest_enc_key(this.__wbg_ptr);
|
|
1094
1072
|
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1095
1073
|
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1096
1074
|
return v1;
|
|
@@ -1104,51 +1082,28 @@ class ReencryptionRequestPayload {
|
|
|
1104
1082
|
set enc_key(arg0) {
|
|
1105
1083
|
const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
1106
1084
|
const len0 = WASM_VECTOR_LEN;
|
|
1107
|
-
wasm.
|
|
1085
|
+
wasm.__wbg_set_eip712domainmsg_chain_id(this.__wbg_ptr, ptr0, len0);
|
|
1108
1086
|
}
|
|
1109
1087
|
/**
|
|
1110
|
-
*
|
|
1111
|
-
* generation
|
|
1112
|
-
* @returns {RequestId | undefined}
|
|
1088
|
+
* @returns {Eip712DomainMsg | undefined}
|
|
1113
1089
|
*/
|
|
1114
|
-
get
|
|
1115
|
-
const ret = wasm.
|
|
1116
|
-
return ret === 0 ? undefined :
|
|
1090
|
+
get domain() {
|
|
1091
|
+
const ret = wasm.__wbg_get_reencryptionrequest_domain(this.__wbg_ptr);
|
|
1092
|
+
return ret === 0 ? undefined : Eip712DomainMsg.__wrap(ret);
|
|
1117
1093
|
}
|
|
1118
1094
|
/**
|
|
1119
|
-
*
|
|
1120
|
-
* generation
|
|
1121
|
-
* @param {RequestId | undefined} [arg0]
|
|
1095
|
+
* @param {Eip712DomainMsg | undefined} [arg0]
|
|
1122
1096
|
*/
|
|
1123
|
-
set
|
|
1097
|
+
set domain(arg0) {
|
|
1124
1098
|
let ptr0 = 0;
|
|
1125
1099
|
if (!isLikeNone(arg0)) {
|
|
1126
|
-
_assertClass(arg0,
|
|
1100
|
+
_assertClass(arg0, Eip712DomainMsg);
|
|
1127
1101
|
ptr0 = arg0.__destroy_into_raw();
|
|
1128
1102
|
}
|
|
1129
|
-
wasm.
|
|
1130
|
-
}
|
|
1131
|
-
/**
|
|
1132
|
-
* The list of ciphertexts to reencrypt.
|
|
1133
|
-
* @returns {(TypedCiphertext)[]}
|
|
1134
|
-
*/
|
|
1135
|
-
get typed_ciphertexts() {
|
|
1136
|
-
const ret = wasm.__wbg_get_reencryptionrequestpayload_typed_ciphertexts(this.__wbg_ptr);
|
|
1137
|
-
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
1138
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1139
|
-
return v1;
|
|
1140
|
-
}
|
|
1141
|
-
/**
|
|
1142
|
-
* The list of ciphertexts to reencrypt.
|
|
1143
|
-
* @param {(TypedCiphertext)[]} arg0
|
|
1144
|
-
*/
|
|
1145
|
-
set typed_ciphertexts(arg0) {
|
|
1146
|
-
const ptr0 = passArrayJsValueToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
1147
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1148
|
-
wasm.__wbg_set_reencryptionrequestpayload_typed_ciphertexts(this.__wbg_ptr, ptr0, len0);
|
|
1103
|
+
wasm.__wbg_set_reencryptionrequest_domain(this.__wbg_ptr, ptr0);
|
|
1149
1104
|
}
|
|
1150
1105
|
}
|
|
1151
|
-
module.exports.
|
|
1106
|
+
module.exports.ReencryptionRequest = ReencryptionRequest;
|
|
1152
1107
|
|
|
1153
1108
|
const ReencryptionResponseFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1154
1109
|
? { register: () => {}, unregister: () => {} }
|
|
@@ -1192,7 +1147,38 @@ class ReencryptionResponse {
|
|
|
1192
1147
|
wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
|
|
1193
1148
|
}
|
|
1194
1149
|
/**
|
|
1195
|
-
*
|
|
1150
|
+
* This is the external signature created from the Eip712 domain
|
|
1151
|
+
* on the structure, where reencryptedShare is bincode::serialize(&payload)
|
|
1152
|
+
* struct UserDecryptResponseVerification {
|
|
1153
|
+
* bytes publicKey;
|
|
1154
|
+
* uint256\[\] ctHandles;
|
|
1155
|
+
* bytes reencryptedShare;
|
|
1156
|
+
* }
|
|
1157
|
+
* @returns {Uint8Array}
|
|
1158
|
+
*/
|
|
1159
|
+
get external_signature() {
|
|
1160
|
+
const ret = wasm.__wbg_get_reencryptionresponse_external_signature(this.__wbg_ptr);
|
|
1161
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1162
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1163
|
+
return v1;
|
|
1164
|
+
}
|
|
1165
|
+
/**
|
|
1166
|
+
* This is the external signature created from the Eip712 domain
|
|
1167
|
+
* on the structure, where reencryptedShare is bincode::serialize(&payload)
|
|
1168
|
+
* struct UserDecryptResponseVerification {
|
|
1169
|
+
* bytes publicKey;
|
|
1170
|
+
* uint256\[\] ctHandles;
|
|
1171
|
+
* bytes reencryptedShare;
|
|
1172
|
+
* }
|
|
1173
|
+
* @param {Uint8Array} arg0
|
|
1174
|
+
*/
|
|
1175
|
+
set external_signature(arg0) {
|
|
1176
|
+
const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
1177
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1178
|
+
wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
|
|
1179
|
+
}
|
|
1180
|
+
/**
|
|
1181
|
+
* The actual \[ReencryptionResponsePayload\].
|
|
1196
1182
|
* @returns {ReencryptionResponsePayload | undefined}
|
|
1197
1183
|
*/
|
|
1198
1184
|
get payload() {
|
|
@@ -1200,7 +1186,7 @@ class ReencryptionResponse {
|
|
|
1200
1186
|
return ret === 0 ? undefined : ReencryptionResponsePayload.__wrap(ret);
|
|
1201
1187
|
}
|
|
1202
1188
|
/**
|
|
1203
|
-
*
|
|
1189
|
+
* The actual \[ReencryptionResponsePayload\].
|
|
1204
1190
|
* @param {ReencryptionResponsePayload | undefined} [arg0]
|
|
1205
1191
|
*/
|
|
1206
1192
|
set payload(arg0) {
|
|
@@ -1240,8 +1226,7 @@ class ReencryptionResponsePayload {
|
|
|
1240
1226
|
wasm.__wbg_reencryptionresponsepayload_free(ptr, 0);
|
|
1241
1227
|
}
|
|
1242
1228
|
/**
|
|
1243
|
-
* The server's signature verification key.
|
|
1244
|
-
* Encoded using SEC1.
|
|
1229
|
+
* The server's signature verification key, Encoded using SEC1.
|
|
1245
1230
|
* Needed to validate the response, but MUST also be linked to a list of
|
|
1246
1231
|
* trusted keys.
|
|
1247
1232
|
* @returns {Uint8Array}
|
|
@@ -1253,8 +1238,7 @@ class ReencryptionResponsePayload {
|
|
|
1253
1238
|
return v1;
|
|
1254
1239
|
}
|
|
1255
1240
|
/**
|
|
1256
|
-
* The server's signature verification key.
|
|
1257
|
-
* Encoded using SEC1.
|
|
1241
|
+
* The server's signature verification key, Encoded using SEC1.
|
|
1258
1242
|
* Needed to validate the response, but MUST also be linked to a list of
|
|
1259
1243
|
* trusted keys.
|
|
1260
1244
|
* @param {Uint8Array} arg0
|
|
@@ -1265,9 +1249,9 @@ class ReencryptionResponsePayload {
|
|
|
1265
1249
|
wasm.__wbg_set_eip712domainmsg_name(this.__wbg_ptr, ptr0, len0);
|
|
1266
1250
|
}
|
|
1267
1251
|
/**
|
|
1268
|
-
* The concatenation of two digests:
|
|
1269
|
-
* (eip712_signing_hash(pk, domain) || ciphertext digest).
|
|
1270
1252
|
* This is needed to ensure the response corresponds to the request.
|
|
1253
|
+
* It is the digest of UserDecryptionLinker hashed using EIP712
|
|
1254
|
+
* under the given domain in the request.
|
|
1271
1255
|
* @returns {Uint8Array}
|
|
1272
1256
|
*/
|
|
1273
1257
|
get digest() {
|
|
@@ -1277,9 +1261,9 @@ class ReencryptionResponsePayload {
|
|
|
1277
1261
|
return v1;
|
|
1278
1262
|
}
|
|
1279
1263
|
/**
|
|
1280
|
-
* The concatenation of two digests:
|
|
1281
|
-
* (eip712_signing_hash(pk, domain) || ciphertext digest).
|
|
1282
1264
|
* This is needed to ensure the response corresponds to the request.
|
|
1265
|
+
* It is the digest of UserDecryptionLinker hashed using EIP712
|
|
1266
|
+
* under the given domain in the request.
|
|
1283
1267
|
* @param {Uint8Array} arg0
|
|
1284
1268
|
*/
|
|
1285
1269
|
set digest(arg0) {
|
|
@@ -1288,6 +1272,9 @@ class ReencryptionResponsePayload {
|
|
|
1288
1272
|
wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
|
|
1289
1273
|
}
|
|
1290
1274
|
/**
|
|
1275
|
+
* The resulting signcrypted ciphertexts, each ciphertext
|
|
1276
|
+
* must be decrypted and then reconstructed with the other shares
|
|
1277
|
+
* to produce the final plaintext.
|
|
1291
1278
|
* @returns {(TypedSigncryptedCiphertext)[]}
|
|
1292
1279
|
*/
|
|
1293
1280
|
get signcrypted_ciphertexts() {
|
|
@@ -1297,6 +1284,9 @@ class ReencryptionResponsePayload {
|
|
|
1297
1284
|
return v1;
|
|
1298
1285
|
}
|
|
1299
1286
|
/**
|
|
1287
|
+
* The resulting signcrypted ciphertexts, each ciphertext
|
|
1288
|
+
* must be decrypted and then reconstructed with the other shares
|
|
1289
|
+
* to produce the final plaintext.
|
|
1300
1290
|
* @param {(TypedSigncryptedCiphertext)[]} arg0
|
|
1301
1291
|
*/
|
|
1302
1292
|
set signcrypted_ciphertexts(arg0) {
|
|
@@ -1336,37 +1326,6 @@ class ReencryptionResponsePayload {
|
|
|
1336
1326
|
set degree(arg0) {
|
|
1337
1327
|
wasm.__wbg_set_reencryptionresponsepayload_degree(this.__wbg_ptr, arg0);
|
|
1338
1328
|
}
|
|
1339
|
-
/**
|
|
1340
|
-
* This is the external signature created from the Eip712 domain
|
|
1341
|
-
* on the structure, where reencryptedShare is bincode::serialize(&signcrypted_ciphertexts)
|
|
1342
|
-
* struct UserDecryptionResult {
|
|
1343
|
-
* bytes publicKey;
|
|
1344
|
-
* uint256\[\] handles;
|
|
1345
|
-
* bytes reencryptedShare;
|
|
1346
|
-
* }
|
|
1347
|
-
* @returns {Uint8Array}
|
|
1348
|
-
*/
|
|
1349
|
-
get external_signature() {
|
|
1350
|
-
const ret = wasm.__wbg_get_reencryptionresponsepayload_external_signature(this.__wbg_ptr);
|
|
1351
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1352
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1353
|
-
return v1;
|
|
1354
|
-
}
|
|
1355
|
-
/**
|
|
1356
|
-
* This is the external signature created from the Eip712 domain
|
|
1357
|
-
* on the structure, where reencryptedShare is bincode::serialize(&signcrypted_ciphertexts)
|
|
1358
|
-
* struct UserDecryptionResult {
|
|
1359
|
-
* bytes publicKey;
|
|
1360
|
-
* uint256\[\] handles;
|
|
1361
|
-
* bytes reencryptedShare;
|
|
1362
|
-
* }
|
|
1363
|
-
* @param {Uint8Array} arg0
|
|
1364
|
-
*/
|
|
1365
|
-
set external_signature(arg0) {
|
|
1366
|
-
const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
1367
|
-
const len0 = WASM_VECTOR_LEN;
|
|
1368
|
-
wasm.__wbg_set_eip712domainmsg_verifying_contract(this.__wbg_ptr, ptr0, len0);
|
|
1369
|
-
}
|
|
1370
1329
|
}
|
|
1371
1330
|
module.exports.ReencryptionResponsePayload = ReencryptionResponsePayload;
|
|
1372
1331
|
|
|
@@ -1374,8 +1333,8 @@ const RequestIdFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
1374
1333
|
? { register: () => {}, unregister: () => {} }
|
|
1375
1334
|
: new FinalizationRegistry(ptr => wasm.__wbg_requestid_free(ptr >>> 0, 1));
|
|
1376
1335
|
/**
|
|
1377
|
-
* Simple response to return
|
|
1378
|
-
* later on.
|
|
1336
|
+
* Simple response to return a 32 Byte / 256 Bit ID, to be used to retrieve the computed result
|
|
1337
|
+
* later on. This string does NOT contain a `0x` prefix.
|
|
1379
1338
|
*/
|
|
1380
1339
|
class RequestId {
|
|
1381
1340
|
|
|
@@ -1457,7 +1416,7 @@ class TypedCiphertext {
|
|
|
1457
1416
|
wasm.__wbg_typedciphertext_free(ptr, 0);
|
|
1458
1417
|
}
|
|
1459
1418
|
/**
|
|
1460
|
-
* The actual ciphertext to decrypt, taken directly from
|
|
1419
|
+
* The actual ciphertext to decrypt, taken directly from HTTPZ.
|
|
1461
1420
|
* @returns {Uint8Array}
|
|
1462
1421
|
*/
|
|
1463
1422
|
get ciphertext() {
|
|
@@ -1467,7 +1426,7 @@ class TypedCiphertext {
|
|
|
1467
1426
|
return v1;
|
|
1468
1427
|
}
|
|
1469
1428
|
/**
|
|
1470
|
-
* The actual ciphertext to decrypt, taken directly from
|
|
1429
|
+
* The actual ciphertext to decrypt, taken directly from HTTPZ.
|
|
1471
1430
|
* @param {Uint8Array} arg0
|
|
1472
1431
|
*/
|
|
1473
1432
|
set ciphertext(arg0) {
|
|
@@ -1509,6 +1468,23 @@ class TypedCiphertext {
|
|
|
1509
1468
|
const len0 = WASM_VECTOR_LEN;
|
|
1510
1469
|
wasm.__wbg_set_eip712domainmsg_version(this.__wbg_ptr, ptr0, len0);
|
|
1511
1470
|
}
|
|
1471
|
+
/**
|
|
1472
|
+
* The ciphertext format, see CiphertextFormat documentation for details.
|
|
1473
|
+
* CiphertextFormat::default() is used if unspecified.
|
|
1474
|
+
* @returns {number}
|
|
1475
|
+
*/
|
|
1476
|
+
get ciphertext_format() {
|
|
1477
|
+
const ret = wasm.__wbg_get_typedciphertext_ciphertext_format(this.__wbg_ptr);
|
|
1478
|
+
return ret;
|
|
1479
|
+
}
|
|
1480
|
+
/**
|
|
1481
|
+
* The ciphertext format, see CiphertextFormat documentation for details.
|
|
1482
|
+
* CiphertextFormat::default() is used if unspecified.
|
|
1483
|
+
* @param {number} arg0
|
|
1484
|
+
*/
|
|
1485
|
+
set ciphertext_format(arg0) {
|
|
1486
|
+
wasm.__wbg_set_typedciphertext_ciphertext_format(this.__wbg_ptr, arg0);
|
|
1487
|
+
}
|
|
1512
1488
|
}
|
|
1513
1489
|
module.exports.TypedCiphertext = TypedCiphertext;
|
|
1514
1490
|
|
package/kms_lib_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/LICENSE
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
BSD 3-Clause Clear License
|
|
2
|
-
|
|
3
|
-
Copyright © 2024 ZAMA.
|
|
4
|
-
All rights reserved.
|
|
5
|
-
|
|
6
|
-
Redistribution and use in source and binary forms, with or without modification,
|
|
7
|
-
are permitted provided that the following conditions are met:
|
|
8
|
-
|
|
9
|
-
1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
-
list of conditions and the following disclaimer.
|
|
11
|
-
|
|
12
|
-
2. Redistributions in binary form must reproduce the above copyright notice, this
|
|
13
|
-
list of conditions and the following disclaimer in the documentation and/or other
|
|
14
|
-
materials provided with the distribution.
|
|
15
|
-
|
|
16
|
-
3. Neither the name of ZAMA nor the names of its contributors may be used to endorse
|
|
17
|
-
or promote products derived from this software without specific prior written permission.
|
|
18
|
-
|
|
19
|
-
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
|
|
20
|
-
THIS SOFTWARE IS PROVIDED BY THE ZAMA AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
|
|
21
|
-
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
22
|
-
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
|
23
|
-
ZAMA OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
|
24
|
-
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
25
|
-
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
26
|
-
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
27
|
-
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
|
28
|
-
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|