@fhevm/sdk 1.0.0-alpha.5 → 1.0.0-alpha.7
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/_cjs/core/_version.js +1 -1
- package/_cjs/core/actions/base/{canReadPublicValue.js → canDecryptPublicValue.js} +3 -3
- package/_cjs/core/actions/base/canDecryptPublicValue.js.map +1 -0
- package/_cjs/core/actions/base/{canReadPublicValues.js → canDecryptPublicValues.js} +3 -3
- package/_cjs/core/actions/base/canDecryptPublicValues.js.map +1 -0
- package/_cjs/core/actions/base/{readPublicValue.js → decryptPublicValue.js} +4 -4
- package/_cjs/core/actions/base/decryptPublicValue.js.map +1 -0
- package/_cjs/core/actions/base/{readPublicValues.js → decryptPublicValues.js} +4 -4
- package/_cjs/core/actions/base/decryptPublicValues.js.map +1 -0
- package/_cjs/core/actions/base/{readPublicValuesWithSignatures.js → decryptPublicValuesWithSignatures.js} +4 -4
- package/_cjs/core/actions/base/decryptPublicValuesWithSignatures.js.map +1 -0
- package/_cjs/core/actions/base/index.js +11 -11
- package/_cjs/core/actions/base/index.js.map +1 -1
- package/_cjs/core/clients/decorators/base.js +6 -6
- package/_cjs/core/clients/decorators/base.js.map +1 -1
- package/_cjs/core/kms/SignedDecryptionPermit-p.js +2 -2
- package/_cjs/core/kms/SignedDecryptionPermit-p.js.map +1 -1
- package/_cjs/core/kms/kmsExtraData.js +7 -1
- package/_cjs/core/kms/kmsExtraData.js.map +1 -1
- package/_cjs/core/modules/relayer/module/RelayerAsyncRequest.js.map +1 -1
- package/_cjs/core/types/index.js.map +1 -1
- package/_cjs/core/utils-p/decrypt/assertPermitMatchesKeyPair.js +2 -2
- package/_cjs/core/utils-p/decrypt/assertPermitMatchesKeyPair.js.map +1 -1
- package/_cjs/core/utils-p/decrypt/verifyTkmsPublicKey.js +1 -1
- package/_cjs/core/utils-p/decrypt/verifyTkmsPublicKey.js.map +1 -1
- package/_esm/core/_version.js +1 -1
- package/_esm/core/actions/base/{canReadPublicValue.js → canDecryptPublicValue.js} +2 -2
- package/_esm/core/actions/base/canDecryptPublicValue.js.map +1 -0
- package/_esm/core/actions/base/{canReadPublicValues.js → canDecryptPublicValues.js} +2 -2
- package/_esm/core/actions/base/canDecryptPublicValues.js.map +1 -0
- package/_esm/core/actions/base/{readPublicValue.js → decryptPublicValue.js} +3 -3
- package/_esm/core/actions/base/decryptPublicValue.js.map +1 -0
- package/_esm/core/actions/base/{readPublicValues.js → decryptPublicValues.js} +3 -3
- package/_esm/core/actions/base/decryptPublicValues.js.map +1 -0
- package/_esm/core/actions/base/{readPublicValuesWithSignatures.js → decryptPublicValuesWithSignatures.js} +3 -3
- package/_esm/core/actions/base/decryptPublicValuesWithSignatures.js.map +1 -0
- package/_esm/core/actions/base/index.js +5 -5
- package/_esm/core/actions/base/index.js.map +1 -1
- package/_esm/core/clients/decorators/base.js +6 -6
- package/_esm/core/clients/decorators/base.js.map +1 -1
- package/_esm/core/kms/SignedDecryptionPermit-p.js +2 -2
- package/_esm/core/kms/SignedDecryptionPermit-p.js.map +1 -1
- package/_esm/core/kms/kmsExtraData.js +7 -1
- package/_esm/core/kms/kmsExtraData.js.map +1 -1
- package/_esm/core/modules/relayer/module/RelayerAsyncRequest.js +13 -0
- package/_esm/core/modules/relayer/module/RelayerAsyncRequest.js.map +1 -1
- package/_esm/core/types/index.js.map +1 -1
- package/_esm/core/utils-p/decrypt/assertPermitMatchesKeyPair.js +2 -2
- package/_esm/core/utils-p/decrypt/assertPermitMatchesKeyPair.js.map +1 -1
- package/_esm/core/utils-p/decrypt/verifyTkmsPublicKey.js +1 -1
- package/_esm/core/utils-p/decrypt/verifyTkmsPublicKey.js.map +1 -1
- package/_types/core/actions/base/canDecryptPublicValue.d.ts +9 -0
- package/_types/core/actions/base/canDecryptPublicValue.d.ts.map +1 -0
- package/_types/core/actions/base/canDecryptPublicValues.d.ts +9 -0
- package/_types/core/actions/base/canDecryptPublicValues.d.ts.map +1 -0
- package/_types/core/actions/base/{readPublicValue.d.ts → decryptPublicValue.d.ts} +4 -4
- package/_types/core/actions/base/decryptPublicValue.d.ts.map +1 -0
- package/_types/core/actions/base/{readPublicValues.d.ts → decryptPublicValues.d.ts} +4 -4
- package/_types/core/actions/base/decryptPublicValues.d.ts.map +1 -0
- package/_types/core/actions/base/{readPublicValuesWithSignatures.d.ts → decryptPublicValuesWithSignatures.d.ts} +4 -4
- package/_types/core/actions/base/decryptPublicValuesWithSignatures.d.ts.map +1 -0
- package/_types/core/actions/base/index.d.ts +5 -5
- package/_types/core/actions/base/index.d.ts.map +1 -1
- package/_types/core/clients/decorators/base.d.ts +16 -16
- package/_types/core/clients/decorators/base.d.ts.map +1 -1
- package/_types/core/kms/kmsExtraData.d.ts.map +1 -1
- package/_types/core/modules/relayer/module/RelayerAsyncRequest.d.ts.map +1 -1
- package/_types/core/types/index.d.ts +1 -0
- package/_types/core/types/index.d.ts.map +1 -1
- package/_types/core/types/signedDecryptionPermit.d.ts +1 -1
- package/_types/core/types/signedDecryptionPermit.d.ts.map +1 -1
- package/core/_version.ts +1 -1
- package/core/actions/base/{canReadPublicValue.ts → canDecryptPublicValue.ts} +5 -5
- package/core/actions/base/{canReadPublicValues.ts → canDecryptPublicValues.ts} +5 -5
- package/core/actions/base/{readPublicValue.ts → decryptPublicValue.ts} +6 -6
- package/core/actions/base/{readPublicValues.ts → decryptPublicValues.ts} +6 -6
- package/core/actions/base/{readPublicValuesWithSignatures.ts → decryptPublicValuesWithSignatures.ts} +6 -6
- package/core/actions/base/index.ts +21 -17
- package/core/clients/decorators/base.ts +30 -30
- package/core/kms/SignedDecryptionPermit-p.ts +2 -2
- package/core/kms/kmsExtraData.ts +8 -1
- package/core/modules/relayer/module/RelayerAsyncRequest.ts +14 -0
- package/core/types/index.ts +1 -0
- package/core/types/signedDecryptionPermit.ts +1 -1
- package/core/utils-p/decrypt/assertPermitMatchesKeyPair.ts +2 -2
- package/core/utils-p/decrypt/verifyTkmsPublicKey.ts +1 -1
- package/package.json +1 -1
- package/_cjs/core/actions/base/canReadPublicValue.js.map +0 -1
- package/_cjs/core/actions/base/canReadPublicValues.js.map +0 -1
- package/_cjs/core/actions/base/readPublicValue.js.map +0 -1
- package/_cjs/core/actions/base/readPublicValues.js.map +0 -1
- package/_cjs/core/actions/base/readPublicValuesWithSignatures.js.map +0 -1
- package/_esm/core/actions/base/canReadPublicValue.js.map +0 -1
- package/_esm/core/actions/base/canReadPublicValues.js.map +0 -1
- package/_esm/core/actions/base/readPublicValue.js.map +0 -1
- package/_esm/core/actions/base/readPublicValues.js.map +0 -1
- package/_esm/core/actions/base/readPublicValuesWithSignatures.js.map +0 -1
- package/_types/core/actions/base/canReadPublicValue.d.ts +0 -9
- package/_types/core/actions/base/canReadPublicValue.d.ts.map +0 -1
- package/_types/core/actions/base/canReadPublicValues.d.ts +0 -9
- package/_types/core/actions/base/canReadPublicValues.d.ts.map +0 -1
- package/_types/core/actions/base/readPublicValue.d.ts.map +0 -1
- package/_types/core/actions/base/readPublicValues.d.ts.map +0 -1
- package/_types/core/actions/base/readPublicValuesWithSignatures.d.ts.map +0 -1
|
@@ -7,39 +7,39 @@ import { type ParseTransportKeyPairParameters, type ParseTransportKeyPairReturnT
|
|
|
7
7
|
import { type FetchFheEncryptionKeyBytesParameters, type FetchFheEncryptionKeyBytesReturnType } from '../../actions/chain/fetchFheEncryptionKeyBytes.js';
|
|
8
8
|
import { type SerializeSignedDecryptionPermitParameters, type SerializeSignedDecryptionPermitReturnType } from '../../actions/chain/serializeSignedDecryptionPermit.js';
|
|
9
9
|
import { type ParseSignedDecryptionPermitParameters, type ParseSignedDecryptionPermitReturnType } from '../../actions/chain/parseSignedDecryptionPermit.js';
|
|
10
|
-
import { type
|
|
11
|
-
import { type
|
|
12
|
-
import { type
|
|
10
|
+
import { type DecryptPublicValueParameters, type DecryptPublicValueReturnType } from '../../actions/base/decryptPublicValue.js';
|
|
11
|
+
import { type DecryptPublicValuesParameters, type DecryptPublicValuesReturnType } from '../../actions/base/decryptPublicValues.js';
|
|
12
|
+
import { type DecryptPublicValuesWithSignaturesParameters, type DecryptPublicValuesWithSignaturesReturnType } from '../../actions/base/decryptPublicValuesWithSignatures.js';
|
|
13
13
|
export type BaseActions = {
|
|
14
14
|
/**
|
|
15
15
|
* Reads the decrypted (clear) value of an encrypted value that was made public.
|
|
16
16
|
*
|
|
17
17
|
* By default, encrypted values on-chain can only be decrypted by their owner.
|
|
18
18
|
* When a contract calls `TFHE.allowForDecryption(encryptedValue)` in Solidity,
|
|
19
|
-
* the value becomes publicly readable. Anyone can then call `
|
|
19
|
+
* the value becomes publicly readable. Anyone can then call `decryptPublicValue`
|
|
20
20
|
* to get the clear value — no permit or private key needed.
|
|
21
21
|
*
|
|
22
22
|
* @example
|
|
23
23
|
* ```ts
|
|
24
|
-
* const result = await client.
|
|
24
|
+
* const result = await client.decryptPublicValue({
|
|
25
25
|
* encryptedValue: "0xabcd..."
|
|
26
26
|
* });
|
|
27
27
|
* console.log(result.value); // e.g. 42
|
|
28
28
|
* console.log(result.type); // e.g. 'uint8'
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
|
-
readonly
|
|
31
|
+
readonly decryptPublicValue: (parameters: DecryptPublicValueParameters) => Promise<DecryptPublicValueReturnType>;
|
|
32
32
|
/**
|
|
33
33
|
* Reads the decrypted (clear) values of encrypted values that were made public.
|
|
34
34
|
*
|
|
35
35
|
* By default, encrypted values on-chain can only be decrypted by their owner.
|
|
36
36
|
* When a contract calls `TFHE.allowForDecryption(encryptedValue)` in Solidity,
|
|
37
|
-
* a value becomes publicly readable. Anyone can then call `
|
|
37
|
+
* a value becomes publicly readable. Anyone can then call `decryptPublicValues`
|
|
38
38
|
* to get the clear values — no permit or private key needed.
|
|
39
39
|
*
|
|
40
40
|
* @example
|
|
41
41
|
* ```ts
|
|
42
|
-
* const results = await client.
|
|
42
|
+
* const results = await client.decryptPublicValues({
|
|
43
43
|
* encryptedValues: ["0xabcd...", "0xef..."]
|
|
44
44
|
* });
|
|
45
45
|
* console.log(results[0].value); // e.g. 42
|
|
@@ -48,13 +48,13 @@ export type BaseActions = {
|
|
|
48
48
|
* console.log(results[1].type); // e.g. 'uint32'
|
|
49
49
|
* ```
|
|
50
50
|
*/
|
|
51
|
-
readonly
|
|
51
|
+
readonly decryptPublicValues: (parameters: DecryptPublicValuesParameters) => Promise<DecryptPublicValuesReturnType>;
|
|
52
52
|
/**
|
|
53
53
|
* Reads the decrypted (clear) value of an encrypted value that was made public.
|
|
54
54
|
*
|
|
55
55
|
* By default, encrypted values on-chain can only be decrypted by their owner.
|
|
56
56
|
* When a contract calls `TFHE.allowForDecryption(encryptedValue)` in Solidity,
|
|
57
|
-
* the value becomes publicly readable. Anyone can then call `
|
|
57
|
+
* the value becomes publicly readable. Anyone can then call `decryptPublicValue`
|
|
58
58
|
* to get the clear value — no permit or private key needed.
|
|
59
59
|
*
|
|
60
60
|
* Returns both the clear values and a decryption proof. The proof can be
|
|
@@ -63,13 +63,13 @@ export type BaseActions = {
|
|
|
63
63
|
*
|
|
64
64
|
* @example
|
|
65
65
|
* ```ts
|
|
66
|
-
* const result = await client.
|
|
66
|
+
* const result = await client.decryptPublicValuesWithSignatures({
|
|
67
67
|
* encryptedValues: ["0xabcd...", "0xef..."]
|
|
68
68
|
* });
|
|
69
|
-
* console.log(
|
|
70
|
-
* console.log(
|
|
71
|
-
* console.log(
|
|
72
|
-
* console.log(
|
|
69
|
+
* console.log(result.clearValues[0].value); // e.g. 42
|
|
70
|
+
* console.log(result.clearValues[0].type); // e.g. 'uint8'
|
|
71
|
+
* console.log(result.clearValues[1].value); // e.g. 123456789
|
|
72
|
+
* console.log(result.clearValues[1].type); // e.g. 'uint32'
|
|
73
73
|
*
|
|
74
74
|
* // Forward the proof on-chain for smart contract verification
|
|
75
75
|
* // Solidity side:
|
|
@@ -80,7 +80,7 @@ export type BaseActions = {
|
|
|
80
80
|
* await contract.verify(args.handlesList, args.abiEncodedCleartexts, args.decryptionProof);
|
|
81
81
|
* ```
|
|
82
82
|
*/
|
|
83
|
-
readonly
|
|
83
|
+
readonly decryptPublicValuesWithSignatures: (parameters: DecryptPublicValuesWithSignaturesParameters) => Promise<DecryptPublicValuesWithSignaturesReturnType>;
|
|
84
84
|
readonly signDecryptionPermit: {
|
|
85
85
|
/**
|
|
86
86
|
* Signs a self decryption permit — Alice decrypts her own encrypted values.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../core/clients/decorators/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAS,SAAS,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACvF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EACV,0BAA0B,EAC1B,+BAA+B,EAChC,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EACV,mCAAmC,EACnC,mCAAmC,EACpC,MAAM,kDAAkD,CAAC;AAE1D,OAAO,EAEL,KAAK,kCAAkC,EACvC,KAAK,uCAAuC,EAC7C,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAEL,KAAK,+BAA+B,EACpC,KAAK,+BAA+B,EACrC,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAEL,KAAK,oCAAoC,EACzC,KAAK,oCAAoC,EAC1C,MAAM,mDAAmD,CAAC;AAE3D,OAAO,EAEL,KAAK,yCAAyC,EAC9C,KAAK,yCAAyC,EAC/C,MAAM,wDAAwD,CAAC;AAChE,OAAO,EAEL,KAAK,qCAAqC,EAC1C,KAAK,qCAAqC,EAC3C,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EAEL,KAAK,
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../core/clients/decorators/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAS,SAAS,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACvF,OAAO,KAAK,EAAE,UAAU,EAAE,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,EAAE,WAAW,CAAC;IACrB,YAAY,EAAE,aAAa,CAAC;CAC7B,
|
|
1
|
+
{"version":3,"file":"kmsExtraData.d.ts","sourceRoot":"","sources":["../../../core/kms/kmsExtraData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA0B,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC3G,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAMvE,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,QAAQ,GAAG;IACrD,OAAO,EAAE,WAAW,CAAC;IACrB,YAAY,EAAE,aAAa,CAAC;CAC7B,CAuBA;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE;IACnC,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC;CACtC,GAAG,QAAQ,CAIX;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,OAAO,EACd,OAAO,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,mBAAmB,GAClD,OAAO,CAAC,KAAK,IAAI,QAAQ,CAM3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RelayerAsyncRequest.d.ts","sourceRoot":"","sources":["../../../../../core/modules/relayer/module/RelayerAsyncRequest.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,wBAAwB,EAQxB,sBAAsB,EACvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAEV,qBAAqB,EACrB,wBAAwB,EACxB,sBAAsB,EACtB,kCAAkC,EAGlC,wBAAwB,EAExB,oBAAoB,EAOpB,2BAA2B,EAE3B,yBAAyB,EAE1B,MAAM,2BAA2B,CAAC;AAuEnC,KAAK,yBAAyB,GAAG;IAC/B,gBAAgB,EAAE,oBAAoB,CAAC;IACvC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,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;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,aAAa;IAQrB,OAAO,KAAK,KAAK,GAGhB;IAMD;;;;;;;;OAQG;YACW,eAAe;IA2B7B;;;OAGG;YACW,UAAU;IAqExB;;;OAGG;YACW,SAAS;IAoEvB,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CA0BzC;IAGF,OAAO,CAAC,QAAQ,CAAC,0BAA0B,CAkCzC;IAMF;;OAEG;IACH,OAAO,CAAC,UAAU;YA+CJ,qBAAqB;IAyCnC,OAAO,CAAC,0BAA0B;IA+BlC,OAAO,CAAC,wBAAwB;IAYhC,OAAO,CAAC,2BAA2B;IA8BnC,OAAO,CAAC,6BAA6B;IAerC,OAAO,CAAC,4BAA4B;IA6BpC;;;OAGG;IACH,OAAO,CAAC,uBAAuB;IAwB/B;;;OAGG;IACH,OAAO,CAAC,6BAA6B;IA6CrC,OAAO,CAAC,OAAO;IAMf;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAU3B;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAa3B;;;OAGG;IACH,OAAO,CAAC,8BAA8B;IAiBtC;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAaxB;;;;;;;;;;;;;;;;;OAiBG;IACH,OAAO,CAAC,4BAA4B;IAUpC,OAAO,CAAC,MAAM;CAKf"}
|
|
@@ -2,5 +2,6 @@ export type { TypedValue } from './primitives.js';
|
|
|
2
2
|
export type { EncryptedValue, EncryptedValueLike } from './encryptedTypes.js';
|
|
3
3
|
export type { KmsDecryptEip712Like } from './kms.js';
|
|
4
4
|
export type { FhevmEncryptClient, FhevmDecryptClient } from './fhevmClient.js';
|
|
5
|
+
export type { Auth } from './auth.js';
|
|
5
6
|
export { asEncryptedValue, isEncryptedValue } from '../handle/EncryptedValue.js';
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../core/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9E,YAAY,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AACrD,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../core/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,YAAY,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9E,YAAY,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AACrD,YAAY,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC/E,YAAY,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC"}
|
|
@@ -28,7 +28,7 @@ export type SignedDecryptionPermitBase = {
|
|
|
28
28
|
*/
|
|
29
29
|
readonly encryptedDataOwnerAddress: ChecksummedAddress;
|
|
30
30
|
/** The E2E transport public key embedded in the EIP-712 message. */
|
|
31
|
-
readonly
|
|
31
|
+
readonly transportPublicKey: BytesHex;
|
|
32
32
|
/** @throws If the permit has expired based on `startTimestamp` + `durationDays`. */
|
|
33
33
|
assertNotExpired(): void;
|
|
34
34
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signedDecryptionPermit.d.ts","sourceRoot":"","sources":["../../../core/types/signedDecryptionPermit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AACp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A6B,CAAC;IAC/C,mHAAmH;IACnH,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,0BAA0B,GAAG,+BAA+B,CAAC"}
|
package/core/_version.ts
CHANGED
|
@@ -7,18 +7,18 @@ import { toFhevmHandle } from '../../handle/FhevmHandle.js';
|
|
|
7
7
|
|
|
8
8
|
////////////////////////////////////////////////////////////////////////////////
|
|
9
9
|
|
|
10
|
-
export type
|
|
10
|
+
export type CanDecryptPublicValueParameters = {
|
|
11
11
|
readonly encryptedValue: EncryptedValueLike;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
export type
|
|
14
|
+
export type CanDecryptPublicValueReturnType = boolean;
|
|
15
15
|
|
|
16
16
|
////////////////////////////////////////////////////////////////////////////////
|
|
17
17
|
|
|
18
|
-
export async function
|
|
18
|
+
export async function canDecryptPublicValue(
|
|
19
19
|
fhevm: Fhevm<FhevmChain>,
|
|
20
|
-
parameters:
|
|
21
|
-
): Promise<
|
|
20
|
+
parameters: CanDecryptPublicValueParameters,
|
|
21
|
+
): Promise<CanDecryptPublicValueReturnType> {
|
|
22
22
|
const results = await isAllowedForDecryption(fhevm, {
|
|
23
23
|
address: fhevm.chain.fhevm.contracts.acl.address as ChecksummedAddress,
|
|
24
24
|
handles: [toFhevmHandle(parameters.encryptedValue)],
|
|
@@ -7,18 +7,18 @@ import { toFhevmHandle } from '../../handle/FhevmHandle.js';
|
|
|
7
7
|
|
|
8
8
|
////////////////////////////////////////////////////////////////////////////////
|
|
9
9
|
|
|
10
|
-
export type
|
|
10
|
+
export type CanDecryptPublicValuesParameters = {
|
|
11
11
|
readonly encryptedValues: readonly EncryptedValueLike[];
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
export type
|
|
14
|
+
export type CanDecryptPublicValuesReturnType = readonly boolean[];
|
|
15
15
|
|
|
16
16
|
////////////////////////////////////////////////////////////////////////////////
|
|
17
17
|
|
|
18
|
-
export async function
|
|
18
|
+
export async function canDecryptPublicValues(
|
|
19
19
|
fhevm: Fhevm<FhevmChain>,
|
|
20
|
-
parameters:
|
|
21
|
-
): Promise<
|
|
20
|
+
parameters: CanDecryptPublicValuesParameters,
|
|
21
|
+
): Promise<CanDecryptPublicValuesReturnType> {
|
|
22
22
|
const handles = parameters.encryptedValues.map(toFhevmHandle);
|
|
23
23
|
|
|
24
24
|
return isAllowedForDecryption(fhevm, {
|
|
@@ -9,22 +9,22 @@ import { clearValueToTypedValue } from '../../handle/ClearValue.js';
|
|
|
9
9
|
|
|
10
10
|
////////////////////////////////////////////////////////////////////////////////
|
|
11
11
|
|
|
12
|
-
export type
|
|
12
|
+
export type DecryptPublicValueParameters = {
|
|
13
13
|
readonly encryptedValue: EncryptedValueLike;
|
|
14
14
|
readonly options?: RelayerPublicDecryptOptions | undefined;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
export type
|
|
17
|
+
export type DecryptPublicValueReturnType = TypedValue;
|
|
18
18
|
|
|
19
19
|
////////////////////////////////////////////////////////////////////////////////
|
|
20
20
|
|
|
21
|
-
export async function
|
|
21
|
+
export async function decryptPublicValue(
|
|
22
22
|
fhevm: Fhevm<FhevmChain>,
|
|
23
|
-
parameters:
|
|
24
|
-
): Promise<
|
|
23
|
+
parameters: DecryptPublicValueParameters,
|
|
24
|
+
): Promise<DecryptPublicValueReturnType> {
|
|
25
25
|
const handle = toFhevmHandle(parameters.encryptedValue);
|
|
26
26
|
|
|
27
|
-
const originToken = Symbol('
|
|
27
|
+
const originToken = Symbol('decryptPublicValues');
|
|
28
28
|
const res = await publicDecrypt_(fhevm, { ...parameters, handles: [handle], originToken });
|
|
29
29
|
|
|
30
30
|
return clearValueToTypedValue(res.orderedClearValues[0], originToken);
|
|
@@ -9,22 +9,22 @@ import { clearValueToTypedValue } from '../../handle/ClearValue.js';
|
|
|
9
9
|
|
|
10
10
|
////////////////////////////////////////////////////////////////////////////////
|
|
11
11
|
|
|
12
|
-
export type
|
|
12
|
+
export type DecryptPublicValuesParameters = {
|
|
13
13
|
readonly encryptedValues: readonly EncryptedValueLike[];
|
|
14
14
|
readonly options?: RelayerPublicDecryptOptions | undefined;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
export type
|
|
17
|
+
export type DecryptPublicValuesReturnType = TypedValue[];
|
|
18
18
|
|
|
19
19
|
////////////////////////////////////////////////////////////////////////////////
|
|
20
20
|
|
|
21
|
-
export async function
|
|
21
|
+
export async function decryptPublicValues(
|
|
22
22
|
fhevm: Fhevm<FhevmChain>,
|
|
23
|
-
parameters:
|
|
24
|
-
): Promise<
|
|
23
|
+
parameters: DecryptPublicValuesParameters,
|
|
24
|
+
): Promise<DecryptPublicValuesReturnType> {
|
|
25
25
|
const handles = parameters.encryptedValues.map(toFhevmHandle);
|
|
26
26
|
|
|
27
|
-
const originToken = Symbol('
|
|
27
|
+
const originToken = Symbol('decryptPublicValues');
|
|
28
28
|
const res = await publicDecrypt_(fhevm, { ...parameters, handles, originToken });
|
|
29
29
|
|
|
30
30
|
return res.orderedClearValues.map((cv) => clearValueToTypedValue(cv, originToken));
|
package/core/actions/base/{readPublicValuesWithSignatures.ts → decryptPublicValuesWithSignatures.ts}
RENAMED
|
@@ -11,12 +11,12 @@ import { clearValueToTypedValue } from '../../handle/ClearValue.js';
|
|
|
11
11
|
|
|
12
12
|
////////////////////////////////////////////////////////////////////////////////
|
|
13
13
|
|
|
14
|
-
export type
|
|
14
|
+
export type DecryptPublicValuesWithSignaturesParameters = {
|
|
15
15
|
readonly encryptedValues: readonly EncryptedValueLike[];
|
|
16
16
|
readonly options?: RelayerPublicDecryptOptions | undefined;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
export type
|
|
19
|
+
export type DecryptPublicValuesWithSignaturesReturnType = {
|
|
20
20
|
readonly clearValues: NonEmptyReadonlyArray<TypedValue>;
|
|
21
21
|
readonly checkSignaturesArgs: {
|
|
22
22
|
readonly handlesList: NonEmptyReadonlyArray<HandleBytes32Hex>;
|
|
@@ -27,13 +27,13 @@ export type ReadPublicValuesWithSignaturesReturnType = {
|
|
|
27
27
|
|
|
28
28
|
////////////////////////////////////////////////////////////////////////////////
|
|
29
29
|
|
|
30
|
-
export async function
|
|
30
|
+
export async function decryptPublicValuesWithSignatures(
|
|
31
31
|
fhevm: Fhevm<FhevmChain>,
|
|
32
|
-
parameters:
|
|
33
|
-
): Promise<
|
|
32
|
+
parameters: DecryptPublicValuesWithSignaturesParameters,
|
|
33
|
+
): Promise<DecryptPublicValuesWithSignaturesReturnType> {
|
|
34
34
|
const handles = parameters.encryptedValues.map(toFhevmHandle);
|
|
35
35
|
|
|
36
|
-
const originToken = Symbol('
|
|
36
|
+
const originToken = Symbol('decryptPublicValues');
|
|
37
37
|
const res = await publicDecrypt_(fhevm, { ...parameters, handles, originToken });
|
|
38
38
|
|
|
39
39
|
const typedValues = res.orderedClearValues.map((cv) =>
|
|
@@ -1,32 +1,36 @@
|
|
|
1
1
|
export { type ReadKmsSignersContextReturnType, readKmsSignersContext } from './readKmsSignersContext.js';
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export {
|
|
4
|
+
type DecryptPublicValueParameters,
|
|
5
|
+
type DecryptPublicValueReturnType,
|
|
6
|
+
decryptPublicValue,
|
|
7
|
+
} from './decryptPublicValue.js';
|
|
4
8
|
|
|
5
9
|
export type { RelayerPublicDecryptOptions, RelayerPublicDecryptProgressArgs } from '../../types/relayer.js';
|
|
6
10
|
|
|
7
11
|
export {
|
|
8
|
-
type
|
|
9
|
-
type
|
|
10
|
-
|
|
11
|
-
} from './
|
|
12
|
+
type DecryptPublicValuesParameters,
|
|
13
|
+
type DecryptPublicValuesReturnType,
|
|
14
|
+
decryptPublicValues,
|
|
15
|
+
} from './decryptPublicValues.js';
|
|
12
16
|
|
|
13
17
|
export {
|
|
14
|
-
type
|
|
15
|
-
type
|
|
16
|
-
|
|
17
|
-
} from './
|
|
18
|
+
type DecryptPublicValuesWithSignaturesParameters,
|
|
19
|
+
type DecryptPublicValuesWithSignaturesReturnType,
|
|
20
|
+
decryptPublicValuesWithSignatures,
|
|
21
|
+
} from './decryptPublicValuesWithSignatures.js';
|
|
18
22
|
|
|
19
23
|
export {
|
|
20
|
-
type
|
|
21
|
-
type
|
|
22
|
-
|
|
23
|
-
} from './
|
|
24
|
+
type CanDecryptPublicValueParameters,
|
|
25
|
+
type CanDecryptPublicValueReturnType,
|
|
26
|
+
canDecryptPublicValue,
|
|
27
|
+
} from './canDecryptPublicValue.js';
|
|
24
28
|
|
|
25
29
|
export {
|
|
26
|
-
type
|
|
27
|
-
type
|
|
28
|
-
|
|
29
|
-
} from './
|
|
30
|
+
type CanDecryptPublicValuesParameters,
|
|
31
|
+
type CanDecryptPublicValuesReturnType,
|
|
32
|
+
canDecryptPublicValues,
|
|
33
|
+
} from './canDecryptPublicValues.js';
|
|
30
34
|
|
|
31
35
|
export {
|
|
32
36
|
type CreateVerifiedInputProofFromRawBytesParameters,
|
|
@@ -36,20 +36,20 @@ import {
|
|
|
36
36
|
type ParseSignedDecryptionPermitReturnType,
|
|
37
37
|
} from '../../actions/chain/parseSignedDecryptionPermit.js';
|
|
38
38
|
import {
|
|
39
|
-
|
|
40
|
-
type
|
|
41
|
-
type
|
|
42
|
-
} from '../../actions/base/
|
|
39
|
+
decryptPublicValue,
|
|
40
|
+
type DecryptPublicValueParameters,
|
|
41
|
+
type DecryptPublicValueReturnType,
|
|
42
|
+
} from '../../actions/base/decryptPublicValue.js';
|
|
43
43
|
import {
|
|
44
|
-
|
|
45
|
-
type
|
|
46
|
-
type
|
|
47
|
-
} from '../../actions/base/
|
|
44
|
+
decryptPublicValues,
|
|
45
|
+
type DecryptPublicValuesParameters,
|
|
46
|
+
type DecryptPublicValuesReturnType,
|
|
47
|
+
} from '../../actions/base/decryptPublicValues.js';
|
|
48
48
|
import {
|
|
49
|
-
|
|
50
|
-
type
|
|
51
|
-
type
|
|
52
|
-
} from '../../actions/base/
|
|
49
|
+
decryptPublicValuesWithSignatures,
|
|
50
|
+
type DecryptPublicValuesWithSignaturesParameters,
|
|
51
|
+
type DecryptPublicValuesWithSignaturesReturnType,
|
|
52
|
+
} from '../../actions/base/decryptPublicValuesWithSignatures.js';
|
|
53
53
|
|
|
54
54
|
////////////////////////////////////////////////////////////////////////////////
|
|
55
55
|
|
|
@@ -59,30 +59,30 @@ export type BaseActions = {
|
|
|
59
59
|
*
|
|
60
60
|
* By default, encrypted values on-chain can only be decrypted by their owner.
|
|
61
61
|
* When a contract calls `TFHE.allowForDecryption(encryptedValue)` in Solidity,
|
|
62
|
-
* the value becomes publicly readable. Anyone can then call `
|
|
62
|
+
* the value becomes publicly readable. Anyone can then call `decryptPublicValue`
|
|
63
63
|
* to get the clear value — no permit or private key needed.
|
|
64
64
|
*
|
|
65
65
|
* @example
|
|
66
66
|
* ```ts
|
|
67
|
-
* const result = await client.
|
|
67
|
+
* const result = await client.decryptPublicValue({
|
|
68
68
|
* encryptedValue: "0xabcd..."
|
|
69
69
|
* });
|
|
70
70
|
* console.log(result.value); // e.g. 42
|
|
71
71
|
* console.log(result.type); // e.g. 'uint8'
|
|
72
72
|
* ```
|
|
73
73
|
*/
|
|
74
|
-
readonly
|
|
74
|
+
readonly decryptPublicValue: (parameters: DecryptPublicValueParameters) => Promise<DecryptPublicValueReturnType>;
|
|
75
75
|
/**
|
|
76
76
|
* Reads the decrypted (clear) values of encrypted values that were made public.
|
|
77
77
|
*
|
|
78
78
|
* By default, encrypted values on-chain can only be decrypted by their owner.
|
|
79
79
|
* When a contract calls `TFHE.allowForDecryption(encryptedValue)` in Solidity,
|
|
80
|
-
* a value becomes publicly readable. Anyone can then call `
|
|
80
|
+
* a value becomes publicly readable. Anyone can then call `decryptPublicValues`
|
|
81
81
|
* to get the clear values — no permit or private key needed.
|
|
82
82
|
*
|
|
83
83
|
* @example
|
|
84
84
|
* ```ts
|
|
85
|
-
* const results = await client.
|
|
85
|
+
* const results = await client.decryptPublicValues({
|
|
86
86
|
* encryptedValues: ["0xabcd...", "0xef..."]
|
|
87
87
|
* });
|
|
88
88
|
* console.log(results[0].value); // e.g. 42
|
|
@@ -91,13 +91,13 @@ export type BaseActions = {
|
|
|
91
91
|
* console.log(results[1].type); // e.g. 'uint32'
|
|
92
92
|
* ```
|
|
93
93
|
*/
|
|
94
|
-
readonly
|
|
94
|
+
readonly decryptPublicValues: (parameters: DecryptPublicValuesParameters) => Promise<DecryptPublicValuesReturnType>;
|
|
95
95
|
/**
|
|
96
96
|
* Reads the decrypted (clear) value of an encrypted value that was made public.
|
|
97
97
|
*
|
|
98
98
|
* By default, encrypted values on-chain can only be decrypted by their owner.
|
|
99
99
|
* When a contract calls `TFHE.allowForDecryption(encryptedValue)` in Solidity,
|
|
100
|
-
* the value becomes publicly readable. Anyone can then call `
|
|
100
|
+
* the value becomes publicly readable. Anyone can then call `decryptPublicValue`
|
|
101
101
|
* to get the clear value — no permit or private key needed.
|
|
102
102
|
*
|
|
103
103
|
* Returns both the clear values and a decryption proof. The proof can be
|
|
@@ -106,13 +106,13 @@ export type BaseActions = {
|
|
|
106
106
|
*
|
|
107
107
|
* @example
|
|
108
108
|
* ```ts
|
|
109
|
-
* const result = await client.
|
|
109
|
+
* const result = await client.decryptPublicValuesWithSignatures({
|
|
110
110
|
* encryptedValues: ["0xabcd...", "0xef..."]
|
|
111
111
|
* });
|
|
112
|
-
* console.log(
|
|
113
|
-
* console.log(
|
|
114
|
-
* console.log(
|
|
115
|
-
* console.log(
|
|
112
|
+
* console.log(result.clearValues[0].value); // e.g. 42
|
|
113
|
+
* console.log(result.clearValues[0].type); // e.g. 'uint8'
|
|
114
|
+
* console.log(result.clearValues[1].value); // e.g. 123456789
|
|
115
|
+
* console.log(result.clearValues[1].type); // e.g. 'uint32'
|
|
116
116
|
*
|
|
117
117
|
* // Forward the proof on-chain for smart contract verification
|
|
118
118
|
* // Solidity side:
|
|
@@ -123,9 +123,9 @@ export type BaseActions = {
|
|
|
123
123
|
* await contract.verify(args.handlesList, args.abiEncodedCleartexts, args.decryptionProof);
|
|
124
124
|
* ```
|
|
125
125
|
*/
|
|
126
|
-
readonly
|
|
127
|
-
parameters:
|
|
128
|
-
) => Promise<
|
|
126
|
+
readonly decryptPublicValuesWithSignatures: (
|
|
127
|
+
parameters: DecryptPublicValuesWithSignaturesParameters,
|
|
128
|
+
) => Promise<DecryptPublicValuesWithSignaturesReturnType>;
|
|
129
129
|
readonly signDecryptionPermit: {
|
|
130
130
|
/**
|
|
131
131
|
* Signs a self decryption permit — Alice decrypts her own encrypted values.
|
|
@@ -173,9 +173,9 @@ export type BaseActions = {
|
|
|
173
173
|
|
|
174
174
|
function _baseActions(fhevm: Fhevm<FhevmChain>): BaseActions {
|
|
175
175
|
return {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
176
|
+
decryptPublicValue: (parameters) => decryptPublicValue(fhevm, parameters),
|
|
177
|
+
decryptPublicValues: (parameters) => decryptPublicValues(fhevm, parameters),
|
|
178
|
+
decryptPublicValuesWithSignatures: (parameters) => decryptPublicValuesWithSignatures(fhevm, parameters),
|
|
179
179
|
// Preserve the original action overloads on the decorated client API.
|
|
180
180
|
// Runtime behavior is unchanged: this is a direct pass-through wrapper.
|
|
181
181
|
signDecryptionPermit: ((parameters: SignSelfDecryptionPermitParameters | SignDelegatedDecryptionPermitParameters) =>
|
|
@@ -125,7 +125,7 @@ abstract class SignedDecryptionPermitBaseImpl {
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
public get
|
|
128
|
+
public get transportPublicKey(): BytesHex {
|
|
129
129
|
return this.#eip712.message.publicKey;
|
|
130
130
|
}
|
|
131
131
|
|
|
@@ -440,7 +440,7 @@ export async function parseSignedDecryptionPermit(
|
|
|
440
440
|
|
|
441
441
|
if (eip712.message.publicKey.toLowerCase() !== transportKeyPair.publicKey.toLowerCase()) {
|
|
442
442
|
throw new Error(
|
|
443
|
-
"The permit's publicKey does not match the
|
|
443
|
+
"The permit's publicKey does not match the TransportKeyPairKeyPair's publicKey. " +
|
|
444
444
|
'Ensure the permit was signed with the same key pair.',
|
|
445
445
|
);
|
|
446
446
|
}
|
package/core/kms/kmsExtraData.ts
CHANGED
|
@@ -9,6 +9,13 @@ export function fromKmsExtraData(extraData: BytesHex): {
|
|
|
9
9
|
version: Uint8Number;
|
|
10
10
|
kmsContextId: Uint256BigInt;
|
|
11
11
|
} {
|
|
12
|
+
if ((extraData as string) === '0x00' || (extraData as string) === '0x') {
|
|
13
|
+
return {
|
|
14
|
+
version: 0 as Uint8Number,
|
|
15
|
+
kmsContextId: 0n as Uint256BigInt,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
12
19
|
// First byte = version (characters 2-3 after '0x')
|
|
13
20
|
const version = asUint8Number(parseInt(extraData.slice(2, 4), 16));
|
|
14
21
|
|
|
@@ -43,7 +50,7 @@ export function assertIsKmsExtraData(
|
|
|
43
50
|
value: unknown,
|
|
44
51
|
options: { subject?: string } & ErrorMetadataParams,
|
|
45
52
|
): asserts value is BytesHex {
|
|
46
|
-
if (value === '0x00') {
|
|
53
|
+
if (value === '0x00' || value === '0x') {
|
|
47
54
|
return;
|
|
48
55
|
}
|
|
49
56
|
assertIsBytesHex(value, { ...options, byteLength: 33 as ByteLength });
|
|
@@ -1611,6 +1611,20 @@ export class RelayerAsyncRequest {
|
|
|
1611
1611
|
});
|
|
1612
1612
|
}
|
|
1613
1613
|
|
|
1614
|
+
// private _throwRelayerResponseApiErrorLoose(params: { status: number; bodyJson: Record<string, unknown> }): never {
|
|
1615
|
+
// // body is considered ok if:
|
|
1616
|
+
// // body.error exists
|
|
1617
|
+
// // body.error.label is a string
|
|
1618
|
+
// // body.error.message is a string
|
|
1619
|
+
// // body.error.details is optional array of {field, issue}
|
|
1620
|
+
// // body.Json contains "error" ?
|
|
1621
|
+
// // error.label;
|
|
1622
|
+
// // error.message: string;
|
|
1623
|
+
// // error.details
|
|
1624
|
+
// // error.details[i].field
|
|
1625
|
+
// // error.details[i].issue
|
|
1626
|
+
// }
|
|
1627
|
+
|
|
1614
1628
|
/**
|
|
1615
1629
|
* Throws a relayer API error with the given status and error details.
|
|
1616
1630
|
* @throws {RelayerResponseApiError} Always throws with the provided error details.
|
package/core/types/index.ts
CHANGED
|
@@ -2,4 +2,5 @@ export type { TypedValue } from './primitives.js';
|
|
|
2
2
|
export type { EncryptedValue, EncryptedValueLike } from './encryptedTypes.js';
|
|
3
3
|
export type { KmsDecryptEip712Like } from './kms.js';
|
|
4
4
|
export type { FhevmEncryptClient, FhevmDecryptClient } from './fhevmClient.js';
|
|
5
|
+
export type { Auth } from './auth.js';
|
|
5
6
|
export { asEncryptedValue, isEncryptedValue } from '../handle/EncryptedValue.js';
|
|
@@ -29,7 +29,7 @@ export type SignedDecryptionPermitBase = {
|
|
|
29
29
|
*/
|
|
30
30
|
readonly encryptedDataOwnerAddress: ChecksummedAddress;
|
|
31
31
|
/** The E2E transport public key embedded in the EIP-712 message. */
|
|
32
|
-
readonly
|
|
32
|
+
readonly transportPublicKey: BytesHex;
|
|
33
33
|
|
|
34
34
|
/** @throws If the permit has expired based on `startTimestamp` + `durationDays`. */
|
|
35
35
|
assertNotExpired(): void;
|
|
@@ -18,9 +18,9 @@ export function assertPermitMatchesKeyPair(
|
|
|
18
18
|
assertIsSignedDecryptionPermit(signedPermit, {});
|
|
19
19
|
assertIsTransportKeyPair(transportKeyPair, {});
|
|
20
20
|
|
|
21
|
-
if (signedPermit.
|
|
21
|
+
if (signedPermit.transportPublicKey.toLowerCase() !== transportKeyPair.publicKey.toLowerCase()) {
|
|
22
22
|
throw new Error(
|
|
23
|
-
"The permit's publicKey does not match the
|
|
23
|
+
"The permit's publicKey does not match the TransportKeyPairKeyPair's publicKey. " +
|
|
24
24
|
'Ensure the permit was signed with the same key pair.',
|
|
25
25
|
);
|
|
26
26
|
}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"canReadPublicValue.js","sourceRoot":"","sources":["../../../../core/actions/base/canReadPublicValue.ts"],"names":[],"mappings":";;AAiBA,gDAUC;AAvBD,8FAAwF;AACxF,gEAA4D;AAYrD,KAAK,UAAU,kBAAkB,CACtC,KAAwB,EACxB,UAAwC;IAExC,MAAM,OAAO,GAAG,MAAM,IAAA,kDAAsB,EAAC,KAAK,EAAE;QAClD,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,OAA6B;QACtE,OAAO,EAAE,CAAC,IAAA,8BAAa,EAAC,UAAU,CAAC,cAAc,CAAC,CAAC;KACpD,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;AAC7B,CAAC"}
|