@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,50 @@
|
|
|
1
|
+
export declare const localNodeLightningConfig: {
|
|
2
|
+
readonly mainnet: {
|
|
3
|
+
readonly executorAddress: "0x4b9911b0191B0b6a6eA8F2Ed562e20Cff5AC8624";
|
|
4
|
+
readonly chainId: 31337;
|
|
5
|
+
readonly covalidatorUrls: readonly ["http://localhost:50055"];
|
|
6
|
+
readonly signers: readonly ["0xDD166476574D64D54A8d65810478007eDccc1d1d"];
|
|
7
|
+
readonly hostChainRpcUrls: readonly ["http://localhost:8545"];
|
|
8
|
+
readonly senderPrivateKey: "0x7f2a092a3ecab2e11400fc235b8d3d6b76fb7ec14c71b64baf5a6885a36c1b3a";
|
|
9
|
+
};
|
|
10
|
+
readonly demonet: {
|
|
11
|
+
readonly executorAddress: "0xad9Af2e804FbF14d69391167F1FCDf918A3980fb";
|
|
12
|
+
readonly chainId: 31337;
|
|
13
|
+
readonly covalidatorUrls: readonly ["http://localhost:50055"];
|
|
14
|
+
readonly signers: readonly ["0x9cDbDc8E83F84B9D6d3c19356B8C590f0CE1F549"];
|
|
15
|
+
readonly hostChainRpcUrls: readonly ["http://localhost:8545"];
|
|
16
|
+
readonly senderPrivateKey: "0x8e6681c7870f0adc53511b6f38515a5b0f4e3a3fa62a62505f58c61e64c92497";
|
|
17
|
+
};
|
|
18
|
+
readonly testnet: {
|
|
19
|
+
readonly executorAddress: "0xe9CB49A5b16C6D4a093E5900AA8b450FD40541B6";
|
|
20
|
+
readonly chainId: 31337;
|
|
21
|
+
readonly covalidatorUrls: readonly ["http://localhost:50055"];
|
|
22
|
+
readonly signers: readonly ["0x8A853ACC000D50bfb59e1D04635959957e28Db38"];
|
|
23
|
+
readonly hostChainRpcUrls: readonly ["http://localhost:8545"];
|
|
24
|
+
readonly senderPrivateKey: "0x835c46722a63e5132eaf24d0a1dad8689d43b85bdcc0e592c23e55fa603895d7";
|
|
25
|
+
};
|
|
26
|
+
readonly devnet: {
|
|
27
|
+
readonly executorAddress: "0xB3C06f0Ed967a7E366ba31C67927DDf93d7c1154";
|
|
28
|
+
readonly chainId: 31337;
|
|
29
|
+
readonly covalidatorUrls: readonly ["http://localhost:50055"];
|
|
30
|
+
readonly signers: readonly ["0x29C5a8C17d8c0A2B2036365EA6908291A35dDadF"];
|
|
31
|
+
readonly hostChainRpcUrls: readonly ["http://localhost:8545"];
|
|
32
|
+
readonly senderPrivateKey: "0xbea2b6c911de6a581e7e5fab9da94edbb00c5ddba7ab1645c100b012997c842e";
|
|
33
|
+
};
|
|
34
|
+
readonly alphanet: {
|
|
35
|
+
readonly executorAddress: "0xc0d693DeEF0A91CE39208676b6da09B822abd199";
|
|
36
|
+
readonly chainId: 31337;
|
|
37
|
+
readonly covalidatorUrls: readonly ["http://localhost:50055"];
|
|
38
|
+
readonly signers: readonly ["0x8E873085348a3406A07907E5d1465B9824bA07cd"];
|
|
39
|
+
readonly hostChainRpcUrls: readonly ["http://localhost:8545"];
|
|
40
|
+
readonly senderPrivateKey: "0x279c172cf3638a79642daa5f7666c600befde318550d7579cf96280920e318b6";
|
|
41
|
+
};
|
|
42
|
+
readonly scratch: {
|
|
43
|
+
readonly executorAddress: "0xb390b23b8fa1761a85035E7C135bf93713d1d4d1";
|
|
44
|
+
readonly chainId: 31337;
|
|
45
|
+
readonly covalidatorUrls: readonly ["http://localhost:50055"];
|
|
46
|
+
readonly signers: readonly ["0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"];
|
|
47
|
+
readonly hostChainRpcUrls: readonly ["http://127.0.0.1:8567"];
|
|
48
|
+
readonly senderPrivateKey: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80";
|
|
49
|
+
};
|
|
50
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ============================================================================
|
|
3
|
+
// WARNING: LOCAL DEVELOPMENT ONLY - DO NOT USE IN PRODUCTION
|
|
4
|
+
// ============================================================================
|
|
5
|
+
//
|
|
6
|
+
// This file contains TEST KEYS that are publicly known and have no value.
|
|
7
|
+
//
|
|
8
|
+
// SECURITY NOTICE: All URLs in this configuration use HTTP (unencrypted).
|
|
9
|
+
// This is acceptable ONLY for localhost connections where traffic never
|
|
10
|
+
// leaves the local machine.
|
|
11
|
+
//
|
|
12
|
+
// DO NOT modify these URLs to point to non-localhost addresses without
|
|
13
|
+
// switching to HTTPS. Using HTTP with remote hosts exposes sensitive data
|
|
14
|
+
// (including private keys and transaction data) to network interception.
|
|
15
|
+
//
|
|
16
|
+
// For production or any non-local environment, use the appropriate
|
|
17
|
+
// network configuration files which enforce HTTPS for all remote connections.
|
|
18
|
+
// ============================================================================
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.localNodeLightningConfig = void 0;
|
|
21
|
+
exports.localNodeLightningConfig = {
|
|
22
|
+
"mainnet": {
|
|
23
|
+
"executorAddress": "0x4b9911b0191B0b6a6eA8F2Ed562e20Cff5AC8624",
|
|
24
|
+
"chainId": 31337,
|
|
25
|
+
"covalidatorUrls": [
|
|
26
|
+
"http://localhost:50055"
|
|
27
|
+
],
|
|
28
|
+
"signers": [
|
|
29
|
+
"0xDD166476574D64D54A8d65810478007eDccc1d1d"
|
|
30
|
+
],
|
|
31
|
+
"hostChainRpcUrls": [
|
|
32
|
+
"http://localhost:8545"
|
|
33
|
+
],
|
|
34
|
+
"senderPrivateKey": "0x7f2a092a3ecab2e11400fc235b8d3d6b76fb7ec14c71b64baf5a6885a36c1b3a"
|
|
35
|
+
},
|
|
36
|
+
"demonet": {
|
|
37
|
+
"executorAddress": "0xad9Af2e804FbF14d69391167F1FCDf918A3980fb",
|
|
38
|
+
"chainId": 31337,
|
|
39
|
+
"covalidatorUrls": [
|
|
40
|
+
"http://localhost:50055"
|
|
41
|
+
],
|
|
42
|
+
"signers": [
|
|
43
|
+
"0x9cDbDc8E83F84B9D6d3c19356B8C590f0CE1F549"
|
|
44
|
+
],
|
|
45
|
+
"hostChainRpcUrls": [
|
|
46
|
+
"http://localhost:8545"
|
|
47
|
+
],
|
|
48
|
+
"senderPrivateKey": "0x8e6681c7870f0adc53511b6f38515a5b0f4e3a3fa62a62505f58c61e64c92497"
|
|
49
|
+
},
|
|
50
|
+
"testnet": {
|
|
51
|
+
"executorAddress": "0xe9CB49A5b16C6D4a093E5900AA8b450FD40541B6",
|
|
52
|
+
"chainId": 31337,
|
|
53
|
+
"covalidatorUrls": [
|
|
54
|
+
"http://localhost:50055"
|
|
55
|
+
],
|
|
56
|
+
"signers": [
|
|
57
|
+
"0x8A853ACC000D50bfb59e1D04635959957e28Db38"
|
|
58
|
+
],
|
|
59
|
+
"hostChainRpcUrls": [
|
|
60
|
+
"http://localhost:8545"
|
|
61
|
+
],
|
|
62
|
+
"senderPrivateKey": "0x835c46722a63e5132eaf24d0a1dad8689d43b85bdcc0e592c23e55fa603895d7"
|
|
63
|
+
},
|
|
64
|
+
"devnet": {
|
|
65
|
+
"executorAddress": "0xB3C06f0Ed967a7E366ba31C67927DDf93d7c1154",
|
|
66
|
+
"chainId": 31337,
|
|
67
|
+
"covalidatorUrls": [
|
|
68
|
+
"http://localhost:50055"
|
|
69
|
+
],
|
|
70
|
+
"signers": [
|
|
71
|
+
"0x29C5a8C17d8c0A2B2036365EA6908291A35dDadF"
|
|
72
|
+
],
|
|
73
|
+
"hostChainRpcUrls": [
|
|
74
|
+
"http://localhost:8545"
|
|
75
|
+
],
|
|
76
|
+
"senderPrivateKey": "0xbea2b6c911de6a581e7e5fab9da94edbb00c5ddba7ab1645c100b012997c842e"
|
|
77
|
+
},
|
|
78
|
+
"alphanet": {
|
|
79
|
+
"executorAddress": "0xc0d693DeEF0A91CE39208676b6da09B822abd199",
|
|
80
|
+
"chainId": 31337,
|
|
81
|
+
"covalidatorUrls": [
|
|
82
|
+
"http://localhost:50055"
|
|
83
|
+
],
|
|
84
|
+
"signers": [
|
|
85
|
+
"0x8E873085348a3406A07907E5d1465B9824bA07cd"
|
|
86
|
+
],
|
|
87
|
+
"hostChainRpcUrls": [
|
|
88
|
+
"http://localhost:8545"
|
|
89
|
+
],
|
|
90
|
+
"senderPrivateKey": "0x279c172cf3638a79642daa5f7666c600befde318550d7579cf96280920e318b6"
|
|
91
|
+
},
|
|
92
|
+
"scratch": {
|
|
93
|
+
"executorAddress": "0xb390b23b8fa1761a85035E7C135bf93713d1d4d1",
|
|
94
|
+
"chainId": 31337,
|
|
95
|
+
"covalidatorUrls": [
|
|
96
|
+
"http://localhost:50055"
|
|
97
|
+
],
|
|
98
|
+
"signers": [
|
|
99
|
+
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
|
|
100
|
+
],
|
|
101
|
+
"hostChainRpcUrls": [
|
|
102
|
+
"http://127.0.0.1:8567"
|
|
103
|
+
],
|
|
104
|
+
"senderPrivateKey": "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9jYWwtbm9kZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9nZW5lcmF0ZWQvbG9jYWwtbm9kZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsK0VBQStFO0FBQy9FLDZEQUE2RDtBQUM3RCwrRUFBK0U7QUFDL0UsRUFBRTtBQUNGLDBFQUEwRTtBQUMxRSxFQUFFO0FBQ0YsMEVBQTBFO0FBQzFFLHdFQUF3RTtBQUN4RSw0QkFBNEI7QUFDNUIsRUFBRTtBQUNGLHVFQUF1RTtBQUN2RSwwRUFBMEU7QUFDMUUseUVBQXlFO0FBQ3pFLEVBQUU7QUFDRixtRUFBbUU7QUFDbkUsOEVBQThFO0FBQzlFLCtFQUErRTs7O0FBRWxFLFFBQUEsd0JBQXdCLEdBQUc7SUFDdEMsU0FBUyxFQUFFO1FBQ1QsaUJBQWlCLEVBQUUsNENBQTRDO1FBQy9ELFNBQVMsRUFBRSxLQUFLO1FBQ2hCLGlCQUFpQixFQUFFO1lBQ2pCLHdCQUF3QjtTQUN6QjtRQUNELFNBQVMsRUFBRTtZQUNULDRDQUE0QztTQUM3QztRQUNELGtCQUFrQixFQUFFO1lBQ2xCLHVCQUF1QjtT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BdUI7U0FDeEI7UUFDRCxrQkFBa0IsRUFBRSxvRUFBb0U7S0FDekY7SUFDRCxTQUFTLEVBQUU7UUFDVCxpQkFBaUIsRUFBRSw0Q0FBNEM7UUFDL0QsU0FBUyxFQUFFLEtBQUs7UUFDaEIsaUJBQWlCLEVBQUU7WUFDakIsd0JBQXdCO1NBQ3pCO1FBQ0QsU0FBUyxFQUFFO1lBQ1QsNENBQTRDO1NBQzdDO1FBQ0Qsa0JBQWtCLEVBQUU7WUFDbEIsdUJBQXVCO1NBQ3hCO1FBQ0Qsa0JBQWtCLEVBQUUsb0VBQW9FO0tBQ3pGO0NBQ08sQ0FBQyJ9
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
|
+
import { HexString } from './binary.js';
|
|
3
|
+
/** Current handle version byte, appended as the last byte of every handle. */
|
|
4
|
+
export declare const HANDLE_VERSION = 0;
|
|
5
|
+
/**
|
|
6
|
+
* Domain separators for handle derivation. Must be kept in sync with Solidity
|
|
7
|
+
* (contracts/lightning/src/Types.sol) and Go (pkg/hostchain/handle.go). Prefixing every
|
|
8
|
+
* keccak256 preimage with a unique constant string makes cross-derivation-path
|
|
9
|
+
* collision resistance structural rather than incidental.
|
|
10
|
+
*/
|
|
11
|
+
export declare const SEP_INPUT_HANDLE = "inco/handle/input-handle";
|
|
12
|
+
export declare const SEP_INPUT_CONTEXT = "inco/handle/input-context";
|
|
13
|
+
export declare const SEP_OP_RESULT = "inco/handle/op-result";
|
|
14
|
+
export declare const SEP_ELIST_OP_RESULT = "inco/handle/elist-result";
|
|
15
|
+
export declare const BYTE_ELIST_ELEMENT_TYPE_INDEX = 29;
|
|
16
|
+
/**
|
|
17
|
+
* Map of ENCRYPTION type names to their integer identifiers.
|
|
18
|
+
*
|
|
19
|
+
* Keys provide a semantic interpretation over the underlying integral type.
|
|
20
|
+
* For example, `ebool` interprets a `uint16` as a boolean, `ebytes64` interprets
|
|
21
|
+
* a `uint512` as a 64-byte array, etc.
|
|
22
|
+
*/
|
|
23
|
+
export declare const handleTypes: Readonly<{
|
|
24
|
+
ebool: 0;
|
|
25
|
+
euint4: 1;
|
|
26
|
+
euint8: 2;
|
|
27
|
+
euint16: 3;
|
|
28
|
+
euint32: 4;
|
|
29
|
+
euint64: 5;
|
|
30
|
+
euint128: 6;
|
|
31
|
+
euint160: 7;
|
|
32
|
+
euint256: 8;
|
|
33
|
+
ebytes64: 9;
|
|
34
|
+
ebytes128: 10;
|
|
35
|
+
ebytes256: 11;
|
|
36
|
+
}>;
|
|
37
|
+
/** Schema that validates a string is one of the known ENCRYPTION type names (e.g. `"ebool"`, `"euint256"`). */
|
|
38
|
+
export declare const HandleTypeName: Schema.SchemaClass<"ebool" | "euint4" | "euint8" | "euint16" | "euint32" | "euint64" | "euint128" | "euint160" | "euint256" | "ebytes64" | "ebytes128" | "ebytes256", "ebool" | "euint4" | "euint8" | "euint16" | "euint32" | "euint64" | "euint128" | "euint160" | "euint256" | "ebytes64" | "ebytes128" | "ebytes256", never>;
|
|
39
|
+
/** A valid ENCRYPTION type name string (e.g. `"ebool"`, `"euint32"`, `"ebytes64"`). */
|
|
40
|
+
export type HandleTypeName = typeof HandleTypeName.Type;
|
|
41
|
+
/** The typeof {@link handleTypes} — mapping from ENCRYPTION type names to integer IDs. */
|
|
42
|
+
export type HandleTypes = typeof handleTypes;
|
|
43
|
+
/** Integer identifier of an ENCRYPTION type (0–11), corresponding to a {@link HandleTypeName}. */
|
|
44
|
+
export type TeeType = HandleTypes[keyof HandleTypes];
|
|
45
|
+
/**
|
|
46
|
+
* Type guard that checks whether a number is a valid {@link TeeType} identifier.
|
|
47
|
+
* @param value - The number to check.
|
|
48
|
+
* @returns `true` if `value` is a known ENCRYPTION type integer (0–11).
|
|
49
|
+
*/
|
|
50
|
+
export declare function isTeeType(value: number): value is TeeType;
|
|
51
|
+
/** Schema for the context required to compute a deterministic ENCRYPTION handle. */
|
|
52
|
+
export declare const InputContext: Schema.Struct<{
|
|
53
|
+
hostChainId: typeof Schema.BigInt;
|
|
54
|
+
aclAddress: Schema.TemplateLiteral<`0x${string}`>;
|
|
55
|
+
userAddress: Schema.TemplateLiteral<`0x${string}`>;
|
|
56
|
+
contractAddress: Schema.TemplateLiteral<`0x${string}`>;
|
|
57
|
+
version: typeof Schema.Number;
|
|
58
|
+
inputType: typeof Schema.Number;
|
|
59
|
+
}>;
|
|
60
|
+
/** Context fields (chain ID, ACL address, user/contract addresses, version, on-chain inputType) used to derive a deterministic handle. */
|
|
61
|
+
export type InputContext = typeof InputContext.Type;
|
|
62
|
+
/**
|
|
63
|
+
* A 32-byte hex string representing an ENCRYPTION ciphertext handle.
|
|
64
|
+
*
|
|
65
|
+
* Format: `keccak_hash[0:29] || index_handle || handle_type || handle_version`
|
|
66
|
+
*
|
|
67
|
+
* @see pkg/hostchain/handle.md for the handle format spec.
|
|
68
|
+
*/
|
|
69
|
+
export type Handle = HexString;
|
|
70
|
+
/**
|
|
71
|
+
* Expected length of a handle in bytes.
|
|
72
|
+
* Handle format: 29 bytes hash + 1 byte index + 1 byte type + 1 byte version = 32 bytes
|
|
73
|
+
*/
|
|
74
|
+
export declare const HANDLE_LENGTH_BYTES = 32;
|
|
75
|
+
/**
|
|
76
|
+
* Validates handle integrity by checking format, length, and version.
|
|
77
|
+
* Matches the validation in Go's HandleFromBytes (pkg/hostchain/handle.go).
|
|
78
|
+
* @param handle - The handle to validate
|
|
79
|
+
* @throws Error if handle is malformed (wrong format, length, or unsupported version)
|
|
80
|
+
*/
|
|
81
|
+
export declare function validateHandle(handle: HexString): void;
|
|
82
|
+
/**
|
|
83
|
+
* Extracts the {@link TeeType} from byte 30 of a validated handle.
|
|
84
|
+
* @param handle - A 32-byte hex handle string.
|
|
85
|
+
* @returns The ENCRYPTION type identifier stored in the handle.
|
|
86
|
+
* @throws If the handle is malformed or contains an invalid ENCRYPTION type.
|
|
87
|
+
* @see pkg/hostchain/handle.md for the handle format spec.
|
|
88
|
+
*/
|
|
89
|
+
export declare function getHandleType(handle: HexString): TeeType;
|
|
90
|
+
/**
|
|
91
|
+
* Extracts the elist element {@link TeeType} from byte 29 of a validated handle.
|
|
92
|
+
* @param handle - A 32-byte hex handle string for an elist.
|
|
93
|
+
* @returns The ENCRYPTION type identifier of the elist elements.
|
|
94
|
+
* @throws If the handle is malformed or contains an invalid ENCRYPTION type at byte 29.
|
|
95
|
+
*/
|
|
96
|
+
export declare function getEListElementType(handle: HexString): TeeType;
|
|
97
|
+
/**
|
|
98
|
+
* Computes the final handle for an input based on the ciphertext and the input context, matches the handle generation
|
|
99
|
+
* in Go and Solidity.
|
|
100
|
+
*
|
|
101
|
+
* @param ciphertext Note this is different from the input which has the external handle prepended
|
|
102
|
+
* @param indexHandle
|
|
103
|
+
* @param handleType
|
|
104
|
+
* @param handleVersion
|
|
105
|
+
* @param context
|
|
106
|
+
*/
|
|
107
|
+
export declare function computeHandle({ ciphertext, indexHandle, handleType, handleVersion, context, }: {
|
|
108
|
+
ciphertext: Uint8Array;
|
|
109
|
+
indexHandle: number;
|
|
110
|
+
handleType: TeeType;
|
|
111
|
+
handleVersion: number;
|
|
112
|
+
context: InputContext;
|
|
113
|
+
}): Buffer;
|
|
114
|
+
/**
|
|
115
|
+
* Computes the Keccak-256 hash of an ABI-packed {@link InputContext}.
|
|
116
|
+
*
|
|
117
|
+
* The context is packed as: `"evm/" || SEP_INPUT_CONTEXT || HANDLE_VERSION || inputType ||
|
|
118
|
+
* chainId || aclAddress || userAddress || contractAddress || version`.
|
|
119
|
+
*
|
|
120
|
+
* @param context - The input context to hash.
|
|
121
|
+
* @returns A 32-byte `Buffer` containing the Keccak-256 digest.
|
|
122
|
+
*/
|
|
123
|
+
export declare function hashInputContext(context: InputContext): Buffer;
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HANDLE_LENGTH_BYTES = exports.InputContext = exports.HandleTypeName = exports.handleTypes = exports.BYTE_ELIST_ELEMENT_TYPE_INDEX = exports.SEP_ELIST_OP_RESULT = exports.SEP_OP_RESULT = exports.SEP_INPUT_CONTEXT = exports.SEP_INPUT_HANDLE = exports.HANDLE_VERSION = void 0;
|
|
4
|
+
exports.isTeeType = isTeeType;
|
|
5
|
+
exports.validateHandle = validateHandle;
|
|
6
|
+
exports.getHandleType = getHandleType;
|
|
7
|
+
exports.getEListElementType = getEListElementType;
|
|
8
|
+
exports.computeHandle = computeHandle;
|
|
9
|
+
exports.hashInputContext = hashInputContext;
|
|
10
|
+
const effect_1 = require("effect");
|
|
11
|
+
const sha3_1 = require("sha3");
|
|
12
|
+
const viem_1 = require("viem");
|
|
13
|
+
const binary_js_1 = require("./binary.js");
|
|
14
|
+
/** Current handle version byte, appended as the last byte of every handle. */
|
|
15
|
+
exports.HANDLE_VERSION = 0;
|
|
16
|
+
/**
|
|
17
|
+
* Domain separators for handle derivation. Must be kept in sync with Solidity
|
|
18
|
+
* (contracts/lightning/src/Types.sol) and Go (pkg/hostchain/handle.go). Prefixing every
|
|
19
|
+
* keccak256 preimage with a unique constant string makes cross-derivation-path
|
|
20
|
+
* collision resistance structural rather than incidental.
|
|
21
|
+
*/
|
|
22
|
+
exports.SEP_INPUT_HANDLE = 'inco/handle/input-handle';
|
|
23
|
+
exports.SEP_INPUT_CONTEXT = 'inco/handle/input-context';
|
|
24
|
+
exports.SEP_OP_RESULT = 'inco/handle/op-result';
|
|
25
|
+
exports.SEP_ELIST_OP_RESULT = 'inco/handle/elist-result';
|
|
26
|
+
// The index of the byte in the handle where elist element type is stored
|
|
27
|
+
exports.BYTE_ELIST_ELEMENT_TYPE_INDEX = 29;
|
|
28
|
+
/**
|
|
29
|
+
* Map of ENCRYPTION type names to their integer identifiers.
|
|
30
|
+
*
|
|
31
|
+
* Keys provide a semantic interpretation over the underlying integral type.
|
|
32
|
+
* For example, `ebool` interprets a `uint16` as a boolean, `ebytes64` interprets
|
|
33
|
+
* a `uint512` as a 64-byte array, etc.
|
|
34
|
+
*/
|
|
35
|
+
exports.handleTypes = Object.freeze({
|
|
36
|
+
ebool: 0,
|
|
37
|
+
euint4: 1,
|
|
38
|
+
euint8: 2,
|
|
39
|
+
euint16: 3,
|
|
40
|
+
euint32: 4,
|
|
41
|
+
euint64: 5,
|
|
42
|
+
euint128: 6,
|
|
43
|
+
euint160: 7,
|
|
44
|
+
euint256: 8,
|
|
45
|
+
ebytes64: 9,
|
|
46
|
+
ebytes128: 10,
|
|
47
|
+
ebytes256: 11,
|
|
48
|
+
});
|
|
49
|
+
const handleNames = Object.keys(exports.handleTypes);
|
|
50
|
+
/** Schema that validates a string is one of the known ENCRYPTION type names (e.g. `"ebool"`, `"euint256"`). */
|
|
51
|
+
exports.HandleTypeName = effect_1.Schema.Literal(...handleNames);
|
|
52
|
+
/**
|
|
53
|
+
* Type guard that checks whether a number is a valid {@link TeeType} identifier.
|
|
54
|
+
* @param value - The number to check.
|
|
55
|
+
* @returns `true` if `value` is a known ENCRYPTION type integer (0–11).
|
|
56
|
+
*/
|
|
57
|
+
function isTeeType(value) {
|
|
58
|
+
return Object.values(exports.handleTypes).includes(value);
|
|
59
|
+
}
|
|
60
|
+
/** Schema for the context required to compute a deterministic ENCRYPTION handle. */
|
|
61
|
+
exports.InputContext = effect_1.Schema.Struct({
|
|
62
|
+
hostChainId: effect_1.Schema.BigInt,
|
|
63
|
+
aclAddress: binary_js_1.HexString,
|
|
64
|
+
userAddress: binary_js_1.HexString,
|
|
65
|
+
contractAddress: binary_js_1.HexString,
|
|
66
|
+
version: effect_1.Schema.Number,
|
|
67
|
+
inputType: effect_1.Schema.Number,
|
|
68
|
+
});
|
|
69
|
+
/**
|
|
70
|
+
* Expected length of a handle in bytes.
|
|
71
|
+
* Handle format: 29 bytes hash + 1 byte index + 1 byte type + 1 byte version = 32 bytes
|
|
72
|
+
*/
|
|
73
|
+
exports.HANDLE_LENGTH_BYTES = 32;
|
|
74
|
+
/**
|
|
75
|
+
* Validates handle integrity by checking format, length, and version.
|
|
76
|
+
* Matches the validation in Go's HandleFromBytes (pkg/hostchain/handle.go).
|
|
77
|
+
* @param handle - The handle to validate
|
|
78
|
+
* @throws Error if handle is malformed (wrong format, length, or unsupported version)
|
|
79
|
+
*/
|
|
80
|
+
function validateHandle(handle) {
|
|
81
|
+
// Check format: must start with 0x prefix and have correct length
|
|
82
|
+
if (!handle.startsWith('0x') ||
|
|
83
|
+
handle.length !== 2 + 2 * exports.HANDLE_LENGTH_BYTES) {
|
|
84
|
+
throw new Error(`Invalid handle format: must be a ${exports.HANDLE_LENGTH_BYTES}-byte hex string with 0x prefix`);
|
|
85
|
+
}
|
|
86
|
+
const handleBytes = (0, viem_1.hexToBytes)(handle);
|
|
87
|
+
// Validate handle version (byte 31 must match HANDLE_VERSION)
|
|
88
|
+
const handleVersion = handleBytes[31];
|
|
89
|
+
if (handleVersion !== exports.HANDLE_VERSION) {
|
|
90
|
+
throw new Error(`Unsupported handle version: expected ${exports.HANDLE_VERSION}, got ${handleVersion} for handle ${handle}`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Extracts the {@link TeeType} from byte 30 of a validated handle.
|
|
95
|
+
* @param handle - A 32-byte hex handle string.
|
|
96
|
+
* @returns The ENCRYPTION type identifier stored in the handle.
|
|
97
|
+
* @throws If the handle is malformed or contains an invalid ENCRYPTION type.
|
|
98
|
+
* @see pkg/hostchain/handle.md for the handle format spec.
|
|
99
|
+
*/
|
|
100
|
+
function getHandleType(handle) {
|
|
101
|
+
// Validate handle integrity before extracting type
|
|
102
|
+
validateHandle(handle);
|
|
103
|
+
const handleBytes = (0, viem_1.hexToBytes)(handle);
|
|
104
|
+
const handleType = handleBytes[30];
|
|
105
|
+
if (!isTeeType(handleType)) {
|
|
106
|
+
throw new Error(`Invalid handle type ${handleType} for handle ${handle}`);
|
|
107
|
+
}
|
|
108
|
+
return handleType;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Extracts the elist element {@link TeeType} from byte 29 of a validated handle.
|
|
112
|
+
* @param handle - A 32-byte hex handle string for an elist.
|
|
113
|
+
* @returns The ENCRYPTION type identifier of the elist elements.
|
|
114
|
+
* @throws If the handle is malformed or contains an invalid ENCRYPTION type at byte 29.
|
|
115
|
+
*/
|
|
116
|
+
function getEListElementType(handle) {
|
|
117
|
+
validateHandle(handle);
|
|
118
|
+
const handleBytes = (0, viem_1.hexToBytes)(handle);
|
|
119
|
+
const elementType = handleBytes[exports.BYTE_ELIST_ELEMENT_TYPE_INDEX];
|
|
120
|
+
if (!isTeeType(elementType)) {
|
|
121
|
+
throw new Error(`Invalid elist element type ${elementType} for handle ${handle}`);
|
|
122
|
+
}
|
|
123
|
+
return elementType;
|
|
124
|
+
}
|
|
125
|
+
// Handle format reference (kept in sync with Solidity in contracts/lightning/src and Go in pkg/hostchain/handle.go):
|
|
126
|
+
/// @dev handle format for user inputs: keccak256(keccak256(CiphertextList) || index_handle)[0:29] || index_handle || handle_type || handle_version
|
|
127
|
+
/// @dev handle format for op results: keccak256(keccak256(rawCiphertextList) || index_handle)[0:30] || handle_type || handle_version
|
|
128
|
+
/// @dev CiphertextList layout: 1 byte (= N) for handles_list size, N bytes for handles_types (1 per handle), followed by the original raw ciphertext list
|
|
129
|
+
/**
|
|
130
|
+
* Computes the final handle for an input based on the ciphertext and the input context, matches the handle generation
|
|
131
|
+
* in Go and Solidity.
|
|
132
|
+
*
|
|
133
|
+
* @param ciphertext Note this is different from the input which has the external handle prepended
|
|
134
|
+
* @param indexHandle
|
|
135
|
+
* @param handleType
|
|
136
|
+
* @param handleVersion
|
|
137
|
+
* @param context
|
|
138
|
+
*/
|
|
139
|
+
function computeHandle({ ciphertext, indexHandle, handleType, handleVersion, context, }) {
|
|
140
|
+
assertUint8(indexHandle);
|
|
141
|
+
assertUint8(handleType);
|
|
142
|
+
assertUint8(handleVersion);
|
|
143
|
+
if (handleVersion !== exports.HANDLE_VERSION) {
|
|
144
|
+
throw new Error(`Unsupported handle version: expected ${exports.HANDLE_VERSION}, got ${handleVersion}`);
|
|
145
|
+
}
|
|
146
|
+
const packed = (0, viem_1.encodePacked)([
|
|
147
|
+
'string',
|
|
148
|
+
'uint8',
|
|
149
|
+
'uint8',
|
|
150
|
+
'uint32',
|
|
151
|
+
'bytes',
|
|
152
|
+
'uint8',
|
|
153
|
+
'string',
|
|
154
|
+
'uint256',
|
|
155
|
+
'address',
|
|
156
|
+
'address',
|
|
157
|
+
'address',
|
|
158
|
+
'uint16',
|
|
159
|
+
], [
|
|
160
|
+
exports.SEP_INPUT_HANDLE,
|
|
161
|
+
handleVersion,
|
|
162
|
+
handleType,
|
|
163
|
+
ciphertext.length,
|
|
164
|
+
(0, viem_1.toHex)(ciphertext),
|
|
165
|
+
indexHandle,
|
|
166
|
+
// Note: The x/hostchain spec requires the chain ID to be prefixed with 'evm/' for EVM chains
|
|
167
|
+
'evm/',
|
|
168
|
+
context.hostChainId,
|
|
169
|
+
context.aclAddress,
|
|
170
|
+
context.userAddress,
|
|
171
|
+
context.contractAddress,
|
|
172
|
+
context.version,
|
|
173
|
+
]);
|
|
174
|
+
const hash = new sha3_1.Keccak(256).update(Buffer.from((0, viem_1.hexToBytes)(packed))).digest();
|
|
175
|
+
const handle = Buffer.alloc(32);
|
|
176
|
+
hash.copy(handle, 0, 0, 29);
|
|
177
|
+
handle.writeUInt8(indexHandle, 29);
|
|
178
|
+
handle.writeUInt8(handleType, 30);
|
|
179
|
+
handle.writeUInt8(handleVersion, 31);
|
|
180
|
+
return handle;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Computes the Keccak-256 hash of an ABI-packed {@link InputContext}.
|
|
184
|
+
*
|
|
185
|
+
* The context is packed as: `"evm/" || SEP_INPUT_CONTEXT || HANDLE_VERSION || inputType ||
|
|
186
|
+
* chainId || aclAddress || userAddress || contractAddress || version`.
|
|
187
|
+
*
|
|
188
|
+
* @param context - The input context to hash.
|
|
189
|
+
* @returns A 32-byte `Buffer` containing the Keccak-256 digest.
|
|
190
|
+
*/
|
|
191
|
+
function hashInputContext(context) {
|
|
192
|
+
const packed = (0, viem_1.encodePacked)([
|
|
193
|
+
'string',
|
|
194
|
+
'string',
|
|
195
|
+
'uint8',
|
|
196
|
+
'uint8',
|
|
197
|
+
'uint256',
|
|
198
|
+
'address',
|
|
199
|
+
'address',
|
|
200
|
+
'address',
|
|
201
|
+
'uint16',
|
|
202
|
+
], [
|
|
203
|
+
// Note: The x/hostchain spec requires the chain ID to be prefixed with 'evm/' for EVM chains
|
|
204
|
+
'evm/',
|
|
205
|
+
exports.SEP_INPUT_CONTEXT,
|
|
206
|
+
exports.HANDLE_VERSION,
|
|
207
|
+
context.inputType,
|
|
208
|
+
context.hostChainId,
|
|
209
|
+
context.aclAddress,
|
|
210
|
+
context.userAddress,
|
|
211
|
+
context.contractAddress,
|
|
212
|
+
context.version,
|
|
213
|
+
]);
|
|
214
|
+
return new sha3_1.Keccak(256).update(Buffer.from((0, viem_1.hexToBytes)(packed))).digest();
|
|
215
|
+
}
|
|
216
|
+
function assertUint8(value) {
|
|
217
|
+
if (!Number.isInteger(value) || value < 0 || value > 255) {
|
|
218
|
+
throw new Error(`Invalid uint8 value: ${value}`);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaGFuZGxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2hhbmRsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUE4REEsOEJBRUM7QUF1Q0Qsd0NBb0JDO0FBU0Qsc0NBVUM7QUFRRCxrREFXQztBQWlCRCxzQ0EyREM7QUFXRCw0Q0EyQkM7QUFuUkQsbUNBQWdDO0FBQ2hDLCtCQUE4QjtBQUM5QiwrQkFBdUQ7QUFDdkQsMkNBQXdDO0FBRXhDLDhFQUE4RTtBQUNqRSxRQUFBLGNBQWMs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FLENBQUM7QUFFRCxTQUFTLFdBQVcsQ0FBQyxLQUFhO0lBQ2hDLElBQUksQ0FBQyxNQUFNLENBQUMsU0FBUyxDQUFDLEtBQUssQ0FBQyxJQUFJLEtBQUssR0FBRyxDQUFDLElBQUksS0FBSyxHQUFHLEdBQUcsRUFBRSxDQUFDO1FBQ3pELE1BQU0sSUFBSSxLQUFLLENBQUMsd0JBQXdCLEtBQUssRUFBRSxDQUFDLENBQUM7SUFDbkQsQ0FBQztBQUNILENBQUMifQ==
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export * from './binary.js';
|
|
2
|
+
export * from './chain.js';
|
|
3
|
+
export { HANDLE_LENGTH_BYTES, HANDLE_VERSION, HandleTypeName, InputContext, getHandleType, handleTypes, isTeeType, validateHandle, type Handle, type HandleTypes, type TeeType, } from './handle.js';
|
|
4
|
+
export * from './schema.js';
|
|
5
|
+
export * from './viem.js';
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.validateHandle = exports.isTeeType = exports.handleTypes = exports.getHandleType = exports.InputContext = exports.HandleTypeName = exports.HANDLE_VERSION = exports.HANDLE_LENGTH_BYTES = void 0;
|
|
18
|
+
__exportStar(require("./binary.js"), exports);
|
|
19
|
+
__exportStar(require("./chain.js"), exports);
|
|
20
|
+
var handle_js_1 = require("./handle.js");
|
|
21
|
+
Object.defineProperty(exports, "HANDLE_LENGTH_BYTES", { enumerable: true, get: function () { return handle_js_1.HANDLE_LENGTH_BYTES; } });
|
|
22
|
+
Object.defineProperty(exports, "HANDLE_VERSION", { enumerable: true, get: function () { return handle_js_1.HANDLE_VERSION; } });
|
|
23
|
+
Object.defineProperty(exports, "HandleTypeName", { enumerable: true, get: function () { return handle_js_1.HandleTypeName; } });
|
|
24
|
+
Object.defineProperty(exports, "InputContext", { enumerable: true, get: function () { return handle_js_1.InputContext; } });
|
|
25
|
+
Object.defineProperty(exports, "getHandleType", { enumerable: true, get: function () { return handle_js_1.getHandleType; } });
|
|
26
|
+
Object.defineProperty(exports, "handleTypes", { enumerable: true, get: function () { return handle_js_1.handleTypes; } });
|
|
27
|
+
Object.defineProperty(exports, "isTeeType", { enumerable: true, get: function () { return handle_js_1.isTeeType; } });
|
|
28
|
+
Object.defineProperty(exports, "validateHandle", { enumerable: true, get: function () { return handle_js_1.validateHandle; } });
|
|
29
|
+
__exportStar(require("./schema.js"), exports);
|
|
30
|
+
__exportStar(require("./viem.js"), exports);
|
|
31
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFBQSw4Q0FBNEI7QUFDNUIsNkNBQTJCO0FBQzNCLHlDQVlxQjtBQVhuQixnSEFBQSxtQkFBbUIsT0FBQTtBQUNuQiwyR0FBQSxjQUFjLE9BQUE7QUFDZCwyR0FBQSxjQUFjLE9BQUE7QUFDZCx5R0FBQSxZQUFZLE9BQUE7QUFDWiwwR0FBQSxhQUFhLE9BQUE7QUFDYix3R0FBQSxXQUFXLE9BQUE7QUFDWCxzR0FBQSxTQUFTLE9BQUE7QUFDVCwyR0FBQSxjQUFjLE9BQUE7QUFLaEIsOENBQTRCO0FBQzVCLDRDQUEwQiJ9
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type Client } from '@connectrpc/connect';
|
|
2
|
+
import type { Address } from 'viem';
|
|
3
|
+
import type { SupportedChain } from '../chain.js';
|
|
4
|
+
import { KmsService } from '../generated/es/inco/kms/lite/v1/kms_service_pb.js';
|
|
5
|
+
export declare const TEST_DEFAULT_COVALIDATOR_SIGNER: Address;
|
|
6
|
+
export type KmsClient = Client<typeof KmsService> & {
|
|
7
|
+
signerAddress: Address;
|
|
8
|
+
};
|
|
9
|
+
export declare function getKmsClient(kmsConnectRpcEndpointOrClient: string | KmsClient, signerAddress: Address): KmsClient;
|
|
10
|
+
export declare function defaultCovalidatorGrpc(chain: SupportedChain): string;
|
|
11
|
+
export declare function lightningDevnetCovalidatorGrpc(chain: SupportedChain): string;
|
|
12
|
+
export declare function lightningTestnetCovalidatorGrpc(chain: SupportedChain): string;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TEST_DEFAULT_COVALIDATOR_SIGNER = void 0;
|
|
4
|
+
exports.getKmsClient = getKmsClient;
|
|
5
|
+
exports.defaultCovalidatorGrpc = defaultCovalidatorGrpc;
|
|
6
|
+
exports.lightningDevnetCovalidatorGrpc = lightningDevnetCovalidatorGrpc;
|
|
7
|
+
exports.lightningTestnetCovalidatorGrpc = lightningTestnetCovalidatorGrpc;
|
|
8
|
+
const connect_1 = require("@connectrpc/connect");
|
|
9
|
+
const connect_web_1 = require("@connectrpc/connect-web");
|
|
10
|
+
const kms_service_pb_js_1 = require("../generated/es/inco/kms/lite/v1/kms_service_pb.js");
|
|
11
|
+
// anvil zeroth address, while there is only one signer,
|
|
12
|
+
// this does not matter, as we use these addresses for signer ordering
|
|
13
|
+
// [WARNING] This is the default signer for the Inco Lightning public testnet.
|
|
14
|
+
exports.TEST_DEFAULT_COVALIDATOR_SIGNER = '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266';
|
|
15
|
+
// Helper function to get a KMS client from a string or a Client instance.
|
|
16
|
+
function getKmsClient(kmsConnectRpcEndpointOrClient, signerAddress) {
|
|
17
|
+
if (typeof kmsConnectRpcEndpointOrClient === 'string') {
|
|
18
|
+
const transport = (0, connect_web_1.createConnectTransport)({
|
|
19
|
+
baseUrl: kmsConnectRpcEndpointOrClient,
|
|
20
|
+
});
|
|
21
|
+
const client = (0, connect_1.createClient)(kms_service_pb_js_1.KmsService, transport);
|
|
22
|
+
return Object.assign(client, { signerAddress });
|
|
23
|
+
}
|
|
24
|
+
return Object.assign(kmsConnectRpcEndpointOrClient, { signerAddress });
|
|
25
|
+
}
|
|
26
|
+
// Helper function to return the default gRPC endpoint for the covalidator.
|
|
27
|
+
// Currently, this returns the covalidator for the Inco Lightning public testnet.
|
|
28
|
+
function defaultCovalidatorGrpc(chain) {
|
|
29
|
+
return lightningTestnetCovalidatorGrpc(chain);
|
|
30
|
+
}
|
|
31
|
+
// Helper function to get the devnet gRPC endpoint for the Inco Lightning covalidator.
|
|
32
|
+
function lightningDevnetCovalidatorGrpc(chain) {
|
|
33
|
+
return getCovalidatorGrpcHelper(chain, 'devnet', 'lightning');
|
|
34
|
+
}
|
|
35
|
+
// Helper function to get the testnet gRPC endpoint for the Inco Lightning covalidator.
|
|
36
|
+
function lightningTestnetCovalidatorGrpc(chain) {
|
|
37
|
+
return getCovalidatorGrpcHelper(chain, 'testnet', 'lightning');
|
|
38
|
+
}
|
|
39
|
+
// Convert camelCase to dash-case.
|
|
40
|
+
function camelToDashCase(str) {
|
|
41
|
+
return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
|
|
42
|
+
}
|
|
43
|
+
// Small helper, as our GCP covalidator URLs are in a specific format.
|
|
44
|
+
function getCovalidatorGrpcHelper(chain, network, cluster) {
|
|
45
|
+
return `https://grpc.${camelToDashCase(chain.name)}.${cluster}.${network}.inco.org`;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xpZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2ttcy9jbGllbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBZUEsb0NBYUM7QUFJRCx3REFFQztBQUdELHdFQUVDO0FBR0QsMEVBRUM7QUE1Q0QsaURBQWdFO0FBQ2hFLHlEQUFpRTtBQUdqRSwwRkFBZ0Y7QUFFaEYsd0RBQXdEO0FBQ3hELHNFQUFzRTtBQUN0RSw4RUFBOEU7QUFDakUsUUFBQSwrQkFBK0IsR0FDMUMsNENBQTRDLENBQUM7QUFJL0MsMEVBQTBFO0FBQzFFLFNBQWdCLFlBQVksQ0FDMUIsNkJBQWlELEVBQ2pELGFBQXNCO0lBRXRCLElBQUksT0FBTyw2QkFBNkIsS0FBSyxRQUFRLEVBQUUsQ0FBQztRQUN0RCxNQUFNLFNBQVMsR0FBRyxJQUFBLG9DQUFzQixFQUFDO1lBQ3ZDLE9BQU8sRUFBRSw2QkFBNkI7U0FDdkMsQ0FBQyxDQUFDO1FBQ0gsTUFBTSxNQUFNLEdBQUcsSUFBQSxzQkFBWSxFQUFDLDhCQUFVLEVBQUUsU0FBUyxDQUFDLENBQUM7UUFDbkQsT0FBTyxNQUFNLENBQUMsTUFBTSxDQUFDLE1BQU0sRUFBRSxFQUFFLGFBQWEsRUFBRSxDQUFDLENBQUM7SUFDbEQsQ0FBQztJQUVELE9BQU8sTUFBTSxDQUFDLE1BQU0sQ0FBQyw2QkFBNkIsRUFBRSxFQU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