@inco/js 0.8.0-devnet-6 → 0.9.0-devnet-test-3

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.
Files changed (64) hide show
  1. package/dist/cjs/advancedacl/session-key.d.ts +10 -9
  2. package/dist/cjs/advancedacl/session-key.js +7 -8
  3. package/dist/cjs/attestedcompute/attested-compute.d.ts +2 -2
  4. package/dist/cjs/attestedcompute/attested-compute.js +2 -2
  5. package/dist/cjs/attesteddecrypt/attested-decrypt.d.ts +3 -3
  6. package/dist/cjs/attesteddecrypt/attested-decrypt.js +5 -5
  7. package/dist/cjs/encryption/encryption.d.ts +8 -10
  8. package/dist/cjs/encryption/encryption.js +2 -5
  9. package/dist/cjs/generated/es/inco/covalidator/compute/v1/server_pb.d.ts +234 -7
  10. package/dist/cjs/generated/es/inco/covalidator/compute/v1/server_pb.js +86 -10
  11. package/dist/cjs/generated/es/inco/covalidator/compute/v1/types_pb.d.ts +0 -6
  12. package/dist/cjs/generated/es/inco/covalidator/compute/v1/types_pb.js +2 -8
  13. package/dist/cjs/generated/es/inco/kms/lite/v1/kms_service_pb.d.ts +213 -0
  14. package/dist/cjs/generated/es/inco/kms/lite/v1/kms_service_pb.js +36 -11
  15. package/dist/cjs/kms/quorumClient.d.ts +3 -2
  16. package/dist/cjs/kms/quorumClient.js +30 -27
  17. package/dist/cjs/lite/index.d.ts +1 -2
  18. package/dist/cjs/lite/index.js +5 -18
  19. package/dist/cjs/lite/lightning.d.ts +16 -16
  20. package/dist/cjs/lite/lightning.js +28 -39
  21. package/dist/cjs/lite/xwing.d.ts +5 -1
  22. package/dist/cjs/lite/xwing.js +10 -5
  23. package/dist/cjs/reencryption/types.d.ts +2 -2
  24. package/dist/esm/advancedacl/session-key.d.ts +10 -9
  25. package/dist/esm/advancedacl/session-key.js +7 -8
  26. package/dist/esm/attestedcompute/attested-compute.d.ts +2 -2
  27. package/dist/esm/attestedcompute/attested-compute.js +2 -2
  28. package/dist/esm/attesteddecrypt/attested-decrypt.d.ts +3 -3
  29. package/dist/esm/attesteddecrypt/attested-decrypt.js +3 -3
  30. package/dist/esm/encryption/encryption.d.ts +8 -10
  31. package/dist/esm/encryption/encryption.js +2 -5
  32. package/dist/esm/generated/es/inco/covalidator/compute/v1/server_pb.d.ts +234 -7
  33. package/dist/esm/generated/es/inco/covalidator/compute/v1/server_pb.js +85 -9
  34. package/dist/esm/generated/es/inco/covalidator/compute/v1/types_pb.d.ts +0 -6
  35. package/dist/esm/generated/es/inco/covalidator/compute/v1/types_pb.js +2 -8
  36. package/dist/esm/generated/es/inco/kms/lite/v1/kms_service_pb.d.ts +213 -0
  37. package/dist/esm/generated/es/inco/kms/lite/v1/kms_service_pb.js +35 -10
  38. package/dist/esm/kms/quorumClient.d.ts +3 -2
  39. package/dist/esm/kms/quorumClient.js +30 -27
  40. package/dist/esm/lite/index.d.ts +1 -2
  41. package/dist/esm/lite/index.js +2 -5
  42. package/dist/esm/lite/lightning.d.ts +16 -16
  43. package/dist/esm/lite/lightning.js +29 -40
  44. package/dist/esm/lite/xwing.d.ts +5 -1
  45. package/dist/esm/lite/xwing.js +9 -4
  46. package/dist/esm/reencryption/types.d.ts +2 -2
  47. package/dist/types/advancedacl/session-key.d.ts +10 -9
  48. package/dist/types/attestedcompute/attested-compute.d.ts +2 -2
  49. package/dist/types/attesteddecrypt/attested-decrypt.d.ts +3 -3
  50. package/dist/types/encryption/encryption.d.ts +8 -10
  51. package/dist/types/generated/es/inco/covalidator/compute/v1/server_pb.d.ts +234 -7
  52. package/dist/types/generated/es/inco/covalidator/compute/v1/types_pb.d.ts +0 -6
  53. package/dist/types/generated/es/inco/kms/lite/v1/kms_service_pb.d.ts +213 -0
  54. package/dist/types/kms/quorumClient.d.ts +3 -2
  55. package/dist/types/lite/index.d.ts +1 -2
  56. package/dist/types/lite/lightning.d.ts +16 -16
  57. package/dist/types/lite/xwing.d.ts +5 -1
  58. package/dist/types/reencryption/types.d.ts +2 -2
  59. package/package.json +3 -6
  60. package/dist/cjs/lite/ecies.d.ts +0 -26
  61. package/dist/cjs/lite/ecies.js +0 -146
  62. package/dist/esm/lite/ecies.d.ts +0 -26
  63. package/dist/esm/lite/ecies.js +0 -134
  64. package/dist/types/lite/ecies.d.ts +0 -26
