@fhevm/sdk 1.0.0-alpha.2 → 1.0.0-alpha.3

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.
Files changed (54) hide show
  1. package/_cjs/core/_version.js +1 -1
  2. package/_cjs/core/actions/chain/parseSignedDecryptionPermit.js.map +1 -1
  3. package/_cjs/core/actions/host/getUserDecryptionDelegationExpirationDate.js +12 -14
  4. package/_cjs/core/actions/host/getUserDecryptionDelegationExpirationDate.js.map +1 -1
  5. package/_cjs/core/host-contracts/checkDelegation.js +74 -0
  6. package/_cjs/core/host-contracts/checkDelegation.js.map +1 -0
  7. package/_cjs/core/host-contracts/getUserDecryptionDelegationExpirationDate.js +21 -0
  8. package/_cjs/core/host-contracts/getUserDecryptionDelegationExpirationDate.js.map +1 -0
  9. package/_cjs/core/host-contracts/isHandleDelegatedForUserDecryption-p.js +33 -0
  10. package/_cjs/core/host-contracts/isHandleDelegatedForUserDecryption-p.js.map +1 -0
  11. package/_cjs/core/host-contracts/persistAllowed.js +1 -1
  12. package/_cjs/core/host-contracts/persistAllowed.js.map +1 -1
  13. package/_cjs/core/kms/fetchKmsSignedcryptedShares-p.js +16 -5
  14. package/_cjs/core/kms/fetchKmsSignedcryptedShares-p.js.map +1 -1
  15. package/_esm/core/_version.js +1 -1
  16. package/_esm/core/actions/chain/parseSignedDecryptionPermit.js.map +1 -1
  17. package/_esm/core/actions/host/getUserDecryptionDelegationExpirationDate.js +13 -14
  18. package/_esm/core/actions/host/getUserDecryptionDelegationExpirationDate.js.map +1 -1
  19. package/_esm/core/host-contracts/checkDelegation.js +81 -0
  20. package/_esm/core/host-contracts/checkDelegation.js.map +1 -0
  21. package/_esm/core/host-contracts/getUserDecryptionDelegationExpirationDate.js +19 -0
  22. package/_esm/core/host-contracts/getUserDecryptionDelegationExpirationDate.js.map +1 -0
  23. package/_esm/core/host-contracts/isHandleDelegatedForUserDecryption-p.js +32 -0
  24. package/_esm/core/host-contracts/isHandleDelegatedForUserDecryption-p.js.map +1 -0
  25. package/_esm/core/host-contracts/persistAllowed.js +1 -1
  26. package/_esm/core/host-contracts/persistAllowed.js.map +1 -1
  27. package/_esm/core/kms/fetchKmsSignedcryptedShares-p.js +16 -5
  28. package/_esm/core/kms/fetchKmsSignedcryptedShares-p.js.map +1 -1
  29. package/_types/core/actions/chain/parseSignedDecryptionPermit.d.ts +6 -2
  30. package/_types/core/actions/chain/parseSignedDecryptionPermit.d.ts.map +1 -1
  31. package/_types/core/actions/host/getUserDecryptionDelegationExpirationDate.d.ts +5 -2
  32. package/_types/core/actions/host/getUserDecryptionDelegationExpirationDate.d.ts.map +1 -1
  33. package/_types/core/host-contracts/checkDelegation.d.ts +22 -0
  34. package/_types/core/host-contracts/checkDelegation.d.ts.map +1 -0
  35. package/_types/core/host-contracts/getUserDecryptionDelegationExpirationDate.d.ts +19 -0
  36. package/_types/core/host-contracts/getUserDecryptionDelegationExpirationDate.d.ts.map +1 -0
  37. package/_types/core/host-contracts/isHandleDelegatedForUserDecryption-p.d.ts +20 -0
  38. package/_types/core/host-contracts/isHandleDelegatedForUserDecryption-p.d.ts.map +1 -0
  39. package/_types/core/kms/fetchKmsSignedcryptedShares-p.d.ts.map +1 -1
  40. package/_types/core/types/index.d.ts +1 -0
  41. package/_types/core/types/index.d.ts.map +1 -1
  42. package/_types/core/types/kms.d.ts +21 -0
  43. package/_types/core/types/kms.d.ts.map +1 -1
  44. package/core/_version.ts +1 -1
  45. package/core/actions/chain/parseSignedDecryptionPermit.ts +6 -2
  46. package/core/actions/host/getUserDecryptionDelegationExpirationDate.ts +22 -18
  47. package/core/host-contracts/checkDelegation.ts +114 -0
  48. package/core/host-contracts/getUserDecryptionDelegationExpirationDate.ts +45 -0
  49. package/core/host-contracts/isHandleDelegatedForUserDecryption-p.ts +77 -0
  50. package/core/host-contracts/persistAllowed.ts +1 -1
  51. package/core/kms/fetchKmsSignedcryptedShares-p.ts +15 -5
  52. package/core/types/index.ts +1 -0
  53. package/core/types/kms.ts +19 -0
  54. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"getUserDecryptionDelegationExpirationDate.d.ts","sourceRoot":"","sources":["../../../../core/actions/host/getUserDecryptionDelegationExpirationDate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAKlF,MAAM,MAAM,mDAAmD,GAAG;IAChE,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,mDAAmD,GAAG,YAAY,CAAC;AAE/E,wBAAsB,yCAAyC,CAC7D,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,mDAAmD,GAC9D,OAAO,CAAC,mDAAmD,CAAC,CAgB9D"}
