Skip to main content
Cofhejs is a TypeScript package designed to enable seamless interaction between clients and Fhenix’s co-processor (CoFHE). It is an essential component for engineers working with FHE-enabled smart contracts, as it facilitates the encryption and decryption processes required for secure data handling in decentralized applications (dApps). Cofhejs ensures that data remains private throughout its journey from input to output in the blockchain ecosystem.

Key Concepts

Mental Model

Learn how data flows through FHE-enabled dApps using the Counter example—from encryption to computation to decryption.

Encrypting Input Data

Before passing data to the smart contract, input must be encrypted to ensure its confidentiality.

Creating Permits and Permissions

Generate permits and permissions that determine who can interact with or view the data.

Unsealing Output Data

Decrypt the output after the contract processes the data so it can be used or displayed.
Cofhejs allows encryption to begin and end privately in a dApp, while FHE-enabled contracts perform computations on these encrypted values.