@@ -106,6 +106,105 @@ export type AttestedDecryptRequest = Message<"inco.kms.lite.v1.AttestedDecryptRe
106
106
  * Use `create(AttestedDecryptRequestSchema)` to create a new message.
107
107
  */
108
108
  export declare const AttestedDecryptRequestSchema: GenMessage<AttestedDecryptRequest>;
109
+ /**
110
+ * EListAttestedDecryptRequest is the request type for the KmsService/EListAttestedDecrypt RPC method.
111
+ *
112
+ * @generated from message inco.kms.lite.v1.EListAttestedDecryptRequest
113
+ */
114
+ export type EListAttestedDecryptRequest = Message<"inco.kms.lite.v1.EListAttestedDecryptRequest"> & {
115
+ /**
116
+ * user_address is the Ethereum address of the user who requested the
117
+ * decryption, prefixed with 0x.
118
+ *
119
+ * @generated from field: string user_address = 1;
120
+ */
121
+ userAddress: string;
122
+ /**
123
+ * reencrypt_pub_key is the encoding of the user's public
124
+ * encryption key (secp256k1) used to reencrypt the result for.
125
+ * It is encoded in its 33-byte compressed format.
126
+ * If empty, the KMS will return plaintext decryption instead of reencryption.
127
+ *
128
+ * @generated from field: bytes reencrypt_pub_key = 2;
129
+ */
130
+ reencryptPubKey: Uint8Array;
131
+ /**
132
+ * eip712_signature is an EIP-712 signature of the following EIP-712 typed data by
133
+ * `user_address` (note that we only give a JSON representation for the sake of
134
+ * readability, but the actual signed data is defined in the EIP-712 spec) where:
135
+ * handles - list of 0x prefixed handles to decrypt
136
+ * publicKey - 0x prefixed reencrypt_pub_key (if any). "0x" otherwise if empty.
137
+ *
138
+ * ```json
139
+ * {
140
+ * "types": {
141
+ * "EIP712Domain": [
142
+ * { "name": "name", "type": "string" },
143
+ * { "name": "version", "type": "string" },
144
+ * { "name": "chainId", "type": "uint256" }
145
+ * ],
146
+ * "AttestedDecryptRequest": [
147
+ * { "name": "handles", "type": "bytes32[]" },
148
+ * { "name": "publicKey", "type": "bytes" },
149
+ * ]
150
+ * },
151
+ * "primaryType": "AttestedDecryptRequest",
152
+ * "domain": {
153
+ * "name": "IncoAttestedDecrypt",
154
+ * "version": "1",
155
+ * "chainId": "<host_chain_id>",
156
+ * },
157
+ * "message": {
158
+ * "handles": ["<handle1>", "<handle2>", ...],
159
+ * "publicKey": "0x<reencrypt_pub_key>"
160
+ * }
161
+ * }
162
+ * ```
163
+ *
164
+ * @generated from field: bytes eip712_signature = 3;
165
+ */
166
+ eip712Signature: Uint8Array;
167
+ /**
168
+ * handle_with_proof is the handle of an elist ciphertext with proof to decrypt.
169
+ * Either the user_address or sharer must have ACL access to the elist handle for the attested
170
+ * decryption to succeed.
171
+ *
172
+ * @generated from field: inco.kms.lite.v1.HandleWithProof elist_handle_with_proof = 4;
173
+ */
174
+ elistHandleWithProof?: HandleWithProof;
175
+ };
176
+ /**
177
+ * Describes the message inco.kms.lite.v1.EListAttestedDecryptRequest.
178
+ * Use `create(EListAttestedDecryptRequestSchema)` to create a new message.
179
+ */
180
+ export declare const EListAttestedDecryptRequestSchema: GenMessage<EListAttestedDecryptRequest>;
181
+ /**
182
+ * EListAttestedDecryptResponse is the response type for the KmsService/EListAttestedDecryptResponse RPC method.
183
+ *
184
+ * @generated from message inco.kms.lite.v1.EListAttestedDecryptResponse
185
+ */
186
+ export type EListAttestedDecryptResponse = Message<"inco.kms.lite.v1.EListAttestedDecryptResponse"> & {
187
+ /**
188
+ * commitment_proof_attestation is the signed commitment_proof of the decrypted elist values and their corresponding commitments.
189
+ * commitment_proof = hash(concat([
190
+ * hash(concat([commitment1, v1])),
191
+ * ...]))
192
+ *
193
+ * @generated from field: inco.kms.lite.v1.DecryptionAttestation commitment_proof_attestation = 1;
194
+ */
195
+ commitmentProofAttestation?: DecryptionAttestation;
196
+ /**
197
+ * values is the list of decrypted elist values.
198
+ *
199
+ * @generated from field: repeated inco.kms.lite.v1.EListElement values = 2;
200
+ */
201
+ values: EListElement[];
202
+ };
203
+ /**
204
+ * Describes the message inco.kms.lite.v1.EListAttestedDecryptResponse.
205
+ * Use `create(EListAttestedDecryptResponseSchema)` to create a new message.
206
+ */
207
+ export declare const EListAttestedDecryptResponseSchema: GenMessage<EListAttestedDecryptResponse>;
109
208
  /**
110
209
  * AttestedRevealRequest is the request type for the KmsService/AttestedReveal RPC method.
111
210
  *
@@ -125,6 +224,25 @@ export type AttestedRevealRequest = Message<"inco.kms.lite.v1.AttestedRevealRequ
125
224
  * Use `create(AttestedRevealRequestSchema)` to create a new message.
126
225
  */
