This repository contains the tooling for interacting with Fhenix's CoFHE coprocessor.
@cofhe/sdk— core SDK for fetching FHE keys, encrypting inputs, decrypting handles, and working with ACPs via subpath modules such as@cofhe/sdk/adapters,@cofhe/sdk/acps,@cofhe/sdk/web, and@cofhe/sdk/node.@cofhe/react— React hooks and components for CoFHE-enabled frontends.@cofhe/abi— shared contract ABIs.@cofhe/mock-contracts— local mock contracts for testing CoFHE flows.@cofhe/hardhat-plugin— Hardhat 2 integration for deploying and using the mock stack.@cofhe/hardhat-3-plugin— Hardhat 3 integration.@cofhe/foundry-plugin— Foundry helpers for CoFHE contract tests.@cofhe/site— documentation site (not published to npm).
The repository also contains shared TypeScript and ESLint configuration packages under packages/.
- Node.js 18 or newer
- pnpm 8.15.6
Install dependencies:
pnpm installBuild the packages:
pnpm buildRun the test suite:
pnpm testUseful repository-wide commands:
pnpm lint
pnpm check:types
pnpm check:formatting
pnpm formatRun the documentation site locally with:
pnpm docsThe SDK documentation is published at cofhesdk.fhenix.io. For CoFHE itself and the FHE.sol contract library, see cofhe-docs.fhenix.zone.
Example applications live in examples/. See examples/README.md for the current example setup and usage instructions.
cofheClient.encryptInputs(...).execute() returns [...hashes, signature] — one external* handle per input followed by a single signature authenticating the whole batch — replacing the old per-item CofheInUint8/EncryptedUint8Input structs. setConsumingContract(address) is required before execute().
See the 0.7.0 migration guide, or run the migration skill against your project.
This monorepo uses Changesets for package versioning and release notes.
Create a changeset for package changes with:
pnpm changesetAdd a changeset only when a published package changes. Changes to docs, @cofhe/site, the examples, or the private config packages don't need one. Keep the changeset short and written for consumers of the package, and call out breaking changes.
Some exports are used internally and are not a supported API. They are marked @internal in their JSDoc, are not documented on the docs site, and may change in any release without a major version bump. Do not build on them, and do not open PRs that extend them; they are not a supported API. The SDK's debug request interceptors (setCofheDebugInterceptors, getCofheDebugInterceptors, cofheFetch) and the React CofheEncryptInput demo component are the current examples.
- FHE keys are fetched only when
client.encryptInputs(...).execute()is called because they are only needed for input encryption. - TFHE WASM initialization is also deferred until
client.encryptInputs(...).execute()is called.