@inco/js 0.6.9 → 0.7.1
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/README.md +8 -8
- package/dist/cjs/advancedacl/session-key.d.ts +39 -26
- package/dist/cjs/advancedacl/session-key.js +53 -136
- package/dist/cjs/attestedcompute/attested-compute.d.ts +6 -6
- package/dist/cjs/attestedcompute/attested-compute.js +5 -35
- package/dist/cjs/attesteddecrypt/attested-decrypt.d.ts +36 -21
- package/dist/cjs/attesteddecrypt/attested-decrypt.js +107 -108
- package/dist/cjs/attesteddecrypt/types.d.ts +4 -4
- package/dist/cjs/generated/es/inco/covalidator/compute/v1/types_pb.d.ts +15 -1
- package/dist/cjs/generated/es/inco/covalidator/compute/v1/types_pb.js +1 -1
- package/dist/cjs/generated/es/inco/kms/lite/v1/kms_service_pb.d.ts +13 -5
- package/dist/cjs/generated/es/inco/kms/lite/v1/kms_service_pb.js +3 -4
- package/dist/cjs/generated/lightning.d.ts +40 -0
- package/dist/cjs/generated/lightning.js +43 -1
- package/dist/cjs/generated/local-node.d.ts +11 -7
- package/dist/cjs/generated/local-node.js +28 -8
- package/dist/cjs/kms/client.d.ts +8 -4
- package/dist/cjs/kms/client.js +9 -4
- package/dist/cjs/kms/quorumClient.d.ts +58 -0
- package/dist/cjs/kms/quorumClient.js +378 -0
- package/dist/cjs/kms/thresholdPromises.d.ts +7 -0
- package/dist/cjs/kms/thresholdPromises.js +52 -0
- package/dist/cjs/lite/ecies.d.ts +2 -0
- package/dist/cjs/lite/ecies.js +5 -2
- package/dist/cjs/lite/index.d.ts +0 -1
- package/dist/cjs/lite/index.js +1 -2
- package/dist/cjs/lite/lightning.d.ts +110 -74
- package/dist/cjs/lite/lightning.js +272 -127
- package/dist/cjs/local/local-node.d.ts +1 -2
- package/dist/cjs/local/local-node.js +2 -3
- package/dist/cjs/test/mocks.d.ts +3 -0
- package/dist/cjs/test/mocks.js +19 -1
- package/dist/cjs/viem.d.ts +2 -4
- package/dist/cjs/viem.js +6 -2
- package/dist/esm/advancedacl/session-key.d.ts +39 -26
- package/dist/esm/advancedacl/session-key.js +44 -126
- package/dist/esm/attestedcompute/attested-compute.d.ts +6 -6
- package/dist/esm/attestedcompute/attested-compute.js +6 -36
- package/dist/esm/attesteddecrypt/attested-decrypt.d.ts +36 -21
- package/dist/esm/attesteddecrypt/attested-decrypt.js +106 -108
- package/dist/esm/attesteddecrypt/types.d.ts +4 -4
- package/dist/esm/generated/es/inco/covalidator/compute/v1/types_pb.d.ts +15 -1
- package/dist/esm/generated/es/inco/covalidator/compute/v1/types_pb.js +1 -1
- package/dist/esm/generated/es/inco/kms/lite/v1/kms_service_pb.d.ts +13 -5
- package/dist/esm/generated/es/inco/kms/lite/v1/kms_service_pb.js +2 -3
- package/dist/esm/generated/lightning.d.ts +40 -0
- package/dist/esm/generated/lightning.js +43 -1
- package/dist/esm/generated/local-node.d.ts +11 -7
- package/dist/esm/generated/local-node.js +28 -8
- package/dist/esm/kms/client.d.ts +8 -4
- package/dist/esm/kms/client.js +8 -4
- package/dist/esm/kms/quorumClient.d.ts +58 -0
- package/dist/esm/kms/quorumClient.js +374 -0
- package/dist/esm/kms/thresholdPromises.d.ts +7 -0
- package/dist/esm/kms/thresholdPromises.js +49 -0
- package/dist/esm/lite/ecies.d.ts +2 -0
- package/dist/esm/lite/ecies.js +4 -2
- package/dist/esm/lite/index.d.ts +0 -1
- package/dist/esm/lite/index.js +1 -2
- package/dist/esm/lite/lightning.d.ts +110 -74
- package/dist/esm/lite/lightning.js +276 -131
- package/dist/esm/local/local-node.d.ts +1 -2
- package/dist/esm/local/local-node.js +2 -3
- package/dist/esm/test/mocks.d.ts +3 -0
- package/dist/esm/test/mocks.js +17 -1
- package/dist/esm/viem.d.ts +2 -4
- package/dist/esm/viem.js +6 -2
- package/dist/types/advancedacl/session-key.d.ts +39 -26
- package/dist/types/attestedcompute/attested-compute.d.ts +6 -6
- package/dist/types/attesteddecrypt/attested-decrypt.d.ts +36 -21
- package/dist/types/attesteddecrypt/types.d.ts +4 -4
- package/dist/types/generated/es/inco/covalidator/compute/v1/types_pb.d.ts +15 -1
- package/dist/types/generated/es/inco/kms/lite/v1/kms_service_pb.d.ts +13 -5
- package/dist/types/generated/lightning.d.ts +40 -0
- package/dist/types/generated/local-node.d.ts +11 -7
- package/dist/types/kms/client.d.ts +8 -4
- package/dist/types/kms/quorumClient.d.ts +58 -0
- package/dist/types/kms/thresholdPromises.d.ts +7 -0
- package/dist/types/lite/ecies.d.ts +2 -0
- package/dist/types/lite/index.d.ts +0 -1
- package/dist/types/lite/lightning.d.ts +110 -74
- package/dist/types/local/local-node.d.ts +1 -2
- package/dist/types/test/mocks.d.ts +3 -0
- package/dist/types/viem.d.ts +2 -4
- package/package.json +6 -3
- package/dist/cjs/attestedreveal/attested-reveal.d.ts +0 -21
- package/dist/cjs/attestedreveal/attested-reveal.js +0 -69
- package/dist/cjs/attestedreveal/index.d.ts +0 -1
- package/dist/cjs/attestedreveal/index.js +0 -18
- package/dist/cjs/attestedreveal/types.d.ts +0 -7
- package/dist/cjs/attestedreveal/types.js +0 -16
- package/dist/cjs/generated/es/cosmos_proto/cosmos_pb.d.ts +0 -174
- package/dist/cjs/generated/es/cosmos_proto/cosmos_pb.js +0 -118
- package/dist/cjs/generated/es/inco/fhe/v1/types_pb.d.ts +0 -419
- package/dist/cjs/generated/es/inco/fhe/v1/types_pb.js +0 -136
- package/dist/cjs/lite/reencrypt.d.ts +0 -21
- package/dist/cjs/lite/reencrypt.js +0 -141
- package/dist/esm/attestedreveal/attested-reveal.d.ts +0 -21
- package/dist/esm/attestedreveal/attested-reveal.js +0 -66
- package/dist/esm/attestedreveal/index.d.ts +0 -1
- package/dist/esm/attestedreveal/index.js +0 -2
- package/dist/esm/attestedreveal/types.d.ts +0 -7
- package/dist/esm/attestedreveal/types.js +0 -12
- package/dist/esm/generated/es/cosmos_proto/cosmos_pb.d.ts +0 -174
- package/dist/esm/generated/es/cosmos_proto/cosmos_pb.js +0 -115
- package/dist/esm/generated/es/inco/fhe/v1/types_pb.d.ts +0 -419
- package/dist/esm/generated/es/inco/fhe/v1/types_pb.js +0 -133
- package/dist/esm/lite/reencrypt.d.ts +0 -21
- package/dist/esm/lite/reencrypt.js +0 -131
- package/dist/types/attestedreveal/attested-reveal.d.ts +0 -21
- package/dist/types/attestedreveal/index.d.ts +0 -1
- package/dist/types/attestedreveal/types.d.ts +0 -7
- package/dist/types/generated/es/cosmos_proto/cosmos_pb.d.ts +0 -174
- package/dist/types/generated/es/inco/fhe/v1/types_pb.d.ts +0 -419
- package/dist/types/lite/reencrypt.d.ts +0 -21
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { Account, Chain, PublicClient, Transport, WalletClient } from 'viem';
|
|
1
|
+
import { Account, Chain, GetContractReturnType, PublicClient, Transport, WalletClient } from 'viem';
|
|
2
2
|
import { AllowanceVoucherWithSig } from '../advancedacl/types.js';
|
|
3
3
|
import { AttestedComputeOP } from '../attestedcompute/types.js';
|
|
4
|
-
import { DecryptionAttestation } from '../attesteddecrypt/index.js';
|
|
4
|
+
import { DecryptionAttestation, EncryptedDecryptionAttestation } from '../attesteddecrypt/index.js';
|
|
5
5
|
import { Address, HexString } from '../binary.js';
|
|
6
|
-
import { EciesScheme,
|
|
6
|
+
import { EciesScheme, SupportedFheType } from '../encryption/index.js';
|
|
7
|
+
import { incoVerifierAbi } from '../generated/abis/verifier.js';
|
|
7
8
|
import { lightningDeployments } from '../generated/lightning.js';
|
|
8
9
|
import { localNodeLightningConfig } from '../generated/local-node.js';
|
|
10
|
+
import { FheType } from '../handle.js';
|
|
9
11
|
import { LocalNodeEnv } from '../local/index.js';
|
|
10
|
-
import type { Reencryptor } from '../reencryption/index.js';
|
|
11
12
|
import { BackoffConfig } from '../retry.js';
|
|
12
13
|
import { Secp256k1Keypair } from './ecies.js';
|
|
13
14
|
type TupleToUnion<T> = T extends readonly unknown[] ? T[number] : never;
|
|
@@ -23,6 +24,7 @@ export type SupportedNativeType = boolean | bigint | number;
|
|
|
23
24
|
export type EncryptionContext = {
|
|
24
25
|
accountAddress: string;
|
|
25
26
|
dappAddress: string;
|
|
27
|
+
handleType: FheType;
|
|
26
28
|
};
|
|
27
29
|
export type DeploymentSlice = {
|
|
28
30
|
executorAddress: string;
|
|
@@ -31,22 +33,35 @@ export type DeploymentSlice = {
|
|
|
31
33
|
export type CustomConfig = {
|
|
32
34
|
executorAddress: string;
|
|
33
35
|
chainId: number;
|
|
34
|
-
|
|
36
|
+
covalidatorUrls: string[];
|
|
37
|
+
signers?: Address[];
|
|
35
38
|
hostChainRpcUrl?: string;
|
|
36
39
|
senderPrivateKey?: HexString;
|
|
37
40
|
};
|
|
38
41
|
export type CustomDeployment = DeploymentSlice & CustomConfig;
|
|
42
|
+
export type IncoVerifierConfig = {
|
|
43
|
+
threshold: number;
|
|
44
|
+
signers: Address[];
|
|
45
|
+
eciesPubKey: HexString;
|
|
46
|
+
};
|
|
47
|
+
type LocalNodeEnvFileSource = {
|
|
48
|
+
filePath: string;
|
|
49
|
+
};
|
|
39
50
|
/**
|
|
40
51
|
* The Lightning class provides a convenient way to interact with the Inco Lightning contract by binding to a specific
|
|
41
52
|
* deployment.
|
|
42
53
|
*/
|
|
43
54
|
export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
44
55
|
private readonly _deployment;
|
|
45
|
-
readonly
|
|
56
|
+
private readonly covalidatorUrls;
|
|
57
|
+
private readonly signers;
|
|
58
|
+
private readonly threshold;
|
|
59
|
+
private readonly eciesPubKey;
|
|
46
60
|
readonly executorAddress: Address;
|
|
47
61
|
readonly chainId: bigint;
|
|
48
62
|
private readonly ephemeralKeypair;
|
|
49
|
-
private readonly
|
|
63
|
+
private readonly kmsQuorumClient;
|
|
64
|
+
private readonly encryptor;
|
|
50
65
|
private constructor();
|
|
51
66
|
/**
|
|
52
67
|
* Get a Lightning instance bound to the latest Lightning deployment for the Base Sepolia testnet.
|
|
@@ -73,7 +88,7 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
73
88
|
*
|
|
74
89
|
* @param filePath the path to the file containing the environment variables in dotenv format
|
|
75
90
|
*/
|
|
76
|
-
static localNodeFromEnv(
|
|
91
|
+
static localNodeFromEnv(source?: string | Buffer | LocalNodeEnvFileSource): Promise<Lightning<CustomDeployment>>;
|
|
77
92
|
/**
|
|
78
93
|
* Get a Lightning deployment by name or executor address on a particular chain.
|
|
79
94
|
*
|
|
@@ -87,7 +102,6 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
87
102
|
* additional fields past will be made available as part of the `deployment` property.
|
|
88
103
|
*/
|
|
89
104
|
static custom<T extends CustomConfig>(config: T): Promise<Lightning<DeploymentSlice & T>>;
|
|
90
|
-
static getEciesPublicKey(client: PublicClient, executorAddress: Address): Promise<HexString>;
|
|
91
105
|
/**
|
|
92
106
|
* Get the latest deployment for a given pepper, which usually denotes a family of deployments distinct from their
|
|
93
107
|
* version such as 'devnet', 'testnet', 'mainnet', etc.
|
|
@@ -102,7 +116,7 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
102
116
|
* will not be compatible with the new version.
|
|
103
117
|
*
|
|
104
118
|
* @param pepper the pepper to use to filter the deployments
|
|
105
|
-
* @param
|
|
119
|
+
* @param chain the chain to use to filter the deployments
|
|
106
120
|
*/
|
|
107
121
|
static latest<P extends Pepper>(pepper: P, chainId: ChainId): Promise<Lightning<Deployment>>;
|
|
108
122
|
get deployment(): T;
|
|
@@ -112,17 +126,13 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
112
126
|
* @param value a boolean or numeric value to encrypt
|
|
113
127
|
* @param accountAddress the address of the account interacting with the dapp contract, normally an Externally Owned Account (EOA)
|
|
114
128
|
* @param dappAddress the address of the dapp contract that interacts with the Inco Lightning contract or library
|
|
129
|
+
* @param handleType (optional) the handle type to be used for encrypting the value - this is required in case of non-default handle types
|
|
130
|
+
* default handle types:
|
|
131
|
+
* - boolean -> handleTypes.ebool
|
|
132
|
+
* - number | bigint -> handleTypes.euint256
|
|
133
|
+
* @returns a promise that resolves to the encrypted value as a HexString
|
|
115
134
|
*/
|
|
116
|
-
encrypt<T extends SupportedNativeType>(value: T, { accountAddress, dappAddress }: EncryptionContext
|
|
117
|
-
/**
|
|
118
|
-
* Obtain a reencryptor for a particular Externally Owned Account (EOA) to request decrypted values.
|
|
119
|
-
* The account associated with the walletClient must have permissions to decrypt the handle or ciphertext passed
|
|
120
|
-
* to the reencryptor function.
|
|
121
|
-
*
|
|
122
|
-
* @param walletClient the wallet client to use for signing the reencrypt request.
|
|
123
|
-
*/
|
|
124
|
-
getReencryptor(walletClient: WalletClient<Transport, Chain, Account>): Promise<Reencryptor<EciesScheme>>;
|
|
125
|
-
getEncryptor(eciesPubkey: HexString): Encryptor<EciesScheme>;
|
|
135
|
+
encrypt<T extends SupportedNativeType>(value: T, { accountAddress, dappAddress, handleType }: EncryptionContext): Promise<HexString>;
|
|
126
136
|
/**
|
|
127
137
|
* Grants a session key allowance voucher for secure reencryption operations.
|
|
128
138
|
*
|
|
@@ -147,24 +157,6 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
147
157
|
* ```
|
|
148
158
|
*/
|
|
149
159
|
grantSessionKeyAllowanceVoucher(walletClient: WalletClient<Transport, Chain, Account>, granteeAddress: string, expiresAt: Date, sessionVerifierAddress: string): Promise<AllowanceVoucherWithSig>;
|
|
150
|
-
/**
|
|
151
|
-
* Creates a session key reencryptor for secure data reencryption operations.
|
|
152
|
-
*
|
|
153
|
-
* This method returns a reencryptor instance that can be used to perform reencryption
|
|
154
|
-
* operations using session keys. The reencryptor is configured with the provided
|
|
155
|
-
* allowance voucher and ephemeral keypair for secure communication.
|
|
156
|
-
*
|
|
157
|
-
* @param allowanceVoucherWithSig - The signed allowance voucher obtained from grantSessionKeyAllowanceVoucher
|
|
158
|
-
* @param ephemeralKeypair - The ephemeral keypair used for secure communication with the KMS make sure it has allowance to voucher
|
|
159
|
-
* @returns A reencryptor instance configured for session key operations
|
|
160
|
-
*
|
|
161
|
-
* @example
|
|
162
|
-
* ```typescript
|
|
163
|
-
* const reencryptor = await lightning.getSessionKeyRencryptor(voucher, ephemeralKeypair);
|
|
164
|
-
* const decryptedValue = await reencryptor({handle: resultHandle});
|
|
165
|
-
* ```
|
|
166
|
-
*/
|
|
167
|
-
getSessionKeyRencryptor(allowanceVoucherWithSig: AllowanceVoucherWithSig, ephemeralKeypair: Secp256k1Keypair): Promise<(<T_1 extends SupportedFheType>({ handle, }: import("../reencryption/types.js").ReencryptFnArgs<EciesScheme, T_1>) => Promise<PlaintextOf<1, 0 | 5 | 7 | 8>>)>;
|
|
168
160
|
/**
|
|
169
161
|
* Updates the active session nonce for the given wallet client.
|
|
170
162
|
*
|
|
@@ -176,35 +168,68 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
176
168
|
*/
|
|
177
169
|
updateActiveVouchersSessionNonce(walletClient: WalletClient<Transport, Chain, Account>): Promise<HexString>;
|
|
178
170
|
/**
|
|
179
|
-
*
|
|
171
|
+
* Requests attested decrypts signed by the covalidator using a wallet client.
|
|
180
172
|
*
|
|
181
|
-
* @param walletClient
|
|
182
|
-
* @param handles -
|
|
183
|
-
* @param backoffConfig
|
|
184
|
-
* @returns The decryption attestations
|
|
173
|
+
* @param walletClient Wallet used to sign the EIP-712 request.
|
|
174
|
+
* @param handles 32-byte handles to decrypt.
|
|
175
|
+
* @param backoffConfig Optional retry configuration.
|
|
185
176
|
*
|
|
186
|
-
* @example
|
|
187
|
-
* ```
|
|
188
|
-
* const
|
|
189
|
-
*
|
|
177
|
+
* @example Plaintext results
|
|
178
|
+
* ```ts
|
|
179
|
+
* const attestations = await lightning.attestedDecrypt(walletClient, [handle]);
|
|
180
|
+
* console.log(attestations[0].plaintext.value);
|
|
181
|
+
* ```
|
|
182
|
+
*
|
|
183
|
+
* @example Reencrypt for a delegate
|
|
184
|
+
* ```ts
|
|
185
|
+
* const encrypted = await lightning.attestedDecrypt(walletClient, [handle], delegatePubKey);
|
|
186
|
+
* console.log(encrypted[0].encryptedPlaintext.ciphertext.value);
|
|
187
|
+
* ```
|
|
188
|
+
*
|
|
189
|
+
* @example Reencrypt and decrypt locally
|
|
190
|
+
* ```ts
|
|
191
|
+
* const decrypted = await lightning.attestedDecrypt(
|
|
192
|
+
* walletClient,
|
|
193
|
+
* [handle],
|
|
194
|
+
* keypair.encodePublicKey(),
|
|
195
|
+
* keypair,
|
|
196
|
+
* );
|
|
197
|
+
* console.log(decrypted[0].plaintext.value);
|
|
190
198
|
* ```
|
|
191
199
|
*/
|
|
192
200
|
attestedDecrypt(walletClient: WalletClient<Transport, Chain, Account>, handles: HexString[], backoffConfig?: Partial<BackoffConfig>): Promise<Array<DecryptionAttestation<EciesScheme, SupportedFheType>>>;
|
|
201
|
+
attestedDecrypt(walletClient: WalletClient<Transport, Chain, Account>, handles: HexString[], reencryptPubKey: Uint8Array, backoffConfig?: Partial<BackoffConfig>): Promise<Array<EncryptedDecryptionAttestation<EciesScheme, SupportedFheType>>>;
|
|
202
|
+
attestedDecrypt(walletClient: WalletClient<Transport, Chain, Account>, handles: HexString[], reencryptPubKey: Uint8Array, reencryptKeypair: Secp256k1Keypair, backoffConfig?: Partial<BackoffConfig>): Promise<Array<DecryptionAttestation<EciesScheme, SupportedFheType>>>;
|
|
193
203
|
/**
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
204
|
+
* Requests attested decrypts using a voucher-backed session key.
|
|
205
|
+
*
|
|
206
|
+
* @param ephemeralKeypair Session keypair matching the voucher grantee.
|
|
207
|
+
* @param allowanceVoucherWithSig Signed allowance voucher.
|
|
208
|
+
* @param handles Handles to decrypt.
|
|
209
|
+
* @param options Optional reencryption/backoff configuration.
|
|
198
210
|
*
|
|
199
|
-
* @
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
211
|
+
* @example Plaintext results
|
|
212
|
+
* ```ts
|
|
213
|
+
* const attestations = await lightning.attestedDecryptWithVoucher(
|
|
214
|
+
* ephemeralKeypair,
|
|
215
|
+
* voucher,
|
|
216
|
+
* [handle],
|
|
217
|
+
* );
|
|
218
|
+
* ```
|
|
204
219
|
*
|
|
205
|
-
* @
|
|
220
|
+
* @example Reencrypt for a delegate
|
|
221
|
+
* ```ts
|
|
222
|
+
* const encrypted = await lightning.attestedDecryptWithVoucher(
|
|
223
|
+
* ephemeralKeypair,
|
|
224
|
+
* voucher,
|
|
225
|
+
* [handle],
|
|
226
|
+
* { reencryptPubKey: delegateKeypair.encodePublicKey() },
|
|
227
|
+
* );
|
|
228
|
+
* ```
|
|
206
229
|
*/
|
|
207
|
-
|
|
230
|
+
attestedDecryptWithVoucher(ephemeralKeypair: Secp256k1Keypair, allowanceVoucherWithSig: AllowanceVoucherWithSig, handles: HexString[], backoffConfig?: Partial<BackoffConfig>): Promise<Array<DecryptionAttestation<EciesScheme, SupportedFheType>>>;
|
|
231
|
+
attestedDecryptWithVoucher(ephemeralKeypair: Secp256k1Keypair, allowanceVoucherWithSig: AllowanceVoucherWithSig, handles: HexString[], reencryptPubKey: Uint8Array, backoffConfig?: Partial<BackoffConfig>): Promise<Array<EncryptedDecryptionAttestation<EciesScheme, SupportedFheType>>>;
|
|
232
|
+
attestedDecryptWithVoucher(ephemeralKeypair: Secp256k1Keypair, allowanceVoucherWithSig: AllowanceVoucherWithSig, handles: HexString[], reencryptPubKey: Uint8Array, reencryptKeypair: Secp256k1Keypair, backoffConfig?: Partial<BackoffConfig>): Promise<Array<DecryptionAttestation<EciesScheme, SupportedFheType>>>;
|
|
208
233
|
/**
|
|
209
234
|
* Get an attested compute for the given wallet client.
|
|
210
235
|
*
|
|
@@ -227,22 +252,20 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
227
252
|
*/
|
|
228
253
|
attestedCompute(walletClient: WalletClient<Transport, Chain, Account>, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean, backoffConfig?: Partial<BackoffConfig>): Promise<DecryptionAttestation<EciesScheme, SupportedFheType>>;
|
|
229
254
|
/**
|
|
230
|
-
*
|
|
231
|
-
* @dev This method is used when you want to perform attested compute
|
|
232
|
-
* via an ephemeral session key and an allowance voucher. The session
|
|
233
|
-
* key setup is typically faster and more flexible than using a wallet.
|
|
234
|
-
*
|
|
235
|
-
* @param ephemeralKeypair The ephemeral Secp256k1 keypair used for secure communication.
|
|
236
|
-
* @param lhsHandle The handle to compute on
|
|
237
|
-
* @param op The operation to perform
|
|
238
|
-
* @param rhsPlaintext The plaintext to compute with
|
|
239
|
-
* @param allowanceVoucherWithSig The signed allowance voucher, obtained from
|
|
240
|
-
* `grantSessionKeyAllowanceVoucher`, proving the session key's compute rights.
|
|
241
|
-
* @param backoffConfig Optional configuration for retry and backoff strategy.
|
|
255
|
+
* Performs attested compute via a voucher-backed session key.
|
|
242
256
|
*
|
|
243
|
-
* @
|
|
257
|
+
* @example
|
|
258
|
+
* ```ts
|
|
259
|
+
* const attestation = await lightning.attestedComputeWithVoucher(
|
|
260
|
+
* ephemeralKeypair,
|
|
261
|
+
* voucher,
|
|
262
|
+
* lhsHandle,
|
|
263
|
+
* AttestedComputeSupportedOps.Eq,
|
|
264
|
+
* true,
|
|
265
|
+
* );
|
|
266
|
+
* ```
|
|
244
267
|
*/
|
|
245
|
-
|
|
268
|
+
attestedComputeWithVoucher(ephemeralKeypair: Secp256k1Keypair, allowanceVoucherWithSig: AllowanceVoucherWithSig, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean, backoffConfig?: Partial<BackoffConfig>): Promise<DecryptionAttestation<EciesScheme, SupportedFheType>>;
|
|
246
269
|
/**
|
|
247
270
|
* Get an decryption of publicly revealed handles.
|
|
248
271
|
*
|
|
@@ -260,10 +283,23 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
260
283
|
/**
|
|
261
284
|
* Get the GRPC endpoint for the covalidator that services this deployment.
|
|
262
285
|
*/
|
|
263
|
-
static
|
|
286
|
+
static getCovalidatorUrls(deployment: DeploymentSlice & {
|
|
264
287
|
pepper: string;
|
|
265
|
-
}): string;
|
|
288
|
+
}, threshold: number): string[];
|
|
266
289
|
private static isIdByName;
|
|
267
290
|
private static plaintextFromValue;
|
|
291
|
+
static getEciesPublicKey(client: PublicClient, executorAddress: Address): Promise<HexString>;
|
|
292
|
+
static getIncoVerifierContract(client: PublicClient, executorAddress: Address): Promise<GetContractReturnType<typeof incoVerifierAbi, PublicClient, Address>>;
|
|
293
|
+
/**
|
|
294
|
+
* Retrieves the verifier contract details including threshold, signers, and ECIES public key from the Inco Verifier contract.
|
|
295
|
+
*
|
|
296
|
+
* @param executorAddress The address of the Inco Lightning executor contract.
|
|
297
|
+
* @param client The public client to interact with the blockchain.
|
|
298
|
+
* @returns An object containing the threshold, signers, and ECIES public key.
|
|
299
|
+
*/
|
|
300
|
+
private static getVerifierContractDetails;
|
|
301
|
+
private static getChainConfig;
|
|
302
|
+
private static supportsThresholdRetrieval;
|
|
303
|
+
private static getDefaultThresholdAndSigners;
|
|
268
304
|
}
|
|
269
305
|
export {};
|