@inco/js 0.6.8 → 0.7.0
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 -19
- package/dist/cjs/advancedacl/session-key.js +59 -108
- package/dist/cjs/attestedcompute/attested-compute.d.ts +6 -6
- package/dist/cjs/attestedcompute/attested-compute.js +5 -28
- package/dist/cjs/attesteddecrypt/attested-decrypt.d.ts +68 -16
- package/dist/cjs/attesteddecrypt/attested-decrypt.js +108 -66
- package/dist/cjs/attesteddecrypt/types.d.ts +8 -3
- package/dist/cjs/attesteddecrypt/types.js +1 -1
- package/dist/cjs/encryption/encryption.d.ts +8 -10
- package/dist/cjs/encryption/encryption.js +6 -6
- package/dist/cjs/generated/abis/add-two.d.ts +1 -1
- package/dist/cjs/generated/abis/add-two.js +1 -1
- package/dist/cjs/generated/abis/lightning-preview.d.ts +40 -0
- package/dist/cjs/generated/abis/lightning-preview.js +29 -1
- package/dist/cjs/generated/abis/lightning.d.ts +1 -1
- package/dist/cjs/generated/abis/lightning.js +1 -1
- package/dist/cjs/generated/abis/verifier.d.ts +126 -67
- package/dist/cjs/generated/abis/verifier.js +108 -54
- 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 +87 -132
- package/dist/cjs/generated/es/inco/kms/lite/v1/kms_service_pb.js +21 -27
- package/dist/cjs/generated/lightning.d.ts +40 -32
- package/dist/cjs/generated/lightning.js +43 -33
- package/dist/cjs/generated/local-node.d.ts +11 -11
- package/dist/cjs/generated/local-node.js +28 -12
- 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/deployments.d.ts +20 -2
- package/dist/cjs/lite/deployments.js +1 -1
- package/dist/cjs/lite/index.d.ts +1 -2
- package/dist/cjs/lite/index.js +1 -2
- package/dist/cjs/lite/lightning.d.ts +109 -77
- package/dist/cjs/lite/lightning.js +279 -112
- 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 +15 -0
- package/dist/cjs/test/mocks.js +45 -0
- package/dist/cjs/viem.d.ts +1 -1
- package/dist/esm/advancedacl/session-key.d.ts +39 -19
- package/dist/esm/advancedacl/session-key.js +52 -100
- package/dist/esm/attestedcompute/attested-compute.d.ts +6 -6
- package/dist/esm/attestedcompute/attested-compute.js +6 -29
- package/dist/esm/attesteddecrypt/attested-decrypt.d.ts +68 -16
- package/dist/esm/attesteddecrypt/attested-decrypt.js +109 -68
- package/dist/esm/attesteddecrypt/types.d.ts +8 -3
- package/dist/esm/attesteddecrypt/types.js +1 -1
- package/dist/esm/encryption/encryption.d.ts +8 -10
- package/dist/esm/encryption/encryption.js +6 -6
- package/dist/esm/generated/abis/add-two.d.ts +1 -1
- package/dist/esm/generated/abis/add-two.js +1 -1
- package/dist/esm/generated/abis/lightning-preview.d.ts +40 -0
- package/dist/esm/generated/abis/lightning-preview.js +29 -1
- package/dist/esm/generated/abis/lightning.d.ts +1 -1
- package/dist/esm/generated/abis/lightning.js +1 -1
- package/dist/esm/generated/abis/verifier.d.ts +126 -67
- package/dist/esm/generated/abis/verifier.js +108 -54
- 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 +87 -132
- package/dist/esm/generated/es/inco/kms/lite/v1/kms_service_pb.js +19 -25
- package/dist/esm/generated/lightning.d.ts +40 -32
- package/dist/esm/generated/lightning.js +43 -33
- package/dist/esm/generated/local-node.d.ts +11 -11
- package/dist/esm/generated/local-node.js +28 -12
- 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/deployments.d.ts +20 -2
- package/dist/esm/lite/deployments.js +1 -1
- package/dist/esm/lite/index.d.ts +1 -2
- package/dist/esm/lite/index.js +1 -2
- package/dist/esm/lite/lightning.d.ts +109 -77
- package/dist/esm/lite/lightning.js +278 -111
- 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 +15 -0
- package/dist/esm/test/mocks.js +39 -0
- package/dist/esm/viem.d.ts +1 -1
- package/dist/types/advancedacl/session-key.d.ts +39 -19
- package/dist/types/attestedcompute/attested-compute.d.ts +6 -6
- package/dist/types/attesteddecrypt/attested-decrypt.d.ts +68 -16
- package/dist/types/attesteddecrypt/types.d.ts +8 -3
- package/dist/types/encryption/encryption.d.ts +8 -10
- package/dist/types/generated/abis/add-two.d.ts +1 -1
- package/dist/types/generated/abis/lightning-preview.d.ts +40 -0
- package/dist/types/generated/abis/lightning.d.ts +1 -1
- package/dist/types/generated/abis/verifier.d.ts +126 -67
- 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 +87 -132
- package/dist/types/generated/lightning.d.ts +40 -32
- package/dist/types/generated/local-node.d.ts +11 -11
- 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/deployments.d.ts +20 -2
- package/dist/types/lite/index.d.ts +1 -2
- package/dist/types/lite/lightning.d.ts +109 -77
- package/dist/types/local/local-node.d.ts +1 -2
- package/dist/types/test/mocks.d.ts +15 -0
- package/dist/types/viem.d.ts +1 -1
- package/package.json +3 -3
- package/dist/cjs/attestedreveal/attested-reveal.d.ts +0 -21
- package/dist/cjs/attestedreveal/attested-reveal.js +0 -67
- 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 -23
- package/dist/cjs/lite/reencrypt.js +0 -131
- package/dist/esm/attestedreveal/attested-reveal.d.ts +0 -21
- package/dist/esm/attestedreveal/attested-reveal.js +0 -64
- 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 -23
- package/dist/esm/lite/reencrypt.js +0 -122
- 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 -23
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { Account, Chain, Transport, WalletClient } from 'viem';
|
|
1
|
+
import { Account, Chain, 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, Encryptor, SupportedFheType } from '../encryption/index.js';
|
|
7
7
|
import { lightningDeployments } from '../generated/lightning.js';
|
|
8
8
|
import { localNodeLightningConfig } from '../generated/local-node.js';
|
|
9
9
|
import { LocalNodeEnv } from '../local/index.js';
|
|
10
|
-
import type { Reencryptor } from '../reencryption/index.js';
|
|
11
10
|
import { BackoffConfig } from '../retry.js';
|
|
12
11
|
import { Secp256k1Keypair } from './ecies.js';
|
|
13
12
|
type TupleToUnion<T> = T extends readonly unknown[] ? T[number] : never;
|
|
@@ -26,36 +25,38 @@ export type EncryptionContext = {
|
|
|
26
25
|
};
|
|
27
26
|
export type DeploymentSlice = {
|
|
28
27
|
executorAddress: string;
|
|
29
|
-
eciesPublicKey: string;
|
|
30
28
|
chainId: number;
|
|
31
29
|
};
|
|
32
30
|
export type CustomConfig = {
|
|
33
31
|
executorAddress: string;
|
|
34
|
-
eciesPublicKey: string;
|
|
35
32
|
chainId: number;
|
|
36
|
-
|
|
33
|
+
covalidatorUrls: string[];
|
|
34
|
+
signers?: Address[];
|
|
37
35
|
hostChainRpcUrl?: string;
|
|
38
36
|
senderPrivateKey?: HexString;
|
|
39
37
|
};
|
|
40
38
|
export type CustomDeployment = DeploymentSlice & CustomConfig;
|
|
39
|
+
type LocalNodeEnvFileSource = {
|
|
40
|
+
filePath: string;
|
|
41
|
+
};
|
|
41
42
|
/**
|
|
42
43
|
* The Lightning class provides a convenient way to interact with the Inco Lightning contract by binding to a specific
|
|
43
44
|
* deployment.
|
|
44
45
|
*/
|
|
45
46
|
export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
46
47
|
private readonly _deployment;
|
|
47
|
-
readonly
|
|
48
|
+
readonly covalidatorUrls: string[];
|
|
49
|
+
readonly signers: Address[];
|
|
50
|
+
readonly threshold: number;
|
|
48
51
|
readonly executorAddress: Address;
|
|
49
|
-
readonly eciesPublicKey: HexString;
|
|
50
52
|
readonly chainId: bigint;
|
|
51
|
-
private readonly encryptor;
|
|
52
53
|
private readonly ephemeralKeypair;
|
|
53
|
-
private readonly
|
|
54
|
+
private readonly kmsQuorumClient;
|
|
54
55
|
private constructor();
|
|
55
56
|
/**
|
|
56
57
|
* Get a Lightning instance bound to the latest Lightning deployment for the Base Sepolia testnet.
|
|
57
58
|
*/
|
|
58
|
-
static baseSepoliaTestnet(): Lightning<Deployment
|
|
59
|
+
static baseSepoliaTestnet(): Promise<Lightning<Deployment>>;
|
|
59
60
|
/**
|
|
60
61
|
* Get a Lightning instance bound to our canonical Anvil-based test node and test Covalidator node
|
|
61
62
|
*
|
|
@@ -71,26 +72,27 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
71
72
|
* corresponding Pepper.
|
|
72
73
|
*
|
|
73
74
|
*/
|
|
74
|
-
static localNode(env?: LocalNodeEnv | LocalNodePepper): Lightning<CustomDeployment
|
|
75
|
+
static localNode(env?: LocalNodeEnv | LocalNodePepper): Promise<Lightning<CustomDeployment>>;
|
|
75
76
|
/**
|
|
76
77
|
* Get a Lightning instance bound to a local node from a file containing a LocalNodeEnv environment .
|
|
77
78
|
*
|
|
78
79
|
* @param filePath the path to the file containing the environment variables in dotenv format
|
|
79
80
|
*/
|
|
80
|
-
static localNodeFromEnv(
|
|
81
|
+
static localNodeFromEnv(source?: string | Buffer | LocalNodeEnvFileSource): Promise<Lightning<CustomDeployment>>;
|
|
81
82
|
/**
|
|
82
83
|
* Get a Lightning deployment by name or executor address on a particular chain.
|
|
83
84
|
*
|
|
84
85
|
* @param id this is an object containing either the pair of name and chainId or the executorAddress and chainId
|
|
85
86
|
*/
|
|
86
|
-
static at(id: DeploymentId): Lightning<Deployment
|
|
87
|
+
static at(id: DeploymentId): Promise<Lightning<Deployment>>;
|
|
87
88
|
/**
|
|
88
89
|
* Get a Lightning deployment for a local or custom node
|
|
89
90
|
*
|
|
90
91
|
* @param config this is an object containing the executorAddress, eciesPublicKey, chainId and covalidatorUrl.
|
|
91
92
|
* additional fields past will be made available as part of the `deployment` property.
|
|
92
93
|
*/
|
|
93
|
-
static custom<T extends CustomConfig>(config: T): Lightning<DeploymentSlice & T
|
|
94
|
+
static custom<T extends CustomConfig>(config: T): Promise<Lightning<DeploymentSlice & T>>;
|
|
95
|
+
static getEciesPublicKey(client: PublicClient, executorAddress: Address): Promise<HexString>;
|
|
94
96
|
/**
|
|
95
97
|
* Get the latest deployment for a given pepper, which usually denotes a family of deployments distinct from their
|
|
96
98
|
* version such as 'devnet', 'testnet', 'mainnet', etc.
|
|
@@ -105,9 +107,9 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
105
107
|
* will not be compatible with the new version.
|
|
106
108
|
*
|
|
107
109
|
* @param pepper the pepper to use to filter the deployments
|
|
108
|
-
* @param
|
|
110
|
+
* @param chain the chain to use to filter the deployments
|
|
109
111
|
*/
|
|
110
|
-
static latest<P extends Pepper>(pepper: P, chainId: ChainId): Lightning<Deployment
|
|
112
|
+
static latest<P extends Pepper>(pepper: P, chainId: ChainId): Promise<Lightning<Deployment>>;
|
|
111
113
|
get deployment(): T;
|
|
112
114
|
/**
|
|
113
115
|
* Encrypt a value using the public ECIES key of the Lightning deployment.
|
|
@@ -116,15 +118,14 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
116
118
|
* @param accountAddress the address of the account interacting with the dapp contract, normally an Externally Owned Account (EOA)
|
|
117
119
|
* @param dappAddress the address of the dapp contract that interacts with the Inco Lightning contract or library
|
|
118
120
|
*/
|
|
119
|
-
encrypt<T extends SupportedNativeType>(value: T, { accountAddress, dappAddress }: EncryptionContext): Promise<HexString>;
|
|
121
|
+
encrypt<T extends SupportedNativeType>(value: T, { accountAddress, dappAddress }: EncryptionContext, encryptor: Encryptor<EciesScheme>): Promise<HexString>;
|
|
120
122
|
/**
|
|
121
|
-
*
|
|
122
|
-
* The account associated with the walletClient must have permissions to decrypt the handle or ciphertext passed
|
|
123
|
-
* to the reencryptor function.
|
|
123
|
+
* Get the encryptor for a specific ECIES public key.
|
|
124
124
|
*
|
|
125
|
-
* @param
|
|
125
|
+
* @param eciesPubkey the ECIES public key to use for encryption
|
|
126
|
+
* @returns an Encryptor instance configured for the specified ECIES public key
|
|
126
127
|
*/
|
|
127
|
-
|
|
128
|
+
getEncryptor(eciesPubkey: HexString): Encryptor<EciesScheme>;
|
|
128
129
|
/**
|
|
129
130
|
* Grants a session key allowance voucher for secure reencryption operations.
|
|
130
131
|
*
|
|
@@ -149,24 +150,6 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
149
150
|
* ```
|
|
150
151
|
*/
|
|
151
152
|
grantSessionKeyAllowanceVoucher(walletClient: WalletClient<Transport, Chain, Account>, granteeAddress: string, expiresAt: Date, sessionVerifierAddress: string): Promise<AllowanceVoucherWithSig>;
|
|
152
|
-
/**
|
|
153
|
-
* Creates a session key reencryptor for secure data reencryption operations.
|
|
154
|
-
*
|
|
155
|
-
* This method returns a reencryptor instance that can be used to perform reencryption
|
|
156
|
-
* operations using session keys. The reencryptor is configured with the provided
|
|
157
|
-
* allowance voucher and ephemeral keypair for secure communication.
|
|
158
|
-
*
|
|
159
|
-
* @param allowanceVoucherWithSig - The signed allowance voucher obtained from grantSessionKeyAllowanceVoucher
|
|
160
|
-
* @param ephemeralKeypair - The ephemeral keypair used for secure communication with the KMS make sure it has allowance to voucher
|
|
161
|
-
* @returns A reencryptor instance configured for session key operations
|
|
162
|
-
*
|
|
163
|
-
* @example
|
|
164
|
-
* ```typescript
|
|
165
|
-
* const reencryptor = await lightning.getSessionKeyRencryptor(voucher, ephemeralKeypair);
|
|
166
|
-
* const decryptedValue = await reencryptor({handle: resultHandle});
|
|
167
|
-
* ```
|
|
168
|
-
*/
|
|
169
|
-
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>>)>;
|
|
170
153
|
/**
|
|
171
154
|
* Updates the active session nonce for the given wallet client.
|
|
172
155
|
*
|
|
@@ -178,35 +161,68 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
178
161
|
*/
|
|
179
162
|
updateActiveVouchersSessionNonce(walletClient: WalletClient<Transport, Chain, Account>): Promise<HexString>;
|
|
180
163
|
/**
|
|
181
|
-
*
|
|
164
|
+
* Requests attested decrypts signed by the covalidator using a wallet client.
|
|
182
165
|
*
|
|
183
|
-
* @param walletClient
|
|
184
|
-
* @param handles -
|
|
185
|
-
* @param backoffConfig
|
|
186
|
-
* @returns The decryption attestations
|
|
166
|
+
* @param walletClient Wallet used to sign the EIP-712 request.
|
|
167
|
+
* @param handles 32-byte handles to decrypt.
|
|
168
|
+
* @param backoffConfig Optional retry configuration.
|
|
187
169
|
*
|
|
188
|
-
* @example
|
|
189
|
-
* ```
|
|
190
|
-
* const
|
|
191
|
-
*
|
|
170
|
+
* @example Plaintext results
|
|
171
|
+
* ```ts
|
|
172
|
+
* const attestations = await lightning.attestedDecrypt(walletClient, [handle]);
|
|
173
|
+
* console.log(attestations[0].plaintext.value);
|
|
174
|
+
* ```
|
|
175
|
+
*
|
|
176
|
+
* @example Reencrypt for a delegate
|
|
177
|
+
* ```ts
|
|
178
|
+
* const encrypted = await lightning.attestedDecrypt(walletClient, [handle], delegatePubKey);
|
|
179
|
+
* console.log(encrypted[0].encryptedPlaintext.ciphertext.value);
|
|
180
|
+
* ```
|
|
181
|
+
*
|
|
182
|
+
* @example Reencrypt and decrypt locally
|
|
183
|
+
* ```ts
|
|
184
|
+
* const decrypted = await lightning.attestedDecrypt(
|
|
185
|
+
* walletClient,
|
|
186
|
+
* [handle],
|
|
187
|
+
* keypair.encodePublicKey(),
|
|
188
|
+
* keypair,
|
|
189
|
+
* );
|
|
190
|
+
* console.log(decrypted[0].plaintext.value);
|
|
192
191
|
* ```
|
|
193
192
|
*/
|
|
194
193
|
attestedDecrypt(walletClient: WalletClient<Transport, Chain, Account>, handles: HexString[], backoffConfig?: Partial<BackoffConfig>): Promise<Array<DecryptionAttestation<EciesScheme, SupportedFheType>>>;
|
|
194
|
+
attestedDecrypt(walletClient: WalletClient<Transport, Chain, Account>, handles: HexString[], reencryptPubKey: Uint8Array, backoffConfig?: Partial<BackoffConfig>): Promise<Array<EncryptedDecryptionAttestation<EciesScheme, SupportedFheType>>>;
|
|
195
|
+
attestedDecrypt(walletClient: WalletClient<Transport, Chain, Account>, handles: HexString[], reencryptPubKey: Uint8Array, reencryptKeypair: Secp256k1Keypair, backoffConfig?: Partial<BackoffConfig>): Promise<Array<DecryptionAttestation<EciesScheme, SupportedFheType>>>;
|
|
195
196
|
/**
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
197
|
+
* Requests attested decrypts using a voucher-backed session key.
|
|
198
|
+
*
|
|
199
|
+
* @param ephemeralKeypair Session keypair matching the voucher grantee.
|
|
200
|
+
* @param allowanceVoucherWithSig Signed allowance voucher.
|
|
201
|
+
* @param handles Handles to decrypt.
|
|
202
|
+
* @param options Optional reencryption/backoff configuration.
|
|
200
203
|
*
|
|
201
|
-
* @
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
204
|
+
* @example Plaintext results
|
|
205
|
+
* ```ts
|
|
206
|
+
* const attestations = await lightning.attestedDecryptWithVoucher(
|
|
207
|
+
* ephemeralKeypair,
|
|
208
|
+
* voucher,
|
|
209
|
+
* [handle],
|
|
210
|
+
* );
|
|
211
|
+
* ```
|
|
206
212
|
*
|
|
207
|
-
* @
|
|
213
|
+
* @example Reencrypt for a delegate
|
|
214
|
+
* ```ts
|
|
215
|
+
* const encrypted = await lightning.attestedDecryptWithVoucher(
|
|
216
|
+
* ephemeralKeypair,
|
|
217
|
+
* voucher,
|
|
218
|
+
* [handle],
|
|
219
|
+
* { reencryptPubKey: delegateKeypair.encodePublicKey() },
|
|
220
|
+
* );
|
|
221
|
+
* ```
|
|
208
222
|
*/
|
|
209
|
-
|
|
223
|
+
attestedDecryptWithVoucher(ephemeralKeypair: Secp256k1Keypair, allowanceVoucherWithSig: AllowanceVoucherWithSig, handles: HexString[], backoffConfig?: Partial<BackoffConfig>): Promise<Array<DecryptionAttestation<EciesScheme, SupportedFheType>>>;
|
|
224
|
+
attestedDecryptWithVoucher(ephemeralKeypair: Secp256k1Keypair, allowanceVoucherWithSig: AllowanceVoucherWithSig, handles: HexString[], reencryptPubKey: Uint8Array, backoffConfig?: Partial<BackoffConfig>): Promise<Array<EncryptedDecryptionAttestation<EciesScheme, SupportedFheType>>>;
|
|
225
|
+
attestedDecryptWithVoucher(ephemeralKeypair: Secp256k1Keypair, allowanceVoucherWithSig: AllowanceVoucherWithSig, handles: HexString[], reencryptPubKey: Uint8Array, reencryptKeypair: Secp256k1Keypair, backoffConfig?: Partial<BackoffConfig>): Promise<Array<DecryptionAttestation<EciesScheme, SupportedFheType>>>;
|
|
210
226
|
/**
|
|
211
227
|
* Get an attested compute for the given wallet client.
|
|
212
228
|
*
|
|
@@ -229,29 +245,45 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
229
245
|
*/
|
|
230
246
|
attestedCompute(walletClient: WalletClient<Transport, Chain, Account>, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean, backoffConfig?: Partial<BackoffConfig>): Promise<DecryptionAttestation<EciesScheme, SupportedFheType>>;
|
|
231
247
|
/**
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
*
|
|
248
|
+
* Performs attested compute via a voucher-backed session key.
|
|
249
|
+
*
|
|
250
|
+
* @example
|
|
251
|
+
* ```ts
|
|
252
|
+
* const attestation = await lightning.attestedComputeWithVoucher(
|
|
253
|
+
* ephemeralKeypair,
|
|
254
|
+
* voucher,
|
|
255
|
+
* lhsHandle,
|
|
256
|
+
* AttestedComputeSupportedOps.Eq,
|
|
257
|
+
* true,
|
|
258
|
+
* );
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
261
|
+
attestedComputeWithVoucher(ephemeralKeypair: Secp256k1Keypair, allowanceVoucherWithSig: AllowanceVoucherWithSig, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean, backoffConfig?: Partial<BackoffConfig>): Promise<DecryptionAttestation<EciesScheme, SupportedFheType>>;
|
|
262
|
+
/**
|
|
263
|
+
* Get an decryption of publicly revealed handles.
|
|
236
264
|
*
|
|
237
|
-
* @param
|
|
238
|
-
* @param
|
|
239
|
-
* @
|
|
240
|
-
* @param rhsPlaintext The plaintext to compute with
|
|
241
|
-
* @param allowanceVoucherWithSig The signed allowance voucher, obtained from
|
|
242
|
-
* `grantSessionKeyAllowanceVoucher`, proving the session key's compute rights.
|
|
243
|
-
* @param backoffConfig Optional configuration for retry and backoff strategy.
|
|
265
|
+
* @param handles - The handles to decrypt
|
|
266
|
+
* @param backoffConfig - The backoff configuration for the attested decrypt request
|
|
267
|
+
* @returns The decryption attestations
|
|
244
268
|
*
|
|
245
|
-
* @
|
|
269
|
+
* @example
|
|
270
|
+
* ```typescript
|
|
271
|
+
* const response = await lightning.attestedReveal([handle1, handle2]);
|
|
272
|
+
* const { plaintext, covalidatorSignature } = response[0];
|
|
273
|
+
* ```
|
|
246
274
|
*/
|
|
247
|
-
|
|
275
|
+
attestedReveal(handles: HexString[], backoffConfig?: Partial<BackoffConfig>): Promise<Array<DecryptionAttestation<EciesScheme, SupportedFheType>>>;
|
|
248
276
|
/**
|
|
249
277
|
* Get the GRPC endpoint for the covalidator that services this deployment.
|
|
250
278
|
*/
|
|
251
|
-
static
|
|
279
|
+
static getCovalidatorUrls(deployment: DeploymentSlice & {
|
|
252
280
|
pepper: string;
|
|
253
|
-
}): string;
|
|
281
|
+
}, threshold: number): string[];
|
|
254
282
|
private static isIdByName;
|
|
255
283
|
private static plaintextFromValue;
|
|
284
|
+
private static getContractThresholdAndSigners;
|
|
285
|
+
private static getThresholdAndSigners;
|
|
286
|
+
private static supportsThresholdRetrieval;
|
|
287
|
+
private static getDefaultThresholdAndSigners;
|
|
256
288
|
}
|
|
257
289
|
export {};
|