@inco/lightning-js 0.0.0-bootstrap.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/LICENSE +201 -0
- package/README.md +587 -0
- 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 +95 -0
- package/dist/cjs/advancedacl/session-key.js +376 -0
- package/dist/cjs/advancedacl/types.d.ts +16 -0
- package/dist/cjs/advancedacl/types.js +3 -0
- package/dist/cjs/attestedcompute/attested-compute.d.ts +65 -0
- package/dist/cjs/attestedcompute/attested-compute.js +80 -0
- package/dist/cjs/attestedcompute/types.d.ts +35 -0
- package/dist/cjs/attestedcompute/types.js +46 -0
- package/dist/cjs/attesteddecrypt/attested-decrypt.d.ts +61 -0
- package/dist/cjs/attesteddecrypt/attested-decrypt.js +118 -0
- package/dist/cjs/attesteddecrypt/index.d.ts +1 -0
- package/dist/cjs/attesteddecrypt/index.js +18 -0
- package/dist/cjs/attesteddecrypt/types.d.ts +27 -0
- package/dist/cjs/attesteddecrypt/types.js +16 -0
- package/dist/cjs/attestedreveal/attested-reveal.d.ts +21 -0
- package/dist/cjs/attestedreveal/attested-reveal.js +31 -0
- package/dist/cjs/attestedreveal/index.d.ts +2 -0
- package/dist/cjs/attestedreveal/index.js +21 -0
- package/dist/cjs/attestedreveal/types.d.ts +4 -0
- package/dist/cjs/attestedreveal/types.js +13 -0
- package/dist/cjs/binary.d.ts +104 -0
- package/dist/cjs/binary.js +171 -0
- package/dist/cjs/chain.d.ts +50 -0
- package/dist/cjs/chain.js +62 -0
- package/dist/cjs/eip712/eip712.d.ts +18 -0
- package/dist/cjs/eip712/eip712.js +51 -0
- package/dist/cjs/eip712/index.d.ts +1 -0
- package/dist/cjs/eip712/index.js +8 -0
- package/dist/cjs/elistattesteddecrypt/elist-attested-decrypt.d.ts +51 -0
- package/dist/cjs/elistattesteddecrypt/elist-attested-decrypt.js +94 -0
- package/dist/cjs/elistattesteddecrypt/index.d.ts +2 -0
- package/dist/cjs/elistattesteddecrypt/index.js +22 -0
- package/dist/cjs/elistattesteddecrypt/types.d.ts +31 -0
- package/dist/cjs/elistattesteddecrypt/types.js +16 -0
- package/dist/cjs/encryption/encryption.d.ts +235 -0
- package/dist/cjs/encryption/encryption.js +226 -0
- package/dist/cjs/encryption/index.d.ts +1 -0
- package/dist/cjs/encryption/index.js +19 -0
- package/dist/cjs/generated/abis/add-two.d.ts +117 -0
- package/dist/cjs/generated/abis/add-two.js +80 -0
- package/dist/cjs/generated/abis/lightning.d.ts +3362 -0
- package/dist/cjs/generated/abis/lightning.js +2445 -0
- package/dist/cjs/generated/abis/test-elist.d.ts +276 -0
- package/dist/cjs/generated/abis/test-elist.js +168 -0
- package/dist/cjs/generated/abis/verifier.d.ts +1353 -0
- package/dist/cjs/generated/abis/verifier.js +954 -0
- package/dist/cjs/generated/es/inco/covalidator/compute/v1/server_pb.d.ts +1494 -0
- package/dist/cjs/generated/es/inco/covalidator/compute/v1/server_pb.js +395 -0
- package/dist/cjs/generated/es/inco/covalidator/compute/v1/types_pb.d.ts +247 -0
- package/dist/cjs/generated/es/inco/covalidator/compute/v1/types_pb.js +80 -0
- package/dist/cjs/generated/es/inco/helioswrapper/v1/helioswrapper_pb.d.ts +77 -0
- package/dist/cjs/generated/es/inco/helioswrapper/v1/helioswrapper_pb.js +28 -0
- package/dist/cjs/generated/es/inco/kms/lite/v1/kms_service_pb.d.ts +685 -0
- package/dist/cjs/generated/es/inco/kms/lite/v1/kms_service_pb.js +100 -0
- package/dist/cjs/generated/es/inco/kms/lite/v1/types_pb.d.ts +289 -0
- package/dist/cjs/generated/es/inco/kms/lite/v1/types_pb.js +136 -0
- package/dist/cjs/generated/es/inco/sealingfetcher/v1/sealingfetcher_pb.d.ts +371 -0
- package/dist/cjs/generated/es/inco/sealingfetcher/v1/sealingfetcher_pb.js +88 -0
- package/dist/cjs/generated/lightning.d.ts +830 -0
- package/dist/cjs/generated/lightning.js +872 -0
- package/dist/cjs/generated/local-node.d.ts +50 -0
- package/dist/cjs/generated/local-node.js +107 -0
- package/dist/cjs/handle.d.ts +123 -0
- package/dist/cjs/handle.js +221 -0
- package/dist/cjs/index.d.ts +5 -0
- package/dist/cjs/index.js +31 -0
- package/dist/cjs/kms/client.d.ts +12 -0
- package/dist/cjs/kms/client.js +47 -0
- package/dist/cjs/kms/quorumClient.d.ts +65 -0
- package/dist/cjs/kms/quorumClient.js +463 -0
- package/dist/cjs/kms/quorumConsistency.d.ts +82 -0
- package/dist/cjs/kms/quorumConsistency.js +269 -0
- package/dist/cjs/kms/signatureVerification.d.ts +35 -0
- package/dist/cjs/kms/signatureVerification.js +88 -0
- package/dist/cjs/kms/thresholdPromises.d.ts +8 -0
- package/dist/cjs/kms/thresholdPromises.js +62 -0
- package/dist/cjs/lite/attested-compute.d.ts +6 -0
- package/dist/cjs/lite/attested-compute.js +8 -0
- package/dist/cjs/lite/attested-decrypt.d.ts +4 -0
- package/dist/cjs/lite/attested-decrypt.js +6 -0
- package/dist/cjs/lite/deployments.d.ts +24 -0
- package/dist/cjs/lite/deployments.js +21 -0
- package/dist/cjs/lite/hadu.d.ts +4 -0
- package/dist/cjs/lite/hadu.js +28 -0
- package/dist/cjs/lite/index.d.ts +13 -0
- package/dist/cjs/lite/index.js +31 -0
- package/dist/cjs/lite/lightning.d.ts +459 -0
- package/dist/cjs/lite/lightning.js +696 -0
- package/dist/cjs/lite/types.d.ts +47 -0
- package/dist/cjs/lite/types.js +3 -0
- package/dist/cjs/lite/xwing.d.ts +154 -0
- package/dist/cjs/lite/xwing.js +326 -0
- package/dist/cjs/local/index.d.ts +1 -0
- package/dist/cjs/local/index.js +18 -0
- package/dist/cjs/local/local-node.d.ts +37 -0
- package/dist/cjs/local/local-node.js +80 -0
- package/dist/cjs/reencryption/eip712.d.ts +56 -0
- package/dist/cjs/reencryption/eip712.js +90 -0
- package/dist/cjs/reencryption/index.d.ts +2 -0
- package/dist/cjs/reencryption/index.js +19 -0
- package/dist/cjs/reencryption/types.d.ts +48 -0
- package/dist/cjs/reencryption/types.js +3 -0
- package/dist/cjs/retry.d.ts +30 -0
- package/dist/cjs/retry.js +87 -0
- package/dist/cjs/schema.d.ts +4 -0
- package/dist/cjs/schema.js +19 -0
- package/dist/cjs/test/mocks.d.ts +20 -0
- package/dist/cjs/test/mocks.js +72 -0
- package/dist/cjs/viem.d.ts +1141 -0
- package/dist/cjs/viem.js +36 -0
- 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 +95 -0
- package/dist/esm/advancedacl/session-key.js +367 -0
- package/dist/esm/advancedacl/types.d.ts +16 -0
- package/dist/esm/advancedacl/types.js +2 -0
- package/dist/esm/attestedcompute/attested-compute.d.ts +65 -0
- package/dist/esm/attestedcompute/attested-compute.js +76 -0
- package/dist/esm/attestedcompute/types.d.ts +35 -0
- package/dist/esm/attestedcompute/types.js +42 -0
- package/dist/esm/attesteddecrypt/attested-decrypt.d.ts +61 -0
- package/dist/esm/attesteddecrypt/attested-decrypt.js +112 -0
- package/dist/esm/attesteddecrypt/index.d.ts +1 -0
- package/dist/esm/attesteddecrypt/index.js +2 -0
- package/dist/esm/attesteddecrypt/types.d.ts +27 -0
- package/dist/esm/attesteddecrypt/types.js +12 -0
- package/dist/esm/attestedreveal/attested-reveal.d.ts +21 -0
- package/dist/esm/attestedreveal/attested-reveal.js +28 -0
- package/dist/esm/attestedreveal/index.d.ts +2 -0
- package/dist/esm/attestedreveal/index.js +3 -0
- package/dist/esm/attestedreveal/types.d.ts +4 -0
- package/dist/esm/attestedreveal/types.js +9 -0
- package/dist/esm/binary.d.ts +104 -0
- package/dist/esm/binary.js +155 -0
- package/dist/esm/chain.d.ts +50 -0
- package/dist/esm/chain.js +58 -0
- package/dist/esm/eip712/eip712.d.ts +18 -0
- package/dist/esm/eip712/eip712.js +46 -0
- package/dist/esm/eip712/index.d.ts +1 -0
- package/dist/esm/eip712/index.js +2 -0
- package/dist/esm/elistattesteddecrypt/elist-attested-decrypt.d.ts +51 -0
- package/dist/esm/elistattesteddecrypt/elist-attested-decrypt.js +89 -0
- package/dist/esm/elistattesteddecrypt/index.d.ts +2 -0
- package/dist/esm/elistattesteddecrypt/index.js +3 -0
- package/dist/esm/elistattesteddecrypt/types.d.ts +31 -0
- package/dist/esm/elistattesteddecrypt/types.js +12 -0
- package/dist/esm/encryption/encryption.d.ts +235 -0
- package/dist/esm/encryption/encryption.js +214 -0
- package/dist/esm/encryption/index.d.ts +1 -0
- package/dist/esm/encryption/index.js +2 -0
- package/dist/esm/generated/abis/add-two.d.ts +117 -0
- package/dist/esm/generated/abis/add-two.js +77 -0
- package/dist/esm/generated/abis/lightning.d.ts +3362 -0
- package/dist/esm/generated/abis/lightning.js +2442 -0
- package/dist/esm/generated/abis/test-elist.d.ts +276 -0
- package/dist/esm/generated/abis/test-elist.js +165 -0
- package/dist/esm/generated/abis/verifier.d.ts +1353 -0
- package/dist/esm/generated/abis/verifier.js +951 -0
- package/dist/esm/generated/es/inco/covalidator/compute/v1/server_pb.d.ts +1494 -0
- package/dist/esm/generated/es/inco/covalidator/compute/v1/server_pb.js +392 -0
- package/dist/esm/generated/es/inco/covalidator/compute/v1/types_pb.d.ts +247 -0
- package/dist/esm/generated/es/inco/covalidator/compute/v1/types_pb.js +77 -0
- package/dist/esm/generated/es/inco/helioswrapper/v1/helioswrapper_pb.d.ts +77 -0
- package/dist/esm/generated/es/inco/helioswrapper/v1/helioswrapper_pb.js +25 -0
- package/dist/esm/generated/es/inco/kms/lite/v1/kms_service_pb.d.ts +685 -0
- package/dist/esm/generated/es/inco/kms/lite/v1/kms_service_pb.js +97 -0
- package/dist/esm/generated/es/inco/kms/lite/v1/types_pb.d.ts +289 -0
- package/dist/esm/generated/es/inco/kms/lite/v1/types_pb.js +133 -0
- package/dist/esm/generated/es/inco/sealingfetcher/v1/sealingfetcher_pb.d.ts +371 -0
- package/dist/esm/generated/es/inco/sealingfetcher/v1/sealingfetcher_pb.js +85 -0
- package/dist/esm/generated/lightning.d.ts +830 -0
- package/dist/esm/generated/lightning.js +869 -0
- package/dist/esm/generated/local-node.d.ts +50 -0
- package/dist/esm/generated/local-node.js +104 -0
- package/dist/esm/handle.d.ts +123 -0
- package/dist/esm/handle.js +212 -0
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/kms/client.d.ts +12 -0
- package/dist/esm/kms/client.js +40 -0
- package/dist/esm/kms/quorumClient.d.ts +65 -0
- package/dist/esm/kms/quorumClient.js +459 -0
- package/dist/esm/kms/quorumConsistency.d.ts +82 -0
- package/dist/esm/kms/quorumConsistency.js +260 -0
- package/dist/esm/kms/signatureVerification.d.ts +35 -0
- package/dist/esm/kms/signatureVerification.js +84 -0
- package/dist/esm/kms/thresholdPromises.d.ts +8 -0
- package/dist/esm/kms/thresholdPromises.js +59 -0
- package/dist/esm/lite/attested-compute.d.ts +6 -0
- package/dist/esm/lite/attested-compute.js +4 -0
- package/dist/esm/lite/attested-decrypt.d.ts +4 -0
- package/dist/esm/lite/attested-decrypt.js +3 -0
- package/dist/esm/lite/deployments.d.ts +24 -0
- package/dist/esm/lite/deployments.js +17 -0
- package/dist/esm/lite/hadu.d.ts +4 -0
- package/dist/esm/lite/hadu.js +24 -0
- package/dist/esm/lite/index.d.ts +13 -0
- package/dist/esm/lite/index.js +10 -0
- package/dist/esm/lite/lightning.d.ts +459 -0
- package/dist/esm/lite/lightning.js +692 -0
- package/dist/esm/lite/types.d.ts +47 -0
- package/dist/esm/lite/types.js +2 -0
- package/dist/esm/lite/xwing.d.ts +154 -0
- package/dist/esm/lite/xwing.js +311 -0
- package/dist/esm/local/index.d.ts +1 -0
- package/dist/esm/local/index.js +2 -0
- package/dist/esm/local/local-node.d.ts +37 -0
- package/dist/esm/local/local-node.js +76 -0
- package/dist/esm/reencryption/eip712.d.ts +56 -0
- package/dist/esm/reencryption/eip712.js +87 -0
- package/dist/esm/reencryption/index.d.ts +2 -0
- package/dist/esm/reencryption/index.js +3 -0
- package/dist/esm/reencryption/types.d.ts +48 -0
- package/dist/esm/reencryption/types.js +2 -0
- package/dist/esm/retry.d.ts +30 -0
- package/dist/esm/retry.js +82 -0
- package/dist/esm/schema.d.ts +4 -0
- package/dist/esm/schema.js +15 -0
- package/dist/esm/test/mocks.d.ts +20 -0
- package/dist/esm/test/mocks.js +64 -0
- package/dist/esm/viem.d.ts +1141 -0
- package/dist/esm/viem.js +32 -0
- package/dist/types/advancedacl/index.d.ts +2 -0
- package/dist/types/advancedacl/session-key.d.ts +95 -0
- package/dist/types/advancedacl/types.d.ts +16 -0
- package/dist/types/attestedcompute/attested-compute.d.ts +65 -0
- package/dist/types/attestedcompute/types.d.ts +35 -0
- package/dist/types/attesteddecrypt/attested-decrypt.d.ts +61 -0
- package/dist/types/attesteddecrypt/index.d.ts +1 -0
- package/dist/types/attesteddecrypt/types.d.ts +27 -0
- package/dist/types/attestedreveal/attested-reveal.d.ts +21 -0
- package/dist/types/attestedreveal/index.d.ts +2 -0
- package/dist/types/attestedreveal/types.d.ts +4 -0
- package/dist/types/binary.d.ts +104 -0
- package/dist/types/chain.d.ts +50 -0
- package/dist/types/eip712/eip712.d.ts +18 -0
- package/dist/types/eip712/index.d.ts +1 -0
- package/dist/types/elistattesteddecrypt/elist-attested-decrypt.d.ts +51 -0
- package/dist/types/elistattesteddecrypt/index.d.ts +2 -0
- package/dist/types/elistattesteddecrypt/types.d.ts +31 -0
- package/dist/types/encryption/encryption.d.ts +235 -0
- package/dist/types/encryption/index.d.ts +1 -0
- package/dist/types/generated/abis/add-two.d.ts +117 -0
- package/dist/types/generated/abis/lightning.d.ts +3362 -0
- package/dist/types/generated/abis/test-elist.d.ts +276 -0
- package/dist/types/generated/abis/verifier.d.ts +1353 -0
- package/dist/types/generated/es/inco/covalidator/compute/v1/server_pb.d.ts +1494 -0
- package/dist/types/generated/es/inco/covalidator/compute/v1/types_pb.d.ts +247 -0
- package/dist/types/generated/es/inco/helioswrapper/v1/helioswrapper_pb.d.ts +77 -0
- package/dist/types/generated/es/inco/kms/lite/v1/kms_service_pb.d.ts +685 -0
- package/dist/types/generated/es/inco/kms/lite/v1/types_pb.d.ts +289 -0
- package/dist/types/generated/es/inco/sealingfetcher/v1/sealingfetcher_pb.d.ts +371 -0
- package/dist/types/generated/lightning.d.ts +830 -0
- package/dist/types/generated/local-node.d.ts +50 -0
- package/dist/types/handle.d.ts +123 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/kms/client.d.ts +12 -0
- package/dist/types/kms/quorumClient.d.ts +65 -0
- package/dist/types/kms/quorumConsistency.d.ts +82 -0
- package/dist/types/kms/signatureVerification.d.ts +35 -0
- package/dist/types/kms/thresholdPromises.d.ts +8 -0
- package/dist/types/lite/attested-compute.d.ts +6 -0
- package/dist/types/lite/attested-decrypt.d.ts +4 -0
- package/dist/types/lite/deployments.d.ts +24 -0
- package/dist/types/lite/hadu.d.ts +4 -0
- package/dist/types/lite/index.d.ts +13 -0
- package/dist/types/lite/lightning.d.ts +459 -0
- package/dist/types/lite/types.d.ts +47 -0
- package/dist/types/lite/xwing.d.ts +154 -0
- package/dist/types/local/index.d.ts +1 -0
- package/dist/types/local/local-node.d.ts +37 -0
- package/dist/types/reencryption/eip712.d.ts +56 -0
- package/dist/types/reencryption/index.d.ts +2 -0
- package/dist/types/reencryption/types.d.ts +48 -0
- package/dist/types/retry.d.ts +30 -0
- package/dist/types/schema.d.ts +4 -0
- package/dist/types/test/mocks.d.ts +20 -0
- package/dist/types/viem.d.ts +1141 -0
- package/package.json +129 -0
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
|
+
import { ByteArray, Hex } from 'viem';
|
|
3
|
+
import { Bytes32 } from '../binary.js';
|
|
4
|
+
/**
|
|
5
|
+
* A function that encrypts a plaintext value, embedding its {@link InputContext} into the resulting ciphertext.
|
|
6
|
+
*
|
|
7
|
+
* @typeParam S - The encryption scheme (e.g. X-Wing).
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const result = await encrypt({ plaintext: { scheme: 2, type: 5, value: 42n }, context });
|
|
11
|
+
* // result.handle, result.ciphertext
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export type Encryptor<S extends EncryptionScheme = EncryptionScheme> = <T extends SupportedTeeType>(plaintext: PlaintextWithContextOf<S, T>) => Promise<EncryptResultOf<S, T>>;
|
|
15
|
+
/**
|
|
16
|
+
* A function that decrypts a ciphertext back to its plaintext value.
|
|
17
|
+
*
|
|
18
|
+
* @typeParam S - The encryption scheme (e.g. X-Wing).
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const plaintext = await decrypt({ scheme: 2, type: 5, value: '0x...' });
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export type Decryptor<S extends EncryptionScheme = EncryptionScheme> = <T extends SupportedTeeType>(ciphertext: CiphertextOf<S, T>) => Promise<PlaintextOf<S, T>>;
|
|
25
|
+
/**
|
|
26
|
+
* Subset of ENCRYPTION types currently supported for encryption/decryption.
|
|
27
|
+
*
|
|
28
|
+
* @remarks TODO: review need of `euint64` and `euint160` — `Lib.sol` only supports `euint256` and `ebool`.
|
|
29
|
+
*/
|
|
30
|
+
export declare const supportedTeeTypes: {
|
|
31
|
+
readonly euint64: 5;
|
|
32
|
+
readonly euint160: 7;
|
|
33
|
+
readonly euint256: 8;
|
|
34
|
+
readonly ebool: 0;
|
|
35
|
+
};
|
|
36
|
+
/** Schema that validates a string is one of the supported ENCRYPTION type names. */
|
|
37
|
+
export declare const SupportedTeeTypeName: Schema.SchemaClass<"ebool" | "euint64" | "euint160" | "euint256", "ebool" | "euint64" | "euint160" | "euint256", never>;
|
|
38
|
+
/** A supported ENCRYPTION type name (e.g. `"euint256"`, `"ebool"`). */
|
|
39
|
+
export type SupportedTeeTypeName = typeof SupportedTeeTypeName.Type;
|
|
40
|
+
/** Schema that validates a number is one of the supported ENCRYPTION type integer identifiers. */
|
|
41
|
+
export declare const SupportedTeeType: Schema.SchemaClass<0 | 5 | 7 | 8, 0 | 5 | 7 | 8, never>;
|
|
42
|
+
/** Integer identifier of a supported ENCRYPTION type (a subset of all ENCRYPTION types). */
|
|
43
|
+
export type SupportedTeeType = typeof SupportedTeeType.Type;
|
|
44
|
+
/** Map of encryption scheme names to their integer identifiers. Currently only X-Wing (2) is supported. */
|
|
45
|
+
export declare const encryptionSchemes: {
|
|
46
|
+
readonly xwing: 2;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Returns the human-readable name of an encryption scheme.
|
|
50
|
+
* @param scheme - The encryption scheme integer identifier.
|
|
51
|
+
* @returns The scheme name (e.g. `"X-Wing"`).
|
|
52
|
+
* @throws If the scheme identifier is unknown.
|
|
53
|
+
*/
|
|
54
|
+
export declare function getEncryptionSchemeName(scheme: number): string;
|
|
55
|
+
/** The typeof {@link encryptionSchemes} — mapping from scheme names to integer IDs. */
|
|
56
|
+
export type EncryptionSchemes = typeof encryptionSchemes;
|
|
57
|
+
/** The integer identifier for the X-Wing encryption scheme (`2`). */
|
|
58
|
+
export type XwingScheme = EncryptionSchemes['xwing'];
|
|
59
|
+
/** Schema that validates a value is a known encryption scheme identifier. */
|
|
60
|
+
export declare const EncryptionScheme: Schema.Literal<[2]>;
|
|
61
|
+
/** An encryption scheme identifier (currently only X-Wing = `2`). */
|
|
62
|
+
export type EncryptionScheme = typeof EncryptionScheme.Type;
|
|
63
|
+
type DistType<P, S extends EncryptionScheme, T extends SupportedTeeType> = P extends any ? P & {
|
|
64
|
+
scheme: S;
|
|
65
|
+
type: T;
|
|
66
|
+
} : never;
|
|
67
|
+
/** Schema for an ENCRYPTION ciphertext: encryption scheme, ENCRYPTION type, and the encrypted value as a hex string. */
|
|
68
|
+
export declare const Ciphertext: Schema.Struct<{
|
|
69
|
+
scheme: Schema.Literal<[2]>;
|
|
70
|
+
type: Schema.SchemaClass<0 | 5 | 7 | 8, 0 | 5 | 7 | 8, never>;
|
|
71
|
+
value: Schema.TemplateLiteral<`0x${string}`>;
|
|
72
|
+
}>;
|
|
73
|
+
/** An ENCRYPTION ciphertext containing the encryption scheme, ENCRYPTION type, and encrypted hex value. */
|
|
74
|
+
export type Ciphertext = typeof Ciphertext.Type;
|
|
75
|
+
export type CiphertextOf<S extends EncryptionScheme, T extends SupportedTeeType> = DistType<Ciphertext, S, T>;
|
|
76
|
+
/** Schema for a ciphertext paired with the {@link InputContext} it was encrypted under. */
|
|
77
|
+
export declare const CiphertextWithContext: Schema.Struct<{
|
|
78
|
+
ciphertext: Schema.Struct<{
|
|
79
|
+
scheme: Schema.Literal<[2]>;
|
|
80
|
+
type: Schema.SchemaClass<0 | 5 | 7 | 8, 0 | 5 | 7 | 8, never>;
|
|
81
|
+
value: Schema.TemplateLiteral<`0x${string}`>;
|
|
82
|
+
}>;
|
|
83
|
+
context: Schema.Struct<{
|
|
84
|
+
hostChainId: typeof Schema.BigInt;
|
|
85
|
+
aclAddress: Schema.TemplateLiteral<`0x${string}`>;
|
|
86
|
+
userAddress: Schema.TemplateLiteral<`0x${string}`>;
|
|
87
|
+
contractAddress: Schema.TemplateLiteral<`0x${string}`>;
|
|
88
|
+
version: typeof Schema.Number;
|
|
89
|
+
inputType: typeof Schema.Number;
|
|
90
|
+
}>;
|
|
91
|
+
}>;
|
|
92
|
+
/** A ciphertext paired with the {@link InputContext} it was encrypted under. */
|
|
93
|
+
export type CiphertextWithContext = typeof CiphertextWithContext.Type;
|
|
94
|
+
export type CiphertextWithContextOf<S extends EncryptionScheme, T extends SupportedTeeType> = CiphertextWithContext & {
|
|
95
|
+
ciphertext: CiphertextOf<S, T>;
|
|
96
|
+
};
|
|
97
|
+
/** Schema for the result of an encryption operation: ciphertext, input context, and final handle. */
|
|
98
|
+
export declare const EncryptResult: Schema.Struct<{
|
|
99
|
+
ciphertext: Schema.Struct<{
|
|
100
|
+
scheme: Schema.Literal<[2]>;
|
|
101
|
+
type: Schema.SchemaClass<0 | 5 | 7 | 8, 0 | 5 | 7 | 8, never>;
|
|
102
|
+
value: Schema.TemplateLiteral<`0x${string}`>;
|
|
103
|
+
}>;
|
|
104
|
+
context: Schema.Struct<{
|
|
105
|
+
hostChainId: typeof Schema.BigInt;
|
|
106
|
+
aclAddress: Schema.TemplateLiteral<`0x${string}`>;
|
|
107
|
+
userAddress: Schema.TemplateLiteral<`0x${string}`>;
|
|
108
|
+
contractAddress: Schema.TemplateLiteral<`0x${string}`>;
|
|
109
|
+
version: typeof Schema.Number;
|
|
110
|
+
inputType: typeof Schema.Number;
|
|
111
|
+
}>;
|
|
112
|
+
handle: Schema.brand<Schema.filter<Schema.transformOrFail<Schema.Union<[typeof Schema.String, Schema.refine<object & Uint8Array<ArrayBufferLike>, Schema.Schema<object, object, never>>]>, Schema.TemplateLiteral<`0x${string}`>, never>>, "Bytes32">;
|
|
113
|
+
}>;
|
|
114
|
+
/** The result of an encryption operation, containing the ciphertext, context, and deterministic handle. */
|
|
115
|
+
export type EncryptResult = typeof EncryptResult.Type;
|
|
116
|
+
export type EncryptResultOf<S extends EncryptionScheme, T extends SupportedTeeType> = EncryptResult & {
|
|
117
|
+
ciphertext: CiphertextOf<S, T>;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Schema for an ENCRYPTION plaintext value. The `value` field type depends on the ENCRYPTION type:
|
|
121
|
+
* - `euint64` / `euint160` / `euint256`: `bigint`
|
|
122
|
+
* - `ebool`: `boolean`
|
|
123
|
+
*/
|
|
124
|
+
export declare const Plaintext: Schema.Union<[Schema.Struct<{
|
|
125
|
+
scheme: Schema.Literal<[2]>;
|
|
126
|
+
type: Schema.Literal<[5, 7, 8]>;
|
|
127
|
+
value: typeof Schema.BigInt;
|
|
128
|
+
}>, Schema.Struct<{
|
|
129
|
+
scheme: Schema.Literal<[2]>;
|
|
130
|
+
type: Schema.Literal<[0]>;
|
|
131
|
+
value: typeof Schema.Boolean;
|
|
132
|
+
}>]>;
|
|
133
|
+
/** An ENCRYPTION plaintext value — `bigint` for integer types, `boolean` for `ebool`. */
|
|
134
|
+
export type Plaintext = typeof Plaintext.Type;
|
|
135
|
+
export type PlaintextOf<S extends EncryptionScheme, T extends SupportedTeeType> = DistType<Plaintext, S, T>;
|
|
136
|
+
/** Schema for a plaintext paired with the {@link InputContext} it will be encrypted under. */
|
|
137
|
+
export declare const PlaintextWithContext: Schema.Struct<{
|
|
138
|
+
plaintext: Schema.Union<[Schema.Struct<{
|
|
139
|
+
scheme: Schema.Literal<[2]>;
|
|
140
|
+
type: Schema.Literal<[5, 7, 8]>;
|
|
141
|
+
value: typeof Schema.BigInt;
|
|
142
|
+
}>, Schema.Struct<{
|
|
143
|
+
scheme: Schema.Literal<[2]>;
|
|
144
|
+
type: Schema.Literal<[0]>;
|
|
145
|
+
value: typeof Schema.Boolean;
|
|
146
|
+
}>]>;
|
|
147
|
+
context: Schema.Struct<{
|
|
148
|
+
hostChainId: typeof Schema.BigInt;
|
|
149
|
+
aclAddress: Schema.TemplateLiteral<`0x${string}`>;
|
|
150
|
+
userAddress: Schema.TemplateLiteral<`0x${string}`>;
|
|
151
|
+
contractAddress: Schema.TemplateLiteral<`0x${string}`>;
|
|
152
|
+
version: typeof Schema.Number;
|
|
153
|
+
inputType: typeof Schema.Number;
|
|
154
|
+
}>;
|
|
155
|
+
}>;
|
|
156
|
+
/** A plaintext paired with the {@link InputContext} it will be encrypted under. */
|
|
157
|
+
export type PlaintextWithContext = typeof PlaintextWithContext.Type;
|
|
158
|
+
export type PlaintextWithContextOf<S extends EncryptionScheme, T extends SupportedTeeType> = PlaintextWithContext & {
|
|
159
|
+
plaintext: PlaintextOf<S, T>;
|
|
160
|
+
};
|
|
161
|
+
/**
|
|
162
|
+
* Converts a `bigint` to a typed {@link Plaintext} value.
|
|
163
|
+
*
|
|
164
|
+
* For integer ENCRYPTION types (`euint64`, `euint160`, `euint256`) the value is passed through as-is.
|
|
165
|
+
* For `ebool`, non-zero values become `true`.
|
|
166
|
+
*
|
|
167
|
+
* @param scheme - The encryption scheme identifier.
|
|
168
|
+
* @param type - The ENCRYPTION type to interpret the value as.
|
|
169
|
+
* @param bigPt - The raw bigint plaintext value.
|
|
170
|
+
* @returns A typed `Plaintext` matching the given scheme and ENCRYPTION type.
|
|
171
|
+
* @throws If `type` is not a supported ENCRYPTION type.
|
|
172
|
+
*/
|
|
173
|
+
export declare function bigintToPlaintext<S extends EncryptionScheme, T extends SupportedTeeType>(scheme: S, type: T, bigPt: bigint): PlaintextOf<S, T>;
|
|
174
|
+
/**
|
|
175
|
+
* Decodes an ABI-encoded ciphertext input into its components.
|
|
176
|
+
*
|
|
177
|
+
* The input format is: `4-byte version || abi.encode(bytes32 handle, bytes ciphertext)`.
|
|
178
|
+
*
|
|
179
|
+
* @param input - The raw encoded input as a byte array or hex string.
|
|
180
|
+
* @returns The decoded version, handle, and ciphertext.
|
|
181
|
+
*/
|
|
182
|
+
export declare function decodeCiphertextInput(input: ByteArray | Hex): {
|
|
183
|
+
version: number;
|
|
184
|
+
handle: Hex;
|
|
185
|
+
ciphertext: Hex;
|
|
186
|
+
};
|
|
187
|
+
/**
|
|
188
|
+
* Encodes a handle and ciphertext into the on-chain input format.
|
|
189
|
+
*
|
|
190
|
+
* The output format is: `4-byte version || abi.encode(bytes32 handle, bytes ciphertext)`.
|
|
191
|
+
*
|
|
192
|
+
* @param version - The encoding version (int32).
|
|
193
|
+
* @param handle - The 32-byte handle as a hex string.
|
|
194
|
+
* @param ciphertext - The ciphertext as a hex string.
|
|
195
|
+
* @returns The ABI-encoded input as a hex string.
|
|
196
|
+
*/
|
|
197
|
+
export declare function encodeCiphertextInput(version: number, handle: Hex, ciphertext: Hex): Hex;
|
|
198
|
+
/**
|
|
199
|
+
* Converts a {@link Plaintext} to its `bigint` representation.
|
|
200
|
+
*
|
|
201
|
+
* Integer types pass through directly; `ebool` maps `true` → `1n`, `false` → `0n`.
|
|
202
|
+
*
|
|
203
|
+
* @param plaintext - The plaintext to convert.
|
|
204
|
+
* @returns The bigint representation of the plaintext value.
|
|
205
|
+
*/
|
|
206
|
+
export declare function plaintextToBigint(plaintext: Plaintext): bigint;
|
|
207
|
+
/**
|
|
208
|
+
* Converts a {@link Plaintext} to a {@link Bytes32} hex string.
|
|
209
|
+
* @param plaintext - The plaintext to convert.
|
|
210
|
+
* @returns A 32-byte hex representation of the plaintext value.
|
|
211
|
+
*/
|
|
212
|
+
export declare function plaintextToBytes32(plaintext: Plaintext): Bytes32;
|
|
213
|
+
/**
|
|
214
|
+
* Converts a {@link Plaintext} to a 32-byte `Buffer`.
|
|
215
|
+
* @param plaintext - The plaintext to convert.
|
|
216
|
+
* @returns A 32-byte big-endian buffer of the plaintext value.
|
|
217
|
+
*/
|
|
218
|
+
export declare function plaintextToBytes(plaintext: Plaintext): Buffer;
|
|
219
|
+
/**
|
|
220
|
+
* Parses a {@link Bytes32} hex string into a typed {@link Plaintext}.
|
|
221
|
+
* @param plaintext - The 32-byte hex value to interpret.
|
|
222
|
+
* @param scheme - The encryption scheme identifier.
|
|
223
|
+
* @param type - The ENCRYPTION type to interpret the bytes as.
|
|
224
|
+
* @returns A typed `Plaintext` value.
|
|
225
|
+
*/
|
|
226
|
+
export declare function bytes32ToPlaintext(plaintext: Bytes32, scheme: EncryptionScheme, type: SupportedTeeType): Plaintext;
|
|
227
|
+
/**
|
|
228
|
+
* Parses a `Uint8Array` into a typed {@link Plaintext}.
|
|
229
|
+
* @param plaintext - The byte array to interpret.
|
|
230
|
+
* @param scheme - The encryption scheme identifier.
|
|
231
|
+
* @param type - The ENCRYPTION type to interpret the bytes as.
|
|
232
|
+
* @returns A typed `Plaintext` value.
|
|
233
|
+
*/
|
|
234
|
+
export declare function bytesToPlaintext(plaintext: Uint8Array, scheme: EncryptionScheme, type: SupportedTeeType): Plaintext;
|
|
235
|
+
export {};
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PlaintextWithContext = exports.Plaintext = exports.EncryptResult = exports.CiphertextWithContext = exports.Ciphertext = exports.EncryptionScheme = exports.encryptionSchemes = exports.SupportedTeeType = exports.SupportedTeeTypeName = exports.supportedTeeTypes = void 0;
|
|
4
|
+
exports.getEncryptionSchemeName = getEncryptionSchemeName;
|
|
5
|
+
exports.bigintToPlaintext = bigintToPlaintext;
|
|
6
|
+
exports.decodeCiphertextInput = decodeCiphertextInput;
|
|
7
|
+
exports.encodeCiphertextInput = encodeCiphertextInput;
|
|
8
|
+
exports.plaintextToBigint = plaintextToBigint;
|
|
9
|
+
exports.plaintextToBytes32 = plaintextToBytes32;
|
|
10
|
+
exports.plaintextToBytes = plaintextToBytes;
|
|
11
|
+
exports.bytes32ToPlaintext = bytes32ToPlaintext;
|
|
12
|
+
exports.bytesToPlaintext = bytesToPlaintext;
|
|
13
|
+
const effect_1 = require("effect");
|
|
14
|
+
const viem_1 = require("viem");
|
|
15
|
+
const binary_js_1 = require("../binary.js");
|
|
16
|
+
const handle_js_1 = require("../handle.js");
|
|
17
|
+
/**
|
|
18
|
+
* Subset of ENCRYPTION types currently supported for encryption/decryption.
|
|
19
|
+
*
|
|
20
|
+
* @remarks TODO: review need of `euint64` and `euint160` — `Lib.sol` only supports `euint256` and `ebool`.
|
|
21
|
+
*/
|
|
22
|
+
exports.supportedTeeTypes = {
|
|
23
|
+
euint64: handle_js_1.handleTypes.euint64,
|
|
24
|
+
euint160: handle_js_1.handleTypes.euint160,
|
|
25
|
+
euint256: handle_js_1.handleTypes.euint256,
|
|
26
|
+
ebool: handle_js_1.handleTypes.ebool,
|
|
27
|
+
};
|
|
28
|
+
const supportedTeeTypeNames = Object.keys(exports.supportedTeeTypes);
|
|
29
|
+
/** Schema that validates a string is one of the supported ENCRYPTION type names. */
|
|
30
|
+
exports.SupportedTeeTypeName = effect_1.Schema.Literal(...supportedTeeTypeNames);
|
|
31
|
+
/** Schema that validates a number is one of the supported ENCRYPTION type integer identifiers. */
|
|
32
|
+
// TODO: extend to all types
|
|
33
|
+
exports.SupportedTeeType = effect_1.Schema.Literal(...Object.values(exports.supportedTeeTypes));
|
|
34
|
+
/** Map of encryption scheme names to their integer identifiers. Currently only X-Wing (2) is supported. */
|
|
35
|
+
exports.encryptionSchemes = {
|
|
36
|
+
xwing: 2,
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Returns the human-readable name of an encryption scheme.
|
|
40
|
+
* @param scheme - The encryption scheme integer identifier.
|
|
41
|
+
* @returns The scheme name (e.g. `"X-Wing"`).
|
|
42
|
+
* @throws If the scheme identifier is unknown.
|
|
43
|
+
*/
|
|
44
|
+
function getEncryptionSchemeName(scheme) {
|
|
45
|
+
switch (scheme) {
|
|
46
|
+
case exports.encryptionSchemes.xwing:
|
|
47
|
+
return 'X-Wing';
|
|
48
|
+
default:
|
|
49
|
+
throw new Error(`Unknown encryption scheme: ${scheme}`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/** Schema that validates a value is a known encryption scheme identifier. */
|
|
53
|
+
exports.EncryptionScheme = effect_1.Schema.Literal(exports.encryptionSchemes.xwing);
|
|
54
|
+
/** Schema for an ENCRYPTION ciphertext: encryption scheme, ENCRYPTION type, and the encrypted value as a hex string. */
|
|
55
|
+
exports.Ciphertext = effect_1.Schema.Struct({
|
|
56
|
+
scheme: exports.EncryptionScheme,
|
|
57
|
+
type: exports.SupportedTeeType,
|
|
58
|
+
value: binary_js_1.HexString,
|
|
59
|
+
});
|
|
60
|
+
/** Schema for a ciphertext paired with the {@link InputContext} it was encrypted under. */
|
|
61
|
+
exports.CiphertextWithContext = effect_1.Schema.Struct({
|
|
62
|
+
ciphertext: exports.Ciphertext,
|
|
63
|
+
context: handle_js_1.InputContext,
|
|
64
|
+
});
|
|
65
|
+
/** Schema for the result of an encryption operation: ciphertext, input context, and final handle. */
|
|
66
|
+
exports.EncryptResult = effect_1.Schema.Struct({
|
|
67
|
+
ciphertext: exports.Ciphertext,
|
|
68
|
+
context: handle_js_1.InputContext,
|
|
69
|
+
handle: binary_js_1.Bytes32,
|
|
70
|
+
});
|
|
71
|
+
/**
|
|
72
|
+
* Schema for an ENCRYPTION plaintext value. The `value` field type depends on the ENCRYPTION type:
|
|
73
|
+
* - `euint64` / `euint160` / `euint256`: `bigint`
|
|
74
|
+
* - `ebool`: `boolean`
|
|
75
|
+
*/
|
|
76
|
+
exports.Plaintext = effect_1.Schema.Union(effect_1.Schema.Struct({
|
|
77
|
+
scheme: exports.EncryptionScheme,
|
|
78
|
+
type: effect_1.Schema.Literal(handle_js_1.handleTypes.euint64, handle_js_1.handleTypes.euint160, handle_js_1.handleTypes.euint256),
|
|
79
|
+
value: effect_1.Schema.BigInt,
|
|
80
|
+
}), effect_1.Schema.Struct({
|
|
81
|
+
scheme: exports.EncryptionScheme,
|
|
82
|
+
type: effect_1.Schema.Literal(handle_js_1.handleTypes.ebool),
|
|
83
|
+
value: effect_1.Schema.Boolean,
|
|
84
|
+
}));
|
|
85
|
+
/** Schema for a plaintext paired with the {@link InputContext} it will be encrypted under. */
|
|
86
|
+
exports.PlaintextWithContext = effect_1.Schema.Struct({
|
|
87
|
+
plaintext: exports.Plaintext,
|
|
88
|
+
context: handle_js_1.InputContext,
|
|
89
|
+
});
|
|
90
|
+
/**
|
|
91
|
+
* Converts a `bigint` to a typed {@link Plaintext} value.
|
|
92
|
+
*
|
|
93
|
+
* For integer ENCRYPTION types (`euint64`, `euint160`, `euint256`) the value is passed through as-is.
|
|
94
|
+
* For `ebool`, non-zero values become `true`.
|
|
95
|
+
*
|
|
96
|
+
* @param scheme - The encryption scheme identifier.
|
|
97
|
+
* @param type - The ENCRYPTION type to interpret the value as.
|
|
98
|
+
* @param bigPt - The raw bigint plaintext value.
|
|
99
|
+
* @returns A typed `Plaintext` matching the given scheme and ENCRYPTION type.
|
|
100
|
+
* @throws If `type` is not a supported ENCRYPTION type.
|
|
101
|
+
*/
|
|
102
|
+
function bigintToPlaintext(scheme, type, bigPt) {
|
|
103
|
+
switch (type) {
|
|
104
|
+
case handle_js_1.handleTypes.euint64:
|
|
105
|
+
case handle_js_1.handleTypes.euint160:
|
|
106
|
+
case handle_js_1.handleTypes.euint256:
|
|
107
|
+
return {
|
|
108
|
+
scheme,
|
|
109
|
+
type,
|
|
110
|
+
value: bigPt,
|
|
111
|
+
};
|
|
112
|
+
case handle_js_1.handleTypes.ebool:
|
|
113
|
+
return {
|
|
114
|
+
scheme,
|
|
115
|
+
type,
|
|
116
|
+
value: bigPt !== 0n,
|
|
117
|
+
};
|
|
118
|
+
default:
|
|
119
|
+
console.warn(`bigintToPlaintext: Unsupported Encryption Scheme type ${type}`);
|
|
120
|
+
}
|
|
121
|
+
throw new Error(`Unsupported Encryption Scheme type: ${type}`);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* ABI parameter schema for on-chain ciphertext input encoding.
|
|
125
|
+
*
|
|
126
|
+
* Compatible with Solidity's `abi.decode(input, (bytes32, bytes))`:
|
|
127
|
+
* ```solidity
|
|
128
|
+
* (bytes32 externalHandle, bytes memory ciphertext) = abi.decode(input, (bytes32, bytes));
|
|
129
|
+
* ```
|
|
130
|
+
*
|
|
131
|
+
* This is the source of truth for the encoding format and does not refer to
|
|
132
|
+
* an actual contract or Solidity type's ABI.
|
|
133
|
+
*/
|
|
134
|
+
const ciphertextInputAbi = [
|
|
135
|
+
{ name: 'handle', type: 'bytes32' },
|
|
136
|
+
{ name: 'ciphertext', type: 'bytes' },
|
|
137
|
+
];
|
|
138
|
+
/**
|
|
139
|
+
* Decodes an ABI-encoded ciphertext input into its components.
|
|
140
|
+
*
|
|
141
|
+
* The input format is: `4-byte version || abi.encode(bytes32 handle, bytes ciphertext)`.
|
|
142
|
+
*
|
|
143
|
+
* @param input - The raw encoded input as a byte array or hex string.
|
|
144
|
+
* @returns The decoded version, handle, and ciphertext.
|
|
145
|
+
*/
|
|
146
|
+
function decodeCiphertextInput(input) {
|
|
147
|
+
const bytes = typeof input === 'string' ? (0, viem_1.hexToBytes)(input) : input;
|
|
148
|
+
const buf = new Uint8Array(bytes).buffer;
|
|
149
|
+
const version = new DataView(buf).getInt32(0);
|
|
150
|
+
const [handle, ciphertext] = (0, viem_1.decodeAbiParameters)(ciphertextInputAbi, bytes.slice(4));
|
|
151
|
+
return { version, handle, ciphertext };
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Encodes a handle and ciphertext into the on-chain input format.
|
|
155
|
+
*
|
|
156
|
+
* The output format is: `4-byte version || abi.encode(bytes32 handle, bytes ciphertext)`.
|
|
157
|
+
*
|
|
158
|
+
* @param version - The encoding version (int32).
|
|
159
|
+
* @param handle - The 32-byte handle as a hex string.
|
|
160
|
+
* @param ciphertext - The ciphertext as a hex string.
|
|
161
|
+
* @returns The ABI-encoded input as a hex string.
|
|
162
|
+
*/
|
|
163
|
+
function encodeCiphertextInput(version, handle, ciphertext) {
|
|
164
|
+
const rest = (0, viem_1.hexToBytes)((0, viem_1.encodeAbiParameters)(ciphertextInputAbi, [handle, ciphertext]));
|
|
165
|
+
const buf = new ArrayBuffer(rest.length + 4);
|
|
166
|
+
const dv = new DataView(buf);
|
|
167
|
+
dv.setInt32(0, version);
|
|
168
|
+
const view = new Uint8Array(buf);
|
|
169
|
+
view.set(rest, 4);
|
|
170
|
+
return (0, viem_1.bytesToHex)(view);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Converts a {@link Plaintext} to its `bigint` representation.
|
|
174
|
+
*
|
|
175
|
+
* Integer types pass through directly; `ebool` maps `true` → `1n`, `false` → `0n`.
|
|
176
|
+
*
|
|
177
|
+
* @param plaintext - The plaintext to convert.
|
|
178
|
+
* @returns The bigint representation of the plaintext value.
|
|
179
|
+
*/
|
|
180
|
+
function plaintextToBigint(plaintext) {
|
|
181
|
+
switch (plaintext.type) {
|
|
182
|
+
case handle_js_1.handleTypes.euint64:
|
|
183
|
+
case handle_js_1.handleTypes.euint160:
|
|
184
|
+
case handle_js_1.handleTypes.euint256:
|
|
185
|
+
return plaintext.value;
|
|
186
|
+
case handle_js_1.handleTypes.ebool:
|
|
187
|
+
return plaintext.value ? 1n : 0n;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Converts a {@link Plaintext} to a {@link Bytes32} hex string.
|
|
192
|
+
* @param plaintext - The plaintext to convert.
|
|
193
|
+
* @returns A 32-byte hex representation of the plaintext value.
|
|
194
|
+
*/
|
|
195
|
+
function plaintextToBytes32(plaintext) {
|
|
196
|
+
return (0, binary_js_1.bigintToBytes32)(plaintextToBigint(plaintext));
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Converts a {@link Plaintext} to a 32-byte `Buffer`.
|
|
200
|
+
* @param plaintext - The plaintext to convert.
|
|
201
|
+
* @returns A 32-byte big-endian buffer of the plaintext value.
|
|
202
|
+
*/
|
|
203
|
+
function plaintextToBytes(plaintext) {
|
|
204
|
+
return (0, binary_js_1.bigintToBytes)(plaintextToBigint(plaintext));
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Parses a {@link Bytes32} hex string into a typed {@link Plaintext}.
|
|
208
|
+
* @param plaintext - The 32-byte hex value to interpret.
|
|
209
|
+
* @param scheme - The encryption scheme identifier.
|
|
210
|
+
* @param type - The ENCRYPTION type to interpret the bytes as.
|
|
211
|
+
* @returns A typed `Plaintext` value.
|
|
212
|
+
*/
|
|
213
|
+
function bytes32ToPlaintext(plaintext, scheme, type) {
|
|
214
|
+
return bigintToPlaintext(scheme, type, BigInt(plaintext));
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Parses a `Uint8Array` into a typed {@link Plaintext}.
|
|
218
|
+
* @param plaintext - The byte array to interpret.
|
|
219
|
+
* @param scheme - The encryption scheme identifier.
|
|
220
|
+
* @param type - The ENCRYPTION type to interpret the bytes as.
|
|
221
|
+
* @returns A typed `Plaintext` value.
|
|
222
|
+
*/
|
|
223
|
+
function bytesToPlaintext(plaintext, scheme, type) {
|
|
224
|
+
return bigintToPlaintext(scheme, type, BigInt((0, binary_js_1.bytesToBigInt)(plaintext)));
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW5jcnlwdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9lbmNyeXB0aW9uL2VuY3J5cHRpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBNEZBLDBEQU9DO0FBK0hELDhDQXlCQztBQTBCRCxzREFhQztBQVlELHNEQWNDO0FBVUQsOENBU0M7QUFPRCxnREFFQztBQU9ELDRDQUVDO0FBU0QsZ0RBTUM7QUFTRCw0Q0FNQztBQS9YRCxtQ0FBZ0M7QUFDaEMsK0JBUWM7QUFDZCw0Q0FNc0I7QUFDdEIsNENBQXlEO0FBaUN6RDs7OztHQUlHO0FBQ1UsUUFBQSxpQkFBaUIsR0FBRztJQUMvQixPQUFPLEVBQUUsdUJBQVcsQ0FBQyxPQUFPO0lBQzVCLFFBQVEsRUFBRSx1QkFBVyxDQUFDLFFBQVE7SUFDOUIsUUFBUSxFQUFFLHVCQUFXLENBQUMsUUFBUTtJQUM5QixLQUFLLEVBQUUsdUJBQVcsQ0FBQyxLQUFLO0NBQ2hCLENBQUM7QUFFWCxNQUFNLHFCQUFxQixHQUFHLE1BQU0sQ0FBQyxJQUFJLENBQ3ZDLHlCQUFpQixDQUNvQixDQUFDO0FBRXhDLG9GQUFvRjtBQUN2RSxRQUFBLG9CQUFvQixHQUFHLGVBQU0sQ0FBQyxPQUFPLENBQUMsR0FBRyxxQkFBcUIsQ0FBQyxDQUFDO0FBSzdFLGtHQUFrRztBQUNsRyw0QkFBNEI7QUFDZixRQUFBLGdCQUFnQixHQUFHLGVBQU0sQ0FBQyxPQUFPLENBQzVDLEdBQUcsTUFBTSxDQUFDLE1BQ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UFTLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQyxFQUFFLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQztJQUNyQyxDQUFDO0FBQ0gsQ0FBQztBQUVEOzs7O0dBSUc7QUFDSCxTQUFnQixrQkFBa0IsQ0FBQyxTQUFvQjtJQUNyRCxPQUFPLElBQUEsMkJBQWUsRUFBQyxpQkFBaUIsQ0FBQyxTQUFTLENBQUMsQ0FBQyxDQUFDO0FBQ3ZELENBQUM7QUFFRDs7OztHQUlHO0FBQ0gsU0FBZ0IsZ0JBQWdCLENBQUMsU0FBb0I7SUFDbkQsT0FBTyxJQUFBLHlCQUFhLEVBQUMsaUJBQWlCLENBQUMsU0FBUyxDQUFDLENBQUMsQ0FBQztBQUNyRCxDQUFDO0FBRUQ7Ozs7OztHQU1HO0FBQ0gsU0FBZ0Isa0JBQWtCLENBQ2hDLFNBQWtCLEVBQ2xCLE1BQXdCLEVBQ3hCLElBQXNCO0lBRXRCLE9BQU8saUJBQWlCLENBQUMsTUFBTSxFQUFFLElBQUksRUFBRSxNQUFNLENBQUMsU0FBUyxDQUFDLENBQUMsQ0FBQztBQUM1RCxDQUFDO0FBRUQ7Ozs7OztHQU1HO0FBQ0gsU0FBZ0IsZ0JBQWdCLENBQzlCLFNBQXFCLEVBQ3JCLE1BQXdCLEVBQ3hCLElBQXNCO0lBRXRCLE9BQU8saUJBQWlCLENBQUMsTUFBTSxFQUFFLElBQUksRUFBRSxNQUFNLENBQUMsSUFBQSx5QkFBYSxFQUFDLFNBQVMsQ0FBQyxDQUFDLENBQUMsQ0FBQztBQUMzRSxDQUFDIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Ciphertext, EncryptionScheme, Plaintext, SupportedTeeType, SupportedTeeTypeName, bigintToPlaintext, bytes32ToPlaintext, bytesToPlaintext, encryptionSchemes, getEncryptionSchemeName, plaintextToBigint, plaintextToBytes, plaintextToBytes32, supportedTeeTypes, type EncryptionSchemes, } from './encryption.js';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.supportedTeeTypes = exports.plaintextToBytes32 = exports.plaintextToBytes = exports.plaintextToBigint = exports.getEncryptionSchemeName = exports.encryptionSchemes = exports.bytesToPlaintext = exports.bytes32ToPlaintext = exports.bigintToPlaintext = exports.SupportedTeeTypeName = exports.SupportedTeeType = exports.Plaintext = exports.EncryptionScheme = exports.Ciphertext = void 0;
|
|
4
|
+
var encryption_js_1 = require("./encryption.js");
|
|
5
|
+
Object.defineProperty(exports, "Ciphertext", { enumerable: true, get: function () { return encryption_js_1.Ciphertext; } });
|
|
6
|
+
Object.defineProperty(exports, "EncryptionScheme", { enumerable: true, get: function () { return encryption_js_1.EncryptionScheme; } });
|
|
7
|
+
Object.defineProperty(exports, "Plaintext", { enumerable: true, get: function () { return encryption_js_1.Plaintext; } });
|
|
8
|
+
Object.defineProperty(exports, "SupportedTeeType", { enumerable: true, get: function () { return encryption_js_1.SupportedTeeType; } });
|
|
9
|
+
Object.defineProperty(exports, "SupportedTeeTypeName", { enumerable: true, get: function () { return encryption_js_1.SupportedTeeTypeName; } });
|
|
10
|
+
Object.defineProperty(exports, "bigintToPlaintext", { enumerable: true, get: function () { return encryption_js_1.bigintToPlaintext; } });
|
|
11
|
+
Object.defineProperty(exports, "bytes32ToPlaintext", { enumerable: true, get: function () { return encryption_js_1.bytes32ToPlaintext; } });
|
|
12
|
+
Object.defineProperty(exports, "bytesToPlaintext", { enumerable: true, get: function () { return encryption_js_1.bytesToPlaintext; } });
|
|
13
|
+
Object.defineProperty(exports, "encryptionSchemes", { enumerable: true, get: function () { return encryption_js_1.encryptionSchemes; } });
|
|
14
|
+
Object.defineProperty(exports, "getEncryptionSchemeName", { enumerable: true, get: function () { return encryption_js_1.getEncryptionSchemeName; } });
|
|
15
|
+
Object.defineProperty(exports, "plaintextToBigint", { enumerable: true, get: function () { return encryption_js_1.plaintextToBigint; } });
|
|
16
|
+
Object.defineProperty(exports, "plaintextToBytes", { enumerable: true, get: function () { return encryption_js_1.plaintextToBytes; } });
|
|
17
|
+
Object.defineProperty(exports, "plaintextToBytes32", { enumerable: true, get: function () { return encryption_js_1.plaintextToBytes32; } });
|
|
18
|
+
Object.defineProperty(exports, "supportedTeeTypes", { enumerable: true, get: function () { return encryption_js_1.supportedTeeTypes; } });
|
|
19
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvZW5jcnlwdGlvbi9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSxpREFnQnlCO0FBZnZCLDJHQUFBLFVBQVUsT0FBQTtBQUNWLGlIQUFBLGdCQUFnQixPQUFBO0FBQ2hCLDBHQUFBLFNBQVMsT0FBQTtBQUNULGlIQUFBLGdCQUFnQixPQUFBO0FBQ2hCLHFIQUFBLG9CQUFvQixPQUFBO0FBQ3BCLGtIQUFBLGlCQUFpQixPQUFBO0FBQ2pCLG1IQUFBLGtCQUFrQixPQUFBO0FBQ2xCLGlIQUFBLGdCQUFnQixPQUFBO0FBQ2hCLGtIQUFBLGlCQUFpQixPQUFBO0FBQ2pCLHdIQUFBLHVCQUF1QixPQUFBO0FBQ3ZCLGtIQUFBLGlCQUFpQixPQUFBO0FBQ2pCLGlIQUFBLGdCQUFnQixPQUFBO0FBQ2hCLG1IQUFBLGtCQUFrQixPQUFBO0FBQ2xCLGtIQUFBLGlCQUFpQixPQUFBIn0=
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
export declare const addTwoAbi: readonly [{
|
|
2
|
+
readonly type: "constructor";
|
|
3
|
+
readonly inputs: readonly [{
|
|
4
|
+
readonly name: "_inco";
|
|
5
|
+
readonly internalType: "contract IncoLightning";
|
|
6
|
+
readonly type: "address";
|
|
7
|
+
}];
|
|
8
|
+
readonly stateMutability: "nonpayable";
|
|
9
|
+
}, {
|
|
10
|
+
readonly type: "receive";
|
|
11
|
+
readonly stateMutability: "payable";
|
|
12
|
+
}, {
|
|
13
|
+
readonly type: "function";
|
|
14
|
+
readonly inputs: readonly [{
|
|
15
|
+
readonly name: "a";
|
|
16
|
+
readonly internalType: "euint256";
|
|
17
|
+
readonly type: "bytes32";
|
|
18
|
+
}];
|
|
19
|
+
readonly name: "addTwo";
|
|
20
|
+
readonly outputs: readonly [{
|
|
21
|
+
readonly name: "";
|
|
22
|
+
readonly internalType: "euint256";
|
|
23
|
+
readonly type: "bytes32";
|
|
24
|
+
}];
|
|
25
|
+
readonly stateMutability: "nonpayable";
|
|
26
|
+
}, {
|
|
27
|
+
readonly type: "function";
|
|
28
|
+
readonly inputs: readonly [{
|
|
29
|
+
readonly name: "a";
|
|
30
|
+
readonly internalType: "euint256";
|
|
31
|
+
readonly type: "bytes32";
|
|
32
|
+
}];
|
|
33
|
+
readonly name: "addTwoAlt";
|
|
34
|
+
readonly outputs: readonly [{
|
|
35
|
+
readonly name: "";
|
|
36
|
+
readonly internalType: "euint256";
|
|
37
|
+
readonly type: "bytes32";
|
|
38
|
+
}];
|
|
39
|
+
readonly stateMutability: "nonpayable";
|
|
40
|
+
}, {
|
|
41
|
+
readonly type: "function";
|
|
42
|
+
readonly inputs: readonly [{
|
|
43
|
+
readonly name: "uint256EInput";
|
|
44
|
+
readonly internalType: "bytes";
|
|
45
|
+
readonly type: "bytes";
|
|
46
|
+
}];
|
|
47
|
+
readonly name: "addTwoEoa";
|
|
48
|
+
readonly outputs: readonly [{
|
|
49
|
+
readonly name: "result";
|
|
50
|
+
readonly internalType: "euint256";
|
|
51
|
+
readonly type: "bytes32";
|
|
52
|
+
}, {
|
|
53
|
+
readonly name: "resultRevealed";
|
|
54
|
+
readonly internalType: "euint256";
|
|
55
|
+
readonly type: "bytes32";
|
|
56
|
+
}];
|
|
57
|
+
readonly stateMutability: "payable";
|
|
58
|
+
}, {
|
|
59
|
+
readonly type: "function";
|
|
60
|
+
readonly inputs: readonly [];
|
|
61
|
+
readonly name: "getTrue";
|
|
62
|
+
readonly outputs: readonly [{
|
|
63
|
+
readonly name: "";
|
|
64
|
+
readonly internalType: "ebool";
|
|
65
|
+
readonly type: "bytes32";
|
|
66
|
+
}];
|
|
67
|
+
readonly stateMutability: "nonpayable";
|
|
68
|
+
}, {
|
|
69
|
+
readonly type: "function";
|
|
70
|
+
readonly inputs: readonly [];
|
|
71
|
+
readonly name: "lastResult";
|
|
72
|
+
readonly outputs: readonly [{
|
|
73
|
+
readonly name: "";
|
|
74
|
+
readonly internalType: "uint256";
|
|
75
|
+
readonly type: "uint256";
|
|
76
|
+
}];
|
|
77
|
+
readonly stateMutability: "view";
|
|
78
|
+
}, {
|
|
79
|
+
readonly type: "function";
|
|
80
|
+
readonly inputs: readonly [{
|
|
81
|
+
readonly name: "resultHandle";
|
|
82
|
+
readonly internalType: "bytes32";
|
|
83
|
+
readonly type: "bytes32";
|
|
84
|
+
}, {
|
|
85
|
+
readonly name: "p";
|
|
86
|
+
readonly internalType: "uint256";
|
|
87
|
+
readonly type: "uint256";
|
|
88
|
+
}, {
|
|
89
|
+
readonly name: "decryption";
|
|
90
|
+
readonly internalType: "struct DecryptionAttestation";
|
|
91
|
+
readonly type: "tuple";
|
|
92
|
+
readonly components: readonly [{
|
|
93
|
+
readonly name: "handle";
|
|
94
|
+
readonly internalType: "bytes32";
|
|
95
|
+
readonly type: "bytes32";
|
|
96
|
+
}, {
|
|
97
|
+
readonly name: "value";
|
|
98
|
+
readonly internalType: "bytes32";
|
|
99
|
+
readonly type: "bytes32";
|
|
100
|
+
}];
|
|
101
|
+
}];
|
|
102
|
+
readonly name: "verifyAttestedComputeResultHandle";
|
|
103
|
+
readonly outputs: readonly [{
|
|
104
|
+
readonly name: "";
|
|
105
|
+
readonly internalType: "bool";
|
|
106
|
+
readonly type: "bool";
|
|
107
|
+
}];
|
|
108
|
+
readonly stateMutability: "payable";
|
|
109
|
+
}, {
|
|
110
|
+
readonly type: "error";
|
|
111
|
+
readonly inputs: readonly [];
|
|
112
|
+
readonly name: "ReentrantCall";
|
|
113
|
+
}, {
|
|
114
|
+
readonly type: "error";
|
|
115
|
+
readonly inputs: readonly [];
|
|
116
|
+
readonly name: "RefundFailed";
|
|
117
|
+
}];
|