@inco/js 0.8.0-devnet-22 → 0.8.0-devnet-24
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 +1 -1
- package/dist/cjs/advancedacl/session-key.js +14 -1
- package/dist/cjs/attestedcompute/attested-compute.d.ts +1 -1
- package/dist/cjs/attestedcompute/attested-compute.js +7 -1
- package/dist/cjs/attesteddecrypt/attested-decrypt.d.ts +0 -37
- package/dist/cjs/attesteddecrypt/attested-decrypt.js +35 -49
- package/dist/cjs/attestedreveal/attested-reveal.d.ts +22 -0
- package/dist/cjs/attestedreveal/attested-reveal.js +38 -0
- package/dist/cjs/attestedreveal/index.d.ts +2 -0
- package/dist/cjs/attestedreveal/index.js +21 -0
- package/dist/cjs/attestedreveal/types.d.ts +4 -0
- package/dist/cjs/attestedreveal/types.js +13 -0
- package/dist/cjs/generated/abis/lightning.d.ts +33 -0
- package/dist/cjs/generated/abis/lightning.js +23 -1
- package/dist/cjs/generated/abis/test-elist.d.ts +4 -0
- package/dist/cjs/generated/abis/test-elist.js +2 -1
- package/dist/cjs/generated/es/inco/covalidator/compute/v1/server_pb.d.ts +5 -1
- package/dist/cjs/generated/es/inco/covalidator/compute/v1/server_pb.js +2 -2
- package/dist/cjs/lite/index.d.ts +4 -0
- package/dist/cjs/lite/index.js +8 -1
- package/dist/cjs/lite/lightning.d.ts +41 -31
- package/dist/cjs/lite/lightning.js +92 -198
- package/dist/cjs/lite/types.d.ts +47 -0
- package/dist/cjs/lite/types.js +3 -0
- package/dist/cjs/lite/xwing.d.ts +6 -0
- package/dist/cjs/lite/xwing.js +12 -1
- package/dist/esm/advancedacl/session-key.d.ts +1 -1
- package/dist/esm/advancedacl/session-key.js +14 -1
- package/dist/esm/attestedcompute/attested-compute.d.ts +1 -1
- package/dist/esm/attestedcompute/attested-compute.js +7 -1
- package/dist/esm/attesteddecrypt/attested-decrypt.d.ts +0 -37
- package/dist/esm/attesteddecrypt/attested-decrypt.js +38 -52
- package/dist/esm/attestedreveal/attested-reveal.d.ts +22 -0
- package/dist/esm/attestedreveal/attested-reveal.js +35 -0
- package/dist/esm/attestedreveal/index.d.ts +2 -0
- package/dist/esm/attestedreveal/index.js +3 -0
- package/dist/esm/attestedreveal/types.d.ts +4 -0
- package/dist/esm/attestedreveal/types.js +9 -0
- package/dist/esm/generated/abis/lightning.d.ts +33 -0
- package/dist/esm/generated/abis/lightning.js +23 -1
- package/dist/esm/generated/abis/test-elist.d.ts +4 -0
- package/dist/esm/generated/abis/test-elist.js +2 -1
- package/dist/esm/generated/es/inco/covalidator/compute/v1/server_pb.d.ts +5 -1
- package/dist/esm/generated/es/inco/covalidator/compute/v1/server_pb.js +2 -2
- package/dist/esm/lite/index.d.ts +4 -0
- package/dist/esm/lite/index.js +4 -1
- package/dist/esm/lite/lightning.d.ts +41 -31
- package/dist/esm/lite/lightning.js +92 -198
- package/dist/esm/lite/types.d.ts +47 -0
- package/dist/esm/lite/types.js +2 -0
- package/dist/esm/lite/xwing.d.ts +6 -0
- package/dist/esm/lite/xwing.js +11 -1
- package/dist/types/advancedacl/session-key.d.ts +1 -1
- package/dist/types/attestedcompute/attested-compute.d.ts +1 -1
- package/dist/types/attesteddecrypt/attested-decrypt.d.ts +0 -37
- package/dist/types/attestedreveal/attested-reveal.d.ts +22 -0
- package/dist/types/attestedreveal/index.d.ts +2 -0
- package/dist/types/attestedreveal/types.d.ts +4 -0
- package/dist/types/generated/abis/lightning.d.ts +33 -0
- package/dist/types/generated/abis/test-elist.d.ts +4 -0
- package/dist/types/generated/es/inco/covalidator/compute/v1/server_pb.d.ts +5 -1
- package/dist/types/lite/index.d.ts +4 -0
- package/dist/types/lite/lightning.d.ts +41 -31
- package/dist/types/lite/types.d.ts +47 -0
- package/dist/types/lite/xwing.d.ts +6 -0
- package/package.json +1 -1
|
@@ -22,22 +22,6 @@ export interface IncoLiteAttestedDecryptorArgs {
|
|
|
22
22
|
/** The chain ID to use */
|
|
23
23
|
chainId: SupportedChainId;
|
|
24
24
|
}
|
|
25
|
-
/**
|
|
26
|
-
* Decrypt multiple handles in a single attested request without wallet authentication.
|
|
27
|
-
* Returns an array of attestations aligned with the response ordering.
|
|
28
|
-
*
|
|
29
|
-
* @param args - The arguments for creating the attested decrypt function
|
|
30
|
-
* @returns A function that can decrypt handles and return an attestation
|
|
31
|
-
* @throws {AttestedDecryptError} If the creation fails
|
|
32
|
-
*/
|
|
33
|
-
export declare function attestedDecrypt({ handles, backoffConfig, chainId, kmsQuorumClient, executorAddress, hostChainRpcUrl, }: {
|
|
34
|
-
handles: HexString[];
|
|
35
|
-
backoffConfig?: Partial<BackoffConfig> | undefined;
|
|
36
|
-
chainId: SupportedChainId;
|
|
37
|
-
kmsQuorumClient: KmsQuorumClient;
|
|
38
|
-
executorAddress: HexString;
|
|
39
|
-
hostChainRpcUrl?: string | undefined;
|
|
40
|
-
}): Promise<Array<DecryptionAttestation<EncryptionScheme, SupportedFheType>>>;
|
|
41
25
|
/**
|
|
42
26
|
* Decrypt multiple handles in a single attested request.
|
|
43
27
|
* Returns an array of attestations aligned with the response ordering.
|
|
@@ -55,7 +39,6 @@ export declare function attestedDecrypt({ handles, backoffConfig, walletClient,
|
|
|
55
39
|
reencryptKeypair: XwingKeypair;
|
|
56
40
|
kmsQuorumClient: KmsQuorumClient;
|
|
57
41
|
executorAddress: HexString;
|
|
58
|
-
hostChainRpcUrl?: string | undefined;
|
|
59
42
|
}): Promise<Array<DecryptionAttestation<EncryptionScheme, SupportedFheType>>>;
|
|
60
43
|
/**
|
|
61
44
|
* Decrypt multiple handles in a single attested request.
|
|
@@ -74,26 +57,6 @@ export declare function attestedDecrypt({ handles, backoffConfig, walletClient,
|
|
|
74
57
|
reencryptKeypair?: never;
|
|
75
58
|
kmsQuorumClient: KmsQuorumClient;
|
|
76
59
|
executorAddress: HexString;
|
|
77
|
-
hostChainRpcUrl?: string | undefined;
|
|
78
60
|
}): Promise<Array<EncryptedDecryptionAttestation<EncryptionScheme, SupportedFheType>>>;
|
|
79
|
-
/**
|
|
80
|
-
* Decrypt multiple handles in a single attested request.
|
|
81
|
-
* Returns an array of attestations aligned with the response ordering.
|
|
82
|
-
*
|
|
83
|
-
* @param args - The arguments for creating the attested decrypt function
|
|
84
|
-
* @returns A function that can decrypt handles and return an attestation
|
|
85
|
-
* @throws {AttestedDecryptError} If the creation fails
|
|
86
|
-
*/
|
|
87
|
-
export declare function attestedDecrypt({ handles, backoffConfig, walletClient, chainId, kmsQuorumClient, executorAddress, }: {
|
|
88
|
-
handles: HexString[];
|
|
89
|
-
backoffConfig?: Partial<BackoffConfig> | undefined;
|
|
90
|
-
walletClient: WalletClient<Transport, Chain, Account>;
|
|
91
|
-
chainId: SupportedChainId;
|
|
92
|
-
reencryptPubKey?: never;
|
|
93
|
-
reencryptKeypair?: never;
|
|
94
|
-
kmsQuorumClient: KmsQuorumClient;
|
|
95
|
-
executorAddress: HexString;
|
|
96
|
-
hostChainRpcUrl?: string | undefined;
|
|
97
|
-
}): Promise<Array<DecryptionAttestation<EncryptionScheme, SupportedFheType>>>;
|
|
98
61
|
export declare function fetchEip712DomainVersion(executorAddress: HexString | undefined, defaultVersion: string, walletClient?: WalletClient<Transport, Chain, Account> | PublicClient<Transport, Chain>): Promise<string>;
|
|
99
62
|
export declare function decryptEncryptedAttestations(attestations: Array<DecryptionAttestation<EncryptionScheme, SupportedFheType> | EncryptedDecryptionAttestation<EncryptionScheme, SupportedFheType>>, reencryptKeypair: XwingKeypair): Promise<Array<DecryptionAttestation<EncryptionScheme, SupportedFheType>>>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { DecryptionAttestation } from '../attesteddecrypt/types.js';
|
|
2
|
+
import type { HexString } from '../binary.js';
|
|
3
|
+
import type { SupportedChainId } from '../chain.js';
|
|
4
|
+
import type { EncryptionScheme, SupportedFheType } from '../encryption/encryption.js';
|
|
5
|
+
import type { KmsQuorumClient } from '../kms/quorumClient.js';
|
|
6
|
+
import type { BackoffConfig } from '../retry.js';
|
|
7
|
+
/**
|
|
8
|
+
* Reveal multiple handles in a single attested request without wallet authentication.
|
|
9
|
+
* Returns an array of plaintext attestations aligned with the response ordering.
|
|
10
|
+
*
|
|
11
|
+
* @param args - The arguments for the attested reveal request
|
|
12
|
+
* @returns An array of decryption attestations
|
|
13
|
+
* @throws {AttestedRevealError} If the reveal fails
|
|
14
|
+
*/
|
|
15
|
+
export declare function attestedReveal({ handles, chainId, kmsQuorumClient, executorAddress, hostChainRpcUrl, backoffConfig, }: {
|
|
16
|
+
handles: HexString[];
|
|
17
|
+
chainId: SupportedChainId;
|
|
18
|
+
kmsQuorumClient: KmsQuorumClient;
|
|
19
|
+
executorAddress: HexString;
|
|
20
|
+
hostChainRpcUrl?: string | undefined;
|
|
21
|
+
backoffConfig?: Partial<BackoffConfig> | undefined;
|
|
22
|
+
}): Promise<Array<DecryptionAttestation<EncryptionScheme, SupportedFheType>>>;
|
|
@@ -1177,6 +1177,10 @@ export declare const incoLightningAbi: readonly [{
|
|
|
1177
1177
|
readonly name: "end";
|
|
1178
1178
|
readonly internalType: "uint16";
|
|
1179
1179
|
readonly type: "uint16";
|
|
1180
|
+
}, {
|
|
1181
|
+
readonly name: "listType";
|
|
1182
|
+
readonly internalType: "enum ETypes";
|
|
1183
|
+
readonly type: "uint8";
|
|
1180
1184
|
}];
|
|
1181
1185
|
readonly name: "listRange";
|
|
1182
1186
|
readonly outputs: readonly [{
|
|
@@ -1937,6 +1941,11 @@ export declare const incoLightningAbi: readonly [{
|
|
|
1937
1941
|
readonly internalType: "uint256";
|
|
1938
1942
|
readonly type: "uint256";
|
|
1939
1943
|
readonly indexed: true;
|
|
1944
|
+
}, {
|
|
1945
|
+
readonly name: "listType";
|
|
1946
|
+
readonly internalType: "enum ETypes";
|
|
1947
|
+
readonly type: "uint8";
|
|
1948
|
+
readonly indexed: false;
|
|
1940
1949
|
}, {
|
|
1941
1950
|
readonly name: "result";
|
|
1942
1951
|
readonly internalType: "elist";
|
|
@@ -2672,6 +2681,14 @@ export declare const incoLightningAbi: readonly [{
|
|
|
2672
2681
|
readonly type: "uint16";
|
|
2673
2682
|
}];
|
|
2674
2683
|
readonly name: "InvalidInputVersion";
|
|
2684
|
+
}, {
|
|
2685
|
+
readonly type: "error";
|
|
2686
|
+
readonly inputs: readonly [{
|
|
2687
|
+
readonly name: "raw";
|
|
2688
|
+
readonly internalType: "uint8";
|
|
2689
|
+
readonly type: "uint8";
|
|
2690
|
+
}];
|
|
2691
|
+
readonly name: "InvalidListTypeValue";
|
|
2675
2692
|
}, {
|
|
2676
2693
|
readonly type: "error";
|
|
2677
2694
|
readonly inputs: readonly [{
|
|
@@ -2688,6 +2705,14 @@ export declare const incoLightningAbi: readonly [{
|
|
|
2688
2705
|
readonly type: "error";
|
|
2689
2706
|
readonly inputs: readonly [];
|
|
2690
2707
|
readonly name: "InvalidShortString";
|
|
2708
|
+
}, {
|
|
2709
|
+
readonly type: "error";
|
|
2710
|
+
readonly inputs: readonly [{
|
|
2711
|
+
readonly name: "raw";
|
|
2712
|
+
readonly internalType: "uint8";
|
|
2713
|
+
readonly type: "uint8";
|
|
2714
|
+
}];
|
|
2715
|
+
readonly name: "InvalidTypeValue";
|
|
2691
2716
|
}, {
|
|
2692
2717
|
readonly type: "error";
|
|
2693
2718
|
readonly inputs: readonly [{
|
|
@@ -2752,6 +2777,14 @@ export declare const incoLightningAbi: readonly [{
|
|
|
2752
2777
|
readonly type: "bytes";
|
|
2753
2778
|
}];
|
|
2754
2779
|
readonly name: "ProofVerificationFailed";
|
|
2780
|
+
}, {
|
|
2781
|
+
readonly type: "error";
|
|
2782
|
+
readonly inputs: readonly [{
|
|
2783
|
+
readonly name: "t";
|
|
2784
|
+
readonly internalType: "enum ETypes";
|
|
2785
|
+
readonly type: "uint8";
|
|
2786
|
+
}];
|
|
2787
|
+
readonly name: "SameTypeCast";
|
|
2755
2788
|
}, {
|
|
2756
2789
|
readonly type: "error";
|
|
2757
2790
|
readonly inputs: readonly [{
|
|
@@ -129,6 +129,10 @@ export declare const elistTesterAbi: readonly [{
|
|
|
129
129
|
readonly name: "end";
|
|
130
130
|
readonly internalType: "uint16";
|
|
131
131
|
readonly type: "uint16";
|
|
132
|
+
}, {
|
|
133
|
+
readonly name: "listType";
|
|
134
|
+
readonly internalType: "enum ETypes";
|
|
135
|
+
readonly type: "uint8";
|
|
132
136
|
}];
|
|
133
137
|
readonly name: "listRange";
|
|
134
138
|
readonly outputs: readonly [{
|
|
@@ -426,7 +426,11 @@ export type SingleEListRangeOpRequest = Message<"inco.covalidator.compute.v1.Sin
|
|
|
426
426
|
*/
|
|
427
427
|
end: number;
|
|
428
428
|
/**
|
|
429
|
-
* @generated from field:
|
|
429
|
+
* @generated from field: int32 listType = 3;
|
|
430
|
+
*/
|
|
431
|
+
listType: number;
|
|
432
|
+
/**
|
|
433
|
+
* @generated from field: optional inco.covalidator.compute.v1.ConfigureRequest configure_request = 4;
|
|
430
434
|
*/
|
|
431
435
|
configureRequest?: ConfigureRequest;
|
|
432
436
|
};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
export { AttestedComputeError } from '../attestedcompute/types.js';
|
|
2
|
+
export { AttestedDecryptError } from '../attesteddecrypt/types.js';
|
|
3
|
+
export { AttestedRevealError } from '../attestedreveal/types.js';
|
|
1
4
|
export * from '../generated/abis/lightning.js';
|
|
2
5
|
export type { AttestedComputeRequest, AttestedDecryptRequest, KmsService, } from '../generated/es/inco/kms/lite/v1/kms_service_pb.js';
|
|
3
6
|
export type { HandleWithProof } from '../generated/es/inco/kms/lite/v1/types_pb.js';
|
|
@@ -5,3 +8,4 @@ export * from './attested-compute.js';
|
|
|
5
8
|
export * from './attested-decrypt.js';
|
|
6
9
|
export * from './deployments.js';
|
|
7
10
|
export * from './lightning.js';
|
|
11
|
+
export type { AttestedOpts, AttestedOptsDecrypted, AttestedOptsEncrypted, AttestedOptsEphemeral, AttestedRevealOpts, AttestedWithVoucherOpts, AttestedWithVoucherOptsDecrypted, AttestedWithVoucherOptsEncrypted, AttestedWithVoucherOptsEphemeral, } from './types.js';
|
|
@@ -10,8 +10,7 @@ import { lightningDeployments } from '../generated/lightning.js';
|
|
|
10
10
|
import { localNodeLightningConfig } from '../generated/local-node.js';
|
|
11
11
|
import { FheType } from '../handle.js';
|
|
12
12
|
import { LocalNodeEnv } from '../local/index.js';
|
|
13
|
-
import {
|
|
14
|
-
import { XwingKeypair } from './xwing.js';
|
|
13
|
+
import type { AttestedOptsDecrypted, AttestedOptsEncrypted, AttestedOptsEphemeral, AttestedRevealOpts, AttestedWithVoucherOptsDecrypted, AttestedWithVoucherOptsEncrypted, AttestedWithVoucherOptsEphemeral } from './types.js';
|
|
15
14
|
type TupleToUnion<T> = T extends readonly unknown[] ? T[number] : never;
|
|
16
15
|
type Deployment = TupleToUnion<typeof lightningDeployments>;
|
|
17
16
|
type DistributedPick<T, K> = T extends any ? Pick<T, Extract<keyof T, K>> : never;
|
|
@@ -219,24 +218,24 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
219
218
|
*
|
|
220
219
|
* @example Reencrypt for a delegate
|
|
221
220
|
* ```ts
|
|
222
|
-
* const encrypted = await lightning.attestedDecrypt(walletClient, [handle],
|
|
221
|
+
* const encrypted = await lightning.attestedDecrypt(walletClient, [handle], {
|
|
222
|
+
* reencryptPubKey: delegatePubKey,
|
|
223
|
+
* });
|
|
223
224
|
* console.log(encrypted[0].encryptedPlaintext.ciphertext.value);
|
|
224
225
|
* ```
|
|
225
226
|
*
|
|
226
227
|
* @example Reencrypt and decrypt locally
|
|
227
228
|
* ```ts
|
|
228
|
-
* const decrypted = await lightning.attestedDecrypt(
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
* keypair,
|
|
233
|
-
* );
|
|
229
|
+
* const decrypted = await lightning.attestedDecrypt(walletClient, [handle], {
|
|
230
|
+
* reencryptPubKey: keypair.encodePublicKey(),
|
|
231
|
+
* reencryptKeypair: keypair,
|
|
232
|
+
* });
|
|
234
233
|
* console.log(decrypted[0].plaintext.value);
|
|
235
234
|
* ```
|
|
236
235
|
*/
|
|
237
|
-
attestedDecrypt(walletClient: WalletClient<Transport, Chain, Account>, handles: HexString[],
|
|
238
|
-
attestedDecrypt(walletClient: WalletClient<Transport, Chain, Account>, handles: HexString[],
|
|
239
|
-
attestedDecrypt(walletClient: WalletClient<Transport, Chain, Account>, handles: HexString[],
|
|
236
|
+
attestedDecrypt(walletClient: WalletClient<Transport, Chain, Account>, handles: HexString[], opts?: AttestedOptsEphemeral): Promise<Array<DecryptionAttestation<EncryptionScheme, SupportedFheType>>>;
|
|
237
|
+
attestedDecrypt(walletClient: WalletClient<Transport, Chain, Account>, handles: HexString[], opts: AttestedOptsEncrypted): Promise<Array<EncryptedDecryptionAttestation<EncryptionScheme, SupportedFheType>>>;
|
|
238
|
+
attestedDecrypt(walletClient: WalletClient<Transport, Chain, Account>, handles: HexString[], opts: AttestedOptsDecrypted): Promise<Array<DecryptionAttestation<EncryptionScheme, SupportedFheType>>>;
|
|
240
239
|
/**
|
|
241
240
|
* Requests attested decrypts using a voucher-backed session key.
|
|
242
241
|
*
|
|
@@ -244,7 +243,7 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
244
243
|
* @param allowanceVoucherWithSig Signed allowance voucher.
|
|
245
244
|
* @param ethClient - A public eth client or eth wallet client used for signing the attested decrypt request
|
|
246
245
|
* @param handles Handles to decrypt.
|
|
247
|
-
* @param
|
|
246
|
+
* @param opts Optional reencryption/backoff configuration.
|
|
248
247
|
*
|
|
249
248
|
* @example Plaintext results
|
|
250
249
|
* ```ts
|
|
@@ -266,10 +265,21 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
266
265
|
* { reencryptPubKey: delegateKeypair.encodePublicKey() },
|
|
267
266
|
* );
|
|
268
267
|
* ```
|
|
268
|
+
*
|
|
269
|
+
* @example Reencrypt and decrypt locally
|
|
270
|
+
* ```ts
|
|
271
|
+
* const decrypted = await lightning.attestedDecryptWithVoucher(
|
|
272
|
+
* ephemeralAccount,
|
|
273
|
+
* voucher,
|
|
274
|
+
* ethClient,
|
|
275
|
+
* [handle],
|
|
276
|
+
* { reencryptPubKey: keypair.encodePublicKey(), reencryptKeypair: keypair },
|
|
277
|
+
* );
|
|
278
|
+
* ```
|
|
269
279
|
*/
|
|
270
|
-
attestedDecryptWithVoucher(ephemeralAccount: PrivateKeyAccount, allowanceVoucherWithSig: AllowanceVoucherWithSig, ethClient: PublicClient<Transport, Chain> | WalletClient<Transport, Chain, Account>, handles: HexString[],
|
|
271
|
-
attestedDecryptWithVoucher(ephemeralAccount: PrivateKeyAccount, allowanceVoucherWithSig: AllowanceVoucherWithSig, ethClient: PublicClient<Transport, Chain> | WalletClient<Transport, Chain, Account>, handles: HexString[],
|
|
272
|
-
attestedDecryptWithVoucher(ephemeralAccount: PrivateKeyAccount, allowanceVoucherWithSig: AllowanceVoucherWithSig, ethClient: PublicClient<Transport, Chain> | WalletClient<Transport, Chain, Account>, handles: HexString[],
|
|
280
|
+
attestedDecryptWithVoucher(ephemeralAccount: PrivateKeyAccount, allowanceVoucherWithSig: AllowanceVoucherWithSig, ethClient: PublicClient<Transport, Chain> | WalletClient<Transport, Chain, Account>, handles: HexString[], opts?: AttestedWithVoucherOptsEphemeral): Promise<Array<DecryptionAttestation<EncryptionScheme, SupportedFheType>>>;
|
|
281
|
+
attestedDecryptWithVoucher(ephemeralAccount: PrivateKeyAccount, allowanceVoucherWithSig: AllowanceVoucherWithSig, ethClient: PublicClient<Transport, Chain> | WalletClient<Transport, Chain, Account>, handles: HexString[], opts: AttestedWithVoucherOptsEncrypted): Promise<Array<EncryptedDecryptionAttestation<EncryptionScheme, SupportedFheType>>>;
|
|
282
|
+
attestedDecryptWithVoucher(ephemeralAccount: PrivateKeyAccount, allowanceVoucherWithSig: AllowanceVoucherWithSig, ethClient: PublicClient<Transport, Chain> | WalletClient<Transport, Chain, Account>, handles: HexString[], opts: AttestedWithVoucherOptsDecrypted): Promise<Array<DecryptionAttestation<EncryptionScheme, SupportedFheType>>>;
|
|
273
283
|
/**
|
|
274
284
|
* Get an attested compute for the given wallet client.
|
|
275
285
|
*
|
|
@@ -277,7 +287,7 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
277
287
|
* @param lhsHandle - The handle to compute
|
|
278
288
|
* @param op - The operation to perform
|
|
279
289
|
* @param rhsPlaintext - The plaintext to compute with
|
|
280
|
-
* @param
|
|
290
|
+
* @param opts - Optional configuration (reencryption keys and/or backoff config)
|
|
281
291
|
* @returns The decryption attestation
|
|
282
292
|
*
|
|
283
293
|
* @example Plaintext result
|
|
@@ -297,7 +307,7 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
297
307
|
* lhsHandle,
|
|
298
308
|
* op,
|
|
299
309
|
* rhsPlaintext,
|
|
300
|
-
* delegatePubKey,
|
|
310
|
+
* { reencryptPubKey: delegatePubKey },
|
|
301
311
|
* );
|
|
302
312
|
* console.log(encrypted.encryptedPlaintext.ciphertext.value);
|
|
303
313
|
* ```
|
|
@@ -309,15 +319,14 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
309
319
|
* lhsHandle,
|
|
310
320
|
* op,
|
|
311
321
|
* rhsPlaintext,
|
|
312
|
-
* keypair.encodePublicKey(),
|
|
313
|
-
* keypair,
|
|
322
|
+
* { reencryptPubKey: keypair.encodePublicKey(), reencryptKeypair: keypair },
|
|
314
323
|
* );
|
|
315
324
|
* console.log(decrypted.plaintext.value);
|
|
316
325
|
* ```
|
|
317
326
|
*/
|
|
318
|
-
attestedCompute(walletClient: WalletClient<Transport, Chain, Account>, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean,
|
|
319
|
-
attestedCompute(walletClient: WalletClient<Transport, Chain, Account>, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean,
|
|
320
|
-
attestedCompute(walletClient: WalletClient<Transport, Chain, Account>, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean,
|
|
327
|
+
attestedCompute(walletClient: WalletClient<Transport, Chain, Account>, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean, opts?: AttestedOptsEphemeral): Promise<DecryptionAttestation<EncryptionScheme, SupportedFheType>>;
|
|
328
|
+
attestedCompute(walletClient: WalletClient<Transport, Chain, Account>, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean, opts: AttestedOptsEncrypted): Promise<EncryptedDecryptionAttestation<EncryptionScheme, SupportedFheType>>;
|
|
329
|
+
attestedCompute(walletClient: WalletClient<Transport, Chain, Account>, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean, opts: AttestedOptsDecrypted): Promise<DecryptionAttestation<EncryptionScheme, SupportedFheType>>;
|
|
321
330
|
/**
|
|
322
331
|
* Performs attested compute via a voucher-backed session key.
|
|
323
332
|
*
|
|
@@ -338,10 +347,11 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
338
347
|
* const encrypted = await lightning.attestedComputeWithVoucher(
|
|
339
348
|
* ephemeralAccount,
|
|
340
349
|
* voucher,
|
|
350
|
+
* ethClient,
|
|
341
351
|
* lhsHandle,
|
|
342
352
|
* AttestedComputeSupportedOps.Eq,
|
|
343
353
|
* true,
|
|
344
|
-
* delegatePubKey,
|
|
354
|
+
* { reencryptPubKey: delegatePubKey },
|
|
345
355
|
* );
|
|
346
356
|
* console.log(encrypted.encryptedPlaintext.ciphertext.value);
|
|
347
357
|
* ```
|
|
@@ -351,18 +361,18 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
351
361
|
* const decrypted = await lightning.attestedComputeWithVoucher(
|
|
352
362
|
* ephemeralAccount,
|
|
353
363
|
* voucher,
|
|
364
|
+
* ethClient,
|
|
354
365
|
* lhsHandle,
|
|
355
366
|
* AttestedComputeSupportedOps.Eq,
|
|
356
367
|
* true,
|
|
357
|
-
* keypair.encodePublicKey(),
|
|
358
|
-
* keypair,
|
|
368
|
+
* { reencryptPubKey: keypair.encodePublicKey(), reencryptKeypair: keypair },
|
|
359
369
|
* );
|
|
360
370
|
* console.log(decrypted.plaintext.value);
|
|
361
371
|
* ```
|
|
362
372
|
*/
|
|
363
|
-
attestedComputeWithVoucher(ephemeralAccount: PrivateKeyAccount, allowanceVoucherWithSig: AllowanceVoucherWithSig, ethClient: PublicClient<Transport, Chain> | WalletClient<Transport, Chain, Account>, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean,
|
|
364
|
-
attestedComputeWithVoucher(ephemeralAccount: PrivateKeyAccount, allowanceVoucherWithSig: AllowanceVoucherWithSig, ethClient: PublicClient<Transport, Chain> | WalletClient<Transport, Chain, Account>, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean,
|
|
365
|
-
attestedComputeWithVoucher(ephemeralAccount: PrivateKeyAccount, allowanceVoucherWithSig: AllowanceVoucherWithSig, ethClient: PublicClient<Transport, Chain> | WalletClient<Transport, Chain, Account>, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean,
|
|
373
|
+
attestedComputeWithVoucher(ephemeralAccount: PrivateKeyAccount, allowanceVoucherWithSig: AllowanceVoucherWithSig, ethClient: PublicClient<Transport, Chain> | WalletClient<Transport, Chain, Account>, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean, opts?: AttestedWithVoucherOptsEphemeral): Promise<DecryptionAttestation<EncryptionScheme, SupportedFheType>>;
|
|
374
|
+
attestedComputeWithVoucher(ephemeralAccount: PrivateKeyAccount, allowanceVoucherWithSig: AllowanceVoucherWithSig, ethClient: PublicClient<Transport, Chain> | WalletClient<Transport, Chain, Account>, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean, opts: AttestedWithVoucherOptsEncrypted): Promise<EncryptedDecryptionAttestation<EncryptionScheme, SupportedFheType>>;
|
|
375
|
+
attestedComputeWithVoucher(ephemeralAccount: PrivateKeyAccount, allowanceVoucherWithSig: AllowanceVoucherWithSig, ethClient: PublicClient<Transport, Chain> | WalletClient<Transport, Chain, Account>, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean, opts: AttestedWithVoucherOptsDecrypted): Promise<DecryptionAttestation<EncryptionScheme, SupportedFheType>>;
|
|
366
376
|
/**
|
|
367
377
|
* Get an decryption of publicly revealed handles.
|
|
368
378
|
*
|
|
@@ -372,11 +382,11 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
372
382
|
*
|
|
373
383
|
* @example
|
|
374
384
|
* ```typescript
|
|
375
|
-
* const response = await lightning.attestedReveal([handle1, handle2]
|
|
385
|
+
* const response = await lightning.attestedReveal([handle1, handle2]);
|
|
376
386
|
* const { plaintext, covalidatorSignature } = response[0];
|
|
377
387
|
* ```
|
|
378
388
|
*/
|
|
379
|
-
attestedReveal(handles: HexString[],
|
|
389
|
+
attestedReveal(handles: HexString[], opts?: AttestedRevealOpts): Promise<Array<DecryptionAttestation<EncryptionScheme, SupportedFheType>>>;
|
|
380
390
|
/**
|
|
381
391
|
* Get the GRPC endpoint for the covalidator that services this deployment.
|
|
382
392
|
*/
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { HexString } from '../binary.js';
|
|
2
|
+
import type { BackoffConfig } from '../retry.js';
|
|
3
|
+
import type { XwingKeypair } from './xwing.js';
|
|
4
|
+
/**
|
|
5
|
+
* Options for attested methods when no reencrypt keys are provided.
|
|
6
|
+
* The KMS generates an ephemeral keypair and returns plaintext.
|
|
7
|
+
*/
|
|
8
|
+
export type AttestedOptsEphemeral = {
|
|
9
|
+
reencryptPubKey?: never;
|
|
10
|
+
reencryptKeypair?: never;
|
|
11
|
+
backoffConfig?: Partial<BackoffConfig>;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Options for attested methods when only a reencrypt public key is provided.
|
|
15
|
+
* The KMS encrypts the result under the provided key; caller receives ciphertext.
|
|
16
|
+
*/
|
|
17
|
+
export type AttestedOptsEncrypted = {
|
|
18
|
+
reencryptPubKey: Uint8Array;
|
|
19
|
+
reencryptKeypair?: never;
|
|
20
|
+
backoffConfig?: Partial<BackoffConfig>;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Options for attested methods when both a reencrypt key and keypair are provided.
|
|
24
|
+
* The KMS reencrypts under the public key; the SDK decrypts locally using the keypair.
|
|
25
|
+
*/
|
|
26
|
+
export type AttestedOptsDecrypted = {
|
|
27
|
+
reencryptPubKey: Uint8Array;
|
|
28
|
+
reencryptKeypair: XwingKeypair;
|
|
29
|
+
backoffConfig?: Partial<BackoffConfig>;
|
|
30
|
+
};
|
|
31
|
+
/** Union of all valid opts for attestedDecrypt / attestedCompute. */
|
|
32
|
+
export type AttestedOpts = AttestedOptsEphemeral | AttestedOptsEncrypted | AttestedOptsDecrypted;
|
|
33
|
+
/** Extends the base opts with voucher-specific fields for WithVoucher methods. */
|
|
34
|
+
export type AttestedWithVoucherOptsEphemeral = AttestedOptsEphemeral & {
|
|
35
|
+
requesterArgData?: HexString;
|
|
36
|
+
};
|
|
37
|
+
export type AttestedWithVoucherOptsEncrypted = AttestedOptsEncrypted & {
|
|
38
|
+
requesterArgData?: HexString;
|
|
39
|
+
};
|
|
40
|
+
export type AttestedWithVoucherOptsDecrypted = AttestedOptsDecrypted & {
|
|
41
|
+
requesterArgData?: HexString;
|
|
42
|
+
};
|
|
43
|
+
export type AttestedWithVoucherOpts = AttestedWithVoucherOptsEphemeral | AttestedWithVoucherOptsEncrypted | AttestedWithVoucherOptsDecrypted;
|
|
44
|
+
/** Options for attestedReveal. */
|
|
45
|
+
export type AttestedRevealOpts = {
|
|
46
|
+
backoffConfig?: Partial<BackoffConfig>;
|
|
47
|
+
};
|
|
@@ -146,3 +146,9 @@ export declare function getXwingEncryptor({ pubKeyA, }: XwingEncryptorArgs): Enc
|
|
|
146
146
|
* @returns Decryptor function
|
|
147
147
|
*/
|
|
148
148
|
export declare function getXwingDecryptor({ privKeyA, }: XwingDecryptorArgs): Decryptor<XwingScheme>;
|
|
149
|
+
/**
|
|
150
|
+
* Returns true if the raw public key bytes match the public key encoded by the keypair.
|
|
151
|
+
* Used to catch caller mistakes before sending the keypair to the covalidator, where a
|
|
152
|
+
* mismatch would produce a cryptic signature error instead of a clear failure.
|
|
153
|
+
*/
|
|
154
|
+
export declare function reencryptPublicKeysMatch(reencryptPubKey: Uint8Array, reencryptKeypair: XwingKeypair): boolean;
|