@inco/js 0.8.0-devnet-5 → 0.8.0-devnet-6
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 +3 -3
- package/dist/cjs/advancedacl/session-key.js +1 -4
- package/dist/cjs/attestedcompute/attested-compute.d.ts +4 -4
- package/dist/cjs/attestedcompute/attested-compute.js +1 -1
- package/dist/cjs/attesteddecrypt/attested-decrypt.d.ts +6 -6
- package/dist/cjs/attesteddecrypt/attested-decrypt.js +2 -2
- package/dist/cjs/encryption/encryption.d.ts +10 -8
- package/dist/cjs/encryption/encryption.js +5 -2
- package/dist/cjs/generated/es/inco/covalidator/compute/v1/server_pb.d.ts +36 -0
- package/dist/cjs/generated/es/inco/covalidator/compute/v1/server_pb.js +22 -12
- package/dist/cjs/generated/es/inco/sealingfetcher/v1/sealingfetcher_pb.d.ts +3 -3
- package/dist/cjs/kms/quorumClient.d.ts +4 -4
- package/dist/cjs/kms/quorumClient.js +4 -4
- package/dist/cjs/lite/index.d.ts +2 -1
- package/dist/cjs/lite/index.js +28 -2
- package/dist/cjs/lite/lightning.d.ts +26 -17
- package/dist/cjs/lite/lightning.js +56 -16
- package/dist/cjs/lite/xwing.d.ts +119 -0
- package/dist/cjs/lite/xwing.js +270 -0
- package/dist/esm/advancedacl/session-key.d.ts +3 -3
- package/dist/esm/advancedacl/session-key.js +1 -4
- package/dist/esm/attestedcompute/attested-compute.d.ts +4 -4
- package/dist/esm/attestedcompute/attested-compute.js +1 -1
- package/dist/esm/attesteddecrypt/attested-decrypt.d.ts +6 -6
- package/dist/esm/attesteddecrypt/attested-decrypt.js +2 -2
- package/dist/esm/encryption/encryption.d.ts +10 -8
- package/dist/esm/encryption/encryption.js +5 -2
- package/dist/esm/generated/es/inco/covalidator/compute/v1/server_pb.d.ts +36 -0
- package/dist/esm/generated/es/inco/covalidator/compute/v1/server_pb.js +21 -11
- package/dist/esm/generated/es/inco/sealingfetcher/v1/sealingfetcher_pb.d.ts +3 -3
- package/dist/esm/kms/quorumClient.d.ts +4 -4
- package/dist/esm/kms/quorumClient.js +4 -4
- package/dist/esm/lite/index.d.ts +2 -1
- package/dist/esm/lite/index.js +5 -2
- package/dist/esm/lite/lightning.d.ts +26 -17
- package/dist/esm/lite/lightning.js +57 -17
- package/dist/esm/lite/xwing.d.ts +119 -0
- package/dist/esm/lite/xwing.js +258 -0
- package/dist/types/advancedacl/session-key.d.ts +3 -3
- package/dist/types/attestedcompute/attested-compute.d.ts +4 -4
- package/dist/types/attesteddecrypt/attested-decrypt.d.ts +6 -6
- package/dist/types/encryption/encryption.d.ts +10 -8
- package/dist/types/generated/es/inco/covalidator/compute/v1/server_pb.d.ts +36 -0
- package/dist/types/generated/es/inco/sealingfetcher/v1/sealingfetcher_pb.d.ts +3 -3
- package/dist/types/kms/quorumClient.d.ts +4 -4
- package/dist/types/lite/index.d.ts +2 -1
- package/dist/types/lite/lightning.d.ts +26 -17
- package/dist/types/lite/xwing.d.ts +119 -0
- package/package.json +4 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Account, type Address, type Chain, type Hex, PublicClient, type Transport, type WalletClient } from 'viem';
|
|
2
2
|
import { DecryptionAttestation, EncryptedDecryptionAttestation } from '../attesteddecrypt/index.js';
|
|
3
3
|
import { SupportedChainId } from '../chain.js';
|
|
4
|
-
import {
|
|
4
|
+
import { EncryptionScheme, SupportedFheType } from '../encryption/encryption.js';
|
|
5
5
|
import { HexString } from '../index.js';
|
|
6
6
|
import type { Secp256k1Keypair } from '../lite/index.js';
|
|
7
7
|
import { BackoffConfig } from '../retry.js';
|
|
@@ -46,7 +46,7 @@ export interface SessionKeyAttestedComputeArgs {
|
|
|
46
46
|
reencryptPubKey?: Uint8Array | undefined;
|
|
47
47
|
reencryptKeypair?: Secp256k1Keypair | undefined;
|
|
48
48
|
}
|
|
49
|
-
export declare function sessionKeyAttestedCompute<T extends SupportedFheType>({ lhsHandle, op, rhsPlaintext, backoffConfig, chainId, kmsQuorumClient, ephemeralKeypair, allowanceVoucherWithSig, requesterArgData, ethClient, executorAddress, reencryptPubKey, reencryptKeypair, }: SessionKeyAttestedComputeArgs): Promise<DecryptionAttestation<
|
|
49
|
+
export declare function sessionKeyAttestedCompute<T extends SupportedFheType>({ lhsHandle, op, rhsPlaintext, backoffConfig, chainId, kmsQuorumClient, ephemeralKeypair, allowanceVoucherWithSig, requesterArgData, ethClient, executorAddress, reencryptPubKey, reencryptKeypair, }: SessionKeyAttestedComputeArgs): Promise<DecryptionAttestation<EncryptionScheme, SupportedFheType> | EncryptedDecryptionAttestation<EncryptionScheme, SupportedFheType>>;
|
|
50
50
|
export interface SessionKeyAttestedDecryptArgs {
|
|
51
51
|
chainId: SupportedChainId;
|
|
52
52
|
ephemeralKeypair: Secp256k1Keypair;
|
|
@@ -90,4 +90,4 @@ export interface SessionKeyAttestedDecryptArgs {
|
|
|
90
90
|
* );
|
|
91
91
|
* ```
|
|
92
92
|
*/
|
|
93
|
-
export declare function sessionKeyAttestedDecrypt({ chainId, kmsQuorumClient, handles, ephemeralKeypair, allowanceVoucherWithSig, requesterArgData, backoffConfig, reencryptPubKey, reencryptKeypair, ethClient, executorAddress, }: SessionKeyAttestedDecryptArgs): Promise<Array<DecryptionAttestation<
|
|
93
|
+
export declare function sessionKeyAttestedDecrypt({ chainId, kmsQuorumClient, handles, ephemeralKeypair, allowanceVoucherWithSig, requesterArgData, backoffConfig, reencryptPubKey, reencryptKeypair, ethClient, executorAddress, }: SessionKeyAttestedDecryptArgs): Promise<Array<DecryptionAttestation<EncryptionScheme, SupportedFheType> | EncryptedDecryptionAttestation<EncryptionScheme, SupportedFheType>>>;
|
|
@@ -2,7 +2,7 @@ import type { Account, Chain, Transport, WalletClient } from 'viem';
|
|
|
2
2
|
import { DecryptionAttestation, EncryptedDecryptionAttestation } from '../attesteddecrypt/types.js';
|
|
3
3
|
import { HexString } from '../binary.js';
|
|
4
4
|
import { SupportedChainId } from '../chain.js';
|
|
5
|
-
import type {
|
|
5
|
+
import type { EncryptionScheme, SupportedFheType } from '../encryption/encryption.js';
|
|
6
6
|
import { KmsQuorumClient } from '../kms/quorumClient.js';
|
|
7
7
|
import type { Secp256k1Keypair } from '../lite/ecies.js';
|
|
8
8
|
import type { BackoffConfig } from '../retry.js';
|
|
@@ -39,7 +39,7 @@ export declare function attestedCompute<T extends SupportedFheType>({ executorAd
|
|
|
39
39
|
chainId: SupportedChainId;
|
|
40
40
|
reencryptPubKey: Uint8Array;
|
|
41
41
|
reencryptKeypair: Secp256k1Keypair;
|
|
42
|
-
}): Promise<DecryptionAttestation<
|
|
42
|
+
}): Promise<DecryptionAttestation<EncryptionScheme, T>>;
|
|
43
43
|
export declare function attestedCompute<T extends SupportedFheType>({ executorAddress, lhsHandle, op, rhsPlaintext, backoffConfig, walletClient, kmsQuorumClient, chainId, reencryptPubKey, }: {
|
|
44
44
|
executorAddress: HexString;
|
|
45
45
|
lhsHandle: HexString;
|
|
@@ -51,7 +51,7 @@ export declare function attestedCompute<T extends SupportedFheType>({ executorAd
|
|
|
51
51
|
chainId: SupportedChainId;
|
|
52
52
|
reencryptPubKey: Uint8Array;
|
|
53
53
|
reencryptKeypair?: never;
|
|
54
|
-
}): Promise<EncryptedDecryptionAttestation<
|
|
54
|
+
}): Promise<EncryptedDecryptionAttestation<EncryptionScheme, T>>;
|
|
55
55
|
export declare function attestedCompute<T extends SupportedFheType>({ executorAddress, lhsHandle, op, rhsPlaintext, backoffConfig, walletClient, kmsQuorumClient, chainId, }: {
|
|
56
56
|
executorAddress: HexString;
|
|
57
57
|
lhsHandle: HexString;
|
|
@@ -63,4 +63,4 @@ export declare function attestedCompute<T extends SupportedFheType>({ executorAd
|
|
|
63
63
|
chainId: SupportedChainId;
|
|
64
64
|
reencryptPubKey?: never;
|
|
65
65
|
reencryptKeypair?: never;
|
|
66
|
-
}): Promise<DecryptionAttestation<
|
|
66
|
+
}): Promise<DecryptionAttestation<EncryptionScheme, T>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Account, Chain, PublicClient, Transport, WalletClient } from 'viem';
|
|
2
2
|
import { type HexString } from '../binary.js';
|
|
3
3
|
import { type SupportedChainId } from '../chain.js';
|
|
4
|
-
import {
|
|
4
|
+
import { EncryptionScheme, type SupportedFheType } from '../encryption/encryption.js';
|
|
5
5
|
import { KmsQuorumClient } from '../kms/quorumClient.js';
|
|
6
6
|
import type { Secp256k1Keypair } from '../lite/ecies.js';
|
|
7
7
|
import type { BackoffConfig } from '../retry.js';
|
|
@@ -34,7 +34,7 @@ export declare function attestedDecrypt({ handles, backoffConfig, chainId, kmsQu
|
|
|
34
34
|
chainId: SupportedChainId;
|
|
35
35
|
kmsQuorumClient: KmsQuorumClient;
|
|
36
36
|
executorAddress: HexString;
|
|
37
|
-
}): Promise<Array<DecryptionAttestation<
|
|
37
|
+
}): Promise<Array<DecryptionAttestation<EncryptionScheme, SupportedFheType>>>;
|
|
38
38
|
/**
|
|
39
39
|
* Decrypt multiple handles in a single attested request.
|
|
40
40
|
* Returns an array of attestations aligned with the response ordering.
|
|
@@ -52,7 +52,7 @@ export declare function attestedDecrypt({ handles, backoffConfig, walletClient,
|
|
|
52
52
|
reencryptKeypair: Secp256k1Keypair;
|
|
53
53
|
kmsQuorumClient: KmsQuorumClient;
|
|
54
54
|
executorAddress: HexString;
|
|
55
|
-
}): Promise<Array<DecryptionAttestation<
|
|
55
|
+
}): Promise<Array<DecryptionAttestation<EncryptionScheme, SupportedFheType>>>;
|
|
56
56
|
/**
|
|
57
57
|
* Decrypt multiple handles in a single attested request.
|
|
58
58
|
* Returns an array of attestations aligned with the response ordering.
|
|
@@ -70,7 +70,7 @@ export declare function attestedDecrypt({ handles, backoffConfig, walletClient,
|
|
|
70
70
|
reencryptKeypair?: never;
|
|
71
71
|
kmsQuorumClient: KmsQuorumClient;
|
|
72
72
|
executorAddress: HexString;
|
|
73
|
-
}): Promise<Array<EncryptedDecryptionAttestation<
|
|
73
|
+
}): Promise<Array<EncryptedDecryptionAttestation<EncryptionScheme, SupportedFheType>>>;
|
|
74
74
|
/**
|
|
75
75
|
* Decrypt multiple handles in a single attested request.
|
|
76
76
|
* Returns an array of attestations aligned with the response ordering.
|
|
@@ -88,9 +88,9 @@ export declare function attestedDecrypt({ handles, backoffConfig, walletClient,
|
|
|
88
88
|
reencryptKeypair?: never;
|
|
89
89
|
kmsQuorumClient: KmsQuorumClient;
|
|
90
90
|
executorAddress: HexString;
|
|
91
|
-
}): Promise<Array<DecryptionAttestation<
|
|
91
|
+
}): Promise<Array<DecryptionAttestation<EncryptionScheme, SupportedFheType>>>;
|
|
92
92
|
export declare function fetchEip712DomainVersion(executorAddress: HexString | undefined, defaultVersion: string, walletClient?: WalletClient<Transport, Chain, Account> | PublicClient<Transport, Chain>): Promise<string>;
|
|
93
|
-
export declare function decryptEncryptedAttestations(attestations: Array<DecryptionAttestation<
|
|
93
|
+
export declare function decryptEncryptedAttestations(attestations: Array<DecryptionAttestation<EncryptionScheme, SupportedFheType> | EncryptedDecryptionAttestation<EncryptionScheme, SupportedFheType>>, reencryptKeypair: Secp256k1Keypair): Promise<Array<DecryptionAttestation<EncryptionScheme, SupportedFheType>>>;
|
|
94
94
|
/**
|
|
95
95
|
* Validates a handle format.
|
|
96
96
|
* @param handle - The handle to validate
|
|
@@ -15,18 +15,20 @@ export declare const SupportedFheType: Schema.SchemaClass<0 | 5 | 7 | 8, 0 | 5 |
|
|
|
15
15
|
export type SupportedFheType = typeof SupportedFheType.Type;
|
|
16
16
|
export declare const encryptionSchemes: {
|
|
17
17
|
readonly ecies: 1;
|
|
18
|
+
readonly xwing: 2;
|
|
18
19
|
};
|
|
19
20
|
export declare function getEncryptionSchemeName(scheme: number): string;
|
|
20
21
|
export type EncryptionSchemes = typeof encryptionSchemes;
|
|
21
22
|
export type EciesScheme = EncryptionSchemes['ecies'];
|
|
22
|
-
export
|
|
23
|
+
export type XwingScheme = EncryptionSchemes['xwing'];
|
|
24
|
+
export declare const EncryptionScheme: Schema.Literal<[1, 2]>;
|
|
23
25
|
export type EncryptionScheme = typeof EncryptionScheme.Type;
|
|
24
26
|
type DistType<P, S extends EncryptionScheme, T extends SupportedFheType> = P extends any ? P & {
|
|
25
27
|
scheme: S;
|
|
26
28
|
type: T;
|
|
27
29
|
} : never;
|
|
28
30
|
export declare const Ciphertext: Schema.Struct<{
|
|
29
|
-
scheme: Schema.Literal<[1]>;
|
|
31
|
+
scheme: Schema.Literal<[1, 2]>;
|
|
30
32
|
type: Schema.SchemaClass<0 | 5 | 7 | 8, 0 | 5 | 7 | 8, never>;
|
|
31
33
|
value: Schema.TemplateLiteral<`0x${string}`>;
|
|
32
34
|
}>;
|
|
@@ -34,7 +36,7 @@ export type Ciphertext = typeof Ciphertext.Type;
|
|
|
34
36
|
export type CiphertextOf<S extends EncryptionScheme, T extends SupportedFheType> = DistType<Ciphertext, S, T>;
|
|
35
37
|
export declare const CiphertextWithContext: Schema.Struct<{
|
|
36
38
|
ciphertext: Schema.Struct<{
|
|
37
|
-
scheme: Schema.Literal<[1]>;
|
|
39
|
+
scheme: Schema.Literal<[1, 2]>;
|
|
38
40
|
type: Schema.SchemaClass<0 | 5 | 7 | 8, 0 | 5 | 7 | 8, never>;
|
|
39
41
|
value: Schema.TemplateLiteral<`0x${string}`>;
|
|
40
42
|
}>;
|
|
@@ -52,7 +54,7 @@ export type CiphertextWithContextOf<S extends EncryptionScheme, T extends Suppor
|
|
|
52
54
|
};
|
|
53
55
|
export declare const EncryptResult: Schema.Struct<{
|
|
54
56
|
ciphertext: Schema.Struct<{
|
|
55
|
-
scheme: Schema.Literal<[1]>;
|
|
57
|
+
scheme: Schema.Literal<[1, 2]>;
|
|
56
58
|
type: Schema.SchemaClass<0 | 5 | 7 | 8, 0 | 5 | 7 | 8, never>;
|
|
57
59
|
value: Schema.TemplateLiteral<`0x${string}`>;
|
|
58
60
|
}>;
|
|
@@ -71,11 +73,11 @@ export type EncryptResultOf<S extends EncryptionScheme, T extends SupportedFheTy
|
|
|
71
73
|
ciphertext: CiphertextOf<S, T>;
|
|
72
74
|
};
|
|
73
75
|
export declare const Plaintext: Schema.Union<[Schema.Struct<{
|
|
74
|
-
scheme: Schema.Literal<[1]>;
|
|
76
|
+
scheme: Schema.Literal<[1, 2]>;
|
|
75
77
|
type: Schema.Literal<[5, 7, 8]>;
|
|
76
78
|
value: typeof Schema.BigInt;
|
|
77
79
|
}>, Schema.Struct<{
|
|
78
|
-
scheme: Schema.Literal<[1]>;
|
|
80
|
+
scheme: Schema.Literal<[1, 2]>;
|
|
79
81
|
type: Schema.Literal<[0]>;
|
|
80
82
|
value: typeof Schema.Boolean;
|
|
81
83
|
}>]>;
|
|
@@ -83,11 +85,11 @@ export type Plaintext = typeof Plaintext.Type;
|
|
|
83
85
|
export type PlaintextOf<S extends EncryptionScheme, T extends SupportedFheType> = DistType<Plaintext, S, T>;
|
|
84
86
|
export declare const PlaintextWithContext: Schema.Struct<{
|
|
85
87
|
plaintext: Schema.Union<[Schema.Struct<{
|
|
86
|
-
scheme: Schema.Literal<[1]>;
|
|
88
|
+
scheme: Schema.Literal<[1, 2]>;
|
|
87
89
|
type: Schema.Literal<[5, 7, 8]>;
|
|
88
90
|
value: typeof Schema.BigInt;
|
|
89
91
|
}>, Schema.Struct<{
|
|
90
|
-
scheme: Schema.Literal<[1]>;
|
|
92
|
+
scheme: Schema.Literal<[1, 2]>;
|
|
91
93
|
type: Schema.Literal<[0]>;
|
|
92
94
|
value: typeof Schema.Boolean;
|
|
93
95
|
}>]>;
|
|
@@ -580,6 +580,24 @@ export type ConfigureRequest = Message<"inco.covalidator.compute.v1.ConfigureReq
|
|
|
580
580
|
* Use `create(ConfigureRequestSchema)` to create a new message.
|
|
581
581
|
*/
|
|
582
582
|
export declare const ConfigureRequestSchema: GenMessage<ConfigureRequest>;
|
|
583
|
+
/**
|
|
584
|
+
* HeliosConfigureRequest is a request to configure the helios light client.
|
|
585
|
+
*
|
|
586
|
+
* @generated from message inco.covalidator.compute.v1.HeliosConfigureRequest
|
|
587
|
+
*/
|
|
588
|
+
export type HeliosConfigureRequest = Message<"inco.covalidator.compute.v1.HeliosConfigureRequest"> & {
|
|
589
|
+
/**
|
|
590
|
+
* Provide Helios-specific configuration to start the Helios from compute service.
|
|
591
|
+
*
|
|
592
|
+
* @generated from field: inco.helioswrapper.v1.StartHeliosRequest helios_config = 2;
|
|
593
|
+
*/
|
|
594
|
+
heliosConfig?: StartHeliosRequest;
|
|
595
|
+
};
|
|
596
|
+
/**
|
|
597
|
+
* Describes the message inco.covalidator.compute.v1.HeliosConfigureRequest.
|
|
598
|
+
* Use `create(HeliosConfigureRequestSchema)` to create a new message.
|
|
599
|
+
*/
|
|
600
|
+
export declare const HeliosConfigureRequestSchema: GenMessage<HeliosConfigureRequest>;
|
|
583
601
|
/**
|
|
584
602
|
* ConfigureResponse is a response to ConfigureRequest.
|
|
585
603
|
*
|
|
@@ -604,6 +622,24 @@ export type ConfigureResponse = Message<"inco.covalidator.compute.v1.ConfigureRe
|
|
|
604
622
|
* Use `create(ConfigureResponseSchema)` to create a new message.
|
|
605
623
|
*/
|
|
606
624
|
export declare const ConfigureResponseSchema: GenMessage<ConfigureResponse>;
|
|
625
|
+
/**
|
|
626
|
+
* HeliosConfigureResponse is a response to HeliosConfigureRequest.
|
|
627
|
+
*
|
|
628
|
+
* @generated from message inco.covalidator.compute.v1.HeliosConfigureResponse
|
|
629
|
+
*/
|
|
630
|
+
export type HeliosConfigureResponse = Message<"inco.covalidator.compute.v1.HeliosConfigureResponse"> & {
|
|
631
|
+
/**
|
|
632
|
+
* True if the Helios light client was started successfully.
|
|
633
|
+
*
|
|
634
|
+
* @generated from field: bool helios_started = 1;
|
|
635
|
+
*/
|
|
636
|
+
heliosStarted: boolean;
|
|
637
|
+
};
|
|
638
|
+
/**
|
|
639
|
+
* Describes the message inco.covalidator.compute.v1.HeliosConfigureResponse.
|
|
640
|
+
* Use `create(HeliosConfigureResponseSchema)` to create a new message.
|
|
641
|
+
*/
|
|
642
|
+
export declare const HeliosConfigureResponseSchema: GenMessage<HeliosConfigureResponse>;
|
|
607
643
|
/**
|
|
608
644
|
* AttestedDecryptRequest is the request type for the ComputeService/AttestedDecrypt RPC method.
|
|
609
645
|
*
|
|
@@ -107,9 +107,9 @@ export type TeeKeys = Message<"inco.sealingfetcher.v1.TeeKeys"> & {
|
|
|
107
107
|
*/
|
|
108
108
|
eoaPrivkey: Uint8Array;
|
|
109
109
|
/**
|
|
110
|
-
* The Network private key that the TEE generated during the bootstrap process.
|
|
111
|
-
* This is
|
|
112
|
-
*
|
|
110
|
+
* The Network private key (X-Wing) that the TEE generated during the bootstrap process.
|
|
111
|
+
* This is a 32-byte seed used to derive the X-Wing keypair for input encryption.
|
|
112
|
+
* X-Wing is a post-quantum hybrid KEM combining ML-KEM-768 and X25519.
|
|
113
113
|
*
|
|
114
114
|
* @generated from field: bytes network_privkey = 2;
|
|
115
115
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Address } from 'viem';
|
|
2
2
|
import type { DecryptionAttestation, EncryptedDecryptionAttestation } from '../attesteddecrypt/types.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { EncryptionScheme, SupportedFheType } from '../encryption/encryption.js';
|
|
4
4
|
import type { AttestedComputeRequest, AttestedDecryptRequest, AttestedRevealRequest } from '../generated/es/inco/kms/lite/v1/kms_service_pb.js';
|
|
5
5
|
import type { BackoffConfig } from '../retry.js';
|
|
6
6
|
import { type KmsClient } from './client.js';
|
|
@@ -28,9 +28,9 @@ export declare class KmsQuorumClient {
|
|
|
28
28
|
* @throws {Error} If KMS clients array is empty or threshold is invalid
|
|
29
29
|
*/
|
|
30
30
|
static fromKmsClients(kmsClients: KmsClient[], threshold: number): KmsQuorumClient;
|
|
31
|
-
attestedDecrypt(request: AttestedDecryptRequest, backoffConfig?: Partial<BackoffConfig>): Promise<(DecryptionAttestation<
|
|
32
|
-
attestedCompute(request: AttestedComputeRequest, backoffConfig?: Partial<BackoffConfig>): Promise<DecryptionAttestation<
|
|
33
|
-
attestedReveal(request: AttestedRevealRequest, backoffConfig?: Partial<BackoffConfig>): Promise<(DecryptionAttestation<
|
|
31
|
+
attestedDecrypt(request: AttestedDecryptRequest, backoffConfig?: Partial<BackoffConfig>): Promise<(DecryptionAttestation<EncryptionScheme, SupportedFheType> | EncryptedDecryptionAttestation<EncryptionScheme, SupportedFheType>)[]>;
|
|
32
|
+
attestedCompute(request: AttestedComputeRequest, backoffConfig?: Partial<BackoffConfig>): Promise<DecryptionAttestation<EncryptionScheme, SupportedFheType> | EncryptedDecryptionAttestation<EncryptionScheme, SupportedFheType>>;
|
|
33
|
+
attestedReveal(request: AttestedRevealRequest, backoffConfig?: Partial<BackoffConfig>): Promise<(DecryptionAttestation<EncryptionScheme, SupportedFheType> | EncryptedDecryptionAttestation<EncryptionScheme, SupportedFheType>)[]>;
|
|
34
34
|
/**
|
|
35
35
|
* Generic method to execute a KMS operation across all clients with retry and threshold logic.
|
|
36
36
|
* Returns results with both the response and signer address.
|
|
@@ -4,6 +4,7 @@ export type { HandleWithProof } from '../generated/es/inco/kms/lite/v1/types_pb.
|
|
|
4
4
|
export * from './attested-compute.js';
|
|
5
5
|
export * from './attested-decrypt.js';
|
|
6
6
|
export * from './deployments.js';
|
|
7
|
-
export
|
|
7
|
+
export { TEST_NETWORK_PRIVATE_KEY, TEST_NETWORK_PUBKEY, decodeSecp256k1PrivateKey, decodeSecp256k1PublicKey, decrypt as eciesDecrypt, encrypt as eciesEncrypt, encodeSecp256k1PublicKey, generateSecp256k1Keypair, getEciesDecryptor, getEciesEncryptor, toSecp256k1Keypair, type EciesDecryptorArgs, type EciesEncryptorArgs, type Secp256k1Keypair, type Secp256k1PubKey, } from './ecies.js';
|
|
8
8
|
export * from './hadu.js';
|
|
9
9
|
export * from './lightning.js';
|
|
10
|
+
export { TEST_NETWORK_SEED_KEY, TEST_NETWORK_XWING_PUBKEY, decodeXwingPrivateKey, decodeXwingPublicKey, deriveXwingKeypairFromSeed, encodeXwingPublicKey, generateXwingKeypair, getXwingDecryptor, getXwingEncryptor, decrypt as xwingDecrypt, encrypt as xwingEncrypt, type XwingDecryptorArgs, type XwingEncryptorArgs, type XwingKeypair, } from './xwing.js';
|
|
@@ -3,7 +3,7 @@ import { AllowanceVoucherWithSig } from '../advancedacl/types.js';
|
|
|
3
3
|
import { AttestedComputeOP } from '../attestedcompute/types.js';
|
|
4
4
|
import { DecryptionAttestation, EncryptedDecryptionAttestation } from '../attesteddecrypt/index.js';
|
|
5
5
|
import { Address, HexString } from '../binary.js';
|
|
6
|
-
import {
|
|
6
|
+
import { EncryptionScheme, SupportedFheType } from '../encryption/index.js';
|
|
7
7
|
import { incoVerifierAbi } from '../generated/abis/verifier.js';
|
|
8
8
|
import { lightningDeployments } from '../generated/lightning.js';
|
|
9
9
|
import { localNodeLightningConfig } from '../generated/local-node.js';
|
|
@@ -59,10 +59,18 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
59
59
|
private readonly networkPubkey;
|
|
60
60
|
readonly executorAddress: Address;
|
|
61
61
|
readonly chainId: bigint;
|
|
62
|
-
private readonly ephemeralKeypair;
|
|
63
62
|
private readonly kmsQuorumClient;
|
|
64
|
-
private readonly
|
|
63
|
+
private readonly ephemeralKeypair;
|
|
64
|
+
private encryptor;
|
|
65
|
+
private encryptionScheme;
|
|
65
66
|
private constructor();
|
|
67
|
+
private getEncryptor;
|
|
68
|
+
/**
|
|
69
|
+
* Get the encryption scheme version used by this Lightning instance.
|
|
70
|
+
* Returns 1 for ECIES or 2 for X-Wing.
|
|
71
|
+
* This is a convenience method to get the encryption scheme used by this Lightning instance.
|
|
72
|
+
*/
|
|
73
|
+
getEncryptionScheme(): Promise<EncryptionScheme>;
|
|
66
74
|
/**
|
|
67
75
|
* Get a Lightning instance bound to the latest Lightning deployment for the Base Sepolia testnet.
|
|
68
76
|
*/
|
|
@@ -121,7 +129,8 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
121
129
|
static latest<P extends Pepper>(pepper: P, chainId: ChainId): Promise<Lightning<Deployment>>;
|
|
122
130
|
get deployment(): T;
|
|
123
131
|
/**
|
|
124
|
-
* Encrypt a value using the public
|
|
132
|
+
* Encrypt a value using the network's public key (ECIES or X-Wing).
|
|
133
|
+
* The encryption scheme is automatically detected based on the public key length.
|
|
125
134
|
*
|
|
126
135
|
* @param value a boolean or numeric value to encrypt
|
|
127
136
|
* @param accountAddress the address of the account interacting with the dapp contract, normally an Externally Owned Account (EOA)
|
|
@@ -224,9 +233,9 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
224
233
|
* console.log(decrypted[0].plaintext.value);
|
|
225
234
|
* ```
|
|
226
235
|
*/
|
|
227
|
-
attestedDecrypt(walletClient: WalletClient<Transport, Chain, Account>, handles: HexString[], backoffConfig?: Partial<BackoffConfig>): Promise<Array<DecryptionAttestation<
|
|
228
|
-
attestedDecrypt(walletClient: WalletClient<Transport, Chain, Account>, handles: HexString[], reencryptPubKey: Uint8Array, backoffConfig?: Partial<BackoffConfig>): Promise<Array<EncryptedDecryptionAttestation<
|
|
229
|
-
attestedDecrypt(walletClient: WalletClient<Transport, Chain, Account>, handles: HexString[], reencryptPubKey: Uint8Array, reencryptKeypair: Secp256k1Keypair, backoffConfig?: Partial<BackoffConfig>): Promise<Array<DecryptionAttestation<
|
|
236
|
+
attestedDecrypt(walletClient: WalletClient<Transport, Chain, Account>, handles: HexString[], backoffConfig?: Partial<BackoffConfig>): Promise<Array<DecryptionAttestation<EncryptionScheme, SupportedFheType>>>;
|
|
237
|
+
attestedDecrypt(walletClient: WalletClient<Transport, Chain, Account>, handles: HexString[], reencryptPubKey: Uint8Array, backoffConfig?: Partial<BackoffConfig>): Promise<Array<EncryptedDecryptionAttestation<EncryptionScheme, SupportedFheType>>>;
|
|
238
|
+
attestedDecrypt(walletClient: WalletClient<Transport, Chain, Account>, handles: HexString[], reencryptPubKey: Uint8Array, reencryptKeypair: Secp256k1Keypair, backoffConfig?: Partial<BackoffConfig>): Promise<Array<DecryptionAttestation<EncryptionScheme, SupportedFheType>>>;
|
|
230
239
|
/**
|
|
231
240
|
* Requests attested decrypts using a voucher-backed session key.
|
|
232
241
|
*
|
|
@@ -257,9 +266,9 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
257
266
|
* );
|
|
258
267
|
* ```
|
|
259
268
|
*/
|
|
260
|
-
attestedDecryptWithVoucher(ephemeralKeypair: Secp256k1Keypair, allowanceVoucherWithSig: AllowanceVoucherWithSig, ethClient: PublicClient<Transport, Chain> | WalletClient<Transport, Chain, Account>, handles: HexString[], requesterArgData?: HexString, backoffConfig?: Partial<BackoffConfig>): Promise<Array<DecryptionAttestation<
|
|
261
|
-
attestedDecryptWithVoucher(ephemeralKeypair: Secp256k1Keypair, allowanceVoucherWithSig: AllowanceVoucherWithSig, ethClient: PublicClient<Transport, Chain> | WalletClient<Transport, Chain, Account>, handles: HexString[], reencryptPubKey: Uint8Array, requesterArgData?: HexString, backoffConfig?: Partial<BackoffConfig>): Promise<Array<EncryptedDecryptionAttestation<
|
|
262
|
-
attestedDecryptWithVoucher(ephemeralKeypair: Secp256k1Keypair, allowanceVoucherWithSig: AllowanceVoucherWithSig, ethClient: PublicClient<Transport, Chain> | WalletClient<Transport, Chain, Account>, handles: HexString[], reencryptPubKey: Uint8Array, reencryptKeypair: Secp256k1Keypair, requesterArgData?: HexString, backoffConfig?: Partial<BackoffConfig>): Promise<Array<DecryptionAttestation<
|
|
269
|
+
attestedDecryptWithVoucher(ephemeralKeypair: Secp256k1Keypair, allowanceVoucherWithSig: AllowanceVoucherWithSig, ethClient: PublicClient<Transport, Chain> | WalletClient<Transport, Chain, Account>, handles: HexString[], requesterArgData?: HexString, backoffConfig?: Partial<BackoffConfig>): Promise<Array<DecryptionAttestation<EncryptionScheme, SupportedFheType>>>;
|
|
270
|
+
attestedDecryptWithVoucher(ephemeralKeypair: Secp256k1Keypair, allowanceVoucherWithSig: AllowanceVoucherWithSig, ethClient: PublicClient<Transport, Chain> | WalletClient<Transport, Chain, Account>, handles: HexString[], reencryptPubKey: Uint8Array, requesterArgData?: HexString, backoffConfig?: Partial<BackoffConfig>): Promise<Array<EncryptedDecryptionAttestation<EncryptionScheme, SupportedFheType>>>;
|
|
271
|
+
attestedDecryptWithVoucher(ephemeralKeypair: Secp256k1Keypair, allowanceVoucherWithSig: AllowanceVoucherWithSig, ethClient: PublicClient<Transport, Chain> | WalletClient<Transport, Chain, Account>, handles: HexString[], reencryptPubKey: Uint8Array, reencryptKeypair: Secp256k1Keypair, requesterArgData?: HexString, backoffConfig?: Partial<BackoffConfig>): Promise<Array<DecryptionAttestation<EncryptionScheme, SupportedFheType>>>;
|
|
263
272
|
/**
|
|
264
273
|
* Get an attested compute for the given wallet client.
|
|
265
274
|
*
|
|
@@ -305,9 +314,9 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
305
314
|
* console.log(decrypted.plaintext.value);
|
|
306
315
|
* ```
|
|
307
316
|
*/
|
|
308
|
-
attestedCompute(walletClient: WalletClient<Transport, Chain, Account>, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean, backoffConfig?: Partial<BackoffConfig>): Promise<DecryptionAttestation<
|
|
309
|
-
attestedCompute(walletClient: WalletClient<Transport, Chain, Account>, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean, reencryptPubKey: Uint8Array, backoffConfig?: Partial<BackoffConfig>): Promise<EncryptedDecryptionAttestation<
|
|
310
|
-
attestedCompute(walletClient: WalletClient<Transport, Chain, Account>, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean, reencryptPubKey: Uint8Array, reencryptKeypair: Secp256k1Keypair, backoffConfig?: Partial<BackoffConfig>): Promise<DecryptionAttestation<
|
|
317
|
+
attestedCompute(walletClient: WalletClient<Transport, Chain, Account>, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean, backoffConfig?: Partial<BackoffConfig>): Promise<DecryptionAttestation<EncryptionScheme, SupportedFheType>>;
|
|
318
|
+
attestedCompute(walletClient: WalletClient<Transport, Chain, Account>, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean, reencryptPubKey: Uint8Array, backoffConfig?: Partial<BackoffConfig>): Promise<EncryptedDecryptionAttestation<EncryptionScheme, SupportedFheType>>;
|
|
319
|
+
attestedCompute(walletClient: WalletClient<Transport, Chain, Account>, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean, reencryptPubKey: Uint8Array, reencryptKeypair: Secp256k1Keypair, backoffConfig?: Partial<BackoffConfig>): Promise<DecryptionAttestation<EncryptionScheme, SupportedFheType>>;
|
|
311
320
|
/**
|
|
312
321
|
* Performs attested compute via a voucher-backed session key.
|
|
313
322
|
*
|
|
@@ -350,9 +359,9 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
350
359
|
* console.log(decrypted.plaintext.value);
|
|
351
360
|
* ```
|
|
352
361
|
*/
|
|
353
|
-
attestedComputeWithVoucher(ephemeralKeypair: Secp256k1Keypair, allowanceVoucherWithSig: AllowanceVoucherWithSig, ethClient: PublicClient<Transport, Chain> | WalletClient<Transport, Chain, Account>, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean, requesterArgData?: HexString, backoffConfig?: Partial<BackoffConfig>): Promise<DecryptionAttestation<
|
|
354
|
-
attestedComputeWithVoucher(ephemeralKeypair: Secp256k1Keypair, allowanceVoucherWithSig: AllowanceVoucherWithSig, ethClient: PublicClient<Transport, Chain> | WalletClient<Transport, Chain, Account>, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean, reencryptPubKey: Uint8Array, requesterArgData?: HexString, backoffConfig?: Partial<BackoffConfig>): Promise<EncryptedDecryptionAttestation<
|
|
355
|
-
attestedComputeWithVoucher(ephemeralKeypair: Secp256k1Keypair, allowanceVoucherWithSig: AllowanceVoucherWithSig, ethClient: PublicClient<Transport, Chain> | WalletClient<Transport, Chain, Account>, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean, reencryptPubKey: Uint8Array, reencryptKeypair: Secp256k1Keypair, requesterArgData?: HexString, backoffConfig?: Partial<BackoffConfig>): Promise<DecryptionAttestation<
|
|
362
|
+
attestedComputeWithVoucher(ephemeralKeypair: Secp256k1Keypair, allowanceVoucherWithSig: AllowanceVoucherWithSig, ethClient: PublicClient<Transport, Chain> | WalletClient<Transport, Chain, Account>, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean, requesterArgData?: HexString, backoffConfig?: Partial<BackoffConfig>): Promise<DecryptionAttestation<EncryptionScheme, SupportedFheType>>;
|
|
363
|
+
attestedComputeWithVoucher(ephemeralKeypair: Secp256k1Keypair, allowanceVoucherWithSig: AllowanceVoucherWithSig, ethClient: PublicClient<Transport, Chain> | WalletClient<Transport, Chain, Account>, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean, reencryptPubKey: Uint8Array, requesterArgData?: HexString, backoffConfig?: Partial<BackoffConfig>): Promise<EncryptedDecryptionAttestation<EncryptionScheme, SupportedFheType>>;
|
|
364
|
+
attestedComputeWithVoucher(ephemeralKeypair: Secp256k1Keypair, allowanceVoucherWithSig: AllowanceVoucherWithSig, ethClient: PublicClient<Transport, Chain> | WalletClient<Transport, Chain, Account>, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean, reencryptPubKey: Uint8Array, reencryptKeypair: Secp256k1Keypair, requesterArgData?: HexString, backoffConfig?: Partial<BackoffConfig>): Promise<DecryptionAttestation<EncryptionScheme, SupportedFheType>>;
|
|
356
365
|
/**
|
|
357
366
|
* Get an decryption of publicly revealed handles.
|
|
358
367
|
*
|
|
@@ -366,7 +375,7 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
|
|
|
366
375
|
* const { plaintext, covalidatorSignature } = response[0];
|
|
367
376
|
* ```
|
|
368
377
|
*/
|
|
369
|
-
attestedReveal(handles: HexString[], backoffConfig?: Partial<BackoffConfig>): Promise<Array<DecryptionAttestation<
|
|
378
|
+
attestedReveal(handles: HexString[], backoffConfig?: Partial<BackoffConfig>): Promise<Array<DecryptionAttestation<EncryptionScheme, SupportedFheType>>>;
|
|
370
379
|
/**
|
|
371
380
|
* Get the GRPC endpoint for the covalidator that services this deployment.
|
|
372
381
|
*/
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { Decryptor, Encryptor, XwingScheme } from '../encryption/encryption.js';
|
|
2
|
+
import { PubKeyEncodable } from '../reencryption/index.js';
|
|
3
|
+
export declare const TEST_NETWORK_SEED_KEY = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
4
|
+
export declare const TEST_NETWORK_XWING_PUBKEY = "0xca882388911c7c762aafc20debd63e845b3bed28c9d5262cdea7771fb31bd660a1ae7b395a9a7df3d12c7b118e8eda5057572c1ba05cd9b635edf33dabca4cac7291e0848f19c20e5beb850c3818f3543d49b3a5c729cb86a28fda539775d04feda112fe0c81d138aaf623aea7d507a4e826e890105db6065a44aba76a10d771c00d1b33f4ac51869806aae18eada68f19047024542d64a7aa1c91a5e1aa49d93613b5224b415bcc7aa166e4b55033438d20c641f9664fdb1689b53208181463e3d1325d46b30f07c5945b7e3fa1418bf833d975258461b294664eaf60795964924a280729c10a37fc6e967440bdd55d4ca53596286383481291152365303d44517cef369c00933b0b30368a230353e729c031075e8388673678a56b3ba84a165b28096ee9bd684483e1844258b451c365c41fa534152a3b64120041450128e960c7d6437d717ee266bdde7aaeec225ed93b958d188e97407349f1382976ca47d761ecc59a6f394487eb015c083abb490584677240eb47f838c838568a496119378b8bb81484610a50792b5d9c9939db188e7d0249d3cb918c436f111a2898849b286b0743a22c57464c709c5eaceac1ba493adca3328c0b14b5e38d3aea74e328b622b17e7181c35ad11c2103bdb7f2b209d93dcbc4ab61a06bc37139e6d2b7a06c5b7e9267bef3a8918a706f793271a5acc2574532da79e5a10cf074b998147a3c43586a411a513bba0d11cc19a36c83b19277f28022c88b120abfdba7076a8263e05336e3245aef7033eb3c762b5bbfa5791ac960398b649d5cbb652ddc6b2398143a0861ab3b410b696328879c099098adf819fbf7ac170030e86675e7f45c22ac9e1cf52c3102487bb0b91ab592afdc69c6e3a9b71876b86260b6c736b8291098f1130d3b763525cbad540ce2d042eacb6ed43b7bcba898f712c412f26066e09945f44ec7026c8ef959831abc10719d2017a12a41728b41c02371a5f5756ebc79406be708ea41bbd21563c874a0b791a3b4e4224a609967004f065c5ab4f3b4c61cb35df70573269da53179c3701fc5205f61974426f9b794c1b5826494b70842b6920c17752029369264dc8590b898b85c9d89a258e1f46c1b0490efd17c485cb51687cea272041e90b8e629521d3c5e3fa7518161bad7a159295b63cc6c0077897b53d47db8bc0ecb820f550705b65715a1a1094d04854f56acd26aa0baa10cb8447fad6211f53105796a42882328e6852e8de821c283b51eaab9bc95c4dc53615626049d63b1f9a457193805276b1905b0ab39353b5cf91fdd6023d4d816aef9cce4a3cfb3d12190172df221ae61d427563a098cc60e3dc9997ef54959180be5dc64a911157db6be3a01be2ee343caab33b8729abf0c50c674758c511291941fceac646232920907c2e88b9ec10211161729c797643a553a6ae5c4b7483c04e3263bd291e311c609071348b7c3310aa97d6b8318e0a4afe8399fa22f951049a9bb8860f7c69a333d3cc1aaf0129ab560713bf29eb3a01f9a276c78e54e3a3648b2447c80242b271b11406866389426d8b59796540d6b5702092ab21ee217c075cfc0c17ef826ce9ea29b9e61617457a5b1aaa23a58615dc53c59183beb36ea19498c21820b70ab47adeb678f1c52bf8768b3597b608ea1a8a15cd62e8a29bec4a1ac248ef9f02de0144bca06025f95a42bd6c8eaaaaaa2366328561d";
|
|
5
|
+
/**
|
|
6
|
+
* X-Wing keypair interface.
|
|
7
|
+
* X-Wing is a post-quantum hybrid KEM combining ML-KEM-768 and X25519.
|
|
8
|
+
* - Private key: 32-byte seed
|
|
9
|
+
* - Public key: 1216 bytes
|
|
10
|
+
* - Encapsulated key: 1120 bytes
|
|
11
|
+
*/
|
|
12
|
+
export interface XwingKeypair extends PubKeyEncodable {
|
|
13
|
+
scheme: XwingScheme;
|
|
14
|
+
publicKey: CryptoKey;
|
|
15
|
+
privateKey: CryptoKey;
|
|
16
|
+
publicKeyBytes: Uint8Array;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Derive X-Wing keypair from a 32-byte seed (deterministic).
|
|
20
|
+
* This matches the Go implementation in covalidator/encoding/xwing.go
|
|
21
|
+
*
|
|
22
|
+
* @param seed - 32-byte seed for deterministic key derivation
|
|
23
|
+
* @returns X-Wing keypair with cached public key bytes
|
|
24
|
+
*/
|
|
25
|
+
export declare function deriveXwingKeypairFromSeed(seed: Uint8Array): Promise<XwingKeypair>;
|
|
26
|
+
/**
|
|
27
|
+
* Generate a random X-Wing keypair.
|
|
28
|
+
*
|
|
29
|
+
* @returns X-Wing keypair with cached public key bytes
|
|
30
|
+
*/
|
|
31
|
+
export declare function generateXwingKeypair(): Promise<XwingKeypair>;
|
|
32
|
+
/**
|
|
33
|
+
* Decode X-Wing public key from bytes.
|
|
34
|
+
*
|
|
35
|
+
* @param pubKeyBytes - 1216-byte X-Wing public key
|
|
36
|
+
* @returns CryptoKey for encryption operations
|
|
37
|
+
*/
|
|
38
|
+
export declare function decodeXwingPublicKey(pubKeyBytes: Uint8Array): Promise<CryptoKey>;
|
|
39
|
+
/**
|
|
40
|
+
* Decode X-Wing private key from 32-byte seed.
|
|
41
|
+
* Alias for deriveXwingKeypairFromSeed for consistency with Go API.
|
|
42
|
+
*
|
|
43
|
+
* @param seed - 32-byte seed
|
|
44
|
+
* @returns X-Wing keypair
|
|
45
|
+
*/
|
|
46
|
+
export declare function decodeXwingPrivateKey(seed: Uint8Array): Promise<XwingKeypair>;
|
|
47
|
+
/**
|
|
48
|
+
* Encode X-Wing public key to bytes.
|
|
49
|
+
*
|
|
50
|
+
* @param publicKey - CryptoKey containing X-Wing public key
|
|
51
|
+
* @returns 1216-byte serialized public key
|
|
52
|
+
*/
|
|
53
|
+
export declare function encodeXwingPublicKey(publicKey: CryptoKey): Promise<Uint8Array>;
|
|
54
|
+
/**
|
|
55
|
+
* X-Wing encryptor arguments.
|
|
56
|
+
* pubKeyA is the recipient's public key (usually the covalidator's public key).
|
|
57
|
+
*/
|
|
58
|
+
export type XwingEncryptorArgs = {
|
|
59
|
+
pubKeyA: CryptoKey;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* X-Wing decryptor arguments.
|
|
63
|
+
* privKeyA is the recipient's private key (usually the covalidator's private key).
|
|
64
|
+
*/
|
|
65
|
+
export type XwingDecryptorArgs = {
|
|
66
|
+
privKeyA: XwingKeypair;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Encrypt using X-Wing HPKE (RFC 9180) with ChaCha20-Poly1305 AEAD.
|
|
70
|
+
*
|
|
71
|
+
* Output format: encappedKey (1184 bytes) || ciphertext (variable length)
|
|
72
|
+
*
|
|
73
|
+
* @param pubKeyA - Recipient's public key
|
|
74
|
+
* @param msg - Message to encrypt
|
|
75
|
+
* @param aad - Additional authenticated data (default: empty)
|
|
76
|
+
* @param info - Context info for key derivation (default: empty)
|
|
77
|
+
* @returns Encrypted data (encappedKey || ciphertext)
|
|
78
|
+
*/
|
|
79
|
+
export declare function encrypt(pubKeyA: CryptoKey, msg: Uint8Array, aad?: Uint8Array, info?: Uint8Array): Promise<Uint8Array>;
|
|
80
|
+
/**
|
|
81
|
+
* Decrypt using X-Wing HPKE (RFC 9180) with ChaCha20-Poly1305 AEAD.
|
|
82
|
+
*
|
|
83
|
+
* Input format: encappedKey (1184 bytes) || ciphertext (variable length)
|
|
84
|
+
*
|
|
85
|
+
* @param privKeyA - Recipient's private key
|
|
86
|
+
* @param encryptedData - Encrypted data (encappedKey || ciphertext)
|
|
87
|
+
* @param aad - Additional authenticated data (default: empty)
|
|
88
|
+
* @param info - Context info for key derivation (default: empty)
|
|
89
|
+
* @returns Decrypted plaintext
|
|
90
|
+
*/
|
|
91
|
+
export declare function decrypt(privKeyA: XwingKeypair, encryptedData: Uint8Array, aad?: Uint8Array, info?: Uint8Array): Promise<Uint8Array>;
|
|
92
|
+
/**
|
|
93
|
+
* Create an X-Wing encryptor for encrypting inputs.
|
|
94
|
+
* Follows the same pattern as ECIES encryptor in ecies.ts.
|
|
95
|
+
*
|
|
96
|
+
* The encryptor:
|
|
97
|
+
* 1. Encodes the plaintext with its context (HADU encoding)
|
|
98
|
+
* 2. Encrypts using X-Wing HPKE
|
|
99
|
+
* 3. Computes prehandle and handle for tracking
|
|
100
|
+
* 4. Returns the encrypted ciphertext with metadata
|
|
101
|
+
*
|
|
102
|
+
* @param args - X-Wing encryptor arguments (recipient's public key)
|
|
103
|
+
* @returns Encryptor function
|
|
104
|
+
*/
|
|
105
|
+
export declare function getXwingEncryptor({ pubKeyA, }: XwingEncryptorArgs): Encryptor<XwingScheme>;
|
|
106
|
+
/**
|
|
107
|
+
* Create an X-Wing decryptor for decrypting inputs.
|
|
108
|
+
* Follows the same pattern as ECIES decryptor in ecies.ts.
|
|
109
|
+
*
|
|
110
|
+
* The decryptor:
|
|
111
|
+
* 1. Removes the prepended handle from the ciphertext
|
|
112
|
+
* 2. Decrypts using X-Wing HPKE
|
|
113
|
+
* 3. Decodes the HADU-encoded payload
|
|
114
|
+
* 4. Extracts and returns the plaintext
|
|
115
|
+
*
|
|
116
|
+
* @param args - X-Wing decryptor arguments (recipient's private key)
|
|
117
|
+
* @returns Decryptor function
|
|
118
|
+
*/
|
|
119
|
+
export declare function getXwingDecryptor({ privKeyA, }: XwingDecryptorArgs): Decryptor<XwingScheme>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inco/js",
|
|
3
|
-
"version": "0.8.0-devnet-
|
|
3
|
+
"version": "0.8.0-devnet-6",
|
|
4
4
|
"repository": "https://github.com/Inco-fhevm/inco-monorepo",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -91,6 +91,9 @@
|
|
|
91
91
|
"@connectrpc/connect-node": "^2.0.0",
|
|
92
92
|
"@connectrpc/connect-web": "^2.0.1",
|
|
93
93
|
"@grpc/grpc-js": "^1.13.4",
|
|
94
|
+
"@hpke/hybridkem-x-wing": "^0.6.1",
|
|
95
|
+
"@hpke/core": "^1.7.5",
|
|
96
|
+
"@hpke/chacha20poly1305": "^1.7.1",
|
|
94
97
|
"@types/elliptic": "^6.4.18",
|
|
95
98
|
"ecies-geth": "^1.7.5",
|
|
96
99
|
"effect": "^3.17.13",
|