127
226
  export declare const AttestedRevealRequestSchema: GenMessage<AttestedRevealRequest>;
227
+ /**
228
+ * EListAttestedRevealRequest is the request type for the KmsService/EListAttestedReveal RPC method.
229
+ *
230
+ * @generated from message inco.kms.lite.v1.EListAttestedRevealRequest
231
+ */
232
+ export type EListAttestedRevealRequest = Message<"inco.kms.lite.v1.EListAttestedRevealRequest"> & {
233
+ /**
234
+ * handle is the handle of the elist ciphertext to decrypt.
235
+ * The handle must have been revealed beforehand with the on-chain .reveal() call.
236
+ *
237
+ * @generated from field: string handle = 3;
238
+ */
239
+ handle: string;
240
+ };
241
+ /**
242
+ * Describes the message inco.kms.lite.v1.EListAttestedRevealRequest.
243
+ * Use `create(EListAttestedRevealRequestSchema)` to create a new message.
244
+ */
245
+ export declare const EListAttestedRevealRequestSchema: GenMessage<EListAttestedRevealRequest>;
128
246
  /**
129
247
  * AttestedComputeRequest is the request type for the KmsService/AttestedDecrypt RPC method.
130
248
  *
@@ -261,6 +379,30 @@ export type AttestedRevealResponse = Message<"inco.kms.lite.v1.AttestedRevealRes
261
379
  * Use `create(AttestedRevealResponseSchema)` to create a new message.
262
380
  */
263
381
  export declare const AttestedRevealResponseSchema: GenMessage<AttestedRevealResponse>;
382
+ /**
383
+ * EListAttestedRevealResponse is the response type for the KmsService/EListAttestedReveal RPC method.
384
+ *
385
+ * @generated from message inco.kms.lite.v1.EListAttestedRevealResponse
386
+ */
387
+ export type EListAttestedRevealResponse = Message<"inco.kms.lite.v1.EListAttestedRevealResponse"> & {
388
+ /**
389
+ * commitment_proof_attestation is the signed commitment_proof of the concatenation of the hashes of individual elist values.
390
+ *
391
+ * @generated from field: inco.kms.lite.v1.DecryptionAttestation commitment_proof_attestation = 1;
392
+ */
393
+ commitmentProofAttestation?: DecryptionAttestation;
394
+ /**
395
+ * values is the list of decrypted elist values.
396
+ *
397
+ * @generated from field: repeated inco.kms.lite.v1.EListElement values = 2;
398
+ */
399
+ values: EListElement[];
400
+ };
401
+ /**
402
+ * Describes the message inco.kms.lite.v1.EListAttestedRevealResponse.
403
+ * Use `create(EListAttestedRevealResponseSchema)` to create a new message.
404
+ */
405
+ export declare const EListAttestedRevealResponseSchema: GenMessage<EListAttestedRevealResponse>;
264
406
  /**
265
407
  * AttestedComputeResponse is the response type for the KmsService/AttestedCompute RPC method.
266
408
  *
@@ -321,6 +463,53 @@ export type Reencryption = Message<"inco.kms.lite.v1.Reencryption"> & {
321
463
  * Use `create(ReencryptionSchema)` to create a new message.
322
464
  */
