@inco/js 0.3.0 → 0.3.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/dist/cjs/advancedacl/index.d.ts +2 -0
- package/dist/cjs/advancedacl/index.js +19 -0
- package/dist/cjs/advancedacl/session-key.d.ts +28 -0
- package/dist/cjs/advancedacl/session-key.js +176 -0
- package/dist/cjs/advancedacl/types.d.ts +15 -0
- package/dist/cjs/advancedacl/types.js +3 -0
- package/dist/cjs/generated/abis/lightning-preview.d.ts +2265 -0
- package/dist/cjs/generated/abis/lightning-preview.js +1429 -0
- package/dist/cjs/lite/lightning.d.ts +55 -1
- package/dist/cjs/lite/lightning.js +73 -2
- package/dist/cjs/local/local-node.d.ts +1 -1
- package/dist/cjs/local/local-node.js +15 -15
- package/dist/esm/advancedacl/index.d.ts +2 -0
- package/dist/esm/advancedacl/index.js +3 -0
- package/dist/esm/advancedacl/session-key.d.ts +28 -0
- package/dist/esm/advancedacl/session-key.js +170 -0
- package/dist/esm/advancedacl/types.d.ts +15 -0
- package/dist/esm/advancedacl/types.js +2 -0
- package/dist/esm/generated/abis/lightning-preview.d.ts +2265 -0
- package/dist/esm/generated/abis/lightning-preview.js +1426 -0
- package/dist/esm/lite/lightning.d.ts +55 -1
- package/dist/esm/lite/lightning.js +73 -2
- package/dist/esm/local/local-node.d.ts +1 -1
- package/dist/esm/local/local-node.js +3 -3
- package/dist/types/advancedacl/index.d.ts +2 -0
- package/dist/types/advancedacl/session-key.d.ts +28 -0
- package/dist/types/advancedacl/types.d.ts +15 -0
- package/dist/types/generated/abis/lightning-preview.d.ts +2265 -0
- package/dist/types/lite/lightning.d.ts +55 -1
- package/dist/types/local/local-node.d.ts +1 -1
- package/package.json +1 -1
@@ -1,10 +1,12 @@
|
|
1
1
|
import { Account, Chain, Transport, WalletClient } from 'viem';
|
2
|
+
import { AllowanceVoucherWithSig } from '../advancedacl/types.js';
|
2
3
|
import { Address, HexString } from '../binary.js';
|
3
|
-
import { EciesScheme } from '../encryption/index.js';
|
4
|
+
import { EciesScheme, PlaintextOf } from '../encryption/index.js';
|
4
5
|
import { lightningDeployments } from '../generated/lightning.js';
|
5
6
|
import { localNodeLightningConfig } from '../generated/local-node.js';
|
6
7
|
import { LocalNodeEnv } from '../local/index.js';
|
7
8
|
import type { Reencryptor } from '../reencryption/index.js';
|
9
|
+
import { Secp256k1Keypair } from './ecies.js';
|
8
10
|
type TupleToUnion<T> = T extends readonly unknown[] ? T[number] : never;
|
9
11
|
type Deployment = TupleToUnion<typeof lightningDeployments>;
|
10
12
|
type DistributedPick<T, K> = T extends any ? Pick<T, Extract<keyof T, K>> : never;
|
@@ -120,6 +122,58 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
120
122
|
* @param walletClient the wallet client to use for signing the reencrypt request.
|
121
123
|
*/
|
122
124
|
getReencryptor(walletClient: WalletClient<Transport, Chain, Account>): Promise<Reencryptor<EciesScheme>>;
|
125
|
+
/**
|
126
|
+
* Grants a session key allowance voucher for secure reencryption operations.
|
127
|
+
*
|
128
|
+
* This method creates a signed allowance voucher that authorizes a specific requester address
|
129
|
+
* to perform reencryption operations using session keys. The voucher includes an expiration time
|
130
|
+
* and can optionally specify a custom session verifier contract address.
|
131
|
+
*
|
132
|
+
* @param walletClient - The wallet client used for signing the allowance voucher
|
133
|
+
* @param granteeAddress - The address of the entity requesting the session key allowance
|
134
|
+
* @param expiresAt - The timestamp when the allowance voucher expires (as a bigint)
|
135
|
+
* @param sessionVerifierAddress - Optional custom session verifier contract address. If not provided, uses the executor address
|
136
|
+
* @returns A promise that resolves to an AllowanceVoucherWithSig containing the signed allowance voucher
|
137
|
+
*
|
138
|
+
* @example
|
139
|
+
* ```typescript
|
140
|
+
* const voucher = await lightning.grantSessionKeyAllowanceVoucher(
|
141
|
+
* walletClient,
|
142
|
+
* "0x1234...",
|
143
|
+
* BigInt(Date.now() + 3600000), // 1 hour from now
|
144
|
+
* "0x5678..." // optional custom verifier
|
145
|
+
* );
|
146
|
+
* ```
|
147
|
+
*/
|
148
|
+
grantSessionKeyAllowanceVoucher(walletClient: WalletClient<Transport, Chain, Account>, granteeAddress: string, expiresAt: Date, sessionVerifierAddress: string): Promise<AllowanceVoucherWithSig>;
|
149
|
+
/**
|
150
|
+
* Creates a session key reencryptor for secure data reencryption operations.
|
151
|
+
*
|
152
|
+
* This method returns a reencryptor instance that can be used to perform reencryption
|
153
|
+
* operations using session keys. The reencryptor is configured with the provided
|
154
|
+
* allowance voucher and ephemeral keypair for secure communication.
|
155
|
+
*
|
156
|
+
* @param allowanceVoucherWithSig - The signed allowance voucher obtained from grantSessionKeyAllowanceVoucher
|
157
|
+
* @param ephemeralKeypair - The ephemeral keypair used for secure communication with the KMS make sure it has allowance to voucher
|
158
|
+
* @returns A reencryptor instance configured for session key operations
|
159
|
+
*
|
160
|
+
* @example
|
161
|
+
* ```typescript
|
162
|
+
* const reencryptor = await lightning.getSessionKeyRencryptor(voucher, ephemeralKeypair);
|
163
|
+
* const decryptedValue = await reencryptor({handle: resultHandle});
|
164
|
+
* ```
|
165
|
+
*/
|
166
|
+
getSessionKeyRencryptor(allowanceVoucherWithSig: AllowanceVoucherWithSig, ephemeralKeypair: Secp256k1Keypair): Promise<(<T_1 extends import("../encryption/encryption.js").SupportedFheType>({ handle }: import("../reencryption/types.js").ReencryptFnArgs<EciesScheme, T_1>) => Promise<PlaintextOf<1, 0 | 5 | 7 | 8>>)>;
|
167
|
+
/**
|
168
|
+
* Updates the active session nonce for the given wallet client.
|
169
|
+
*
|
170
|
+
* This method updates the active session nonce for the given wallet client.
|
171
|
+
* It nullifies all the previous shared addresses accessing the voucher.
|
172
|
+
*
|
173
|
+
* @param walletClient - The wallet client used for updating the session nonce
|
174
|
+
* @returns The transaction hash of the updateActiveVouchersSessionNonce transaction
|
175
|
+
*/
|
176
|
+
updateActiveVouchersSessionNonce(walletClient: WalletClient<Transport, Chain, Account>): Promise<HexString>;
|
123
177
|
/**
|
124
178
|
* Get the GRPC endpoint for the covalidator that services this deployment.
|
125
179
|
*/
|
@@ -15,7 +15,7 @@ export declare const LocalNodeEnv: Schema.Struct<{
|
|
15
15
|
COVALIDATOR_INCO_EXECUTOR_ADDR: Schema.brand<Schema.filter<Schema.TemplateLiteral<`0x${string}`>>, "Address">;
|
16
16
|
COVALIDATOR_DECRYPTION_HANDLER_ADDR: Schema.brand<Schema.filter<Schema.TemplateLiteral<`0x${string}`>>, "Address">;
|
17
17
|
COVALIDATOR_HOST_CHAIN_ID: Schema.optional<typeof Schema.String>;
|
18
|
-
|
18
|
+
COVALIDATOR_URL: Schema.optional<typeof Schema.String>;
|
19
19
|
COVALIDATOR_HOST_CHAIN_RPC_URL: Schema.optional<typeof Schema.String>;
|
20
20
|
}>;
|
21
21
|
export type LocalNodeEnv = typeof LocalNodeEnv.Type;
|