@cofhe/sdk is the TypeScript client SDK for CoFHE. It handles the client-side operations required to interact with FHE-enabled smart contracts: encrypting inputs with ZK proofs, decrypting ciphertext handles via the Threshold Network, and managing EIP-712 permits for access control.
On-chain, contracts use FHE.sol to operate on encrypted data. Off-chain, this SDK prepares the inputs and reads the outputs.
What the SDK does
Encrypt Inputs
Packs plaintext values, generates a ZKPoK, and submits them to the CoFHE verifier. Returns signed EncryptedItemInput objects for use in contract calls.
Decrypt for View
Requests decryption of a ciphertext handle via the Threshold Network using a permit. Returns the plaintext locally, not published on-chain.
Decrypt for Tx
Requests decryption and returns the plaintext with a Threshold Network signature for on-chain verification.
Manage Permits
Creates, stores, and manages EIP-712 permits that authorize decryption of specific ciphertext handles.
Entrypoints
Client lifecycle
The SDK follows a three-step lifecycle: config → client → connect.Key concepts
Quick Start
Install the SDK, write a contract, and run your first encrypt → store → decrypt test in minutes.
Encrypting Inputs
Encrypt plaintext values with ZK proofs before passing them to your smart contract.
Permits
Create and manage EIP-712 permits that authorize decryption of confidential data.
Decrypt to View
Reveal encrypted values locally for UI display using permits.
Decrypt to Transact
Decrypt with a verifiable Threshold Network signature for on-chain use.