323
465
  export declare const ReencryptionSchema: GenMessage<Reencryption>;
466
+ /**
467
+ * EListElement contains the decryptions/reencryptions for elist element.
468
+ *
469
+ * @generated from message inco.kms.lite.v1.EListElement
470
+ */
471
+ export type EListElement = Message<"inco.kms.lite.v1.EListElement"> & {
472
+ /**
473
+ * index is the index of the element in the elist.
474
+ *
475
+ * @generated from field: uint32 index = 1;
476
+ */
477
+ index: number;
478
+ /**
479
+ * commitment is the random commitment applied to the element when calculating elist commitment_proof.
480
+ *
481
+ * @generated from field: bytes commitment = 2;
482
+ */
483
+ commitment: Uint8Array;
484
+ /**
485
+ * @generated from oneof inco.kms.lite.v1.EListElement.value
486
+ */
487
+ value: {
488
+ /**
489
+ * Returns plaintext if reencrypt_pub_key was empty in the request
490
+ *
491
+ * @generated from field: inco.kms.lite.v1.Plaintext plaintext = 3;
492
+ */
493
+ value: Plaintext;
494
+ case: "plaintext";
495
+ } | {
496
+ /**
497
+ * Returns encrypted ciphertext if reencrypt_pub_key was set in the request
498
+ *
499
+ * @generated from field: inco.kms.lite.v1.Reencryption reencryption = 4;
500
+ */
501
+ value: Reencryption;
502
+ case: "reencryption";
503
+ } | {
504
+ case: undefined;
505
+ value?: undefined;
506
+ };
507
+ };
508
+ /**
509
+ * Describes the message inco.kms.lite.v1.EListElement.
510
+ * Use `create(EListElementSchema)` to create a new message.
511
+ */
512
+ export declare const EListElementSchema: GenMessage<EListElement>;
324
513
  /**
325
514
  * DecryptionAttestation contains the attestation for the decryption of a single handle.
326
515
  *
@@ -453,4 +642,28 @@ export declare const KmsService: GenService<{
453
642
  input: typeof AttestedRevealRequestSchema;
454
643
  output: typeof AttestedRevealResponseSchema;
455
644
  };
645
+ /**
646
+ * EListAttestedDecrypt decrypts a single elist ciphertext and provides an attestation
647
+ * that the decryption was performed correctly.
648
+ * Can optionally reencrypt the result of the decryption to a desired public key.
649
+ *
650
+ * @generated from rpc inco.kms.lite.v1.KmsService.EListAttestedDecrypt
651
+ */
652
+ eListAttestedDecrypt: {
653
+ methodKind: "unary";
654
+ input: typeof EListAttestedDecryptRequestSchema;
655
+ output: typeof EListAttestedDecryptResponseSchema;
656
+ };
657
+ /**
658
+ * EListAttestedReveal decrypts a single elist ciphertext and provides an attestation
659
+ * that the decryption was performed correctly.
660
+ * Doesn't require authentication if the handle is publicly revealed with the on-chain .reveal() call beforehand.
661
+ *
662
+ * @generated from rpc inco.kms.lite.v1.KmsService.EListAttestedReveal
663
+ */
664
+ eListAttestedReveal: {
665
+ methodKind: "unary";
666
+ input: typeof EListAttestedRevealRequestSchema;
667
+ output: typeof EListAttestedRevealResponseSchema;
668
+ };
456
669
  }>;
@@ -2,6 +2,7 @@ import type { Address } from 'viem';
2
2
  import type { DecryptionAttestation, EncryptedDecryptionAttestation } from '../attesteddecrypt/types.js';
3
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
+ import type { XwingKeypair } from '../lite/index.js';
5
6
  import type { BackoffConfig } from '../retry.js';
6
7
  import { type KmsClient } from './client.js';
