@inco/js 0.3.1 → 0.3.2-alpha.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/dist/cjs/attestedcompute/attested-compute.d.ts +14 -16
- package/dist/cjs/attestedcompute/attested-compute.js +56 -71
- package/dist/cjs/attesteddecrypt/attested-decrypt.d.ts +18 -19
- package/dist/cjs/attesteddecrypt/attested-decrypt.js +50 -60
- package/dist/cjs/attesteddecrypt/index.d.ts +0 -1
- package/dist/cjs/attesteddecrypt/index.js +1 -2
- package/dist/cjs/lite/attested-compute.d.ts +1 -2
- package/dist/cjs/lite/attested-compute.js +1 -4
- package/dist/cjs/lite/attested-decrypt.d.ts +1 -2
- package/dist/cjs/lite/attested-decrypt.js +1 -4
- package/dist/cjs/lite/lightning.d.ts +41 -2
- package/dist/cjs/lite/lightning.js +57 -1
- package/dist/esm/attestedcompute/attested-compute.d.ts +14 -16
- package/dist/esm/attestedcompute/attested-compute.js +55 -70
- package/dist/esm/attesteddecrypt/attested-decrypt.d.ts +18 -19
- package/dist/esm/attesteddecrypt/attested-decrypt.js +49 -59
- package/dist/esm/attesteddecrypt/index.d.ts +0 -1
- package/dist/esm/attesteddecrypt/index.js +1 -2
- package/dist/esm/lite/attested-compute.d.ts +1 -2
- package/dist/esm/lite/attested-compute.js +2 -3
- package/dist/esm/lite/attested-decrypt.d.ts +1 -2
- package/dist/esm/lite/attested-decrypt.js +2 -3
- package/dist/esm/lite/lightning.d.ts +41 -2
- package/dist/esm/lite/lightning.js +57 -1
- package/dist/types/attestedcompute/attested-compute.d.ts +14 -16
- package/dist/types/attesteddecrypt/attested-decrypt.d.ts +18 -19
- package/dist/types/attesteddecrypt/index.d.ts +0 -1
- package/dist/types/lite/attested-compute.d.ts +1 -2
- package/dist/types/lite/attested-decrypt.d.ts +1 -2
- package/dist/types/lite/lightning.d.ts +41 -2
- package/package.json +1 -1
@@ -1,8 +1,11 @@
|
|
1
1
|
import type { Account, Chain, Transport, WalletClient } from 'viem';
|
2
|
+
import { DecryptionAttestation } from '../attesteddecrypt/types.js';
|
3
|
+
import { HexString } from '../binary.js';
|
2
4
|
import { SupportedChainId } from '../chain.js';
|
3
|
-
import { EciesScheme } from '../encryption/encryption.js';
|
5
|
+
import { EciesScheme, SupportedFheType } from '../encryption/encryption.js';
|
4
6
|
import type { KmsClient } from '../kms/client.js';
|
5
|
-
import {
|
7
|
+
import type { BackoffConfig } from '../retry.js';
|
8
|
+
import { AttestedComputeOP } from './types.js';
|
6
9
|
/**
|
7
10
|
* Arguments for creating an attested compute.
|
8
11
|
*/
|
@@ -21,18 +24,13 @@ export interface IncoLiteAttestedComputeArgs {
|
|
21
24
|
* @throws {AttestedComputeError} If the creation fails
|
22
25
|
*
|
23
26
|
* @todo Support multiple operations in a single request.
|
24
|
-
*
|
25
|
-
* @example
|
26
|
-
* ```typescript
|
27
|
-
* const compute = await incoLiteAttestedCompute({
|
28
|
-
* walletClient,
|
29
|
-
* chainId: sepolia,
|
30
|
-
* });
|
31
|
-
* const decryptionAttestation = await compute({
|
32
|
-
* lhsHandle: '0x...',
|
33
|
-
* op: AttestedComputeSupportedOps.Eq,
|
34
|
-
* rhsPlaintext: 1337n,
|
35
|
-
* });
|
36
|
-
* ```
|
37
27
|
*/
|
38
|
-
export declare function
|
28
|
+
export declare function attestedCompute<T extends SupportedFheType>({ lhsHandle, op, rhsPlaintext, backoffConfig, walletClient, kmsConnectRpcEndpointOrClient, chainId, }: {
|
29
|
+
lhsHandle: HexString;
|
30
|
+
op: AttestedComputeOP;
|
31
|
+
rhsPlaintext: bigint | boolean;
|
32
|
+
backoffConfig?: Partial<BackoffConfig> | undefined;
|
33
|
+
walletClient: WalletClient<Transport, Chain, Account>;
|
34
|
+
kmsConnectRpcEndpointOrClient?: string | KmsClient;
|
35
|
+
chainId: SupportedChainId;
|
36
|
+
}): Promise<DecryptionAttestation<EciesScheme, T>>;
|
@@ -1,16 +1,18 @@
|
|
1
1
|
import type { Account, Chain, Transport, WalletClient } from 'viem';
|
2
|
+
import { HexString } from '../binary.js';
|
2
3
|
import { SupportedChainId } from '../chain.js';
|
3
|
-
import { EciesScheme } from '../encryption/encryption.js';
|
4
|
+
import { EciesScheme, SupportedFheType } from '../encryption/encryption.js';
|
4
5
|
import type { KmsClient } from '../kms/client.js';
|
5
|
-
import {
|
6
|
+
import type { BackoffConfig } from '../retry.js';
|
7
|
+
import { DecryptionAttestation } from './types.js';
|
6
8
|
/**
|
7
9
|
* Validates a handle format.
|
8
10
|
* @param handle - The handle to validate
|
9
11
|
* @throws {AttestedDecryptError} If the handle format is invalid
|
10
12
|
*/
|
11
|
-
export declare function validateHandle(handle:
|
13
|
+
export declare function validateHandle(handle: HexString): void;
|
12
14
|
/**
|
13
|
-
* Arguments for creating an attested
|
15
|
+
* Arguments for creating an attested decrypt request.
|
14
16
|
*/
|
15
17
|
export interface IncoLiteAttestedDecryptorArgs {
|
16
18
|
/** The wallet used to interact with the blockchain and sign the decrypt request */
|
@@ -21,20 +23,17 @@ export interface IncoLiteAttestedDecryptorArgs {
|
|
21
23
|
chainId: SupportedChainId;
|
22
24
|
}
|
23
25
|
/**
|
24
|
-
*
|
25
|
-
*
|
26
|
-
* @returns A function that can decrypt handles using attestation
|
27
|
-
* @throws {AttestedDecryptError} If the decryptor creation fails
|
26
|
+
* Decrypt multiple handles in a single attested request.
|
27
|
+
* Returns an array of attestations aligned with the response ordering.
|
28
28
|
*
|
29
|
-
* @
|
30
|
-
*
|
31
|
-
* @
|
32
|
-
* ```typescript
|
33
|
-
* const decryptor = await incoLiteAttestedDecryptor({
|
34
|
-
* walletClient,
|
35
|
-
* chainId: sepolia,
|
36
|
-
* });
|
37
|
-
* const { plaintext, covalidatorSignature } = await decryptor({ handle: '0x...' });
|
38
|
-
* ```
|
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
|
39
32
|
*/
|
40
|
-
export declare function
|
33
|
+
export declare function attestedDecrypt({ handles, backoffConfig, walletClient, chainId, kmsConnectRpcEndpointOrClient, }: {
|
34
|
+
handles: HexString[];
|
35
|
+
backoffConfig?: Partial<BackoffConfig> | undefined;
|
36
|
+
walletClient: WalletClient<Transport, Chain, Account>;
|
37
|
+
chainId: SupportedChainId;
|
38
|
+
kmsConnectRpcEndpointOrClient?: string | KmsClient;
|
39
|
+
}): Promise<Array<DecryptionAttestation<EciesScheme, SupportedFheType>>>;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { type IncoLiteAttestedComputeArgs
|
1
|
+
import { type IncoLiteAttestedComputeArgs } from '../attestedcompute/attested-compute.js';
|
2
2
|
import { type AttestedComputeSupportedOps } from '../attestedcompute/types.js';
|
3
|
-
export { incoLiteAttestedCompute };
|
4
3
|
export type { AttestedComputeSupportedOps, IncoLiteAttestedComputeArgs };
|
@@ -1,3 +1,2 @@
|
|
1
|
-
import { type IncoLiteAttestedDecryptorArgs
|
2
|
-
export { incoLiteAttestedDecryptor };
|
1
|
+
import { type IncoLiteAttestedDecryptorArgs } from '../attesteddecrypt/attested-decrypt.js';
|
3
2
|
export type { IncoLiteAttestedDecryptorArgs };
|
@@ -1,11 +1,14 @@
|
|
1
1
|
import { Account, Chain, Transport, WalletClient } from 'viem';
|
2
2
|
import { AllowanceVoucherWithSig } from '../advancedacl/types.js';
|
3
|
+
import { AttestedComputeOP } from '../attestedcompute/types.js';
|
4
|
+
import { DecryptionAttestation } from '../attesteddecrypt/index.js';
|
3
5
|
import { Address, HexString } from '../binary.js';
|
4
|
-
import { EciesScheme, PlaintextOf } from '../encryption/index.js';
|
6
|
+
import { EciesScheme, PlaintextOf, SupportedFheType } from '../encryption/index.js';
|
5
7
|
import { lightningDeployments } from '../generated/lightning.js';
|
6
8
|
import { localNodeLightningConfig } from '../generated/local-node.js';
|
7
9
|
import { LocalNodeEnv } from '../local/index.js';
|
8
10
|
import type { Reencryptor } from '../reencryption/index.js';
|
11
|
+
import { BackoffConfig } from '../retry.js';
|
9
12
|
import { Secp256k1Keypair } from './ecies.js';
|
10
13
|
type TupleToUnion<T> = T extends readonly unknown[] ? T[number] : never;
|
11
14
|
type Deployment = TupleToUnion<typeof lightningDeployments>;
|
@@ -163,7 +166,7 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
163
166
|
* const decryptedValue = await reencryptor({handle: resultHandle});
|
164
167
|
* ```
|
165
168
|
*/
|
166
|
-
getSessionKeyRencryptor(allowanceVoucherWithSig: AllowanceVoucherWithSig, ephemeralKeypair: Secp256k1Keypair): Promise<(<T_1 extends
|
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>>)>;
|
167
170
|
/**
|
168
171
|
* Updates the active session nonce for the given wallet client.
|
169
172
|
*
|
@@ -174,6 +177,42 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
174
177
|
* @returns The transaction hash of the updateActiveVouchersSessionNonce transaction
|
175
178
|
*/
|
176
179
|
updateActiveVouchersSessionNonce(walletClient: WalletClient<Transport, Chain, Account>): Promise<HexString>;
|
180
|
+
/**
|
181
|
+
* Get an attested decryptor for the given wallet client.
|
182
|
+
*
|
183
|
+
* @param walletClient - The wallet client used for signing the attested decrypt request
|
184
|
+
* @param handles - The handles to decrypt
|
185
|
+
* @param backoffConfig - The backoff configuration for the attested decrypt request
|
186
|
+
* @returns The decryption attestations
|
187
|
+
*
|
188
|
+
* @example
|
189
|
+
* ```typescript
|
190
|
+
* const response = await lightning.attestedDecrypt(walletClient, [handle1, handle2]);
|
191
|
+
* const { plaintext, covalidatorSignature } = response[0];
|
192
|
+
* ```
|
193
|
+
*/
|
194
|
+
attestedDecrypt(walletClient: WalletClient<Transport, Chain, Account>, handles: HexString[], backoffConfig?: Partial<BackoffConfig>): Promise<Array<DecryptionAttestation<EciesScheme, SupportedFheType>>>;
|
195
|
+
/**
|
196
|
+
* Get an attested compute for the given wallet client.
|
197
|
+
*
|
198
|
+
* @param walletClient - The wallet client used for signing the attested compute request
|
199
|
+
* @param lhsHandle - The handle to compute
|
200
|
+
* @param op - The operation to perform
|
201
|
+
* @param rhsPlaintext - The plaintext to compute with
|
202
|
+
* @param backoffConfig - The backoff configuration for the attested compute request
|
203
|
+
* @returns The decryption attestation
|
204
|
+
*
|
205
|
+
* @example
|
206
|
+
* ```typescript
|
207
|
+
* import { AttestedComputeSupportedOps } from '../lite/attested-compute.js';
|
208
|
+
* const lhsHandle = '0x...';
|
209
|
+
* const rhsPlaintext = 1337n;
|
210
|
+
* const op = AttestedComputeSupportedOps.Eq;
|
211
|
+
* const response = await lightning.attestedCompute(walletClient, lhsHandle, op, rhsPlaintext);
|
212
|
+
* const { plaintext, covalidatorSignature, handle } = response;
|
213
|
+
* ```
|
214
|
+
*/
|
215
|
+
attestedCompute(walletClient: WalletClient<Transport, Chain, Account>, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean, backoffConfig?: Partial<BackoffConfig>): Promise<DecryptionAttestation<EciesScheme, SupportedFheType>>;
|
177
216
|
/**
|
178
217
|
* Get the GRPC endpoint for the covalidator that services this deployment.
|
179
218
|
*/
|