1
+ {"version":3,"file":"getUserDecryptionDelegationExpirationDate.d.ts","sourceRoot":"","sources":["../../../../core/actions/host/getUserDecryptionDelegationExpirationDate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAM9D,MAAM,MAAM,mDAAmD,GAAG;IAChE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,mDAAmD,GAAG,YAAY,CAAC;AAI/E,wBAAsB,yCAAyC,CAC7D,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,mDAAmD,GAC9D,OAAO,CAAC,mDAAmD,CAAC,CAc9D"}
@@ -0,0 +1,22 @@
1
+ import type { FhevmRuntime } from '../types/coreFhevmRuntime.js';
2
+ import type { Handle } from '../types/encryptedTypes-p.js';
3
+ import type { ChecksummedAddress } from '../types/primitives.js';
4
+ type Context = {
5
+ readonly runtime: FhevmRuntime;
6
+ readonly client: NonNullable<object>;
7
+ readonly options: {
8
+ readonly batchRpcCalls: boolean;
9
+ };
10
+ };
11
+ type Parameters = {
12
+ readonly address: ChecksummedAddress;
13
+ readonly delegator: ChecksummedAddress;
14
+ readonly delegate: ChecksummedAddress;
15
+ readonly handleContractPairs: ReadonlyArray<{
16
+ readonly handle: Handle;
17
+ readonly contractAddress: ChecksummedAddress;
18
+ }>;
19
+ };
20
+ export declare function checkDelegation(context: Context, parameters: Parameters): Promise<void>;
21
+ export {};
22
+ //# sourceMappingURL=checkDelegation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkDelegation.d.ts","sourceRoot":"","sources":["../../../core/host-contracts/checkDelegation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAOjE,KAAK,OAAO,GAAG;IACb,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE;QAAE,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAA;KAAE,CAAC;CACvD,CAAC;AAEF,KAAK,UAAU,GAAG;IAChB,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;IACrC,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAC;IACvC,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IACtC,QAAQ,CAAC,mBAAmB,EAAE,aAAa,CAAC;QAC1C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,eAAe,EAAE,kBAAkB,CAAC;KAC9C,CAAC,CAAC;CACJ,CAAC;AAIF,wBAAsB,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAsF7F"}
@@ -0,0 +1,19 @@
1
+ import type { FhevmRuntime } from '../types/coreFhevmRuntime.js';
2
+ import type { ChecksummedAddress, Uint64BigInt } from '../types/primitives.js';
3
+ type Context = {
4
+ readonly runtime: FhevmRuntime;
5
+ readonly client: NonNullable<object>;
6
+ readonly options: {
7
+ readonly batchRpcCalls: boolean;
8
+ };
9
+ };
10
+ type Parameters = {
11
+ readonly address: ChecksummedAddress;
12
+ readonly delegator: ChecksummedAddress;
13
+ readonly delegate: ChecksummedAddress;
14
+ readonly contractAddress: ChecksummedAddress;
15
+ };
16
+ type ReturnType = Uint64BigInt;
17
+ export declare function getUserDecryptionDelegationExpirationDate(context: Context, parameters: Parameters): Promise<ReturnType>;
18
+ export {};
19
+ //# sourceMappingURL=getUserDecryptionDelegationExpirationDate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getUserDecryptionDelegationExpirationDate.d.ts","sourceRoot":"","sources":["../../../core/host-contracts/getUserDecryptionDelegationExpirationDate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAO/E,KAAK,OAAO,GAAG;IACb,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE;QAAE,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAA;KAAE,CAAC;CACvD,CAAC;AAEF,KAAK,UAAU,GAAG;IAChB,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;IACrC,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAC;IACvC,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IACtC,QAAQ,CAAC,eAAe,EAAE,kBAAkB,CAAC;CAC9C,CAAC;AAEF,KAAK,UAAU,GAAG,YAAY,CAAC;AAI/B,wBAAsB,yCAAyC,CAC7D,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,UAAU,CAAC,CAgBrB"}
@@ -0,0 +1,20 @@
1
+ import type { ChecksummedAddress } from '../types/primitives.js';
2
+ import type { FhevmRuntime } from '../types/coreFhevmRuntime.js';
3
+ import type { HandleContractPair } from '../types/other-p.js';
4
+ type Context = {
5
+ readonly runtime: FhevmRuntime;
6
+ readonly client: NonNullable<object>;
7
+ readonly options: {
8
+ readonly batchRpcCalls: boolean;
9
+ };
10
+ };
11
+ type Parameters = {
12
+ readonly address: ChecksummedAddress;
13
+ readonly delegate: ChecksummedAddress;
14
+ readonly delegator: ChecksummedAddress;
15
+ readonly pairs: readonly HandleContractPair[];
16
+ };
17
+ type ReturnType = boolean[];
18
+ export declare function isHandleDelegatedForUserDecryption(context: Context, parameters: Parameters): Promise<ReturnType>;
19
+ export {};
20
+ //# sourceMappingURL=isHandleDelegatedForUserDecryption-p.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isHandleDelegatedForUserDecryption-p.d.ts","sourceRoot":"","sources":["../../../core/host-contracts/isHandleDelegatedForUserDecryption-p.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAO9D,KAAK,OAAO,GAAG;IACb,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,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ecryptEip712Like } from './kms.js';
3
4
  //# 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"}
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"}
@@ -154,6 +154,27 @@ export type KmsPublicDecryptEip712Message = Readonly<{
154
154
  decryptedResult: BytesHex;
155
155
  extraData: BytesHex;
156
156
  }>;
157
+ export type KmsDecryptEip712Like = {
158
+ readonly domain: {
159
+ readonly name: string;
160
+ readonly version: string;
161
+ readonly chainId: number | bigint;
162
+ readonly verifyingContract: string;
163
+ };
164
+ readonly primaryType?: string | undefined;
165
+ readonly types: Record<string, ReadonlyArray<{
166
+ readonly name: string;
167
+ readonly type: string;
168
+ }>>;
169
+ readonly message: {
170
+ readonly publicKey: string | Uint8Array;
171
+ readonly contractAddresses: string[];
172
+ readonly startTimestamp: number;
173
+ readonly durationDays: number;
174
+ readonly extraData: string | Uint8Array;
175
+ readonly delegatorAddress?: string | undefined;
176
+ };
177
+ };
157
178
  export type KmsUserDecryptEip712 = Prettify<{
158
179
  readonly domain: KmsEip712Domain;
159
180
  readonly types: KmsUserDecryptEip712Types;
@@ -1 +1 @@
1
- {"version":3,"file":"kms.d.ts","sourceRoot":"","sources":["../../../core/types/kms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE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AC;IAC5C,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,2BAA2B,CAAC;IAC5C,QAAQ,CAAC,WAAW,EAAE,2BAA2B,CAAC;IAClD,QAAQ,CAAC,OAAO,EAAE,6BAA6B,CAAC;CACjD,CAAC,CAAC;AAQH,MAAM,CAAC,OAAO,CAAC,MAAM,yBAAyB,EAAE,OAAO,MAAM,CAAC;AAC9D,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,CAAC,yBAAyB,CAAC,EAAE,KAAK,CAAC;CAC7C"}
package/core/_version.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  // This file is auto-generated
2
- export const version: string = '1.0.0-alpha.2';
2
+ export const version: string = '1.0.0-alpha.3';
3
3
  export const sdkName: string = '@fhevm/sdk';
@@ -2,14 +2,18 @@ import type { Fhevm } from '../../types/coreFhevmClient.js';
2
2
  import type { FhevmChain } from '../../types/fhevmChain.js';
3
3
  import type { SignedDecryptionPermit } from '../../types/signedDecryptionPermit.js';
4
4
  import type { TransportKeypair } from '../../kms/TransportKeypair-p.js';
5
- import type { SerializeSignedDecryptionPermitReturnType } from './serializeSignedDecryptionPermit.js';
5
+ import type { KmsDecryptEip712Like } from '../../types/kms.js';
6
6
  import { parseSignedDecryptionPermit as parseSignedDecryptionPermit_ } from '../../kms/SignedDecryptionPermit-p.js';
7
7
 
8
8
  ////////////////////////////////////////////////////////////////////////////////
9
9
 
10
10
  export type ParseSignedDecryptionPermitParameters = {
11
11
  /** The serialized permit — a previously parsed permit object. */
12
- readonly serializedPermit: SerializeSignedDecryptionPermitReturnType;
12
+ readonly serializedPermit: {
13
+ readonly eip712: KmsDecryptEip712Like;
14
+ readonly signature: string;
15
+ readonly signerAddress: string;
16
+ };
13
17
  /** The transport keypair that was used when signing the permit. */
14
18
  readonly transportKeypair: TransportKeypair;
15
19
  };
@@ -1,32 +1,36 @@
1
1
  import type { Fhevm } from '../../types/coreFhevmClient.js';
2
- import type { ChecksummedAddress, Uint64BigInt } from '../../types/primitives.js';
3
- import { isUint64 } from '../../base/uint.js';
4
- import { getUserDecryptionDelegationExpirationDateAbi } from '../../host-contracts/abi-fragments/fragments.js';
5
- import { getTrustedClient } from '../../runtime/CoreFhevm-p.js';
2
+ import type { Uint64BigInt } from '../../types/primitives.js';
3
+ import { addressToChecksummedAddress, assertIsAddress } from '../../base/address.js';
4
+ import { getUserDecryptionDelegationExpirationDate as getUserDecryptionDelegationExpirationDate_ } from '../../host-contracts/getUserDecryptionDelegationExpirationDate.js';
5
+
6
+ ////////////////////////////////////////////////////////////////////////////////
6
7
 
7
8
  export type GetUserDecryptionDelegationExpirationDateParameters = {
8
- readonly address: ChecksummedAddress;
9
+ readonly address: string;
10
+ readonly delegator: string;
11
+ readonly delegate: string;
12
+ readonly contractAddress: string;
9
13
  };
10
14
 
11
15
  export type GetUserDecryptionDelegationExpirationDateReturnType = Uint64BigInt;
12
16
 
17
+ ////////////////////////////////////////////////////////////////////////////////
18
+
13
19
  export async function getUserDecryptionDelegationExpirationDate(
14
20
  fhevm: Fhevm,
15
21
  parameters: GetUserDecryptionDelegationExpirationDateParameters,
16
22
  ): Promise<GetUserDecryptionDelegationExpirationDateReturnType> {
17
- const trustedClient = getTrustedClient(fhevm);
18
- const address = parameters.address;
23
+ const { address, delegate, delegator, contractAddress } = parameters;
19
24
 
20
- const res = await fhevm.runtime.ethereum.readContract(trustedClient, {
21
- address: address,
22
- abi: getUserDecryptionDelegationExpirationDateAbi,
23
- args: [],
24
- functionName: getUserDecryptionDelegationExpirationDateAbi[0].name,
25
- });
25
+ assertIsAddress(address, {});
26
+ assertIsAddress(delegate, {});
27
+ assertIsAddress(delegator, {});
28
+ assertIsAddress(contractAddress, {});
26
29
 
27
- if (!isUint64(res)) {
28
- throw new Error(`Invalid expiration date.`);
29
- }
30
-
31
- return BigInt(res) as Uint64BigInt;
30
+ return getUserDecryptionDelegationExpirationDate_(fhevm, {
31
+ address: addressToChecksummedAddress(address),
32
+ delegate: addressToChecksummedAddress(delegate),
33
+ delegator: addressToChecksummedAddress(delegator),
34
+ contractAddress: addressToChecksummedAddress(contractAddress),
35
+ });
32
36
  }
@@ -0,0 +1,114 @@
1
+ import type { FhevmRuntime } from '../types/coreFhevmRuntime.js';
2
+ import type { Handle } from '../types/encryptedTypes-p.js';
3
+ import type { ChecksummedAddress } from '../types/primitives.js';
4
+ import type { HandleContractPair } from '../types/other-p.js';
5
+ import { AclUserDecryptionError } from '../errors/AclError.js';
6
+ import { isHandleDelegatedForUserDecryption } from './isHandleDelegatedForUserDecryption-p.js';
7
+
8
+ ////////////////////////////////////////////////////////////////////////////////
9
+
10
+ type Context = {
11
+ readonly runtime: FhevmRuntime;
12
+ readonly client: NonNullable<object>;
13
+ readonly options: { readonly batchRpcCalls: boolean };
14
+ };
15
+
16
+ type Parameters = {
17
+ readonly address: ChecksummedAddress;
18
+ readonly delegator: ChecksummedAddress;
19
+ readonly delegate: ChecksummedAddress;
20
+ readonly handleContractPairs: ReadonlyArray<{
21
+ readonly handle: Handle;
22
+ readonly contractAddress: ChecksummedAddress;
23
+ }>;
24
+ };
25
+
26
+ ////////////////////////////////////////////////////////////////////////////////
27
+
28
+ export async function checkDelegation(context: Context, parameters: Parameters): Promise<void> {
29
+ const { address, delegator, delegate, handleContractPairs } = parameters;
30
+
31
+ if (handleContractPairs.length === 0) {
32
+ throw new Error('checkDelegation requires at least one (handle, contractAddress) pair');
33
+ }
34
+
35
+ // runtime defensive check, use lowercase
36
+ function getKey(addr: string, handleBytes32Hex: string): string {
37
+ return `${addr}:${handleBytes32Hex}`.toLowerCase();
38
+ }
39
+
40
+ // 1. Verify rule: delegator !== delegate
41
+ if (delegator.toLowerCase() === delegate.toLowerCase()) {
42
+ throw new AclUserDecryptionError({
43
+ contractAddress: address,
44
+ message: `delegator ${delegator} cannot be equal to delegate`,
45
+ });
46
+ }
47
+
48
+ // 2. Verify rules: delegator !== contractAddress & delegate !== contractAddress
49
+ for (const pair of handleContractPairs) {
50
+ if (delegator.toLowerCase() === pair.contractAddress.toLowerCase()) {
51
+ throw new AclUserDecryptionError({
52
+ contractAddress: address,
53
+ message: `delegator ${delegator} cannot be equal to contractAddress`,
54
+ });
55
+ }
56
+ if (delegate.toLowerCase() === pair.contractAddress.toLowerCase()) {
57
+ throw new AclUserDecryptionError({
58
+ contractAddress: address,
59
+ message: `delegate ${delegate} cannot be equal to contractAddress`,
60
+ });
61
+ }
62
+ }
63
+
64
+ // 3. Collect all unique (contractAddress, handle) pairs to avoid duplicate RPC calls
65
+ const allChecks: HandleContractPair[] = [];
66
+ const seenKeys = new Set<string>();
67
+
68
+ for (const pair of handleContractPairs) {
69
+ // runtime defensive check, use lowercase
70
+ const key = getKey(pair.contractAddress, pair.handle.bytes32Hex);
71
+ if (!seenKeys.has(key)) {
72
+ seenKeys.add(key);
73
+ allChecks.push({
74
+ handle: pair.handle,
75
+ contractAddress: pair.contractAddress,
76
+ });
77
+ }
78
+ }
79
+
80
+ if (allChecks.length === 0) {
81
+ throw new Error('checkDelegation: no delegation checks to perform (unexpected empty dedup result)');
82
+ }
83
+
84
+ // 4. Single batched RPC call for all unique checks
85
+ const allResults = await isHandleDelegatedForUserDecryption(context, {
86
+ address,
87
+ delegator,
88
+ delegate,
89
+ pairs: allChecks,
90
+ });
91
+
92
+ // 5. Build result map for lookup
93
+ const resultMap = new Map<string, boolean>();
94
+ for (const [i, check] of allChecks.entries()) {
95
+ const result = allResults[i];
96
+ // tsc: noUncheckedIndexedAccess
97
+ if (result === undefined) {
98
+ throw new Error(`Missing result at index ${i}`);
99
+ }
100
+ const key = getKey(check.contractAddress, check.handle.bytes32Hex);
101
+ resultMap.set(key, result);
102
+ }
103
+
104
+ // 6. Verify delegation for each requested pair
105
+ for (const pair of handleContractPairs) {
106
+ const key = getKey(pair.contractAddress, pair.handle.bytes32Hex);
107
+ if (resultMap.get(key) !== true) {
108
+ throw new AclUserDecryptionError({
109
+ contractAddress: address,
110
+ message: `Delegate ${delegate} is not delegated by ${delegator} to user decrypt handle ${pair.handle.bytes32Hex} on contract ${pair.contractAddress}!`,
111
+ });
112
+ }
113
+ }
114
+ }
@@ -0,0 +1,45 @@
1
+ import type { FhevmRuntime } from '../types/coreFhevmRuntime.js';
2
+ import type { ChecksummedAddress, Uint64BigInt } from '../types/primitives.js';
3
+ import { isUint64 } from '../base/uint.js';
4
+ import { getUserDecryptionDelegationExpirationDateAbi } from '../host-contracts/abi-fragments/fragments.js';
5
+ import { getTrustedClient } from '../runtime/CoreFhevm-p.js';
6
+
7
+ ////////////////////////////////////////////////////////////////////////////////
8
+
9
+ type Context = {
10
+ readonly runtime: FhevmRuntime;
11
+ readonly client: NonNullable<object>;
12
+ readonly options: { readonly batchRpcCalls: boolean };
13
+ };
14
+
15
+ type Parameters = {
16
+ readonly address: ChecksummedAddress;
17
+ readonly delegator: ChecksummedAddress;
18
+ readonly delegate: ChecksummedAddress;
19
+ readonly contractAddress: ChecksummedAddress;
20
+ };
21
+
22
+ type ReturnType = Uint64BigInt;
23
+
24
+ ////////////////////////////////////////////////////////////////////////////////
25
+
26
+ export async function getUserDecryptionDelegationExpirationDate(
27
+ context: Context,
28
+ parameters: Parameters,
29
+ ): Promise<ReturnType> {
30
+ const trustedClient = getTrustedClient(context);
31
+ const address = parameters.address;
32
+
33
+ const res = await context.runtime.ethereum.readContract(trustedClient, {
34
+ address: address,
35
+ abi: getUserDecryptionDelegationExpirationDateAbi,
36
+ args: [parameters.delegator, parameters.delegate, parameters.contractAddress],
37
+ functionName: getUserDecryptionDelegationExpirationDateAbi[0].name,
38
+ });
39
+
40
+ if (!isUint64(res)) {
41
+ throw new Error(`Invalid expiration date.`);
42
+ }
43
+
44
+ return BigInt(res) as Uint64BigInt;
45
+ }
@@ -0,0 +1,77 @@
1
+ import type { ChecksummedAddress } from '../types/primitives.js';
2
+ import type { FhevmRuntime } from '../types/coreFhevmRuntime.js';
3
+ import type { Handle } from '../types/encryptedTypes-p.js';
4
+ import type { HandleContractPair } from '../types/other-p.js';
5
+ import { isHandleDelegatedForUserDecryptionAbi } from './abi-fragments/fragments.js';
6
+ import { getTrustedClient } from '../runtime/CoreFhevm-p.js';
7
+ import { executeWithBatching } from '../base/promise.js';
8
+
9
+ ////////////////////////////////////////////////////////////////////////////////
10
+
11
+ type Context = {
12
+ readonly runtime: FhevmRuntime;
13
+ readonly client: NonNullable<object>;
14
+ readonly options: { readonly batchRpcCalls: boolean };
15
+ };
16
+
17
+ type Parameters = {
18
+ readonly address: ChecksummedAddress;
19
+ readonly delegate: ChecksummedAddress;
20
+ readonly delegator: ChecksummedAddress;
21
+ readonly pairs: readonly HandleContractPair[];
22
+ };
23
+
24
+ type ReturnType = boolean[];
25
+
26
+ ////////////////////////////////////////////////////////////////////////////////
27
+
28
+ export async function isHandleDelegatedForUserDecryption(
29
+ context: Context,
30
+ parameters: Parameters,
31
+ ): Promise<ReturnType> {
32
+ const { address, delegate, delegator, pairs } = parameters;
33
+
34
+ const rpcCalls = pairs.map(
35
+ (pair) => () =>
36
+ _isHandleDelegatedForUserDecryption(context, {
37
+ address,
38
+ delegate,
39
+ delegator,
40
+ handle: pair.handle,
41
+ contractAddress: pair.contractAddress,
42
+ }),
43
+ );
44
+
45
+ const results = await executeWithBatching(rpcCalls, context.options.batchRpcCalls);
46
+
47
+ return results;
48
+ }
49
+
50
+ ////////////////////////////////////////////////////////////////////////////////
51
+
52
+ async function _isHandleDelegatedForUserDecryption(
53
+ context: Context,
54
+ parameters: {
55
+ readonly address: ChecksummedAddress;
56
+ readonly delegator: ChecksummedAddress;
57
+ readonly delegate: ChecksummedAddress;
58
+ readonly contractAddress: ChecksummedAddress;
59
+ readonly handle: Handle;
60
+ },
61
+ ): Promise<boolean> {
62
+ const { address, delegator, delegate, contractAddress, handle } = parameters;
63
+ const trustedClient = getTrustedClient(context);
64
+
65
+ const res = await context.runtime.ethereum.readContract(trustedClient, {
66
+ address: address,
67
+ abi: isHandleDelegatedForUserDecryptionAbi,
68
+ args: [delegator, delegate, contractAddress, handle.bytes32Hex],
69
+ functionName: isHandleDelegatedForUserDecryptionAbi[0].name,
70
+ });
71
+
72
+ if (typeof res !== 'boolean') {
73
+ throw new Error(`Invalid isHandleDelegatedForUserDecryptionAbi result.`);
74
+ }
75
+
76
+ return res;
77
+ }
@@ -61,7 +61,7 @@ async function _persistAllowed(
61
61
  });
62
62
 
63
63
  if (typeof res !== 'boolean') {
64
- throw new Error(`Invalid isAllowedForDecryption result.`);
64
+ throw new Error(`Invalid persistAllowed result.`);
65
65
  }
66
66
 
67
67
  return res;
@@ -15,6 +15,7 @@ import { assertKmsDecryptionBitLimit } from './utils.js';
15
15
  import { checkPersistAllowed } from '../host-contracts/checkPersistAllowed.js';
16
16
  import { assertExtraDataMatchesKmsSingersContext } from '../host-contracts/KmsSignersContext-p.js';
17
17
  import { createKmsEip712Domain } from './createKmsEip712Domain.js';
18
+ import { checkDelegation } from '../host-contracts/checkDelegation.js';
18
19
 
19
20
  /*
20
21
  See: in KMS (eip712Domain)
@@ -118,11 +119,20 @@ export async function fetchKmsSignedcryptedShares(context: Context, parameters:
118
119
  signedPermit.assertNotExpired();
119
120
 
120
121
  // 7. Check: ACL permissions (user is signer or delegatorAddress)
121
- await checkPersistAllowed(context, {
122
- address: context.chain.fhevm.contracts.acl.address as ChecksummedAddress,
123
- userAddress: encryptedDataOwnerAddress,
124
- handleContractPairs,
125
- });
122
+ if (signedPermit.isDelegated) {
123
+ await checkDelegation(context, {
124
+ address: context.chain.fhevm.contracts.acl.address as ChecksummedAddress,
125
+ delegate: signerAddress,
126
+ delegator: encryptedDataOwnerAddress,
127
+ handleContractPairs,
128
+ });
129
+ } else {
130
+ await checkPersistAllowed(context, {
131
+ address: context.chain.fhevm.contracts.acl.address as ChecksummedAddress,
132
+ userAddress: encryptedDataOwnerAddress,
133
+ handleContractPairs,
134
+ });
135
+ }
126
136
 
127
137
  // 8. Verify the EIP712 signature
128
138
  // Not required because a signedPermit is guaranteed to be verified.
@@ -1,2 +1,3 @@
1
1
  export type { TypedValue } from './primitives.js';
2
2
  export type { EncryptedValue, EncryptedValueLike } from './encryptedTypes.js';
3
+ export type { KmsDecryptEip712Like } from './kms.js';
package/core/types/kms.ts CHANGED
@@ -99,6 +99,25 @@ export type KmsPublicDecryptEip712Message = Readonly<{
99
99
  extraData: BytesHex;
100
100
  }>;
101
101
 
102
+ export type KmsDecryptEip712Like = {
103
+ readonly domain: {
104
+ readonly name: string;
105
+ readonly version: string;
106
+ readonly chainId: number | bigint;
107
+ readonly verifyingContract: string;
108
+ };
109
+ readonly primaryType?: string | undefined;
110
+ readonly types: Record<string, ReadonlyArray<{ readonly name: string; readonly type: string }>>;
111
+ readonly message: {
112
+ readonly publicKey: string | Uint8Array;
113
+ readonly contractAddresses: string[];
114
+ readonly startTimestamp: number;
115
+ readonly durationDays: number;
116
+ readonly extraData: string | Uint8Array;
117
+ readonly delegatorAddress?: string | undefined;
118
+ };
119
+ };
120
+
102
121
  export type KmsUserDecryptEip712 = Prettify<{
103
122
  readonly domain: KmsEip712Domain;
104
123
  readonly types: KmsUserDecryptEip712Types;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fhevm/sdk",
3
3
  "description": "TypeScript Interface for FHEVM",
4
- "version": "1.0.0-alpha.2",
4
+ "version": "1.0.0-alpha.3",
5
5
  "type": "module",
6
6
  "main": "./_cjs/index.js",
7
7
  "module": "./_esm/index.js",