@fhevm/sdk 1.1.0-alpha.4 → 1.1.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_cjs/core/_version.js +1 -1
- package/_cjs/core/actions/base/canDecryptPublicValue.js +1 -1
- package/_cjs/core/actions/base/canDecryptPublicValue.js.map +1 -1
- package/_cjs/core/actions/base/canDecryptPublicValues.js +1 -1
- package/_cjs/core/actions/base/canDecryptPublicValues.js.map +1 -1
- package/_cjs/core/actions/base/{fetchKmsSignedcryptedShares.js → fetchKmsSigncryptedShares.js} +5 -5
- package/_cjs/core/actions/base/fetchKmsSigncryptedShares.js.map +1 -0
- package/_cjs/core/actions/base/index.js +3 -3
- package/_cjs/core/actions/base/index.js.map +1 -1
- package/_cjs/core/actions/base/readKmsSignersContext.js +2 -1
- package/_cjs/core/actions/base/readKmsSignersContext.js.map +1 -1
- package/_cjs/core/actions/chain/parseTransportKeyPair.js.map +1 -1
- package/_cjs/core/actions/decrypt/decryptKmsSigncryptedShares.js +13 -0
- package/_cjs/core/actions/decrypt/decryptKmsSigncryptedShares.js.map +1 -0
- package/_cjs/core/actions/decrypt/decryptValue.js +3 -1
- package/_cjs/core/actions/decrypt/decryptValue.js.map +1 -1
- package/_cjs/core/actions/decrypt/decryptValues.js +3 -1
- package/_cjs/core/actions/decrypt/decryptValues.js.map +1 -1
- package/_cjs/core/actions/decrypt/decryptValuesFromPairs.js +3 -1
- package/_cjs/core/actions/decrypt/decryptValuesFromPairs.js.map +1 -1
- package/_cjs/core/actions/decrypt/generateTransportKeyPair.js +3 -1
- package/_cjs/core/actions/decrypt/generateTransportKeyPair.js.map +1 -1
- package/_cjs/core/actions/decrypt/index.js +3 -3
- package/_cjs/core/actions/decrypt/index.js.map +1 -1
- package/_cjs/core/actions/encrypt/encryptValue.js +3 -1
- package/_cjs/core/actions/encrypt/encryptValue.js.map +1 -1
- package/_cjs/core/actions/encrypt/encryptValues.js +3 -1
- package/_cjs/core/actions/encrypt/encryptValues.js.map +1 -1
- package/_cjs/core/actions/encrypt/generateZkProof.js +5 -1
- package/_cjs/core/actions/encrypt/generateZkProof.js.map +1 -1
- package/_cjs/core/actions/host/readFhevmExecutorContractData.js +7 -7
- package/_cjs/core/actions/host/readFhevmExecutorContractData.js.map +1 -1
- package/_cjs/core/actions/host/readInputVerifierContractData.js +1 -1
- package/_cjs/core/actions/host/readInputVerifierContractData.js.map +1 -1
- package/_cjs/core/actions/host/readKmsVerifierContractData.js +6 -5
- package/_cjs/core/actions/host/readKmsVerifierContractData.js.map +1 -1
- package/_cjs/core/actions/host/resolveFhevmConfig.js +7 -1
- package/_cjs/core/actions/host/resolveFhevmConfig.js.map +1 -1
- package/_cjs/core/base/bytes.js +2 -1
- package/_cjs/core/base/bytes.js.map +1 -1
- package/_cjs/core/base/environment.js +122 -0
- package/_cjs/core/base/environment.js.map +1 -0
- package/_cjs/core/base/errors/Sha256VerificationError.js +15 -0
- package/_cjs/core/base/errors/Sha256VerificationError.js.map +1 -0
- package/_cjs/core/base/inflate.js +282 -0
- package/_cjs/core/base/inflate.js.map +1 -0
- package/_cjs/core/base/isomorphicFs.js +24 -0
- package/_cjs/core/base/isomorphicFs.js.map +1 -0
- package/_cjs/core/base/isomorphicWorker.js +42 -111
- package/_cjs/core/base/isomorphicWorker.js.map +1 -1
- package/_cjs/core/base/object.js +23 -0
- package/_cjs/core/base/object.js.map +1 -1
- package/_cjs/core/base/semver.js +166 -0
- package/_cjs/core/base/semver.js.map +1 -0
- package/_cjs/core/base/uint.js +20 -3
- package/_cjs/core/base/uint.js.map +1 -1
- package/_cjs/core/base/wasm.js +15 -55
- package/_cjs/core/base/wasm.js.map +1 -1
- package/_cjs/core/chains/definitions/localTestnet.js +3 -0
- package/_cjs/core/chains/definitions/localTestnet.js.map +1 -1
- package/_cjs/core/chains/definitions/mainnet.js +1 -0
- package/_cjs/core/chains/definitions/mainnet.js.map +1 -1
- package/_cjs/core/chains/definitions/sepolia.js +1 -0
- package/_cjs/core/chains/definitions/sepolia.js.map +1 -1
- package/_cjs/core/clients/decorators/base.js +5 -0
- package/_cjs/core/clients/decorators/base.js.map +1 -1
- package/_cjs/core/clients/decorators/decrypt-p.js +13 -0
- package/_cjs/core/clients/decorators/decrypt-p.js.map +1 -0
- package/_cjs/core/clients/decorators/decrypt.js +4 -7
- package/_cjs/core/clients/decorators/decrypt.js.map +1 -1
- package/_cjs/core/clients/decorators/encrypt-p.js +5 -1
- package/_cjs/core/clients/decorators/encrypt-p.js.map +1 -1
- package/_cjs/core/clients/decorators/encrypt.js.map +1 -1
- package/_cjs/core/coprocessor/ZkProof-p.js +4 -2
- package/_cjs/core/coprocessor/ZkProof-p.js.map +1 -1
- package/_cjs/core/coprocessor/ZkProofBuilder-p.js +2 -1
- package/_cjs/core/coprocessor/ZkProofBuilder-p.js.map +1 -1
- package/_cjs/core/coprocessor/encrypt.js +1 -1
- package/_cjs/core/coprocessor/encrypt.js.map +1 -1
- package/_cjs/core/errors/RelayerResponseStatusError.js +3 -2
- package/_cjs/core/errors/RelayerResponseStatusError.js.map +1 -1
- package/_cjs/core/host-contracts/HostContractVersion-p.js +26 -4
- package/_cjs/core/host-contracts/HostContractVersion-p.js.map +1 -1
- package/_cjs/core/host-contracts/KmsSignersContext-p.js +23 -5
- package/_cjs/core/host-contracts/KmsSignersContext-p.js.map +1 -1
- package/_cjs/core/host-contracts/abi-fragments/fragments.js +21 -1
- package/_cjs/core/host-contracts/abi-fragments/fragments.js.map +1 -1
- package/_cjs/core/host-contracts/canDecryptValuesFromPairs.js +1 -1
- package/_cjs/core/host-contracts/canDecryptValuesFromPairs.js.map +1 -1
- package/_cjs/core/host-contracts/checkAllowedForDecryption.js +2 -2
- package/_cjs/core/host-contracts/checkAllowedForDecryption.js.map +1 -1
- package/_cjs/core/host-contracts/checkDelegation.js +8 -8
- package/_cjs/core/host-contracts/checkDelegation.js.map +1 -1
- package/_cjs/core/host-contracts/checkPersistAllowed.js +9 -9
- package/_cjs/core/host-contracts/checkPersistAllowed.js.map +1 -1
- package/_cjs/core/host-contracts/getAclAddress-p.js +1 -2
- package/_cjs/core/host-contracts/getAclAddress-p.js.map +1 -1
- package/_cjs/core/host-contracts/getCurrentKmsContextAndEpoch-p.js +51 -0
- package/_cjs/core/host-contracts/getCurrentKmsContextAndEpoch-p.js.map +1 -0
- package/_cjs/core/host-contracts/getCurrentKmsContextId-p.js +4 -5
- package/_cjs/core/host-contracts/getCurrentKmsContextId-p.js.map +1 -1
- package/_cjs/core/host-contracts/getFhevmExecutorAddress-p.js +1 -1
- package/_cjs/core/host-contracts/getFhevmExecutorAddress-p.js.map +1 -1
- package/_cjs/core/host-contracts/getHandleVersion-p.js +1 -2
- package/_cjs/core/host-contracts/getHandleVersion-p.js.map +1 -1
- package/_cjs/core/host-contracts/getHcuLimitAddress-p.js +1 -2
- package/_cjs/core/host-contracts/getHcuLimitAddress-p.js.map +1 -1
- package/_cjs/core/host-contracts/getInputVerifierAddress-p.js +1 -2
- package/_cjs/core/host-contracts/getInputVerifierAddress-p.js.map +1 -1
- package/_cjs/core/host-contracts/getKmsContextSignersAndThreshold-p.js +5 -7
- package/_cjs/core/host-contracts/getKmsContextSignersAndThreshold-p.js.map +1 -1
- package/_cjs/core/host-contracts/getKmsContextSignersAndThresholdFromExtraData-p.js +4 -5
- package/_cjs/core/host-contracts/getKmsContextSignersAndThresholdFromExtraData-p.js.map +1 -1
- package/_cjs/core/host-contracts/getSignersForKmsContext-p.js +3 -5
- package/_cjs/core/host-contracts/getSignersForKmsContext-p.js.map +1 -1
- package/_cjs/core/host-contracts/isAllowedForDecryption.js +4 -4
- package/_cjs/core/host-contracts/isAllowedForDecryption.js.map +1 -1
- package/_cjs/core/host-contracts/isHandleDelegatedForUserDecryption-p.js +5 -5
- package/_cjs/core/host-contracts/isHandleDelegatedForUserDecryption-p.js.map +1 -1
- package/_cjs/core/host-contracts/isUserDecryptable.js +2 -2
- package/_cjs/core/host-contracts/isUserDecryptable.js.map +1 -1
- package/_cjs/core/host-contracts/persistAllowed.js +4 -4
- package/_cjs/core/host-contracts/persistAllowed.js.map +1 -1
- package/_cjs/core/host-contracts/readKmsSignersContext-p.js +74 -25
- package/_cjs/core/host-contracts/readKmsSignersContext-p.js.map +1 -1
- package/_cjs/core/key/FheEncryptionKeyWasm-p.js +12 -4
- package/_cjs/core/key/FheEncryptionKeyWasm-p.js.map +1 -1
- package/_cjs/core/key/deserializeFheEncryptionKey.js +3 -0
- package/_cjs/core/key/deserializeFheEncryptionKey.js.map +1 -1
- package/_cjs/core/key/fetchFheEncryptionKey.js +1 -1
- package/_cjs/core/key/fetchFheEncryptionKey.js.map +1 -1
- package/_cjs/core/key/fetchFheEncryptionKeyBytes.js.map +1 -1
- package/_cjs/core/key/serializeFheEncryptionKey.js +4 -1
- package/_cjs/core/key/serializeFheEncryptionKey.js.map +1 -1
- package/_cjs/core/kms/KmsSigncryptedShares-p.js +9 -1
- package/_cjs/core/kms/KmsSigncryptedShares-p.js.map +1 -1
- package/_cjs/core/kms/SignedDecryptionPermit-p.js +5 -1
- package/_cjs/core/kms/SignedDecryptionPermit-p.js.map +1 -1
- package/_cjs/core/kms/TransportKeyPair-p.js +27 -7
- package/_cjs/core/kms/TransportKeyPair-p.js.map +1 -1
- package/_cjs/core/kms/createKmsUserDecryptEip712.js +8 -0
- package/_cjs/core/kms/createKmsUserDecryptEip712.js.map +1 -1
- package/_cjs/core/kms/createKmsUserDecryptEip712V2.js +97 -0
- package/_cjs/core/kms/createKmsUserDecryptEip712V2.js.map +1 -0
- package/_cjs/core/kms/{decryptKmsSignedcryptedShares-p.js → decryptKmsSigncryptedShares-p.js} +10 -3
- package/_cjs/core/kms/decryptKmsSigncryptedShares-p.js.map +1 -0
- package/_cjs/core/kms/decryptValuesFromPairs.js +4 -4
- package/_cjs/core/kms/decryptValuesFromPairs.js.map +1 -1
- package/_cjs/core/kms/{fetchKmsSignedcryptedShares-p.js → fetchKmsSigncryptedShares-p.js} +10 -6
- package/_cjs/core/kms/fetchKmsSigncryptedShares-p.js.map +1 -0
- package/_cjs/core/kms/kmsExtraData.js +53 -10
- package/_cjs/core/kms/kmsExtraData.js.map +1 -1
- package/_cjs/core/kms/kmsUserDecryptEip712V2Types.js +25 -0
- package/_cjs/core/kms/kmsUserDecryptEip712V2Types.js.map +1 -0
- package/_cjs/core/kms/publicDecrypt.js +5 -3
- package/_cjs/core/kms/publicDecrypt.js.map +1 -1
- package/_cjs/core/modules/decrypt/mock.js +1 -23
- package/_cjs/core/modules/decrypt/mock.js.map +1 -1
- package/_cjs/core/modules/decrypt/module/api-p.js +51 -23
- package/_cjs/core/modules/decrypt/module/api-p.js.map +1 -1
- package/_cjs/core/modules/decrypt/module/index.js +5 -27
- package/_cjs/core/modules/decrypt/module/index.js.map +1 -1
- package/_cjs/core/modules/decrypt/module/init-p.js +155 -49
- package/_cjs/core/modules/decrypt/module/init-p.js.map +1 -1
- package/_cjs/core/modules/encrypt/mock.js +26 -8
- package/_cjs/core/modules/encrypt/mock.js.map +1 -1
- package/_cjs/core/modules/encrypt/module/api-p.js +50 -21
- package/_cjs/core/modules/encrypt/module/api-p.js.map +1 -1
- package/_cjs/core/modules/encrypt/module/index.js +3 -3
- package/_cjs/core/modules/encrypt/module/index.js.map +1 -1
- package/_cjs/core/modules/encrypt/module/init-p.js +211 -69
- package/_cjs/core/modules/encrypt/module/init-p.js.map +1 -1
- package/_cjs/core/modules/relayer/cleartext/fetchDelegatedUserDecrypt.js +1 -1
- package/_cjs/core/modules/relayer/cleartext/fetchDelegatedUserDecrypt.js.map +1 -1
- package/_cjs/core/modules/relayer/cleartext/fetchUserDecrypt.js +1 -1
- package/_cjs/core/modules/relayer/cleartext/fetchUserDecrypt.js.map +1 -1
- package/_cjs/core/modules/relayer/module/RelayerAsyncRequest.js +28 -4
- package/_cjs/core/modules/relayer/module/RelayerAsyncRequest.js.map +1 -1
- package/_cjs/core/modules/relayer/module/fetchFheEncryptionKeySource.js +5 -1
- package/_cjs/core/modules/relayer/module/fetchFheEncryptionKeySource.js.map +1 -1
- package/_cjs/core/modules/relayer/module/readErrorMessage.js +29 -0
- package/_cjs/core/modules/relayer/module/readErrorMessage.js.map +1 -0
- package/_cjs/core/runtime/CoreFhevm-p.js +171 -5
- package/_cjs/core/runtime/CoreFhevm-p.js.map +1 -1
- package/_cjs/core/runtime/HyperWasmSolver-p.js +187 -0
- package/_cjs/core/runtime/HyperWasmSolver-p.js.map +1 -0
- package/_cjs/core/runtime/ProtocolVersionResolver-p.js +270 -0
- package/_cjs/core/runtime/ProtocolVersionResolver-p.js.map +1 -0
- package/_cjs/core/runtime/initFhevmDecryptRuntime-p.js +1 -1
- package/_cjs/core/runtime/initFhevmDecryptRuntime-p.js.map +1 -1
- package/_cjs/core/runtime/initFhevmEncryptRuntime-p.js +1 -1
- package/_cjs/core/runtime/initFhevmEncryptRuntime-p.js.map +1 -1
- package/_cjs/core/runtime/initFhevmRuntime-p.js +4 -1
- package/_cjs/core/runtime/initFhevmRuntime-p.js.map +1 -1
- package/_cjs/core/runtime/resolveFhevmVersions-p.js +48 -0
- package/_cjs/core/runtime/resolveFhevmVersions-p.js.map +1 -0
- package/_cjs/core/runtimeConfig-p.js +10 -0
- package/_cjs/core/runtimeConfig-p.js.map +1 -1
- package/_cjs/core/types/{zkProofBuilder.js → moduleVersions.js} +1 -1
- package/_cjs/core/types/moduleVersions.js.map +1 -0
- package/_cjs/core/types/{fhevmUser.js → wasmAssets.js} +1 -1
- package/_cjs/core/types/wasmAssets.js.map +1 -0
- package/_cjs/core/types/{fhevmDecryptionKey.js → zkProofBuilder-p.js} +1 -1
- package/_cjs/core/types/zkProofBuilder-p.js.map +1 -0
- package/_cjs/core/utils-p/decrypt/verifyTkmsPublicKey.js +1 -0
- package/_cjs/core/utils-p/decrypt/verifyTkmsPublicKey.js.map +1 -1
- package/_cjs/ethers/internal/config.js +1 -18
- package/_cjs/ethers/internal/config.js.map +1 -1
- package/_cjs/viem/internal/config.js +1 -18
- package/_cjs/viem/internal/config.js.map +1 -1
- package/_cjs/wasm/tfhe/TfheApi.d.ts +12 -12
- package/_cjs/wasm/tfhe/loadTfheLib.js +11 -11
- package/_cjs/wasm/tfhe/loadTfheLib.js.map +2 -2
- package/_cjs/wasm/tfhe/v1.5.3/startWorkers.js +26 -9
- package/_cjs/wasm/tfhe/v1.5.3/startWorkers.js.map +2 -2
- package/_cjs/wasm/tfhe/v1.5.3/tfhe.d.ts +7 -0
- package/_cjs/wasm/tfhe/v1.5.3/tfhe.js +6 -1
- package/_cjs/wasm/tfhe/v1.5.3/tfhe.js.map +2 -2
- package/_cjs/wasm/tfhe/{v1.6.1 → v1.6.2}/startWorkers.js +28 -11
- package/_cjs/wasm/tfhe/v1.6.2/startWorkers.js.map +7 -0
- package/_cjs/wasm/tfhe/{v1.6.1 → v1.6.2}/tfhe-worker.mjs +40 -40
- package/_cjs/wasm/tfhe/{v1.6.1 → v1.6.2}/tfhe.d.ts +92 -85
- package/_cjs/wasm/tfhe/{v1.6.1 → v1.6.2}/tfhe.js +251 -443
- package/_cjs/wasm/tfhe/v1.6.2/tfhe.js.map +7 -0
- package/_cjs/wasm/tfhe/v1.6.2/tfhe_bg.wasm +0 -0
- package/_cjs/wasm/tfhe/v1.6.2/tfhe_bg.wasm.base64.js +35 -0
- package/_cjs/wasm/tfhe/v1.6.2/tfhe_bg.wasm.base64.js.map +7 -0
- package/_cjs/wasm/tkms/loadKmsLib.js.map +1 -1
- package/_cjs/wasm/tkms/v0.13.10/kms_lib.d.ts +4 -0
- package/_cjs/wasm/tkms/v0.13.10/kms_lib.js +6 -1
- package/_cjs/wasm/tkms/v0.13.10/kms_lib.js.map +2 -2
- package/_cjs/wasm/tkms/v0.13.20-0/kms_lib.d.ts +4 -0
- package/_cjs/wasm/tkms/v0.13.20-0/kms_lib.js +6 -1
- package/_cjs/wasm/tkms/v0.13.20-0/kms_lib.js.map +2 -2
- package/_cjs/wasm/wasmBaseUrl.js +12 -7
- package/_cjs/wasm/wasmBaseUrl.js.map +2 -2
- package/_esm/core/_version.js +1 -1
- package/_esm/core/actions/base/canDecryptPublicValue.js +1 -1
- package/_esm/core/actions/base/canDecryptPublicValue.js.map +1 -1
- package/_esm/core/actions/base/canDecryptPublicValues.js +1 -1
- package/_esm/core/actions/base/canDecryptPublicValues.js.map +1 -1
- package/_esm/core/actions/base/{fetchKmsSignedcryptedShares.js → fetchKmsSigncryptedShares.js} +4 -4
- package/_esm/core/actions/base/fetchKmsSigncryptedShares.js.map +1 -0
- package/_esm/core/actions/base/index.js +1 -1
- package/_esm/core/actions/base/index.js.map +1 -1
- package/_esm/core/actions/base/readKmsSignersContext.js +2 -1
- package/_esm/core/actions/base/readKmsSignersContext.js.map +1 -1
- package/_esm/core/actions/chain/parseTransportKeyPair.js.map +1 -1
- package/_esm/core/actions/decrypt/decryptKmsSigncryptedShares.js +11 -0
- package/_esm/core/actions/decrypt/decryptKmsSigncryptedShares.js.map +1 -0
- package/_esm/core/actions/decrypt/decryptValue.js +3 -1
- package/_esm/core/actions/decrypt/decryptValue.js.map +1 -1
- package/_esm/core/actions/decrypt/decryptValues.js +3 -1
- package/_esm/core/actions/decrypt/decryptValues.js.map +1 -1
- package/_esm/core/actions/decrypt/decryptValuesFromPairs.js +3 -1
- package/_esm/core/actions/decrypt/decryptValuesFromPairs.js.map +1 -1
- package/_esm/core/actions/decrypt/generateTransportKeyPair.js +3 -1
- package/_esm/core/actions/decrypt/generateTransportKeyPair.js.map +1 -1
- package/_esm/core/actions/decrypt/index.js +1 -1
- package/_esm/core/actions/decrypt/index.js.map +1 -1
- package/_esm/core/actions/encrypt/encryptValue.js +3 -1
- package/_esm/core/actions/encrypt/encryptValue.js.map +1 -1
- package/_esm/core/actions/encrypt/encryptValues.js +3 -1
- package/_esm/core/actions/encrypt/encryptValues.js.map +1 -1
- package/_esm/core/actions/encrypt/generateZkProof.js +5 -1
- package/_esm/core/actions/encrypt/generateZkProof.js.map +1 -1
- package/_esm/core/actions/host/readFhevmExecutorContractData.js +8 -8
- package/_esm/core/actions/host/readFhevmExecutorContractData.js.map +1 -1
- package/_esm/core/actions/host/readInputVerifierContractData.js +2 -2
- package/_esm/core/actions/host/readInputVerifierContractData.js.map +1 -1
- package/_esm/core/actions/host/readKmsVerifierContractData.js +7 -6
- package/_esm/core/actions/host/readKmsVerifierContractData.js.map +1 -1
- package/_esm/core/actions/host/resolveFhevmConfig.js +7 -1
- package/_esm/core/actions/host/resolveFhevmConfig.js.map +1 -1
- package/_esm/core/base/bytes.js +2 -1
- package/_esm/core/base/bytes.js.map +1 -1
- package/_esm/core/base/environment.js +164 -0
- package/_esm/core/base/environment.js.map +1 -0
- package/_esm/core/base/errors/Sha256VerificationError.js +11 -0
- package/_esm/core/base/errors/Sha256VerificationError.js.map +1 -0
- package/_esm/core/base/inflate.js +337 -0
- package/_esm/core/base/inflate.js.map +1 -0
- package/_esm/core/base/isomorphicFs.js +21 -0
- package/_esm/core/base/isomorphicFs.js.map +1 -0
- package/_esm/core/base/isomorphicWorker.js +92 -85
- package/_esm/core/base/isomorphicWorker.js.map +1 -1
- package/_esm/core/base/object.js +28 -0
- package/_esm/core/base/object.js.map +1 -1
- package/_esm/core/base/semver.js +164 -0
- package/_esm/core/base/semver.js.map +1 -0
- package/_esm/core/base/uint.js +23 -2
- package/_esm/core/base/uint.js.map +1 -1
- package/_esm/core/base/wasm.js +25 -31
- package/_esm/core/base/wasm.js.map +1 -1
- package/_esm/core/chains/definitions/localTestnet.js +3 -0
- package/_esm/core/chains/definitions/localTestnet.js.map +1 -1
- package/_esm/core/chains/definitions/mainnet.js +1 -0
- package/_esm/core/chains/definitions/mainnet.js.map +1 -1
- package/_esm/core/chains/definitions/sepolia.js +1 -0
- package/_esm/core/chains/definitions/sepolia.js.map +1 -1
- package/_esm/core/clients/decorators/base.js +6 -1
- package/_esm/core/clients/decorators/base.js.map +1 -1
- package/_esm/core/clients/decorators/decrypt-p.js +11 -0
- package/_esm/core/clients/decorators/decrypt-p.js.map +1 -0
- package/_esm/core/clients/decorators/decrypt.js +3 -7
- package/_esm/core/clients/decorators/decrypt.js.map +1 -1
- package/_esm/core/clients/decorators/encrypt-p.js +6 -2
- package/_esm/core/clients/decorators/encrypt-p.js.map +1 -1
- package/_esm/core/clients/decorators/encrypt.js.map +1 -1
- package/_esm/core/coprocessor/ZkProof-p.js +4 -2
- package/_esm/core/coprocessor/ZkProof-p.js.map +1 -1
- package/_esm/core/coprocessor/ZkProofBuilder-p.js +2 -1
- package/_esm/core/coprocessor/ZkProofBuilder-p.js.map +1 -1
- package/_esm/core/coprocessor/encrypt.js +1 -1
- package/_esm/core/coprocessor/encrypt.js.map +1 -1
- package/_esm/core/errors/RelayerResponseStatusError.js +7 -2
- package/_esm/core/errors/RelayerResponseStatusError.js.map +1 -1
- package/_esm/core/host-contracts/HostContractVersion-p.js +34 -3
- package/_esm/core/host-contracts/HostContractVersion-p.js.map +1 -1
- package/_esm/core/host-contracts/KmsSignersContext-p.js +24 -6
- package/_esm/core/host-contracts/KmsSignersContext-p.js.map +1 -1
- package/_esm/core/host-contracts/abi-fragments/fragments.js +24 -0
- package/_esm/core/host-contracts/abi-fragments/fragments.js.map +1 -1
- package/_esm/core/host-contracts/canDecryptValuesFromPairs.js +1 -1
- package/_esm/core/host-contracts/canDecryptValuesFromPairs.js.map +1 -1
- package/_esm/core/host-contracts/checkAllowedForDecryption.js +2 -2
- package/_esm/core/host-contracts/checkAllowedForDecryption.js.map +1 -1
- package/_esm/core/host-contracts/checkDelegation.js +8 -8
- package/_esm/core/host-contracts/checkDelegation.js.map +1 -1
- package/_esm/core/host-contracts/checkPersistAllowed.js +9 -9
- package/_esm/core/host-contracts/checkPersistAllowed.js.map +1 -1
- package/_esm/core/host-contracts/getAclAddress-p.js +1 -2
- package/_esm/core/host-contracts/getAclAddress-p.js.map +1 -1
- package/_esm/core/host-contracts/getCurrentKmsContextAndEpoch-p.js +63 -0
- package/_esm/core/host-contracts/getCurrentKmsContextAndEpoch-p.js.map +1 -0
- package/_esm/core/host-contracts/getCurrentKmsContextId-p.js +6 -7
- package/_esm/core/host-contracts/getCurrentKmsContextId-p.js.map +1 -1
- package/_esm/core/host-contracts/getFhevmExecutorAddress-p.js +1 -1
- package/_esm/core/host-contracts/getFhevmExecutorAddress-p.js.map +1 -1
- package/_esm/core/host-contracts/getHandleVersion-p.js +1 -2
- package/_esm/core/host-contracts/getHandleVersion-p.js.map +1 -1
- package/_esm/core/host-contracts/getHcuLimitAddress-p.js +1 -2
- package/_esm/core/host-contracts/getHcuLimitAddress-p.js.map +1 -1
- package/_esm/core/host-contracts/getInputVerifierAddress-p.js +1 -2
- package/_esm/core/host-contracts/getInputVerifierAddress-p.js.map +1 -1
- package/_esm/core/host-contracts/getKmsContextSignersAndThreshold-p.js +6 -8
- package/_esm/core/host-contracts/getKmsContextSignersAndThreshold-p.js.map +1 -1
- package/_esm/core/host-contracts/getKmsContextSignersAndThresholdFromExtraData-p.js +5 -6
- package/_esm/core/host-contracts/getKmsContextSignersAndThresholdFromExtraData-p.js.map +1 -1
- package/_esm/core/host-contracts/getSignersForKmsContext-p.js +5 -7
- package/_esm/core/host-contracts/getSignersForKmsContext-p.js.map +1 -1
- package/_esm/core/host-contracts/isAllowedForDecryption.js +4 -4
- package/_esm/core/host-contracts/isAllowedForDecryption.js.map +1 -1
- package/_esm/core/host-contracts/isHandleDelegatedForUserDecryption-p.js +5 -5
- package/_esm/core/host-contracts/isHandleDelegatedForUserDecryption-p.js.map +1 -1
- package/_esm/core/host-contracts/isUserDecryptable.js +2 -2
- package/_esm/core/host-contracts/isUserDecryptable.js.map +1 -1
- package/_esm/core/host-contracts/persistAllowed.js +4 -4
- package/_esm/core/host-contracts/persistAllowed.js.map +1 -1
- package/_esm/core/host-contracts/readKmsSignersContext-p.js +89 -29
- package/_esm/core/host-contracts/readKmsSignersContext-p.js.map +1 -1
- package/_esm/core/key/FheEncryptionKeyWasm-p.js +12 -4
- package/_esm/core/key/FheEncryptionKeyWasm-p.js.map +1 -1
- package/_esm/core/key/deserializeFheEncryptionKey.js +3 -0
- package/_esm/core/key/deserializeFheEncryptionKey.js.map +1 -1
- package/_esm/core/key/fetchFheEncryptionKey.js +1 -1
- package/_esm/core/key/fetchFheEncryptionKey.js.map +1 -1
- package/_esm/core/key/fetchFheEncryptionKeyBytes.js.map +1 -1
- package/_esm/core/key/serializeFheEncryptionKey.js +4 -1
- package/_esm/core/key/serializeFheEncryptionKey.js.map +1 -1
- package/_esm/core/kms/KmsSigncryptedShares-p.js +9 -1
- package/_esm/core/kms/KmsSigncryptedShares-p.js.map +1 -1
- package/_esm/core/kms/SignedDecryptionPermit-p.js +5 -1
- package/_esm/core/kms/SignedDecryptionPermit-p.js.map +1 -1
- package/_esm/core/kms/TransportKeyPair-p.js +28 -7
- package/_esm/core/kms/TransportKeyPair-p.js.map +1 -1
- package/_esm/core/kms/createKmsUserDecryptEip712.js +8 -0
- package/_esm/core/kms/createKmsUserDecryptEip712.js.map +1 -1
- package/_esm/core/kms/createKmsUserDecryptEip712V2.js +98 -0
- package/_esm/core/kms/createKmsUserDecryptEip712V2.js.map +1 -0
- package/_esm/core/kms/{decryptKmsSignedcryptedShares-p.js → decryptKmsSigncryptedShares-p.js} +9 -2
- package/_esm/core/kms/decryptKmsSigncryptedShares-p.js.map +1 -0
- package/_esm/core/kms/decryptValuesFromPairs.js +4 -4
- package/_esm/core/kms/decryptValuesFromPairs.js.map +1 -1
- package/_esm/core/kms/{fetchKmsSignedcryptedShares-p.js → fetchKmsSigncryptedShares-p.js} +12 -6
- package/_esm/core/kms/fetchKmsSigncryptedShares-p.js.map +1 -0
- package/_esm/core/kms/kmsExtraData.js +70 -12
- package/_esm/core/kms/kmsExtraData.js.map +1 -1
- package/_esm/core/kms/kmsUserDecryptEip712V2Types.js +28 -0
- package/_esm/core/kms/kmsUserDecryptEip712V2Types.js.map +1 -0
- package/_esm/core/kms/publicDecrypt.js +5 -3
- package/_esm/core/kms/publicDecrypt.js.map +1 -1
- package/_esm/core/modules/decrypt/mock.js +0 -24
- package/_esm/core/modules/decrypt/mock.js.map +1 -1
- package/_esm/core/modules/decrypt/module/api-p.js +51 -23
- package/_esm/core/modules/decrypt/module/api-p.js.map +1 -1
- package/_esm/core/modules/decrypt/module/index.js +31 -25
- package/_esm/core/modules/decrypt/module/index.js.map +1 -1
- package/_esm/core/modules/decrypt/module/init-p.js +141 -64
- package/_esm/core/modules/decrypt/module/init-p.js.map +1 -1
- package/_esm/core/modules/encrypt/mock.js +26 -9
- package/_esm/core/modules/encrypt/mock.js.map +1 -1
- package/_esm/core/modules/encrypt/module/api-p.js +50 -21
- package/_esm/core/modules/encrypt/module/api-p.js.map +1 -1
- package/_esm/core/modules/encrypt/module/index.js +3 -3
- package/_esm/core/modules/encrypt/module/index.js.map +1 -1
- package/_esm/core/modules/encrypt/module/init-p.js +369 -82
- package/_esm/core/modules/encrypt/module/init-p.js.map +1 -1
- package/_esm/core/modules/relayer/cleartext/fetchDelegatedUserDecrypt.js +2 -2
- package/_esm/core/modules/relayer/cleartext/fetchDelegatedUserDecrypt.js.map +1 -1
- package/_esm/core/modules/relayer/cleartext/fetchUserDecrypt.js +2 -2
- package/_esm/core/modules/relayer/cleartext/fetchUserDecrypt.js.map +1 -1
- package/_esm/core/modules/relayer/module/RelayerAsyncRequest.js +57 -4
- package/_esm/core/modules/relayer/module/RelayerAsyncRequest.js.map +1 -1
- package/_esm/core/modules/relayer/module/fetchFheEncryptionKeySource.js +8 -1
- package/_esm/core/modules/relayer/module/fetchFheEncryptionKeySource.js.map +1 -1
- package/_esm/core/modules/relayer/module/readErrorMessage.js +52 -0
- package/_esm/core/modules/relayer/module/readErrorMessage.js.map +1 -0
- package/_esm/core/runtime/CoreFhevm-p.js +167 -5
- package/_esm/core/runtime/CoreFhevm-p.js.map +1 -1
- package/_esm/core/runtime/HyperWasmSolver-p.js +268 -0
- package/_esm/core/runtime/HyperWasmSolver-p.js.map +1 -0
- package/_esm/core/runtime/ProtocolVersionResolver-p.js +326 -0
- package/_esm/core/runtime/ProtocolVersionResolver-p.js.map +1 -0
- package/_esm/core/runtime/initFhevmDecryptRuntime-p.js +1 -1
- package/_esm/core/runtime/initFhevmDecryptRuntime-p.js.map +1 -1
- package/_esm/core/runtime/initFhevmEncryptRuntime-p.js +1 -1
- package/_esm/core/runtime/initFhevmEncryptRuntime-p.js.map +1 -1
- package/_esm/core/runtime/initFhevmRuntime-p.js +4 -1
- package/_esm/core/runtime/initFhevmRuntime-p.js.map +1 -1
- package/_esm/core/runtime/resolveFhevmVersions-p.js +62 -0
- package/_esm/core/runtime/resolveFhevmVersions-p.js.map +1 -0
- package/_esm/core/runtimeConfig-p.js +9 -0
- package/_esm/core/runtimeConfig-p.js.map +1 -1
- package/_esm/core/types/moduleVersions.js +2 -0
- package/_esm/core/types/moduleVersions.js.map +1 -0
- package/_esm/core/types/wasmAssets.js +2 -0
- package/_esm/core/types/wasmAssets.js.map +1 -0
- package/_esm/core/types/zkProofBuilder-p.js +2 -0
- package/_esm/core/types/zkProofBuilder-p.js.map +1 -0
- package/_esm/core/utils-p/decrypt/verifyTkmsPublicKey.js +1 -0
- package/_esm/core/utils-p/decrypt/verifyTkmsPublicKey.js.map +1 -1
- package/_esm/ethers/internal/config.js +1 -18
- package/_esm/ethers/internal/config.js.map +1 -1
- package/_esm/viem/internal/config.js +1 -18
- package/_esm/viem/internal/config.js.map +1 -1
- package/_esm/wasm/tfhe/TfheApi.d.ts +12 -12
- package/_esm/wasm/tfhe/loadTfheLib.js +11 -11
- package/_esm/wasm/tfhe/v1.5.3/startWorkers.js +41 -20
- package/_esm/wasm/tfhe/v1.5.3/tfhe.d.ts +7 -0
- package/_esm/wasm/tfhe/v1.5.3/tfhe.js +8 -0
- package/_esm/wasm/tfhe/{v1.6.1 → v1.6.2}/startWorkers.js +46 -25
- package/_esm/wasm/tfhe/{v1.6.1 → v1.6.2}/tfhe-worker.mjs +40 -40
- package/_esm/wasm/tfhe/{v1.6.1 → v1.6.2}/tfhe.d.ts +92 -85
- package/_esm/wasm/tfhe/{v1.6.1 → v1.6.2}/tfhe.js +253 -442
- package/_esm/wasm/tfhe/v1.6.2/tfhe_bg.wasm +0 -0
- package/_esm/wasm/tfhe/v1.6.2/tfhe_bg.wasm.base64.js +7 -0
- package/_esm/wasm/tkms/v0.13.10/kms_lib.d.ts +4 -0
- package/_esm/wasm/tkms/v0.13.10/kms_lib.js +8 -0
- package/_esm/wasm/tkms/v0.13.20-0/kms_lib.d.ts +4 -0
- package/_esm/wasm/tkms/v0.13.20-0/kms_lib.js +8 -0
- package/_esm/wasm/wasmBaseUrl.js +32 -4
- package/_types/core/actions/base/{fetchKmsSignedcryptedShares.d.ts → fetchKmsSigncryptedShares.d.ts} +7 -7
- package/_types/core/actions/base/fetchKmsSigncryptedShares.d.ts.map +1 -0
- package/_types/core/actions/base/index.d.ts +1 -1
- package/_types/core/actions/base/index.d.ts.map +1 -1
- package/_types/core/actions/base/readKmsSignersContext.d.ts.map +1 -1
- package/_types/core/actions/chain/parseSignedDecryptionPermit.d.ts +2 -2
- package/_types/core/actions/chain/parseSignedDecryptionPermit.d.ts.map +1 -1
- package/_types/core/actions/chain/parseTransportKeyPair.d.ts +1 -1
- package/_types/core/actions/chain/parseTransportKeyPair.d.ts.map +1 -1
- package/_types/core/actions/decrypt/{decryptKmsSignedcryptedShares.d.ts → decryptKmsSigncryptedShares.d.ts} +4 -4
- package/_types/core/actions/decrypt/decryptKmsSigncryptedShares.d.ts.map +1 -0
- package/_types/core/actions/decrypt/decryptValue.d.ts.map +1 -1
- package/_types/core/actions/decrypt/decryptValues.d.ts.map +1 -1
- package/_types/core/actions/decrypt/decryptValuesFromPairs.d.ts.map +1 -1
- package/_types/core/actions/decrypt/generateTransportKeyPair.d.ts +2 -2
- package/_types/core/actions/decrypt/generateTransportKeyPair.d.ts.map +1 -1
- package/_types/core/actions/decrypt/index.d.ts +1 -1
- package/_types/core/actions/decrypt/index.d.ts.map +1 -1
- package/_types/core/actions/encrypt/encryptValue.d.ts.map +1 -1
- package/_types/core/actions/encrypt/encryptValues.d.ts.map +1 -1
- package/_types/core/actions/encrypt/generateZkProof.d.ts.map +1 -1
- package/_types/core/actions/host/readKmsVerifierContractData.d.ts +1 -0
- package/_types/core/actions/host/readKmsVerifierContractData.d.ts.map +1 -1
- package/_types/core/actions/host/resolveFhevmConfig.d.ts +2 -0
- package/_types/core/actions/host/resolveFhevmConfig.d.ts.map +1 -1
- package/_types/core/base/bytes.d.ts.map +1 -1
- package/_types/core/base/environment.d.ts +92 -0
- package/_types/core/base/environment.d.ts.map +1 -0
- package/_types/core/base/errors/Sha256VerificationError.d.ts +14 -0
- package/_types/core/base/errors/Sha256VerificationError.d.ts.map +1 -0
- package/_types/core/base/inflate.d.ts +25 -0
- package/_types/core/base/inflate.d.ts.map +1 -0
- package/_types/core/base/isomorphicFs.d.ts +2 -0
- package/_types/core/base/isomorphicFs.d.ts.map +1 -0
- package/_types/core/base/isomorphicWorker.d.ts +27 -43
- package/_types/core/base/isomorphicWorker.d.ts.map +1 -1
- package/_types/core/base/object.d.ts +7 -0
- package/_types/core/base/object.d.ts.map +1 -1
- package/_types/core/base/semver.d.ts +39 -0
- package/_types/core/base/semver.d.ts.map +1 -0
- package/_types/core/base/uint.d.ts +13 -2
- package/_types/core/base/uint.d.ts.map +1 -1
- package/_types/core/base/wasm.d.ts +0 -8
- package/_types/core/base/wasm.d.ts.map +1 -1
- package/_types/core/chains/definitions/localTestnet.d.ts +3 -0
- package/_types/core/chains/definitions/localTestnet.d.ts.map +1 -1
- package/_types/core/chains/definitions/mainnet.d.ts +1 -0
- package/_types/core/chains/definitions/mainnet.d.ts.map +1 -1
- package/_types/core/chains/definitions/sepolia.d.ts.map +1 -1
- package/_types/core/clients/decorators/base.d.ts.map +1 -1
- package/_types/core/clients/decorators/decrypt-p.d.ts +4 -0
- package/_types/core/clients/decorators/decrypt-p.d.ts.map +1 -0
- package/_types/core/clients/decorators/decrypt.d.ts +4 -2
- package/_types/core/clients/decorators/decrypt.d.ts.map +1 -1
- package/_types/core/clients/decorators/encrypt-p.d.ts +2 -3
- package/_types/core/clients/decorators/encrypt-p.d.ts.map +1 -1
- package/_types/core/clients/decorators/encrypt.d.ts +4 -2
- package/_types/core/clients/decorators/encrypt.d.ts.map +1 -1
- package/_types/core/coprocessor/ZkProof-p.d.ts +9 -2
- package/_types/core/coprocessor/ZkProof-p.d.ts.map +1 -1
- package/_types/core/coprocessor/ZkProofBuilder-p.d.ts +3 -1
- package/_types/core/coprocessor/ZkProofBuilder-p.d.ts.map +1 -1
- package/_types/core/coprocessor/encrypt.d.ts +2 -0
- package/_types/core/coprocessor/encrypt.d.ts.map +1 -1
- package/_types/core/errors/RelayerResponseStatusError.d.ts +7 -1
- package/_types/core/errors/RelayerResponseStatusError.d.ts.map +1 -1
- package/_types/core/host-contracts/HostContractVersion-p.d.ts +18 -1
- package/_types/core/host-contracts/HostContractVersion-p.d.ts.map +1 -1
- package/_types/core/host-contracts/KmsSignersContext-p.d.ts +2 -1
- package/_types/core/host-contracts/KmsSignersContext-p.d.ts.map +1 -1
- package/_types/core/host-contracts/abi-fragments/fragments.d.ts +5 -0
- package/_types/core/host-contracts/abi-fragments/fragments.d.ts.map +1 -1
- package/_types/core/host-contracts/checkAllowedForDecryption.d.ts +1 -1
- package/_types/core/host-contracts/checkAllowedForDecryption.d.ts.map +1 -1
- package/_types/core/host-contracts/checkDelegation.d.ts +1 -1
- package/_types/core/host-contracts/checkDelegation.d.ts.map +1 -1
- package/_types/core/host-contracts/checkPersistAllowed.d.ts +1 -1
- package/_types/core/host-contracts/checkPersistAllowed.d.ts.map +1 -1
- package/_types/core/host-contracts/getAclAddress-p.d.ts +1 -1
- package/_types/core/host-contracts/getAclAddress-p.d.ts.map +1 -1
- package/_types/core/host-contracts/getCurrentKmsContextAndEpoch-p.d.ts +30 -0
- package/_types/core/host-contracts/getCurrentKmsContextAndEpoch-p.d.ts.map +1 -0
- package/_types/core/host-contracts/getCurrentKmsContextId-p.d.ts +1 -1
- package/_types/core/host-contracts/getCurrentKmsContextId-p.d.ts.map +1 -1
- package/_types/core/host-contracts/getFhevmExecutorAddress-p.d.ts +1 -1
- package/_types/core/host-contracts/getFhevmExecutorAddress-p.d.ts.map +1 -1
- package/_types/core/host-contracts/getHandleVersion-p.d.ts +1 -1
- package/_types/core/host-contracts/getHandleVersion-p.d.ts.map +1 -1
- package/_types/core/host-contracts/getHcuLimitAddress-p.d.ts +1 -1
- package/_types/core/host-contracts/getHcuLimitAddress-p.d.ts.map +1 -1
- package/_types/core/host-contracts/getInputVerifierAddress-p.d.ts +1 -1
- package/_types/core/host-contracts/getInputVerifierAddress-p.d.ts.map +1 -1
- package/_types/core/host-contracts/getKmsContextSignersAndThreshold-p.d.ts +1 -1
- package/_types/core/host-contracts/getKmsContextSignersAndThreshold-p.d.ts.map +1 -1
- package/_types/core/host-contracts/getKmsContextSignersAndThresholdFromExtraData-p.d.ts +1 -1
- package/_types/core/host-contracts/getKmsContextSignersAndThresholdFromExtraData-p.d.ts.map +1 -1
- package/_types/core/host-contracts/getSignersForKmsContext-p.d.ts +2 -2
- package/_types/core/host-contracts/getSignersForKmsContext-p.d.ts.map +1 -1
- package/_types/core/host-contracts/isAllowedForDecryption.d.ts +1 -1
- package/_types/core/host-contracts/isAllowedForDecryption.d.ts.map +1 -1
- package/_types/core/host-contracts/isHandleDelegatedForUserDecryption-p.d.ts +1 -1
- package/_types/core/host-contracts/isHandleDelegatedForUserDecryption-p.d.ts.map +1 -1
- package/_types/core/host-contracts/isUserDecryptable.d.ts +1 -1
- package/_types/core/host-contracts/isUserDecryptable.d.ts.map +1 -1
- package/_types/core/host-contracts/persistAllowed.d.ts +1 -1
- package/_types/core/host-contracts/persistAllowed.d.ts.map +1 -1
- package/_types/core/host-contracts/readKmsSignersContext-p.d.ts +25 -7
- package/_types/core/host-contracts/readKmsSignersContext-p.d.ts.map +1 -1
- package/_types/core/key/FheEncryptionKeyWasm-p.d.ts +3 -1
- package/_types/core/key/FheEncryptionKeyWasm-p.d.ts.map +1 -1
- package/_types/core/key/deserializeFheEncryptionKey.d.ts +2 -0
- package/_types/core/key/deserializeFheEncryptionKey.d.ts.map +1 -1
- package/_types/core/key/fetchFheEncryptionKey.d.ts +3 -1
- package/_types/core/key/fetchFheEncryptionKey.d.ts.map +1 -1
- package/_types/core/key/fetchFheEncryptionKeyBytes.d.ts.map +1 -1
- package/_types/core/key/serializeFheEncryptionKey.d.ts.map +1 -1
- package/_types/core/kms/KmsSigncryptedShares-p.d.ts.map +1 -1
- package/_types/core/kms/SignedDecryptionPermit-p.d.ts.map +1 -1
- package/_types/core/kms/TransportKeyPair-p.d.ts +9 -0
- package/_types/core/kms/TransportKeyPair-p.d.ts.map +1 -1
- package/_types/core/kms/createKmsUserDecryptEip712.d.ts.map +1 -1
- package/_types/core/kms/createKmsUserDecryptEip712V2.d.ts +15 -0
- package/_types/core/kms/createKmsUserDecryptEip712V2.d.ts.map +1 -0
- package/_types/core/kms/{decryptKmsSignedcryptedShares-p.d.ts → decryptKmsSigncryptedShares-p.d.ts} +4 -2
- package/_types/core/kms/decryptKmsSigncryptedShares-p.d.ts.map +1 -0
- package/_types/core/kms/decryptValuesFromPairs.d.ts +2 -0
- package/_types/core/kms/decryptValuesFromPairs.d.ts.map +1 -1
- package/_types/core/kms/{fetchKmsSignedcryptedShares-p.d.ts → fetchKmsSigncryptedShares-p.d.ts} +2 -2
- package/_types/core/kms/fetchKmsSigncryptedShares-p.d.ts.map +1 -0
- package/_types/core/kms/kmsExtraData.d.ts +9 -2
- package/_types/core/kms/kmsExtraData.d.ts.map +1 -1
- package/_types/core/kms/kmsUserDecryptEip712V2Types.d.ts +3 -0
- package/_types/core/kms/kmsUserDecryptEip712V2Types.d.ts.map +1 -0
- package/_types/core/kms/publicDecrypt.d.ts.map +1 -1
- package/_types/core/modules/decrypt/mock.d.ts +1 -2
- package/_types/core/modules/decrypt/mock.d.ts.map +1 -1
- package/_types/core/modules/decrypt/module/api-p.d.ts +2 -2
- package/_types/core/modules/decrypt/module/api-p.d.ts.map +1 -1
- package/_types/core/modules/decrypt/module/index.d.ts +1 -2
- package/_types/core/modules/decrypt/module/index.d.ts.map +1 -1
- package/_types/core/modules/decrypt/module/init-p.d.ts +3 -3
- package/_types/core/modules/decrypt/module/init-p.d.ts.map +1 -1
- package/_types/core/modules/decrypt/types.d.ts +33 -34
- package/_types/core/modules/decrypt/types.d.ts.map +1 -1
- package/_types/core/modules/encrypt/mock.d.ts.map +1 -1
- package/_types/core/modules/encrypt/module/api-p.d.ts.map +1 -1
- package/_types/core/modules/encrypt/module/index.d.ts.map +1 -1
- package/_types/core/modules/encrypt/module/init-p.d.ts +11 -4
- package/_types/core/modules/encrypt/module/init-p.d.ts.map +1 -1
- package/_types/core/modules/encrypt/types.d.ts +31 -2
- package/_types/core/modules/encrypt/types.d.ts.map +1 -1
- package/_types/core/modules/relayer/module/RelayerAsyncRequest.d.ts +18 -0
- package/_types/core/modules/relayer/module/RelayerAsyncRequest.d.ts.map +1 -1
- package/_types/core/modules/relayer/module/fetchFheEncryptionKeySource.d.ts.map +1 -1
- package/_types/core/modules/relayer/module/readErrorMessage.d.ts +26 -0
- package/_types/core/modules/relayer/module/readErrorMessage.d.ts.map +1 -0
- package/_types/core/runtime/CoreFhevm-p.d.ts +15 -4
- package/_types/core/runtime/CoreFhevm-p.d.ts.map +1 -1
- package/_types/core/runtime/HyperWasmSolver-p.d.ts +71 -0
- package/_types/core/runtime/HyperWasmSolver-p.d.ts.map +1 -0
- package/_types/core/runtime/ProtocolVersionResolver-p.d.ts +29 -0
- package/_types/core/runtime/ProtocolVersionResolver-p.d.ts.map +1 -0
- package/_types/core/runtime/initFhevmRuntime-p.d.ts.map +1 -1
- package/_types/core/runtime/resolveFhevmVersions-p.d.ts +21 -0
- package/_types/core/runtime/resolveFhevmVersions-p.d.ts.map +1 -0
- package/_types/core/runtimeConfig-p.d.ts +3 -2
- package/_types/core/runtimeConfig-p.d.ts.map +1 -1
- package/_types/core/types/auth.d.ts +12 -1
- package/_types/core/types/auth.d.ts.map +1 -1
- package/_types/core/types/coreFhevmClient.d.ts +72 -2
- package/_types/core/types/coreFhevmClient.d.ts.map +1 -1
- package/_types/core/types/coreFhevmRuntime.d.ts +3 -9
- package/_types/core/types/coreFhevmRuntime.d.ts.map +1 -1
- package/_types/core/types/fheEncryptionKey.d.ts +2 -0
- package/_types/core/types/fheEncryptionKey.d.ts.map +1 -1
- package/_types/core/types/fhevmChain.d.ts +3 -0
- package/_types/core/types/fhevmChain.d.ts.map +1 -1
- package/_types/core/types/hostContract.d.ts +1 -0
- package/_types/core/types/hostContract.d.ts.map +1 -1
- package/_types/core/types/index.d.ts +1 -1
- package/_types/core/types/index.d.ts.map +1 -1
- package/_types/core/types/kms-p.d.ts +2 -0
- package/_types/core/types/kms-p.d.ts.map +1 -1
- package/_types/core/types/kms.d.ts +71 -21
- package/_types/core/types/kms.d.ts.map +1 -1
- package/_types/core/types/kmsSignersContext.d.ts +8 -0
- package/_types/core/types/kmsSignersContext.d.ts.map +1 -1
- package/_types/core/types/logger.d.ts +1 -0
- package/_types/core/types/logger.d.ts.map +1 -1
- package/_types/core/types/moduleVersions.d.ts +25 -0
- package/_types/core/types/moduleVersions.d.ts.map +1 -0
- package/_types/core/types/tkms-p.d.ts +2 -0
- package/_types/core/types/tkms-p.d.ts.map +1 -1
- package/_types/core/types/wasmAssets.d.ts +2 -0
- package/_types/core/types/wasmAssets.d.ts.map +1 -0
- package/_types/core/types/{zkProofBuilder.d.ts → zkProofBuilder-p.d.ts} +8 -3
- package/_types/core/types/zkProofBuilder-p.d.ts.map +1 -0
- package/_types/core/utils-p/decrypt/verifyTkmsPublicKey.d.ts +2 -0
- package/_types/core/utils-p/decrypt/verifyTkmsPublicKey.d.ts.map +1 -1
- package/_types/ethers/cleartext/createFhevmCleartextDecryptClient.d.ts +2 -2
- package/_types/ethers/cleartext/createFhevmCleartextDecryptClient.d.ts.map +1 -1
- package/_types/ethers/cleartext/createFhevmCleartextEncryptClient.d.ts +2 -2
- package/_types/ethers/cleartext/createFhevmCleartextEncryptClient.d.ts.map +1 -1
- package/_types/ethers/clients/createFhevmDecryptClient.d.ts +2 -2
- package/_types/ethers/clients/createFhevmDecryptClient.d.ts.map +1 -1
- package/_types/ethers/clients/createFhevmEncryptClient.d.ts +2 -2
- package/_types/ethers/clients/createFhevmEncryptClient.d.ts.map +1 -1
- package/_types/viem/cleartext/createFhevmCleartextDecryptClient.d.ts +2 -2
- package/_types/viem/cleartext/createFhevmCleartextDecryptClient.d.ts.map +1 -1
- package/_types/viem/cleartext/createFhevmCleartextEncryptClient.d.ts +2 -2
- package/_types/viem/cleartext/createFhevmCleartextEncryptClient.d.ts.map +1 -1
- package/_types/viem/clients/createFhevmDecryptClient.d.ts +2 -2
- package/_types/viem/clients/createFhevmDecryptClient.d.ts.map +1 -1
- package/_types/viem/clients/createFhevmEncryptClient.d.ts +2 -2
- package/_types/viem/clients/createFhevmEncryptClient.d.ts.map +1 -1
- package/_types/wasm/tfhe/TfheApi.d.ts +12 -12
- package/_types/wasm/tfhe/v1.5.3/tfhe.d.ts +7 -0
- package/_types/wasm/tfhe/{v1.6.1 → v1.6.2}/tfhe.d.ts +92 -85
- package/_types/wasm/tfheModuleVersion-p.d.ts +1 -1
- package/_types/wasm/tfheModuleVersion-p.d.ts.map +1 -1
- package/_types/wasm/tkms/v0.13.10/kms_lib.d.ts +4 -0
- package/_types/wasm/tkms/v0.13.20-0/kms_lib.d.ts +4 -0
- package/_types/wasm/tkmsModuleVersion-p.d.ts +1 -1
- package/_types/wasm/tkmsModuleVersion-p.d.ts.map +1 -1
- package/core/_version.ts +1 -1
- package/core/actions/base/canDecryptPublicValue.ts +1 -1
- package/core/actions/base/canDecryptPublicValues.ts +1 -1
- package/core/actions/base/{fetchKmsSignedcryptedShares.ts → fetchKmsSigncryptedShares.ts} +16 -16
- package/core/actions/base/index.ts +5 -5
- package/core/actions/base/readKmsSignersContext.ts +2 -1
- package/core/actions/chain/parseSignedDecryptionPermit.ts +2 -2
- package/core/actions/chain/parseTransportKeyPair.ts +2 -1
- package/core/actions/decrypt/{decryptKmsSignedcryptedShares.ts → decryptKmsSigncryptedShares.ts} +12 -9
- package/core/actions/decrypt/decryptValue.ts +4 -1
- package/core/actions/decrypt/decryptValues.ts +4 -1
- package/core/actions/decrypt/decryptValuesFromPairs.ts +4 -1
- package/core/actions/decrypt/generateTransportKeyPair.ts +5 -3
- package/core/actions/decrypt/index.ts +4 -4
- package/core/actions/encrypt/encryptValue.ts +4 -1
- package/core/actions/encrypt/encryptValues.ts +4 -1
- package/core/actions/encrypt/generateZkProof.ts +9 -1
- package/core/actions/host/readFhevmExecutorContractData.ts +8 -8
- package/core/actions/host/readInputVerifierContractData.ts +2 -2
- package/core/actions/host/readKmsVerifierContractData.ts +8 -6
- package/core/actions/host/resolveFhevmConfig.ts +10 -1
- package/core/base/bytes.ts +2 -1
- package/core/base/environment.ts +210 -0
- package/core/base/errors/Sha256VerificationError.ts +22 -0
- package/core/base/inflate.ts +373 -0
- package/core/base/isomorphicFs.ts +23 -0
- package/core/base/isomorphicWorker.ts +96 -123
- package/core/base/object.ts +38 -0
- package/core/base/semver.ts +231 -0
- package/core/base/uint.ts +33 -4
- package/core/base/wasm.ts +28 -35
- package/core/chains/definitions/localTestnet.ts +3 -0
- package/core/chains/definitions/mainnet.ts +1 -0
- package/core/chains/definitions/sepolia.ts +6 -6
- package/core/clients/decorators/base.ts +8 -1
- package/core/clients/decorators/decrypt-p.ts +18 -0
- package/core/clients/decorators/decrypt.ts +10 -15
- package/core/clients/decorators/encrypt-p.ts +12 -7
- package/core/clients/decorators/encrypt.ts +6 -4
- package/core/coprocessor/ZkProof-p.ts +17 -5
- package/core/coprocessor/ZkProofBuilder-p.ts +5 -2
- package/core/coprocessor/encrypt.ts +6 -1
- package/core/errors/RelayerResponseStatusError.ts +14 -2
- package/core/host-contracts/HostContractVersion-p.ts +60 -3
- package/core/host-contracts/KmsSignersContext-p.ts +36 -5
- package/core/host-contracts/abi-fragments/fragments.ts +28 -0
- package/core/host-contracts/canDecryptValuesFromPairs.ts +1 -1
- package/core/host-contracts/checkAllowedForDecryption.ts +3 -3
- package/core/host-contracts/checkDelegation.ts +9 -9
- package/core/host-contracts/checkPersistAllowed.ts +10 -10
- package/core/host-contracts/getAclAddress-p.ts +2 -3
- package/core/host-contracts/getCurrentKmsContextAndEpoch-p.ts +92 -0
- package/core/host-contracts/getCurrentKmsContextId-p.ts +8 -8
- package/core/host-contracts/getFhevmExecutorAddress-p.ts +2 -2
- package/core/host-contracts/getHandleVersion-p.ts +2 -3
- package/core/host-contracts/getHcuLimitAddress-p.ts +2 -3
- package/core/host-contracts/getInputVerifierAddress-p.ts +2 -3
- package/core/host-contracts/getKmsContextSignersAndThreshold-p.ts +7 -9
- package/core/host-contracts/getKmsContextSignersAndThresholdFromExtraData-p.ts +6 -7
- package/core/host-contracts/getSignersForKmsContext-p.ts +6 -8
- package/core/host-contracts/isAllowedForDecryption.ts +6 -6
- package/core/host-contracts/isHandleDelegatedForUserDecryption-p.ts +7 -7
- package/core/host-contracts/isUserDecryptable.ts +3 -3
- package/core/host-contracts/persistAllowed.ts +6 -6
- package/core/host-contracts/readKmsSignersContext-p.ts +131 -41
- package/core/key/FheEncryptionKeyWasm-p.ts +24 -3
- package/core/key/deserializeFheEncryptionKey.ts +8 -1
- package/core/key/fetchFheEncryptionKey.ts +8 -4
- package/core/key/fetchFheEncryptionKeyBytes.ts +4 -2
- package/core/key/serializeFheEncryptionKey.ts +8 -2
- package/core/kms/KmsSigncryptedShares-p.ts +11 -1
- package/core/kms/SignedDecryptionPermit-p.ts +6 -1
- package/core/kms/TransportKeyPair-p.ts +52 -11
- package/core/kms/createKmsUserDecryptEip712.ts +11 -0
- package/core/kms/createKmsUserDecryptEip712V2.ts +159 -0
- package/core/kms/{decryptKmsSignedcryptedShares-p.ts → decryptKmsSigncryptedShares-p.ts} +12 -2
- package/core/kms/decryptValuesFromPairs.ts +6 -4
- package/core/kms/{fetchKmsSignedcryptedShares-p.ts → fetchKmsSigncryptedShares-p.ts} +12 -5
- package/core/kms/kmsExtraData.ts +82 -13
- package/core/kms/kmsUserDecryptEip712V2Types.ts +31 -0
- package/core/kms/publicDecrypt.ts +5 -3
- package/core/modules/decrypt/mock.ts +0 -35
- package/core/modules/decrypt/module/api-p.ts +88 -17
- package/core/modules/decrypt/module/index.ts +37 -34
- package/core/modules/decrypt/module/init-p.ts +194 -73
- package/core/modules/decrypt/types.ts +37 -65
- package/core/modules/encrypt/mock.ts +34 -4
- package/core/modules/encrypt/module/api-p.ts +66 -15
- package/core/modules/encrypt/module/index.ts +5 -3
- package/core/modules/encrypt/module/init-p.ts +465 -101
- package/core/modules/encrypt/types.ts +34 -2
- package/core/modules/relayer/cleartext/fetchDelegatedUserDecrypt.ts +2 -2
- package/core/modules/relayer/cleartext/fetchUserDecrypt.ts +2 -2
- package/core/modules/relayer/module/RelayerAsyncRequest.ts +60 -4
- package/core/modules/relayer/module/fetchFheEncryptionKeySource.ts +9 -1
- package/core/modules/relayer/module/readErrorMessage.ts +56 -0
- package/core/runtime/CoreFhevm-p.ts +247 -22
- package/core/runtime/HyperWasmSolver-p.ts +417 -0
- package/core/runtime/ProtocolVersionResolver-p.ts +463 -0
- package/core/runtime/initFhevmDecryptRuntime-p.ts +1 -1
- package/core/runtime/initFhevmEncryptRuntime-p.ts +1 -1
- package/core/runtime/initFhevmRuntime-p.ts +4 -1
- package/core/runtime/resolveFhevmVersions-p.ts +85 -0
- package/core/runtimeConfig-p.ts +17 -2
- package/core/types/auth.ts +12 -1
- package/core/types/coreFhevmClient.ts +89 -4
- package/core/types/coreFhevmRuntime.ts +3 -18
- package/core/types/fheEncryptionKey.ts +2 -0
- package/core/types/fhevmChain.ts +3 -0
- package/core/types/hostContract.ts +1 -0
- package/core/types/index.ts +1 -1
- package/core/types/kms-p.ts +2 -0
- package/core/types/kms.ts +48 -18
- package/core/types/kmsSignersContext.ts +8 -0
- package/core/types/logger.ts +1 -0
- package/core/types/moduleVersions.ts +35 -0
- package/core/types/tkms-p.ts +3 -0
- package/core/types/wasmAssets.ts +64 -0
- package/core/types/{zkProofBuilder.ts → zkProofBuilder-p.ts} +3 -2
- package/core/utils-p/decrypt/verifyTkmsPublicKey.ts +3 -1
- package/ethers/cleartext/createFhevmCleartextDecryptClient.ts +2 -2
- package/ethers/cleartext/createFhevmCleartextEncryptClient.ts +2 -2
- package/ethers/clients/createFhevmDecryptClient.ts +2 -2
- package/ethers/clients/createFhevmEncryptClient.ts +2 -2
- package/ethers/internal/config.ts +2 -30
- package/package.json +1 -1
- package/viem/cleartext/createFhevmCleartextDecryptClient.ts +2 -2
- package/viem/cleartext/createFhevmCleartextEncryptClient.ts +2 -2
- package/viem/clients/createFhevmDecryptClient.ts +2 -2
- package/viem/clients/createFhevmEncryptClient.ts +2 -2
- package/viem/internal/config.ts +2 -30
- package/wasm/tfhe/TfheApi.d.ts +12 -12
- package/wasm/tfhe/loadTfheLib.js +11 -11
- package/wasm/tfhe/v1.5.3/startWorkers.js +41 -20
- package/wasm/tfhe/v1.5.3/tfhe.d.ts +7 -0
- package/wasm/tfhe/v1.5.3/tfhe.js +8 -0
- package/wasm/tfhe/v1.6.0-dev/startWorkers.js +41 -20
- package/wasm/tfhe/v1.6.0-dev/tfhe.d.ts +7 -0
- package/wasm/tfhe/v1.6.0-dev/tfhe.js +8 -0
- package/wasm/tfhe/{v1.6.1 → v1.6.2}/startWorkers.js +46 -25
- package/wasm/tfhe/{v1.6.1 → v1.6.2}/tfhe-worker.mjs +40 -40
- package/wasm/tfhe/{v1.6.1 → v1.6.2}/tfhe.d.ts +92 -85
- package/wasm/tfhe/{v1.6.1 → v1.6.2}/tfhe.js +253 -442
- package/wasm/tfhe/v1.6.2/tfhe_bg.wasm +0 -0
- package/wasm/tfhe/v1.6.2/tfhe_bg.wasm.base64.js +7 -0
- package/wasm/tfheModuleVersion-p.ts +1 -1
- package/wasm/tkms/v0.13.10/kms_lib.d.ts +4 -0
- package/wasm/tkms/v0.13.10/kms_lib.js +8 -0
- package/wasm/tkms/v0.13.20-0/kms_lib.d.ts +4 -0
- package/wasm/tkms/v0.13.20-0/kms_lib.js +8 -0
- package/wasm/tkmsModuleVersion-p.ts +1 -1
- package/wasm/wasmBaseUrl.js +32 -4
- package/_cjs/core/actions/base/fetchKmsSignedcryptedShares.js.map +0 -1
- package/_cjs/core/actions/decrypt/decryptKmsSignedcryptedShares.js +0 -11
- package/_cjs/core/actions/decrypt/decryptKmsSignedcryptedShares.js.map +0 -1
- package/_cjs/core/kms/decryptKmsSignedcryptedShares-p.js.map +0 -1
- package/_cjs/core/kms/fetchKmsSignedcryptedShares-p.js.map +0 -1
- package/_cjs/core/types/fhevmDecryptionKey.js.map +0 -1
- package/_cjs/core/types/fhevmUser.js.map +0 -1
- package/_cjs/core/types/zkProofBuilder.js.map +0 -1
- package/_cjs/wasm/tfhe/v1.6.1/startWorkers.js.map +0 -7
- package/_cjs/wasm/tfhe/v1.6.1/tfhe.js.map +0 -7
- package/_cjs/wasm/tfhe/v1.6.1/tfhe_bg.wasm +0 -0
- package/_cjs/wasm/tfhe/v1.6.1/tfhe_bg.wasm.base64.js +0 -35
- package/_cjs/wasm/tfhe/v1.6.1/tfhe_bg.wasm.base64.js.map +0 -7
- package/_esm/core/actions/base/fetchKmsSignedcryptedShares.js.map +0 -1
- package/_esm/core/actions/decrypt/decryptKmsSignedcryptedShares.js +0 -9
- package/_esm/core/actions/decrypt/decryptKmsSignedcryptedShares.js.map +0 -1
- package/_esm/core/kms/decryptKmsSignedcryptedShares-p.js.map +0 -1
- package/_esm/core/kms/fetchKmsSignedcryptedShares-p.js.map +0 -1
- package/_esm/core/types/fhevmDecryptionKey.js +0 -2
- package/_esm/core/types/fhevmDecryptionKey.js.map +0 -1
- package/_esm/core/types/fhevmUser.js +0 -2
- package/_esm/core/types/fhevmUser.js.map +0 -1
- package/_esm/core/types/zkProofBuilder.js +0 -2
- package/_esm/core/types/zkProofBuilder.js.map +0 -1
- package/_esm/wasm/tfhe/v1.6.1/tfhe_bg.wasm +0 -0
- package/_esm/wasm/tfhe/v1.6.1/tfhe_bg.wasm.base64.js +0 -7
- package/_types/core/actions/base/fetchKmsSignedcryptedShares.d.ts.map +0 -1
- package/_types/core/actions/decrypt/decryptKmsSignedcryptedShares.d.ts.map +0 -1
- package/_types/core/kms/decryptKmsSignedcryptedShares-p.d.ts.map +0 -1
- package/_types/core/kms/fetchKmsSignedcryptedShares-p.d.ts.map +0 -1
- package/_types/core/types/fhevmDecryptionKey.d.ts +0 -4
- package/_types/core/types/fhevmDecryptionKey.d.ts.map +0 -1
- package/_types/core/types/fhevmUser.d.ts +0 -7
- package/_types/core/types/fhevmUser.d.ts.map +0 -1
- package/_types/core/types/zkProofBuilder.d.ts.map +0 -1
- package/core/types/fhevmDecryptionKey.ts +0 -8
- package/core/types/fhevmUser.ts +0 -7
- package/wasm/tfhe/v1.6.1/tfhe_bg.wasm +0 -0
- package/wasm/tfhe/v1.6.1/tfhe_bg.wasm.base64.js +0 -7
- /package/_cjs/wasm/tfhe/{v1.6.1 → v1.6.2}/tfhe_bg.wasm.base64.d.ts +0 -0
- /package/_esm/wasm/tfhe/{v1.6.1 → v1.6.2}/tfhe_bg.wasm.base64.d.ts +0 -0
- /package/_types/wasm/tfhe/{v1.6.1 → v1.6.2}/tfhe_bg.wasm.base64.d.ts +0 -0
- /package/wasm/tfhe/{v1.6.1 → v1.6.2}/tfhe_bg.wasm.base64.d.ts +0 -0
|
@@ -8,6 +8,7 @@ import { addressToChecksummedAddress, assertIsAddress } from '../../base/address
|
|
|
8
8
|
import { toArray } from '../../base/object.js';
|
|
9
9
|
import { createTypedValue } from '../../base/typedValue.js';
|
|
10
10
|
import { encrypt as encrypt_ } from '../../coprocessor/encrypt.js';
|
|
11
|
+
import { asFhevmWithTfheVersion } from '../../runtime/CoreFhevm-p.js';
|
|
11
12
|
|
|
12
13
|
////////////////////////////////////////////////////////////////////////////////
|
|
13
14
|
|
|
@@ -37,7 +38,9 @@ export async function encryptValue(
|
|
|
37
38
|
assertIsAddress(contractAddress, {});
|
|
38
39
|
assertIsAddress(userAddress, {});
|
|
39
40
|
|
|
40
|
-
const
|
|
41
|
+
const f = asFhevmWithTfheVersion(fhevm);
|
|
42
|
+
|
|
43
|
+
const result = await encrypt_(f, {
|
|
41
44
|
contractAddress: addressToChecksummedAddress(contractAddress),
|
|
42
45
|
userAddress: addressToChecksummedAddress(userAddress),
|
|
43
46
|
values,
|
|
@@ -7,6 +7,7 @@ import type { EncryptedValue } from '../../types/encryptedTypes.js';
|
|
|
7
7
|
import { addressToChecksummedAddress, assertIsAddress } from '../../base/address.js';
|
|
8
8
|
import { createTypedValue } from '../../base/typedValue.js';
|
|
9
9
|
import { encrypt as encrypt_ } from '../../coprocessor/encrypt.js';
|
|
10
|
+
import { asFhevmWithTfheVersion } from '../../runtime/CoreFhevm-p.js';
|
|
10
11
|
|
|
11
12
|
////////////////////////////////////////////////////////////////////////////////
|
|
12
13
|
|
|
@@ -35,7 +36,9 @@ export async function encryptValues(
|
|
|
35
36
|
assertIsAddress(contractAddress, {});
|
|
36
37
|
assertIsAddress(userAddress, {});
|
|
37
38
|
|
|
38
|
-
const
|
|
39
|
+
const f = asFhevmWithTfheVersion(fhevm);
|
|
40
|
+
|
|
41
|
+
const result = await encrypt_(f, {
|
|
39
42
|
contractAddress: addressToChecksummedAddress(contractAddress),
|
|
40
43
|
userAddress: addressToChecksummedAddress(userAddress),
|
|
41
44
|
values,
|
|
@@ -2,8 +2,10 @@ import type { Fhevm } from '../../types/coreFhevmClient.js';
|
|
|
2
2
|
import type { WithEncrypt } from '../../types/coreFhevmRuntime.js';
|
|
3
3
|
import type { FhevmChain } from '../../types/fhevmChain.js';
|
|
4
4
|
import type { ZkProof } from '../../types/zkProof-p.js';
|
|
5
|
+
import type { BytesHex } from '../../types/primitives.js';
|
|
5
6
|
import { createTypedValue } from '../../base/typedValue.js';
|
|
6
7
|
import { createZkProofBuilder } from '../../coprocessor/ZkProofBuilder-p.js';
|
|
8
|
+
import { asFhevmWithTfheVersion } from '../../runtime/CoreFhevm-p.js';
|
|
7
9
|
|
|
8
10
|
////////////////////////////////////////////////////////////////////////////////
|
|
9
11
|
|
|
@@ -22,12 +24,18 @@ export async function generateZkProof(
|
|
|
22
24
|
parameters: GenerateZkProofParameters,
|
|
23
25
|
): Promise<GenerateZkProofReturnType> {
|
|
24
26
|
const { values, contractAddress, userAddress } = parameters;
|
|
27
|
+
const hardCodedExtraData = '0x00' as BytesHex;
|
|
28
|
+
|
|
25
29
|
const builder = createZkProofBuilder();
|
|
26
30
|
for (const value of values) {
|
|
27
31
|
builder.addTypedValue(createTypedValue(value));
|
|
28
32
|
}
|
|
29
|
-
|
|
33
|
+
|
|
34
|
+
const f = asFhevmWithTfheVersion(fhevm);
|
|
35
|
+
|
|
36
|
+
return builder.build(f, {
|
|
30
37
|
contractAddress,
|
|
31
38
|
userAddress,
|
|
39
|
+
extraData: hardCodedExtraData,
|
|
32
40
|
});
|
|
33
41
|
}
|
|
@@ -10,7 +10,7 @@ import { getAclAddress } from '../../host-contracts/getAclAddress-p.js';
|
|
|
10
10
|
import { getHandleVersion } from '../../host-contracts/getHandleVersion-p.js';
|
|
11
11
|
import { getHcuLimitAddress } from '../../host-contracts/getHcuLimitAddress-p.js';
|
|
12
12
|
import { assertIsHostContractVersionOf } from '../../host-contracts/HostContractVersion-p.js';
|
|
13
|
-
import {
|
|
13
|
+
import { getHostContractVersion } from '../../host-contracts/HostContractVersion-p.js';
|
|
14
14
|
import { getInputVerifierAddress } from '../../host-contracts/getInputVerifierAddress-p.js';
|
|
15
15
|
|
|
16
16
|
export type ReadFhevmExecutorContractDataParameters = {
|
|
@@ -22,7 +22,7 @@ export async function readFhevmExecutorContractData(
|
|
|
22
22
|
fhevm: Fhevm,
|
|
23
23
|
parameters: ReadFhevmExecutorContractDataParameters,
|
|
24
24
|
): Promise<ReadFhevmExecutorContractDataReturnType> {
|
|
25
|
-
const
|
|
25
|
+
const fhevmExecutorAddress = parameters.address;
|
|
26
26
|
|
|
27
27
|
////////////////////////////////////////////////////////////////////////////
|
|
28
28
|
//
|
|
@@ -36,11 +36,11 @@ export async function readFhevmExecutorContractData(
|
|
|
36
36
|
////////////////////////////////////////////////////////////////////////////
|
|
37
37
|
|
|
38
38
|
const rpcCalls = [
|
|
39
|
-
() =>
|
|
40
|
-
() => getAclAddress(fhevm,
|
|
41
|
-
() => getHcuLimitAddress(fhevm,
|
|
42
|
-
() => getInputVerifierAddress(fhevm,
|
|
43
|
-
() => getHandleVersion(fhevm,
|
|
39
|
+
() => getHostContractVersion(fhevm, parameters),
|
|
40
|
+
() => getAclAddress(fhevm, { fhevmExecutorAddress }),
|
|
41
|
+
() => getHcuLimitAddress(fhevm, { fhevmExecutorAddress }),
|
|
42
|
+
() => getInputVerifierAddress(fhevm, { fhevmExecutorAddress }),
|
|
43
|
+
() => getHandleVersion(fhevm, { fhevmExecutorAddress }),
|
|
44
44
|
];
|
|
45
45
|
|
|
46
46
|
const res = await executeWithBatching<unknown>(rpcCalls, fhevm.options.batchRpcCalls);
|
|
@@ -63,7 +63,7 @@ export async function readFhevmExecutorContractData(
|
|
|
63
63
|
|
|
64
64
|
const data = createFhevmExecutorContractData(new WeakRef(fhevm.runtime), {
|
|
65
65
|
version: contractVersion,
|
|
66
|
-
address:
|
|
66
|
+
address: fhevmExecutorAddress,
|
|
67
67
|
aclContractAddress,
|
|
68
68
|
inputVerifierContractAddress,
|
|
69
69
|
hcuLimitContractAddress,
|
|
@@ -6,7 +6,7 @@ import type { CoprocessorSignersContext } from '../../types/coprocessorSignersCo
|
|
|
6
6
|
import { eip712Domain, type Eip712DomainReturnType } from '../../host-contracts/eip712Domain-p.js';
|
|
7
7
|
import { assertIsHostContractVersionOf } from '../../host-contracts/HostContractVersion-p.js';
|
|
8
8
|
import { readCoprocessorSignersContext } from '../../host-contracts/readCoprocessorSignersContext-p.js';
|
|
9
|
-
import {
|
|
9
|
+
import { getHostContractVersion } from '../../host-contracts/HostContractVersion-p.js';
|
|
10
10
|
import { executeWithBatching } from '../../base/promise.js';
|
|
11
11
|
import { assertIsCoprocessorEip712Domain } from '../../coprocessor/assertIsCoprocessorEip712Domain.js';
|
|
12
12
|
import { createInputVerifierContractData } from '../../host-contracts/InputVerifierContractData-p.js';
|
|
@@ -39,7 +39,7 @@ export async function readInputVerifierContractData(
|
|
|
39
39
|
////////////////////////////////////////////////////////////////////////////
|
|
40
40
|
|
|
41
41
|
const rpcCalls = [
|
|
42
|
-
() =>
|
|
42
|
+
() => getHostContractVersion(fhevm, parameters),
|
|
43
43
|
() => eip712Domain(fhevm, parameters),
|
|
44
44
|
() => readCoprocessorSignersContext(fhevm, parameters),
|
|
45
45
|
];
|
|
@@ -9,13 +9,14 @@ import { createKmsVerifierContractData } from '../../host-contracts/KmsVerifierC
|
|
|
9
9
|
import { assertIsKmsEip712Domain } from '../../kms/createKmsEip712Domain.js';
|
|
10
10
|
import { eip712Domain } from '../../host-contracts/eip712Domain-p.js';
|
|
11
11
|
import { assertIsHostContractVersionOf } from '../../host-contracts/HostContractVersion-p.js';
|
|
12
|
-
import {
|
|
12
|
+
import { getHostContractVersion } from '../../host-contracts/HostContractVersion-p.js';
|
|
13
13
|
import { readKmsSignersContext } from '../../host-contracts/readKmsSignersContext-p.js';
|
|
14
14
|
|
|
15
15
|
////////////////////////////////////////////////////////////////////////////////
|
|
16
16
|
|
|
17
17
|
export type ReadKmsVerifierContractDataParameters = {
|
|
18
18
|
readonly address: ChecksummedAddress;
|
|
19
|
+
readonly protocolConfigAddress: ChecksummedAddress | undefined;
|
|
19
20
|
};
|
|
20
21
|
|
|
21
22
|
export type ReadKmsVerifierContractDataReturnType = KmsVerifierContractData;
|
|
@@ -26,7 +27,8 @@ export async function readKmsVerifierContractData(
|
|
|
26
27
|
fhevm: Fhevm,
|
|
27
28
|
parameters: ReadKmsVerifierContractDataParameters,
|
|
28
29
|
): Promise<ReadKmsVerifierContractDataReturnType> {
|
|
29
|
-
const
|
|
30
|
+
const kmsVerifierAddress = parameters.address;
|
|
31
|
+
const protocolConfigAddress = parameters.protocolConfigAddress;
|
|
30
32
|
|
|
31
33
|
////////////////////////////////////////////////////////////////////////////
|
|
32
34
|
//
|
|
@@ -40,9 +42,9 @@ export async function readKmsVerifierContractData(
|
|
|
40
42
|
////////////////////////////////////////////////////////////////////////////
|
|
41
43
|
|
|
42
44
|
const rpcCalls = [
|
|
43
|
-
() =>
|
|
45
|
+
() => getHostContractVersion(fhevm, parameters),
|
|
44
46
|
() => eip712Domain(fhevm, parameters),
|
|
45
|
-
() => readKmsSignersContext(fhevm,
|
|
47
|
+
() => readKmsSignersContext(fhevm, { kmsVerifierAddress, protocolConfigAddress }),
|
|
46
48
|
];
|
|
47
49
|
|
|
48
50
|
const res = await executeWithBatching<unknown>(rpcCalls, fhevm.options.batchRpcCalls);
|
|
@@ -59,13 +61,13 @@ export async function readKmsVerifierContractData(
|
|
|
59
61
|
throw new Error(`Invalid KMSVerifier EIP-712 domain.`, { cause: e });
|
|
60
62
|
}
|
|
61
63
|
|
|
62
|
-
if (eip712DomainRes.verifyingContract.toLowerCase() ===
|
|
64
|
+
if (eip712DomainRes.verifyingContract.toLowerCase() === kmsVerifierAddress.toLowerCase()) {
|
|
63
65
|
throw new Error(`Invalid KMSVerifier EIP-712 domain. Unexpected verifyingContract.`);
|
|
64
66
|
}
|
|
65
67
|
|
|
66
68
|
const data = createKmsVerifierContractData(new WeakRef(fhevm.runtime), {
|
|
67
69
|
version: contractVersion,
|
|
68
|
-
address:
|
|
70
|
+
address: kmsVerifierAddress,
|
|
69
71
|
eip712Domain: eip712DomainRes,
|
|
70
72
|
kmsSignerThreshold: kmsSignersContext.threshold,
|
|
71
73
|
kmsSigners: kmsSignersContext.signers,
|
|
@@ -29,6 +29,7 @@ export type ResolveFhevmConfigParameters = {
|
|
|
29
29
|
readonly hcuLimit?: OptionalChainContract | undefined;
|
|
30
30
|
readonly inputVerifier?: OptionalChainContract | undefined;
|
|
31
31
|
readonly kmsVerifier: { readonly address: string };
|
|
32
|
+
readonly protocolConfig: OptionalChainContract | undefined;
|
|
32
33
|
};
|
|
33
34
|
readonly gateway?:
|
|
34
35
|
| {
|
|
@@ -52,6 +53,7 @@ export type ResolveFhevmConfigReturnType = {
|
|
|
52
53
|
readonly fhevmExecutor: FhevmExecutorContractData;
|
|
53
54
|
readonly inputVerifier: InputVerifierContractData;
|
|
54
55
|
readonly kmsVerifier: KmsVerifierContractData;
|
|
56
|
+
readonly protocolConfig: ChecksummedAddress | undefined;
|
|
55
57
|
};
|
|
56
58
|
|
|
57
59
|
////////////////////////////////////////////////////////////////////////////////
|
|
@@ -64,6 +66,11 @@ export async function resolveFhevmConfig(
|
|
|
64
66
|
const kmsVerifierAddress = parameters.fhevm.contracts.kmsVerifier.address;
|
|
65
67
|
assertIsAddress(kmsVerifierAddress, {});
|
|
66
68
|
|
|
69
|
+
const protocolConfigAddress = parameters.fhevm.contracts.protocolConfig?.address;
|
|
70
|
+
if (protocolConfigAddress !== undefined) {
|
|
71
|
+
assertIsAddress(protocolConfigAddress, {});
|
|
72
|
+
}
|
|
73
|
+
|
|
67
74
|
const id: Uint64BigInt = await resolveChainId(fhevm, parameters);
|
|
68
75
|
const fhevmExecutorData = await _resolveFhevmExecutor(fhevm, parameters.fhevm.contracts);
|
|
69
76
|
|
|
@@ -86,6 +93,7 @@ export async function resolveFhevmConfig(
|
|
|
86
93
|
() =>
|
|
87
94
|
readKmsVerifierContractData(fhevm, {
|
|
88
95
|
address: addressToChecksummedAddress(kmsVerifierAddress),
|
|
96
|
+
protocolConfigAddress: protocolConfigAddress ? addressToChecksummedAddress(protocolConfigAddress) : undefined,
|
|
89
97
|
}),
|
|
90
98
|
];
|
|
91
99
|
|
|
@@ -120,6 +128,7 @@ export async function resolveFhevmConfig(
|
|
|
120
128
|
fhevmExecutor: fhevmExecutorData,
|
|
121
129
|
inputVerifier: inputVerifierData,
|
|
122
130
|
kmsVerifier: kmsVerifierData,
|
|
131
|
+
protocolConfig: protocolConfigAddress ? addressToChecksummedAddress(protocolConfigAddress) : undefined,
|
|
123
132
|
};
|
|
124
133
|
|
|
125
134
|
return Object.freeze(returnValue);
|
|
@@ -150,7 +159,7 @@ async function _resolveFhevmExecutor(
|
|
|
150
159
|
|
|
151
160
|
if (acl !== undefined) {
|
|
152
161
|
const aclFhevmExecutor = await getFhevmExecutorAddress(fhevm, {
|
|
153
|
-
|
|
162
|
+
aclAddress: addressToChecksummedAddress(acl),
|
|
154
163
|
});
|
|
155
164
|
if (fhevmExecutor !== undefined) {
|
|
156
165
|
if (aclFhevmExecutor !== fhevmExecutor) {
|
package/core/base/bytes.ts
CHANGED
|
@@ -37,6 +37,7 @@ import { is0x, isNo0x, remove0x } from './string.js';
|
|
|
37
37
|
import { InvalidPropertyError } from './errors/InvalidPropertyError.js';
|
|
38
38
|
import { InvalidTypeError } from './errors/InvalidTypeError.js';
|
|
39
39
|
import { isUintForByteLength } from './uint.js';
|
|
40
|
+
import { Sha256VerificationError } from './errors/Sha256VerificationError.js';
|
|
40
41
|
|
|
41
42
|
////////////////////////////////////////////////////////////////////////////////
|
|
42
43
|
|
|
@@ -1446,7 +1447,7 @@ export async function verifySha256(
|
|
|
1446
1447
|
|
|
1447
1448
|
if (actual !== expected) {
|
|
1448
1449
|
const subject = options?.subject ?? 'bytes';
|
|
1449
|
-
throw new
|
|
1450
|
+
throw new Sha256VerificationError({ subject, expected, actual }, {});
|
|
1450
1451
|
}
|
|
1451
1452
|
}
|
|
1452
1453
|
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JS-runtime environment detection and capability probes.
|
|
3
|
+
*
|
|
4
|
+
* Everything in this file answers one of two questions about the host
|
|
5
|
+
* environment the SDK happens to be running in:
|
|
6
|
+
*
|
|
7
|
+
* - *Which* runtime is this? — {@link isNodeLike}, {@link isBrowserLike}
|
|
8
|
+
* - *What* does it support? — {@link getNodeBuffer}
|
|
9
|
+
*
|
|
10
|
+
* Detection is intentionally capability-leaning rather than UA-based: edge
|
|
11
|
+
* runtimes (Vercel Edge, Cloudflare Workers, Next.js edge) are neither Node nor
|
|
12
|
+
* browser, so probes return the safe answer (`false` / `undefined`) and callers
|
|
13
|
+
* fall back to web-standard APIs.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
export function isNodeLike(): boolean {
|
|
17
|
+
return (
|
|
18
|
+
// eslint-disable-next-line no-restricted-globals
|
|
19
|
+
typeof process !== 'undefined' &&
|
|
20
|
+
// eslint-disable-next-line no-restricted-globals, @typescript-eslint/no-unnecessary-condition
|
|
21
|
+
typeof process.versions?.node === 'string'
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function isBrowserLike(): boolean {
|
|
26
|
+
return (
|
|
27
|
+
// @ts-expect-error - Bun is a runtime global only under Bun
|
|
28
|
+
typeof Bun === 'undefined' &&
|
|
29
|
+
!isNodeLike() &&
|
|
30
|
+
typeof location !== 'undefined' &&
|
|
31
|
+
typeof location.href === 'string' &&
|
|
32
|
+
typeof addEventListener === 'function' &&
|
|
33
|
+
typeof removeEventListener === 'function'
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Imports a Node built-in module by name, returning `undefined` when it isn't
|
|
39
|
+
* importable (browsers, and edge runtimes: Vercel Edge, Cloudflare Workers,
|
|
40
|
+
* Next.js edge). The id is built indirectly so bundlers don't statically
|
|
41
|
+
* resolve/polyfill the module (a polyfill would bloat browser bundles).
|
|
42
|
+
*
|
|
43
|
+
* Every major bundler must be told NOT to analyze this computed dynamic import,
|
|
44
|
+
* each via its own magic comment, or it errors at build/runtime:
|
|
45
|
+
* - `@vite-ignore` — Vite.
|
|
46
|
+
* - `webpackIgnore` — webpack.
|
|
47
|
+
* - `turbopackIgnore` — Turbopack (Next.js). Without it, Turbopack can't analyze
|
|
48
|
+
* the parameter-derived specifier, can't bundle a `node:` builtin as a
|
|
49
|
+
* candidate, and replaces the call with a stub that throws
|
|
50
|
+
* `Cannot find module 'unknown'` — which silently disabled the Node
|
|
51
|
+
* `worker_threads` backend (→ single-threaded TFHE) in Next server components.
|
|
52
|
+
*
|
|
53
|
+
* Each comment instructs its bundler to emit a plain native `import()` that the
|
|
54
|
+
* runtime resolves; in the browser that throws and is caught below (→ undefined).
|
|
55
|
+
* Each capability accessor below wraps this and memoizes its result.
|
|
56
|
+
*/
|
|
57
|
+
async function _importNodeModule<mod>(name: string): Promise<mod | undefined> {
|
|
58
|
+
try {
|
|
59
|
+
const id = `node:${name}`;
|
|
60
|
+
return (await import(/* @vite-ignore */ /* webpackIgnore: true */ /* turbopackIgnore: true */ id)) as mod;
|
|
61
|
+
} catch {
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
type NodeBuffer = { from(str: string, encoding: string): BufferSource };
|
|
67
|
+
|
|
68
|
+
let _nodeBufferPromise: Promise<NodeBuffer | undefined> | undefined;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Resolves Node's `Buffer` if `node:buffer` is importable, else `undefined`.
|
|
72
|
+
*
|
|
73
|
+
* Memoized — the answer can't change within a process lifetime. Returns the
|
|
74
|
+
* `Buffer` reference (not a boolean) because `Buffer` is not a global: the
|
|
75
|
+
* caller needs the actual constructor, so probing and use share one import.
|
|
76
|
+
*
|
|
77
|
+
* Returns `undefined` in non-Node runtimes that also lack `node:buffer`
|
|
78
|
+
* (browsers, and edge runtimes: Vercel Edge, Cloudflare Workers, Next.js edge).
|
|
79
|
+
*/
|
|
80
|
+
export function getNodeBuffer(): Promise<NodeBuffer | undefined> {
|
|
81
|
+
_nodeBufferPromise ??= (async () => {
|
|
82
|
+
const mod = await _importNodeModule<{ Buffer?: NodeBuffer }>('buffer');
|
|
83
|
+
return typeof mod?.Buffer?.from === 'function' ? mod.Buffer : undefined;
|
|
84
|
+
})();
|
|
85
|
+
return _nodeBufferPromise;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Node's `readFile` returns a `Buffer`, which extends `Uint8Array` but whose
|
|
89
|
+
// `.buffer` TS 5.7+ widens to `ArrayBufferLike` (includes `SharedArrayBuffer`),
|
|
90
|
+
// making it incompatible with `BufferSource`. At runtime a `Buffer` is always
|
|
91
|
+
// backed by an `ArrayBuffer`, so typing the result as `BufferSource` here is a
|
|
92
|
+
// safe cast that lets callers pass the bytes to `WebAssembly.compile` directly.
|
|
93
|
+
type NodeFs = {
|
|
94
|
+
readFile(path: string): Promise<BufferSource>;
|
|
95
|
+
access(path: string): Promise<void>;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
let _nodeFsPromise: Promise<NodeFs | undefined> | undefined;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Resolves Node's `fs/promises` (`readFile`, `access`) if importable, else
|
|
102
|
+
* `undefined` (browsers and edge runtimes). Memoized. See {@link getNodeBuffer}
|
|
103
|
+
* for why this returns the module reference rather than a boolean.
|
|
104
|
+
*/
|
|
105
|
+
export function getNodeFs(): Promise<NodeFs | undefined> {
|
|
106
|
+
_nodeFsPromise ??= (async () => {
|
|
107
|
+
const mod = await _importNodeModule<NodeFs>('fs/promises');
|
|
108
|
+
return typeof mod?.readFile === 'function' ? mod : undefined;
|
|
109
|
+
})();
|
|
110
|
+
return _nodeFsPromise;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
type NodeUrl = { fileURLToPath(url: URL | string): string };
|
|
114
|
+
|
|
115
|
+
let _nodeUrlPromise: Promise<NodeUrl | undefined> | undefined;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Resolves Node's `url` (`fileURLToPath`) if importable, else `undefined`
|
|
119
|
+
* (browsers and edge runtimes). Memoized. See {@link getNodeBuffer} for why
|
|
120
|
+
* this returns the module reference rather than a boolean.
|
|
121
|
+
*/
|
|
122
|
+
export function getNodeUrl(): Promise<NodeUrl | undefined> {
|
|
123
|
+
_nodeUrlPromise ??= (async () => {
|
|
124
|
+
const mod = await _importNodeModule<NodeUrl>('url');
|
|
125
|
+
return typeof mod?.fileURLToPath === 'function' ? mod : undefined;
|
|
126
|
+
})();
|
|
127
|
+
return _nodeUrlPromise;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Returns whether the Web Worker API is available (browsers, Deno, and other
|
|
132
|
+
* web-standard runtimes). Synchronous — checks for the required globals only.
|
|
133
|
+
*/
|
|
134
|
+
export function supportsWebWorkerApi(): boolean {
|
|
135
|
+
return (
|
|
136
|
+
typeof Worker === 'function' &&
|
|
137
|
+
typeof Blob === 'function' &&
|
|
138
|
+
typeof URL !== 'undefined' &&
|
|
139
|
+
typeof URL.createObjectURL === 'function'
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
let _decompressionStreamSupported: boolean | undefined;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Returns whether `DecompressionStream` is actually *usable* (plus the `Blob`
|
|
147
|
+
* pipeline it feeds). Needed to inflate compressed embedded WASM.
|
|
148
|
+
*
|
|
149
|
+
* A `typeof` presence check is insufficient: some runtimes — notably the Next.js
|
|
150
|
+
* Edge Runtime — expose `DecompressionStream` as a global **stub that throws on
|
|
151
|
+
* construction**, so presence is a false positive that crashes later inside the
|
|
152
|
+
* compile path. We therefore *construct* one (synchronous, cheap) and memoize the
|
|
153
|
+
* result (support can't change within a process lifetime).
|
|
154
|
+
*
|
|
155
|
+
* Returns `false` on older browsers (Firefox <113, Safari <16.4) and edge runtimes,
|
|
156
|
+
* so callers fall back (uncompressed / URL-based / JS-inflate WASM loading).
|
|
157
|
+
*/
|
|
158
|
+
export function supportsDecompressionStream(): boolean {
|
|
159
|
+
if (_decompressionStreamSupported === undefined) {
|
|
160
|
+
if (typeof DecompressionStream !== 'function' || typeof Blob !== 'function') {
|
|
161
|
+
_decompressionStreamSupported = false;
|
|
162
|
+
} else {
|
|
163
|
+
try {
|
|
164
|
+
// Construction is the probe — the Next.js Edge stub throws here; a real
|
|
165
|
+
// implementation does not. Assigned (not bare `new`) so it reads as a value
|
|
166
|
+
// probe, and discarded.
|
|
167
|
+
const probe = new DecompressionStream('gzip');
|
|
168
|
+
void probe;
|
|
169
|
+
_decompressionStreamSupported = true;
|
|
170
|
+
} catch {
|
|
171
|
+
_decompressionStreamSupported = false;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return _decompressionStreamSupported;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** Message envelope exchanged with a Node `worker_threads` worker. */
|
|
179
|
+
export interface MessageData {
|
|
180
|
+
type: string;
|
|
181
|
+
[key: string]: unknown;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/** Shape of a Node `worker_threads` worker instance the SDK relies on. */
|
|
185
|
+
export interface NodeMessagePort {
|
|
186
|
+
on(event: 'error', listener: (error: Error) => void): void;
|
|
187
|
+
on(event: 'exit', listener: (code: number) => void): void;
|
|
188
|
+
on(event: string, listener: (data: MessageData) => void): void;
|
|
189
|
+
off(event: string, listener: (data: MessageData) => void): void;
|
|
190
|
+
postMessage(value: unknown): void;
|
|
191
|
+
terminate(): Promise<number>;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
type NodeWorkerConstructor = new (code: string | URL, options?: Record<string, unknown>) => NodeMessagePort;
|
|
195
|
+
|
|
196
|
+
let _nodeWorkerPromise: Promise<NodeWorkerConstructor | undefined> | undefined;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Resolves Node's `worker_threads` `Worker` constructor if importable, else
|
|
200
|
+
* `undefined` (browser, sandboxed Electron renderer, edge runtimes). Memoized.
|
|
201
|
+
* See {@link getNodeBuffer} for why this returns the constructor rather than a
|
|
202
|
+
* boolean.
|
|
203
|
+
*/
|
|
204
|
+
export function getNodeWorker(): Promise<NodeWorkerConstructor | undefined> {
|
|
205
|
+
_nodeWorkerPromise ??= (async () => {
|
|
206
|
+
const mod = await _importNodeModule<{ Worker?: NodeWorkerConstructor }>('worker_threads');
|
|
207
|
+
return typeof mod?.Worker === 'function' ? mod.Worker : undefined;
|
|
208
|
+
})();
|
|
209
|
+
return _nodeWorkerPromise;
|
|
210
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ErrorMetadataParams } from './ErrorBase.js';
|
|
2
|
+
import { ErrorBase } from './ErrorBase.js';
|
|
3
|
+
|
|
4
|
+
export type Sha256VerificationErrorType = Sha256VerificationError & {
|
|
5
|
+
name: 'Sha256VerificationError';
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type Sha256VerificationErrorParams = Readonly<{
|
|
9
|
+
subject: string;
|
|
10
|
+
expected: string;
|
|
11
|
+
actual: string;
|
|
12
|
+
}>;
|
|
13
|
+
|
|
14
|
+
export class Sha256VerificationError extends ErrorBase {
|
|
15
|
+
constructor(params: Sha256VerificationErrorParams, options: ErrorMetadataParams) {
|
|
16
|
+
super({
|
|
17
|
+
...options,
|
|
18
|
+
message: `SHA-256 mismatch for ${params.subject}: expected ${params.expected}, got ${params.actual}`,
|
|
19
|
+
name: 'Sha256VerificationError',
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|