7
8
  export declare class KmsQuorumClient {
@@ -28,8 +29,8 @@ export declare class KmsQuorumClient {
28
29
  * @throws {Error} If KMS clients array is empty or threshold is invalid
29
30
  */
30
31
  static fromKmsClients(kmsClients: KmsClient[], threshold: number): KmsQuorumClient;
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>>;
32
+ attestedDecrypt(request: AttestedDecryptRequest, backoffConfig?: Partial<BackoffConfig>, reencryptKeypair?: XwingKeypair): Promise<(DecryptionAttestation<EncryptionScheme, SupportedFheType> | EncryptedDecryptionAttestation<EncryptionScheme, SupportedFheType>)[]>;
33
+ attestedCompute(request: AttestedComputeRequest, backoffConfig?: Partial<BackoffConfig>, reencryptKeypair?: XwingKeypair): Promise<DecryptionAttestation<EncryptionScheme, SupportedFheType> | EncryptedDecryptionAttestation<EncryptionScheme, SupportedFheType>>;
33
34
  attestedReveal(request: AttestedRevealRequest, backoffConfig?: Partial<BackoffConfig>): Promise<(DecryptionAttestation<EncryptionScheme, SupportedFheType> | EncryptedDecryptionAttestation<EncryptionScheme, SupportedFheType>)[]>;
34
35
  /**
35
36
  * Generic method to execute a KMS operation across all clients with retry and threshold logic.
@@ -4,7 +4,6 @@ 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 { 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
7
  export * from './hadu.js';
9
8
  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';
9
+ export { TEST_NETWORK_SEED_KEY, TEST_NETWORK_XWING_PUBKEY, XWING_PUBLIC_KEY_SIZE, decodeXwingPrivateKey, decodeXwingPublicKey, decrypt, deriveXwingKeypairFromSeed, encodeXwingPublicKey, encrypt, generateXwingKeypair, getXwingDecryptor, getXwingEncryptor, type XwingDecryptorArgs, type XwingEncryptorArgs, type XwingKeypair, } from './xwing.js';
@@ -1,4 +1,5 @@
1
1
  import { Account, Chain, GetContractReturnType, PublicClient, Transport, WalletClient } from 'viem';
2
+ import type { PrivateKeyAccount } from 'viem/accounts';
2
3
  import { AllowanceVoucherWithSig } from '../advancedacl/types.js';
3
4
  import { AttestedComputeOP } from '../attestedcompute/types.js';
4
5
  import { DecryptionAttestation, EncryptedDecryptionAttestation } from '../attesteddecrypt/index.js';
@@ -10,7 +11,7 @@ import { localNodeLightningConfig } from '../generated/local-node.js';
10
11
  import { FheType } from '../handle.js';
11
12
  import { LocalNodeEnv } from '../local/index.js';
12
13
  import { BackoffConfig } from '../retry.js';
13
- import { Secp256k1Keypair } from './ecies.js';
14
+ import { XwingKeypair } from './xwing.js';
14
15
  type TupleToUnion<T> = T extends readonly unknown[] ? T[number] : never;
15
16
  type Deployment = TupleToUnion<typeof lightningDeployments>;
16
17
  type DistributedPick<T, K> = T extends any ? Pick<T, Extract<keyof T, K>> : never;
@@ -60,7 +61,6 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
60
61
  readonly executorAddress: Address;
61
62
  readonly chainId: bigint;
62
63
  private readonly kmsQuorumClient;
63
- private readonly ephemeralKeypair;
64
64
  private encryptor;
65
65
  private encryptionScheme;
66
66
  private constructor();
@@ -235,11 +235,11 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
235
235
  */
236
236
  attestedDecrypt(walletClient: WalletClient<Transport, Chain, Account>, handles: HexString[], backoffConfig?: Partial<BackoffConfig>): Promise<Array<DecryptionAttestation<EncryptionScheme, SupportedFheType>>>;
237
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>>>;
238
+ attestedDecrypt(walletClient: WalletClient<Transport, Chain, Account>, handles: HexString[], reencryptPubKey: Uint8Array, reencryptKeypair: XwingKeypair, backoffConfig?: Partial<BackoffConfig>): Promise<Array<DecryptionAttestation<EncryptionScheme, SupportedFheType>>>;
239
239
  /**
240
240
  * Requests attested decrypts using a voucher-backed session key.
241
241
  *
242
- * @param ephemeralKeypair Session keypair matching the voucher grantee.
242
+ * @param ephemeralAccount Session Account matching the voucher grantee.
243
243
  * @param allowanceVoucherWithSig Signed allowance voucher.
244
244
  * @param ethClient - A public eth client or eth wallet client used for signing the attested decrypt request
245
245
  * @param handles Handles to decrypt.
@@ -248,7 +248,7 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
248
248
  * @example Plaintext results
249
249
  * ```ts
250
250
  * const attestations = await lightning.attestedDecryptWithVoucher(
251
- * ephemeralKeypair,
251
+ * ephemeralAccount,
252
252
  * voucher,
253
253
  * ethClient,
254
254
  * [handle],
@@ -258,7 +258,7 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
258
258
  * @example Reencrypt for a delegate
259
259
  * ```ts
260
260
  * const encrypted = await lightning.attestedDecryptWithVoucher(
261
- * ephemeralKeypair,
261
+ * ephemeralAccount,
262
262
  * voucher,
263
263
  * ethClient,
264
264
  * [handle],
@@ -266,9 +266,9 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
266
266
  * );
267
267
  * ```
268
268
  */
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>>>;
269
+ attestedDecryptWithVoucher(ephemeralAccount: PrivateKeyAccount, allowanceVoucherWithSig: AllowanceVoucherWithSig, ethClient: PublicClient<Transport, Chain> | WalletClient<Transport, Chain, Account>, handles: HexString[], requesterArgData?: HexString, backoffConfig?: Partial<BackoffConfig>): Promise<Array<DecryptionAttestation<EncryptionScheme, SupportedFheType>>>;
270
+ attestedDecryptWithVoucher(ephemeralAccount: PrivateKeyAccount, 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(ephemeralAccount: PrivateKeyAccount, allowanceVoucherWithSig: AllowanceVoucherWithSig, ethClient: PublicClient<Transport, Chain> | WalletClient<Transport, Chain, Account>, handles: HexString[], reencryptPubKey: Uint8Array, reencryptKeypair: XwingKeypair, requesterArgData?: HexString, backoffConfig?: Partial<BackoffConfig>): Promise<Array<DecryptionAttestation<EncryptionScheme, SupportedFheType>>>;
272
272
  /**
273
273
  * Get an attested compute for the given wallet client.
274
274
  *
@@ -316,14 +316,14 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
316
316
  */
317
317
  attestedCompute(walletClient: WalletClient<Transport, Chain, Account>, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean, backoffConfig?: Partial<BackoffConfig>): Promise<DecryptionAttestation<EncryptionScheme, SupportedFheType>>;
318
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>>;
319
+ attestedCompute(walletClient: WalletClient<Transport, Chain, Account>, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean, reencryptPubKey: Uint8Array, reencryptKeypair: XwingKeypair, backoffConfig?: Partial<BackoffConfig>): Promise<DecryptionAttestation<EncryptionScheme, SupportedFheType>>;
320
320
  /**
321
321
  * Performs attested compute via a voucher-backed session key.
322
322
  *
323
323
  * @example Plaintext result
324
324
  * ```ts
325
325
  * const attestation = await lightning.attestedComputeWithVoucher(
326
- * ephemeralKeypair,
326
+ * ephemeralAccount,
327
327
  * voucher,
328
328
  * ethClient,
329
329
  * lhsHandle,
@@ -335,7 +335,7 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
335
335
  * @example Reencrypt for a delegate
336
336
  * ```ts
337
337
  * const encrypted = await lightning.attestedComputeWithVoucher(
338
- * ephemeralKeypair,
338
+ * ephemeralAccount,
339
339
  * voucher,
340
340
  * lhsHandle,
341
341
  * AttestedComputeSupportedOps.Eq,
@@ -348,7 +348,7 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
348
348
  * @example Reencrypt and decrypt locally
349
349
  * ```ts
350
350
  * const decrypted = await lightning.attestedComputeWithVoucher(
351
- * ephemeralKeypair,
351
+ * ephemeralAccount,
352
352
  * voucher,
353
353
  * lhsHandle,
354
354
  * AttestedComputeSupportedOps.Eq,
@@ -359,9 +359,9 @@ export declare class Lightning<T extends DeploymentSlice = DeploymentSlice> {
359
359
  * console.log(decrypted.plaintext.value);
360
360
  * ```
361
361
  */
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>>;
362
+ attestedComputeWithVoucher(ephemeralAccount: PrivateKeyAccount, 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(ephemeralAccount: PrivateKeyAccount, 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(ephemeralAccount: PrivateKeyAccount, allowanceVoucherWithSig: AllowanceVoucherWithSig, ethClient: PublicClient<Transport, Chain> | WalletClient<Transport, Chain, Account>, lhsHandle: HexString, op: AttestedComputeOP, rhsPlaintext: bigint | boolean, reencryptPubKey: Uint8Array, reencryptKeypair: XwingKeypair, requesterArgData?: HexString, backoffConfig?: Partial<BackoffConfig>): Promise<DecryptionAttestation<EncryptionScheme, SupportedFheType>>;
365
365
  /**
366
366
  * Get an decryption of publicly revealed handles.
367
367
  *
@@ -1,5 +1,10 @@
1
1
  import { Decryptor, Encryptor, XwingScheme } from '../encryption/encryption.js';
2
2
  import { PubKeyEncodable } from '../reencryption/index.js';
3
+ /**
4
+ * X-Wing public key size in bytes.
5
+ * Combining ML-KEM-768 (1184 bytes) and X25519 (32 bytes).
6
+ */
7
+ export declare const XWING_PUBLIC_KEY_SIZE: number;
3
8
  export declare const TEST_NETWORK_SEED_KEY = "0x0000000000000000000000000000000000000000000000000000000000000000";
4
9
  export declare const TEST_NETWORK_XWING_PUBKEY = "0xca882388911c7c762aafc20debd63e845b3bed28c9d5262cdea7771fb31bd660a1ae7b395a9a7df3d12c7b118e8eda5057572c1ba05cd9b635edf33dabca4cac7291e0848f19c20e5beb850c3818f3543d49b3a5c729cb86a28fda539775d04feda112fe0c81d138aaf623aea7d507a4e826e890105db6065a44aba76a10d771c00d1b33f4ac51869806aae18eada68f19047024542d64a7aa1c91a5e1aa49d93613b5224b415bcc7aa166e4b55033438d20c641f9664fdb1689b53208181463e3d1325d46b30f07c5945b7e3fa1418bf833d975258461b294664eaf60795964924a280729c10a37fc6e967440bdd55d4ca53596286383481291152365303d44517cef369c00933b0b30368a230353e729c031075e8388673678a56b3ba84a165b28096ee9bd684483e1844258b451c365c41fa534152a3b64120041450128e960c7d6437d717ee266bdde7aaeec225ed93b958d188e97407349f1382976ca47d761ecc59a6f394487eb015c083abb490584677240eb47f838c838568a496119378b8bb81484610a50792b5d9c9939db188e7d0249d3cb918c436f111a2898849b286b0743a22c57464c709c5eaceac1ba493adca3328c0b14b5e38d3aea74e328b622b17e7181c35ad11c2103bdb7f2b209d93dcbc4ab61a06bc37139e6d2b7a06c5b7e9267bef3a8918a706f793271a5acc2574532da79e5a10cf074b998147a3c43586a411a513bba0d11cc19a36c83b19277f28022c88b120abfdba7076a8263e05336e3245aef7033eb3c762b5bbfa5791ac960398b649d5cbb652ddc6b2398143a0861ab3b410b696328879c099098adf819fbf7ac170030e86675e7f45c22ac9e1cf52c3102487bb0b91ab592afdc69c6e3a9b71876b86260b6c736b8291098f1130d3b763525cbad540ce2d042eacb6ed43b7bcba898f712c412f26066e09945f44ec7026c8ef959831abc10719d2017a12a41728b41c02371a5f5756ebc79406be708ea41bbd21563c874a0b791a3b4e4224a609967004f065c5ab4f3b4c61cb35df70573269da53179c3701fc5205f61974426f9b794c1b5826494b70842b6920c17752029369264dc8590b898b85c9d89a258e1f46c1b0490efd17c485cb51687cea272041e90b8e629521d3c5e3fa7518161bad7a159295b63cc6c0077897b53d47db8bc0ecb820f550705b65715a1a1094d04854f56acd26aa0baa10cb8447fad6211f53105796a42882328e6852e8de821c283b51eaab9bc95c4dc53615626049d63b1f9a457193805276b1905b0ab39353b5cf91fdd6023d4d816aef9cce4a3cfb3d12190172df221ae61d427563a098cc60e3dc9997ef54959180be5dc64a911157db6be3a01be2ee343caab33b8729abf0c50c674758c511291941fceac646232920907c2e88b9ec10211161729c797643a553a6ae5c4b7483c04e3263bd291e311c609071348b7c3310aa97d6b8318e0a4afe8399fa22f951049a9bb8860f7c69a333d3cc1aaf0129ab560713bf29eb3a01f9a276c78e54e3a3648b2447c80242b271b11406866389426d8b59796540d6b5702092ab21ee217c075cfc0c17ef826ce9ea29b9e61617457a5b1aaa23a58615dc53c59183beb36ea19498c21820b70ab47adeb678f1c52bf8768b3597b608ea1a8a15cd62e8a29bec4a1ac248ef9f02de0144bca06025f95a42bd6c8eaaaaaa2366328561d";
5
10
  /**
@@ -13,7 +18,6 @@ export interface XwingKeypair extends PubKeyEncodable {
13
18
  scheme: XwingScheme;
14
19
  publicKey: CryptoKey;
15
20
  privateKey: CryptoKey;
16
- publicKeyBytes: Uint8Array;
17
21
  }
18
22
  /**
19
23
  * Derive X-Wing keypair from a 32-byte seed (deterministic).
@@ -2,7 +2,7 @@ import { Address } from 'viem';
2
2
  import { HexString } from '../binary.js';
3
3
  import { CiphertextOf, EncryptionScheme, PlaintextOf, SupportedFheType } from '../encryption/encryption.js';
4
4
  import { Handle } from '../handle.js';
5
- import type { Secp256k1Keypair } from '../lite/ecies.js';
5
+ import type { XwingKeypair } from '../lite/xwing.js';
6
6
  import type { BackoffConfig } from '../retry.js';
7
7
  export type Reencryptor<S extends EncryptionScheme> = <T extends SupportedFheType>(args: ReencryptFnArgs<S, T>, backoffConfig?: Partial<BackoffConfig>) => Promise<PlaintextOf<S, T>>;
8
8
  export interface ReencryptorArgs {
@@ -12,7 +12,7 @@ export type ReencryptFnArgs<S extends EncryptionScheme, T extends SupportedFheTy
12
12
  handle: Handle;
13
13
  ciphertext?: CiphertextOf<S, T>;
14
14
  };
15
- export type SupportedEphemeralKeypairs = Secp256k1Keypair;
15
+ export type SupportedEphemeralKeypairs = XwingKeypair;
16
16
  export interface PubKeyEncodable {
17
17
  encodePublicKey(): Uint8Array;
18
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inco/js",
3
- "version": "0.8.0-devnet-6",
3
+ "version": "0.9.0-devnet-test-3",
4
4
  "repository": "https://github.com/Inco-fhevm/inco-monorepo",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -77,7 +77,7 @@
77
77
  "generate:protos": "buf generate",
78
78
  "lint": "bun prettier --check . && eslint .",
79
79
  "lint:fix": "bun prettier --write . && eslint . --fix",
80
- "publish:npm": "bun publish",
80
+ "publish:npm": "npm publish --tag ${NPM_DIST_TAG:-alpha}",
81
81
  "test": "bun run lint && bun run test:tsc && bun run test:unit",
82
82
  "test:coverage": "bun vitest run --project unit --coverage",
83
83
  "test:e2e": "bun vitest run --bail=1 --project e2e",
@@ -94,15 +94,12 @@
94
94
  "@hpke/hybridkem-x-wing": "^0.6.1",
95
95
  "@hpke/core": "^1.7.5",
96
96
  "@hpke/chacha20poly1305": "^1.7.1",
97
- "@types/elliptic": "^6.4.18",
98
- "ecies-geth": "^1.7.5",
99
97
  "effect": "^3.17.13",
100
- "elliptic": "^6.6.1",
101
98
  "sha3": "^2.1.4",
102
99
  "viem": "^2.39.3"
103
100
  },
104
101
  "devDependencies": {
105
- "@inco/pega": "0.0.0",
102
+ "@inco/pega": "workspace:*",
106
103
  "@bufbuild/protoc-gen-es": "^2.2.2",
107
104
  "@typescript-eslint/parser": "^8.35.1",
108
105
  "@vitest/coverage-istanbul": "3.1.1",
@@ -1,26 +0,0 @@
1
- import * as ellipticPkg from 'elliptic';
2
- import { Decryptor, EciesScheme, Encryptor } from '../encryption/encryption.js';
3
- import { PubKeyEncodable } from '../reencryption/index.js';
4
- export declare const TEST_NETWORK_PUBKEY = "0x02516bda9e68a1c3dce74dc1b6ed7d91a91d51c1e1933947f06331cef59631e9eb";
5
- export declare const TEST_NETWORK_PRIVATE_KEY = "0x384a707568ab63ad2ad9f10135faa0699801db3174f33f7846badc11affb8f57";
6
- export interface Secp256k1Keypair extends PubKeyEncodable {
7
- scheme: EciesScheme;
8
- kp: ellipticPkg.ec.KeyPair;
9
- }
10
- export type Secp256k1PubKey = ellipticPkg.curve.base.BasePoint;
11
- export declare function toSecp256k1Keypair(kp: ellipticPkg.ec.KeyPair): Secp256k1Keypair;
12
- export declare function generateSecp256k1Keypair(): Secp256k1Keypair;
13
- export declare function encodeSecp256k1PublicKey(pub: Secp256k1PubKey): Uint8Array;
14
- export declare function decodeSecp256k1PublicKey(pubKeyCompressed: Uint8Array): Secp256k1PubKey;
15
- export declare function decodeSecp256k1PrivateKey(privKey: Uint8Array): Secp256k1Keypair;
16
- export declare function encrypt(pubKeyA: Secp256k1PubKey, plaintext: Uint8Array, privKeyB: Secp256k1Keypair): Promise<Uint8Array>;
17
- export type EciesEncryptorArgs = {
18
- pubKeyA: Secp256k1PubKey;
19
- privKeyB: Secp256k1Keypair;
20
- };
21
- export declare function getEciesEncryptor({ pubKeyA, privKeyB, }: EciesEncryptorArgs): Encryptor<EciesScheme>;
22
- export declare function decrypt(privKeyA: Secp256k1Keypair, ciphertext: Uint8Array): Promise<Uint8Array>;
23
- export type EciesDecryptorArgs = {
24
- privKeyA: Secp256k1Keypair;
25
- };
26
- export declare function getEciesDecryptor({ privKeyA, }: EciesDecryptorArgs): Decryptor<EciesScheme>;