@inco/js 0.8.0-devnet-28 → 0.8.0-devnet-30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/advancedacl/session-key.d.ts +4 -4
- package/dist/cjs/advancedacl/session-key.js +4 -3
- package/dist/cjs/attestedcompute/attested-compute.d.ts +0 -1
- package/dist/cjs/attestedcompute/attested-compute.js +7 -8
- package/dist/cjs/attesteddecrypt/attested-decrypt.d.ts +3 -4
- package/dist/cjs/attesteddecrypt/attested-decrypt.js +8 -60
- package/dist/cjs/attestedreveal/attested-reveal.d.ts +3 -4
- package/dist/cjs/attestedreveal/attested-reveal.js +2 -9
- package/dist/cjs/chain.d.ts +6 -0
- package/dist/cjs/chain.js +15 -2
- package/dist/cjs/eip712/eip712.d.ts +18 -0
- package/dist/cjs/eip712/eip712.js +51 -0
- package/dist/cjs/eip712/index.d.ts +1 -0
- package/dist/cjs/eip712/index.js +8 -0
- package/dist/cjs/elistattesteddecrypt/elist-attested-decrypt.d.ts +49 -0
- package/dist/cjs/elistattesteddecrypt/elist-attested-decrypt.js +94 -0
- package/dist/cjs/elistattesteddecrypt/index.d.ts +2 -0
- package/dist/cjs/elistattesteddecrypt/index.js +22 -0
- package/dist/cjs/elistattesteddecrypt/types.d.ts +31 -0
- package/dist/cjs/elistattesteddecrypt/types.js +16 -0
- package/dist/cjs/generated/abis/lightning.d.ts +0 -39
- package/dist/cjs/generated/abis/lightning.js +1 -39
- package/dist/cjs/generated/abis/test-elist.d.ts +6 -0
- package/dist/cjs/generated/abis/test-elist.js +8 -1
- package/dist/cjs/generated/es/inco/covalidator/compute/v1/server_pb.d.ts +18 -36
- package/dist/cjs/generated/es/inco/covalidator/compute/v1/server_pb.js +35 -40
- package/dist/cjs/generated/es/inco/kms/lite/v1/kms_service_pb.d.ts +16 -0
- package/dist/cjs/generated/es/inco/kms/lite/v1/kms_service_pb.js +2 -2
- package/dist/cjs/generated/lightning.d.ts +29 -0
- package/dist/cjs/generated/lightning.js +30 -1
- package/dist/cjs/generated/local-node.d.ts +5 -5
- package/dist/cjs/generated/local-node.js +16 -6
- package/dist/cjs/handle.d.ts +8 -0
- package/dist/cjs/handle.js +20 -2
- package/dist/cjs/kms/quorumClient.d.ts +17 -4
- package/dist/cjs/kms/quorumClient.js +150 -1
- package/dist/cjs/kms/quorumConsistency.d.ts +25 -1
- package/dist/cjs/kms/quorumConsistency.js +70 -1
- package/dist/cjs/kms/signatureVerification.d.ts +2 -2
- package/dist/cjs/kms/signatureVerification.js +1 -1
- package/dist/cjs/lite/attested-compute.d.ts +2 -2
- package/dist/cjs/lite/attested-compute.js +2 -3
- package/dist/cjs/lite/attested-decrypt.d.ts +2 -2
- package/dist/cjs/lite/attested-decrypt.js +2 -3
- package/dist/cjs/lite/lightning.d.ts +40 -19
- package/dist/cjs/lite/lightning.js +103 -29
- package/dist/cjs/test/mocks.d.ts +5 -1
- package/dist/cjs/test/mocks.js +29 -5
- package/dist/cjs/viem.d.ts +2 -1
- package/dist/cjs/viem.js +1 -1
- package/dist/esm/advancedacl/session-key.d.ts +4 -4
- package/dist/esm/advancedacl/session-key.js +6 -5
- package/dist/esm/attestedcompute/attested-compute.d.ts +0 -1
- package/dist/esm/attestedcompute/attested-compute.js +5 -6
- package/dist/esm/attesteddecrypt/attested-decrypt.d.ts +3 -4
- package/dist/esm/attesteddecrypt/attested-decrypt.js +6 -58
- package/dist/esm/attestedreveal/attested-reveal.d.ts +3 -4
- package/dist/esm/attestedreveal/attested-reveal.js +2 -9
- package/dist/esm/chain.d.ts +6 -0
- package/dist/esm/chain.js +14 -1
- package/dist/esm/eip712/eip712.d.ts +18 -0
- package/dist/esm/eip712/eip712.js +46 -0
- package/dist/esm/eip712/index.d.ts +1 -0
- package/dist/esm/eip712/index.js +2 -0
- package/dist/esm/elistattesteddecrypt/elist-attested-decrypt.d.ts +49 -0
- package/dist/esm/elistattesteddecrypt/elist-attested-decrypt.js +89 -0
- package/dist/esm/elistattesteddecrypt/index.d.ts +2 -0
- package/dist/esm/elistattesteddecrypt/index.js +3 -0
- package/dist/esm/elistattesteddecrypt/types.d.ts +31 -0
- package/dist/esm/elistattesteddecrypt/types.js +12 -0
- package/dist/esm/generated/abis/lightning.d.ts +0 -39
- package/dist/esm/generated/abis/lightning.js +1 -39
- package/dist/esm/generated/abis/test-elist.d.ts +6 -0
- package/dist/esm/generated/abis/test-elist.js +8 -1
- package/dist/esm/generated/es/inco/covalidator/compute/v1/server_pb.d.ts +18 -36
- package/dist/esm/generated/es/inco/covalidator/compute/v1/server_pb.js +34 -39
- package/dist/esm/generated/es/inco/kms/lite/v1/kms_service_pb.d.ts +16 -0
- package/dist/esm/generated/es/inco/kms/lite/v1/kms_service_pb.js +2 -2
- package/dist/esm/generated/lightning.d.ts +29 -0
- package/dist/esm/generated/lightning.js +30 -1
- package/dist/esm/generated/local-node.d.ts +5 -5
- package/dist/esm/generated/local-node.js +16 -6
- package/dist/esm/handle.d.ts +8 -0
- package/dist/esm/handle.js +18 -1
- package/dist/esm/kms/quorumClient.d.ts +17 -4
- package/dist/esm/kms/quorumClient.js +152 -3
- package/dist/esm/kms/quorumConsistency.d.ts +25 -1
- package/dist/esm/kms/quorumConsistency.js +68 -1
- package/dist/esm/kms/signatureVerification.d.ts +2 -2
- package/dist/esm/kms/signatureVerification.js +1 -1
- package/dist/esm/lite/attested-compute.d.ts +2 -2
- package/dist/esm/lite/attested-compute.js +3 -3
- package/dist/esm/lite/attested-decrypt.d.ts +2 -2
- package/dist/esm/lite/attested-decrypt.js +3 -3
- package/dist/esm/lite/lightning.d.ts +40 -19
- package/dist/esm/lite/lightning.js +104 -30
- package/dist/esm/test/mocks.d.ts +5 -1
- package/dist/esm/test/mocks.js +28 -6
- package/dist/esm/viem.d.ts +2 -1
- package/dist/esm/viem.js +1 -1
- package/dist/types/advancedacl/session-key.d.ts +4 -4
- package/dist/types/attestedcompute/attested-compute.d.ts +0 -1
- package/dist/types/attesteddecrypt/attested-decrypt.d.ts +3 -4
- package/dist/types/attestedreveal/attested-reveal.d.ts +3 -4
- package/dist/types/chain.d.ts +6 -0
- package/dist/types/eip712/eip712.d.ts +18 -0
- package/dist/types/eip712/index.d.ts +1 -0
- package/dist/types/elistattesteddecrypt/elist-attested-decrypt.d.ts +49 -0
- package/dist/types/elistattesteddecrypt/index.d.ts +2 -0
- package/dist/types/elistattesteddecrypt/types.d.ts +31 -0
- package/dist/types/generated/abis/lightning.d.ts +0 -39
- package/dist/types/generated/abis/test-elist.d.ts +6 -0
- package/dist/types/generated/es/inco/covalidator/compute/v1/server_pb.d.ts +18 -36
- package/dist/types/generated/es/inco/kms/lite/v1/kms_service_pb.d.ts +16 -0
- package/dist/types/generated/lightning.d.ts +29 -0
- package/dist/types/generated/local-node.d.ts +5 -5
- package/dist/types/handle.d.ts +8 -0
- package/dist/types/kms/quorumClient.d.ts +17 -4
- package/dist/types/kms/quorumConsistency.d.ts +25 -1
- package/dist/types/kms/signatureVerification.d.ts +2 -2
- package/dist/types/lite/attested-compute.d.ts +2 -2
- package/dist/types/lite/attested-decrypt.d.ts +2 -2
- package/dist/types/lite/lightning.d.ts +40 -19
- package/dist/types/test/mocks.d.ts +5 -1
- package/dist/types/viem.d.ts +2 -1
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ export declare const localNodeLightningConfig: {
|
|
|
4
4
|
readonly chainId: 31337;
|
|
5
5
|
readonly covalidatorUrls: readonly ["http://localhost:50055"];
|
|
6
6
|
readonly signers: readonly ["0xa3968E59A2659F33CB8deFEFa713512C800fbc77"];
|
|
7
|
-
readonly
|
|
7
|
+
readonly hostChainRpcUrls: readonly ["http://localhost:8545"];
|
|
8
8
|
readonly senderPrivateKey: "0xde4526e9059cddb3eb8511fcefc2daa1dcaf2475ec76ff6ae63bfc7eb3405a1b";
|
|
9
9
|
};
|
|
10
10
|
readonly testnet: {
|
|
@@ -12,7 +12,7 @@ export declare const localNodeLightningConfig: {
|
|
|
12
12
|
readonly chainId: 31337;
|
|
13
13
|
readonly covalidatorUrls: readonly ["http://localhost:50055"];
|
|
14
14
|
readonly signers: readonly ["0x8586714c02340Dc28935977d8E864f1F8E1c30B2"];
|
|
15
|
-
readonly
|
|
15
|
+
readonly hostChainRpcUrls: readonly ["http://localhost:8545"];
|
|
16
16
|
readonly senderPrivateKey: "0x3ff395b755c4dc09837d0672dd421915e9b9835a4733edf63d8fd12b3fe4475c";
|
|
17
17
|
};
|
|
18
18
|
readonly devnet: {
|
|
@@ -20,7 +20,7 @@ export declare const localNodeLightningConfig: {
|
|
|
20
20
|
readonly chainId: 31337;
|
|
21
21
|
readonly covalidatorUrls: readonly ["http://localhost:50055"];
|
|
22
22
|
readonly signers: readonly ["0xD413DF212d2aeDf4F66241441c018Ce71a2119F1"];
|
|
23
|
-
readonly
|
|
23
|
+
readonly hostChainRpcUrls: readonly ["http://localhost:8545"];
|
|
24
24
|
readonly senderPrivateKey: "0x5683b966233cfbb5e8355f45cdb5fca9d6c713701909d01086cb85276fb9f474";
|
|
25
25
|
};
|
|
26
26
|
readonly alphanet: {
|
|
@@ -28,7 +28,7 @@ export declare const localNodeLightningConfig: {
|
|
|
28
28
|
readonly chainId: 31337;
|
|
29
29
|
readonly covalidatorUrls: readonly ["http://localhost:50055"];
|
|
30
30
|
readonly signers: readonly ["0x8E873085348a3406A07907E5d1465B9824bA07cd"];
|
|
31
|
-
readonly
|
|
31
|
+
readonly hostChainRpcUrls: readonly ["http://localhost:8545"];
|
|
32
32
|
readonly senderPrivateKey: "0x279c172cf3638a79642daa5f7666c600befde318550d7579cf96280920e318b6";
|
|
33
33
|
};
|
|
34
34
|
readonly scratch: {
|
|
@@ -36,7 +36,7 @@ export declare const localNodeLightningConfig: {
|
|
|
36
36
|
readonly chainId: 31337;
|
|
37
37
|
readonly covalidatorUrls: readonly ["http://localhost:50055"];
|
|
38
38
|
readonly signers: readonly ["0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"];
|
|
39
|
-
readonly
|
|
39
|
+
readonly hostChainRpcUrls: readonly ["http://127.0.0.1:8567"];
|
|
40
40
|
readonly senderPrivateKey: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80";
|
|
41
41
|
};
|
|
42
42
|
};
|
package/dist/types/handle.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Schema } from 'effect';
|
|
|
2
2
|
import { HexString } from './binary.js';
|
|
3
3
|
/** Current handle version byte, appended as the last byte of every handle. */
|
|
4
4
|
export declare const HANDLE_VERSION = 0;
|
|
5
|
+
export declare const BYTE_ELIST_ELEMENT_TYPE_INDEX = 29;
|
|
5
6
|
/**
|
|
6
7
|
* Map of ENCRYPTION type names to their integer identifiers (matching tfhe-rs `FheType`).
|
|
7
8
|
*
|
|
@@ -75,6 +76,13 @@ export declare function validateHandle(handle: HexString): void;
|
|
|
75
76
|
* @see {@link https://github.com/Inco-fhevm/inco-monorepo/blob/636756f512ae16535bdcb9a43df76bf14fbd6ba7/pkg/fhe/handle.md Handle format spec}
|
|
76
77
|
*/
|
|
77
78
|
export declare function getHandleType(handle: HexString): FheType;
|
|
79
|
+
/**
|
|
80
|
+
* Extracts the elist element {@link FheType} from byte 29 of a validated handle.
|
|
81
|
+
* @param handle - A 32-byte hex handle string for an elist.
|
|
82
|
+
* @returns The ENCRYPTION type identifier of the elist elements.
|
|
83
|
+
* @throws If the handle is malformed or contains an invalid ENCRYPTION type at byte 29.
|
|
84
|
+
*/
|
|
85
|
+
export declare function getEListElementType(handle: HexString): FheType;
|
|
78
86
|
/**
|
|
79
87
|
* Computes the prehandle hash for an input based on the ciphertext
|
|
80
88
|
*
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Address } from 'viem';
|
|
2
2
|
import type { DecryptionAttestation, EncryptedDecryptionAttestation } from '../attesteddecrypt/types.js';
|
|
3
|
+
import { type EListDecryptionAttestation, type EncryptedEListDecryptionAttestation } from '../elistattesteddecrypt/types.js';
|
|
3
4
|
import type { EncryptionScheme, SupportedFheType } from '../encryption/encryption.js';
|
|
4
|
-
import type { AttestedComputeRequest, AttestedDecryptRequest, AttestedRevealRequest } from '../generated/es/inco/kms/lite/v1/kms_service_pb.js';
|
|
5
|
-
import type
|
|
5
|
+
import type { AttestedComputeRequest, AttestedDecryptRequest, AttestedRevealRequest, EListAttestedDecryptRequest, EListAttestedRevealRequest } from '../generated/es/inco/kms/lite/v1/kms_service_pb.js';
|
|
6
|
+
import { type XwingKeypair } from '../lite/xwing.js';
|
|
6
7
|
import type { BackoffConfig } from '../retry.js';
|
|
7
8
|
import { type KmsClient } from './client.js';
|
|
8
|
-
import type { ViemClient } from '
|
|
9
|
+
import type { ViemClient } from '../viem.js';
|
|
9
10
|
export declare class KmsQuorumClient {
|
|
10
11
|
private readonly kmss;
|
|
11
12
|
private readonly threshold;
|
|
@@ -33,6 +34,8 @@ export declare class KmsQuorumClient {
|
|
|
33
34
|
attestedDecrypt(request: AttestedDecryptRequest, backoffConfig?: Partial<BackoffConfig>, reencryptKeypair?: XwingKeypair, executorAddress?: Address, client?: ViemClient): Promise<(DecryptionAttestation<EncryptionScheme, SupportedFheType> | EncryptedDecryptionAttestation<EncryptionScheme, SupportedFheType>)[]>;
|
|
34
35
|
attestedCompute(request: AttestedComputeRequest, backoffConfig?: Partial<BackoffConfig>, reencryptKeypair?: XwingKeypair, executorAddress?: Address, client?: ViemClient): Promise<DecryptionAttestation<EncryptionScheme, SupportedFheType> | EncryptedDecryptionAttestation<EncryptionScheme, SupportedFheType>>;
|
|
35
36
|
attestedReveal(request: AttestedRevealRequest, backoffConfig?: Partial<BackoffConfig>, executorAddress?: Address, client?: ViemClient): Promise<(DecryptionAttestation<EncryptionScheme, SupportedFheType> | EncryptedDecryptionAttestation<EncryptionScheme, SupportedFheType>)[]>;
|
|
37
|
+
eListAttestedDecrypt(request: EListAttestedDecryptRequest, backoffConfig?: Partial<BackoffConfig>, reencryptKeypair?: XwingKeypair, executorAddress?: Address, client?: ViemClient): Promise<EListDecryptionAttestation<EncryptionScheme, SupportedFheType> | EncryptedEListDecryptionAttestation<EncryptionScheme, SupportedFheType>>;
|
|
38
|
+
eListAttestedReveal(request: EListAttestedRevealRequest, backoffConfig?: Partial<BackoffConfig>, executorAddress?: Address, client?: ViemClient): Promise<EListDecryptionAttestation<EncryptionScheme, SupportedFheType>>;
|
|
36
39
|
/**
|
|
37
40
|
* Generic method to execute a KMS operation across all clients with retry and threshold logic.
|
|
38
41
|
* Returns results with both the response and signer address.
|
|
@@ -49,4 +52,14 @@ export declare class KmsQuorumClient {
|
|
|
49
52
|
private buildPlaintextAttestation;
|
|
50
53
|
private buildAggregatedAttestations;
|
|
51
54
|
private buildAggregatedComputeAttestation;
|
|
55
|
+
private buildAggregatedEListAttestation;
|
|
56
|
+
/**
|
|
57
|
+
* Verifies proof hashes at two levels:
|
|
58
|
+
* 1. Aggregate: keccak256(concat(proofHashes)) must equal the attested commitmentProof
|
|
59
|
+
* 2. Per-element:
|
|
60
|
+
* - For plaintext (reveal): proofHash[i] = keccak256(value[i])
|
|
61
|
+
* - For reencryption (decrypt): proofHash[i] = keccak256(commitment[i] || plaintext[i])
|
|
62
|
+
* — requires reencryptKeypair to decrypt the ciphertext first.
|
|
63
|
+
*/
|
|
64
|
+
private verifyElementProofHashes;
|
|
52
65
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Address } from 'viem';
|
|
2
|
-
import type { AttestedComputeRequest, AttestedComputeResponse, AttestedDecryptResponse, AttestedRevealResponse, DecryptionAttestation as ProtoDecryptionAttestation } from '../generated/es/inco/kms/lite/v1/kms_service_pb.js';
|
|
2
|
+
import type { AttestedComputeRequest, AttestedComputeResponse, AttestedDecryptResponse, AttestedRevealResponse, EListAttestedDecryptResponse, EListAttestedRevealResponse, DecryptionAttestation as ProtoDecryptionAttestation } from '../generated/es/inco/kms/lite/v1/kms_service_pb.js';
|
|
3
3
|
import type { XwingKeypair } from '../lite/xwing.js';
|
|
4
4
|
/**
|
|
5
5
|
* Computes a canonical key for a single attestation.
|
|
@@ -43,6 +43,29 @@ export declare function verifyDecryptResponseConsistency<T extends AttestedDecry
|
|
|
43
43
|
signer: Address;
|
|
44
44
|
}>;
|
|
45
45
|
}>;
|
|
46
|
+
type EListResponse = EListAttestedDecryptResponse | EListAttestedRevealResponse;
|
|
47
|
+
/**
|
|
48
|
+
* Validates that all elist responses in a winning bucket have the same
|
|
49
|
+
* number of values and matching indices.
|
|
50
|
+
*/
|
|
51
|
+
export declare function validateEListResponseStructure<T extends EListResponse>(bucket: Array<{
|
|
52
|
+
response: T;
|
|
53
|
+
signer: Address;
|
|
54
|
+
}>): void;
|
|
55
|
+
/**
|
|
56
|
+
* Verifies elist response consistency using hash-bucket voting.
|
|
57
|
+
* Works for both EListAttestedDecryptResponse and EListAttestedRevealResponse.
|
|
58
|
+
*/
|
|
59
|
+
export declare function verifyEListResponseConsistency<T extends EListResponse>(allResults: Array<{
|
|
60
|
+
response: T;
|
|
61
|
+
signer: Address;
|
|
62
|
+
}>, threshold: number, reencryptKeypair?: XwingKeypair): Promise<{
|
|
63
|
+
reference: T;
|
|
64
|
+
winningResults: Array<{
|
|
65
|
+
response: T;
|
|
66
|
+
signer: Address;
|
|
67
|
+
}>;
|
|
68
|
+
}>;
|
|
46
69
|
/**
|
|
47
70
|
* Verifies compute response consistency using hash-bucket voting.
|
|
48
71
|
*/
|
|
@@ -56,3 +79,4 @@ export declare function verifyComputeResponseConsistency(allResults: Array<{
|
|
|
56
79
|
signer: Address;
|
|
57
80
|
}>;
|
|
58
81
|
}>;
|
|
82
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { Address } from 'viem';
|
|
2
|
+
import { ViemClient } from '../viem.js';
|
|
3
3
|
/**
|
|
4
4
|
* Verifies covalidator signatures for a plaintext DecryptionAttestation
|
|
5
5
|
* by calling `isValidDecryptionAttestation` on the IncoVerifier contract.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ATTESTED_COMPUTE_DOMAIN_NAME,
|
|
1
|
+
import { ATTESTED_COMPUTE_DOMAIN_NAME, type IncoLiteAttestedComputeArgs } from '../attestedcompute/attested-compute.js';
|
|
2
2
|
import type { AttestedCompute, AttestedComputeFnArgs } from '../attestedcompute/types.js';
|
|
3
3
|
import { AttestedComputeSupportedOps } from '../attestedcompute/types.js';
|
|
4
4
|
import type { AttestedDecryptFnArgs } from '../attesteddecrypt/types.js';
|
|
5
|
-
export { ATTESTED_COMPUTE_DOMAIN_NAME, AttestedComputeSupportedOps
|
|
5
|
+
export { ATTESTED_COMPUTE_DOMAIN_NAME, AttestedComputeSupportedOps };
|
|
6
6
|
export type { AttestedCompute, AttestedComputeFnArgs, AttestedDecryptFnArgs, IncoLiteAttestedComputeArgs, };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type IncoLiteAttestedDecryptorArgs } from '../attesteddecrypt/attested-decrypt.js';
|
|
2
2
|
export type { IncoLiteAttestedDecryptorArgs };
|
|
3
|
-
import { ATTESTED_DECRYPT_DOMAIN_NAME
|
|
4
|
-
export { ATTESTED_DECRYPT_DOMAIN_NAME
|
|
3
|
+
import { ATTESTED_DECRYPT_DOMAIN_NAME } from '../attesteddecrypt/attested-decrypt.js';
|
|
4
|
+
export { ATTESTED_DECRYPT_DOMAIN_NAME };
|
|
@@ -4,6 +4,7 @@ import { AllowanceVoucherWithSig } from '../advancedacl/types.js';
|
|
|
4
4
|
import { AttestedComputeOP } from '../attestedcompute/types.js';
|
|
5
5
|
import { DecryptionAttestation, EncryptedDecryptionAttestation } from '../attesteddecrypt/index.js';
|
|
6
6
|
import { Address, HexString } from '../binary.js';
|
|
7
|
+
import { EListDecryptionAttestation, EncryptedEListDecryptionAttestation } from '../elistattesteddecrypt/index.js';
|
|
7
8
|
import { EncryptionScheme, SupportedFheType } from '../encryption/encryption.js';
|
|
8
9
|
import { incoVerifierAbi } from '../generated/abis/verifier.js';
|
|
9
10
|
import { lightningDeployments } from '../generated/lightning.js';
|
|
@@ -35,7 +36,7 @@ export type CustomConfig = {
|
|
|
35
36
|
chainId: number;
|
|
36
37
|
covalidatorUrls: string[];
|
|
37
38
|
signers?: Address[];
|
|
38
|
-
|
|
39
|
+
hostChainRpcUrls?: readonly string[] | string[];
|
|
39
40
|
senderPrivateKey?: HexString;
|
|
40
41
|
};
|
|
41
42
|
export type CustomDeployment = DeploymentSlice & CustomConfig;
|
|
@@ -57,6 +58,7 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
57
58
|
private readonly signers;
|
|
58
59
|
private readonly threshold;
|
|
59
60
|
private readonly networkPubkey;
|
|
61
|
+
private readonly publicClient;
|
|
60
62
|
readonly executorAddress: Address;
|
|
61
63
|
readonly chainId: bigint;
|
|
62
64
|
private readonly kmsQuorumClient;
|
|
@@ -72,8 +74,13 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
72
74
|
getEncryptionScheme(): Promise<EncryptionScheme>;
|
|
73
75
|
/**
|
|
74
76
|
* Get a Lightning instance bound to the latest Lightning deployment for the Base Sepolia testnet.
|
|
77
|
+
*
|
|
78
|
+
* @param options.hostChainRpcUrls optional list of RPC URLs for the host chain. When multiple URLs are
|
|
79
|
+
* provided, viem's fallback transport is used and providers are tried in order on failure.
|
|
75
80
|
*/
|
|
76
|
-
static baseSepoliaTestnet(
|
|
81
|
+
static baseSepoliaTestnet(options?: {
|
|
82
|
+
hostChainRpcUrls?: readonly string[];
|
|
83
|
+
}): Promise<Lightning<Deployment>>;
|
|
77
84
|
/**
|
|
78
85
|
* Get a Lightning instance bound to our canonical Anvil-based test node and test Covalidator node
|
|
79
86
|
*
|
|
@@ -100,8 +107,12 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
100
107
|
* Get a Lightning deployment by name or executor address on a particular chain.
|
|
101
108
|
*
|
|
102
109
|
* @param id this is an object containing either the pair of name and chainId or the executorAddress and chainId
|
|
110
|
+
* @param options.hostChainRpcUrls optional list of RPC URLs for the host chain. When multiple URLs are
|
|
111
|
+
* provided, viem's fallback transport is used and providers are tried in order on failure.
|
|
103
112
|
*/
|
|
104
|
-
static at(id: DeploymentId
|
|
113
|
+
static at(id: DeploymentId, options?: {
|
|
114
|
+
hostChainRpcUrls?: readonly string[];
|
|
115
|
+
}): Promise<Lightning<Deployment>>;
|
|
105
116
|
/**
|
|
106
117
|
* Get a Lightning deployment for a local or custom node
|
|
107
118
|
*
|
|
@@ -123,9 +134,13 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
123
134
|
* will not be compatible with the new version.
|
|
124
135
|
*
|
|
125
136
|
* @param pepper the pepper to use to filter the deployments
|
|
126
|
-
* @param
|
|
137
|
+
* @param chainId the chainId to use to filter the deployments
|
|
138
|
+
* @param options.hostChainRpcUrls optional list of RPC URLs for the host chain. When multiple URLs are
|
|
139
|
+
* provided, viem's fallback transport is used and providers are tried in order on failure.
|
|
127
140
|
*/
|
|
128
|
-
static latest<P extends Pepper>(pepper: P, chainId: ChainId
|
|
141
|
+
static latest<P extends Pepper>(pepper: P, chainId: ChainId, options?: {
|
|
142
|
+
hostChainRpcUrls?: readonly string[];
|
|
143
|
+
}): Promise<Lightning<Deployment>>;
|
|
129
144
|
/** Returns a shallow copy of the deployment configuration this Lightning instance is bound to. */
|
|
130
145
|
get deployment(): T;
|
|
131
146
|
/**
|
|
@@ -241,7 +256,6 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
241
256
|
*
|
|
242
257
|
* @param ephemeralAccount Session Account matching the voucher grantee.
|
|
243
258
|
* @param allowanceVoucherWithSig Signed allowance voucher.
|
|
244
|
-
* @param ethClient - A public eth client or eth wallet client used for signing the attested decrypt request
|
|
245
259
|
* @param handles Handles to decrypt.
|
|
246
260
|
* @param opts Optional reencryption/backoff configuration.
|
|
247
261
|
*
|
|
@@ -250,7 +264,6 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
250
264
|
* const attestations = await lightning.attestedDecryptWithVoucher(
|
|
251
265
|
* ephemeralAccount,
|
|
252
266
|
* voucher,
|
|
253
|
-
* ethClient,
|
|
254
267
|
* [handle],
|
|
255
268
|
* );
|
|
256
269
|
* ```
|
|
@@ -260,7 +273,6 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
260
273
|
* const encrypted = await lightning.attestedDecryptWithVoucher(
|
|
261
274
|
* ephemeralAccount,
|
|
262
275
|
* voucher,
|
|
263
|
-
* ethClient,
|
|
264
276
|
* [handle],
|
|
265
277
|
* { reencryptPubKey: delegateKeypair.encodePublicKey() },
|
|
266
278
|
* );
|
|
@@ -271,15 +283,26 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
271
283
|
* const decrypted = await lightning.attestedDecryptWithVoucher(
|
|
272
284
|
* ephemeralAccount,
|
|
273
285
|
* voucher,
|
|
274
|
-
* ethClient,
|
|
275
286
|
* [handle],
|
|
276
287
|
* { reencryptPubKey: keypair.encodePublicKey(), reencryptKeypair: keypair },
|
|
277
288
|
* );
|
|
278
289
|
* ```
|
|
279
290
|
*/
|
|
280
|
-
attestedDecryptWithVoucher(ephemeralAccount: PrivateKeyAccount, allowanceVoucherWithSig: AllowanceVoucherWithSig,
|
|
281
|
-
attestedDecryptWithVoucher(ephemeralAccount: PrivateKeyAccount, allowanceVoucherWithSig: AllowanceVoucherWithSig,
|
|
282
|
-
attestedDecryptWithVoucher(ephemeralAccount: PrivateKeyAccount, allowanceVoucherWithSig: AllowanceVoucherWithSig,
|
|
291
|
+
attestedDecryptWithVoucher(ephemeralAccount: PrivateKeyAccount, allowanceVoucherWithSig: AllowanceVoucherWithSig, handles: HexString[], opts?: AttestedWithVoucherOptsEphemeral): Promise<Array<DecryptionAttestation<EncryptionScheme, SupportedFheType>>>;
|
|
292
|
+
attestedDecryptWithVoucher(ephemeralAccount: PrivateKeyAccount, allowanceVoucherWithSig: AllowanceVoucherWithSig, handles: HexString[], opts: AttestedWithVoucherOptsEncrypted): Promise<Array<EncryptedDecryptionAttestation<EncryptionScheme, SupportedFheType>>>;
|
|
293
|
+
attestedDecryptWithVoucher(ephemeralAccount: PrivateKeyAccount, allowanceVoucherWithSig: AllowanceVoucherWithSig, handles: HexString[], opts: AttestedWithVoucherOptsDecrypted): Promise<Array<DecryptionAttestation<EncryptionScheme, SupportedFheType>>>;
|
|
294
|
+
eListAttestedDecrypt(walletClient: WalletClient<Transport, Chain, Account>, handle: HexString, opts?: AttestedOptsEphemeral): Promise<EListDecryptionAttestation<EncryptionScheme, SupportedFheType>>;
|
|
295
|
+
eListAttestedDecrypt(walletClient: WalletClient<Transport, Chain, Account>, handle: HexString, opts: AttestedOptsEncrypted): Promise<EncryptedEListDecryptionAttestation<EncryptionScheme, SupportedFheType>>;
|
|
296
|
+
eListAttestedDecrypt(walletClient: WalletClient<Transport, Chain, Account>, handle: HexString, opts: AttestedOptsDecrypted): Promise<EListDecryptionAttestation<EncryptionScheme, SupportedFheType>>;
|
|
297
|
+
/**
|
|
298
|
+
* Reveal a single elist handle without wallet authentication.
|
|
299
|
+
* Returns plaintext values along with an attestation of the checksum.
|
|
300
|
+
*
|
|
301
|
+
* @param handle - The elist handle to reveal
|
|
302
|
+
* @param opts - Optional backoff configuration
|
|
303
|
+
* @returns The elist decryption attestation with plaintext values
|
|
304
|
+
*/
|
|
305
|
+
eListAttestedReveal(handle: HexString, opts?: AttestedRevealOpts): Promise<EListDecryptionAttestation<EncryptionScheme, SupportedFheType>>;
|
|
283
306
|
/**
|
|
284
307
|
* Get an attested compute for the given wallet client.
|
|
285
308
|
*
|
|
@@ -335,7 +358,6 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
335
358
|
* const attestation = await lightning.attestedComputeWithVoucher(
|
|
336
359
|
* ephemeralAccount,
|
|
337
360
|
* voucher,
|
|
338
|
-
* ethClient,
|
|
339
361
|
* lhsHandle,
|
|
340
362
|
* AttestedComputeSupportedOps.Eq,
|
|
341
363
|
* true,
|
|
@@ -347,7 +369,6 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
347
369
|
* const encrypted = await lightning.attestedComputeWithVoucher(
|
|
348
370
|
* ephemeralAccount,
|
|
349
371
|
* voucher,
|
|
350
|
-
* ethClient,
|
|
351
372
|
* lhsHandle,
|
|
352
373
|
* AttestedComputeSupportedOps.Eq,
|
|
353
374
|
* true,
|
|
@@ -361,7 +382,6 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
361
382
|
* const decrypted = await lightning.attestedComputeWithVoucher(
|
|
362
383
|
* ephemeralAccount,
|
|
363
384
|
* voucher,
|
|
364
|
-
* ethClient,
|
|
365
385
|
* lhsHandle,
|
|
366
386
|
* AttestedComputeSupportedOps.Eq,
|
|
367
387
|
* true,
|
|
@@ -370,9 +390,9 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
370
390
|
* console.log(decrypted.plaintext.value);
|
|
371
391
|
* ```
|
|
372
392
|
*/
|
|
373
|
-
attestedComputeWithVoucher(ephemeralAccount: PrivateKeyAccount, allowanceVoucherWithSig: AllowanceVoucherWithSig,
|
|
374
|
-
attestedComputeWithVoucher(ephemeralAccount: PrivateKeyAccount, allowanceVoucherWithSig: AllowanceVoucherWithSig,
|
|
375
|
-
attestedComputeWithVoucher(ephemeralAccount: PrivateKeyAccount, allowanceVoucherWithSig: AllowanceVoucherWithSig,
|
|
393
|
+
attestedComputeWithVoucher(ephemeralAccount: PrivateKeyAccount, allowanceVoucherWithSig: AllowanceVoucherWithSig, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean, opts?: AttestedWithVoucherOptsEphemeral): Promise<DecryptionAttestation<EncryptionScheme, SupportedFheType>>;
|
|
394
|
+
attestedComputeWithVoucher(ephemeralAccount: PrivateKeyAccount, allowanceVoucherWithSig: AllowanceVoucherWithSig, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean, opts: AttestedWithVoucherOptsEncrypted): Promise<EncryptedDecryptionAttestation<EncryptionScheme, SupportedFheType>>;
|
|
395
|
+
attestedComputeWithVoucher(ephemeralAccount: PrivateKeyAccount, allowanceVoucherWithSig: AllowanceVoucherWithSig, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean, opts: AttestedWithVoucherOptsDecrypted): Promise<DecryptionAttestation<EncryptionScheme, SupportedFheType>>;
|
|
376
396
|
/**
|
|
377
397
|
* Get an decryption of publicly revealed handles.
|
|
378
398
|
*
|
|
@@ -392,7 +412,8 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
392
412
|
*/
|
|
393
413
|
static getCovalidatorUrls(deployment: DeploymentSlice & {
|
|
394
414
|
pepper: string;
|
|
395
|
-
|
|
415
|
+
majorVersion: number;
|
|
416
|
+
}, signers: Address[]): string[];
|
|
396
417
|
private static isIdByName;
|
|
397
418
|
private static plaintextFromValue;
|
|
398
419
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Account, Chain, Transport, WalletClient } from 'viem';
|
|
1
|
+
import { Account, Chain, PublicClient, Transport, WalletClient } from 'viem';
|
|
2
2
|
import { vi } from 'vitest';
|
|
3
3
|
import { KmsClient } from '../kms/client.js';
|
|
4
4
|
import { KmsQuorumClient } from '../kms/quorumClient.js';
|
|
@@ -6,11 +6,15 @@ interface MinimalKmsClient {
|
|
|
6
6
|
attestedCompute: ReturnType<typeof vi.fn>;
|
|
7
7
|
attestedDecrypt: ReturnType<typeof vi.fn>;
|
|
8
8
|
attestedReveal: ReturnType<typeof vi.fn>;
|
|
9
|
+
eListAttestedDecrypt: ReturnType<typeof vi.fn>;
|
|
10
|
+
eListAttestedReveal: ReturnType<typeof vi.fn>;
|
|
9
11
|
key: ReturnType<typeof vi.fn>;
|
|
10
12
|
reencrypt: ReturnType<typeof vi.fn>;
|
|
11
13
|
}
|
|
12
14
|
export declare function createMockKmsClient(): MinimalKmsClient & KmsClient;
|
|
13
15
|
export declare function createMockQuorumClient(): KmsQuorumClient;
|
|
14
16
|
export declare function setupMockInQuorumClient(quorumClient: KmsQuorumClient, mockKmsClient: MinimalKmsClient & KmsClient): void;
|
|
17
|
+
export declare function createMockPublicClient(): PublicClient<Transport, Chain>;
|
|
15
18
|
export declare function createTestWalletClient(): WalletClient<Transport, Chain, Account>;
|
|
19
|
+
export declare function createFallbackWalletClient(): WalletClient<Transport, Chain, Account>;
|
|
16
20
|
export {};
|
package/dist/types/viem.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Chain } from 'viem';
|
|
1
|
+
import { Account, Chain, PublicClient, Transport, WalletClient } from 'viem';
|
|
2
2
|
import { Chainish } from './chain.js';
|
|
3
|
+
export type ViemClient = WalletClient<Transport, Chain, Account> | PublicClient<Transport, Chain>;
|
|
3
4
|
/** Map of supported chain short names to their viem chain objects. */
|
|
4
5
|
export declare const chains: {
|
|
5
6
|
sepolia: {
|