Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cofhejs/examples/end-to-end.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
title: End-to-End Example
---

<Warning>
**`cofhejs` is the legacy client library.** New projects should use [`@cofhe/sdk`](/client-sdk/examples/end-to-end) instead. See [Migrating from cofhejs](/client-sdk/introduction/migrating-from-cofhejs) for a side-by-side guide. These pages remain for reference for projects that haven't migrated yet.
</Warning>

This example demonstrates a full interaction between a dApp and an FHE-enabled smart contract using `cofhejs`. You'll learn how to set up the client, encrypt data, send it to the contract, create a permit for accessing sealed data, and finally unseal the returned data for the user.

### Prerequisites
Expand Down
4 changes: 4 additions & 0 deletions cofhejs/guides/encryption.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ title: Encryption
description: "Encrypt input data before sending it to FHE-enabled smart contracts"
---

<Warning>
**`cofhejs` is the legacy client library.** New projects should use [`@cofhe/sdk`](/client-sdk/guides/encrypting-inputs) instead. See [Migrating from cofhejs](/client-sdk/introduction/migrating-from-cofhejs) for a side-by-side guide. These pages remain for reference for projects that haven't migrated yet.
</Warning>

## Encrypting Input Data

This step secures your data before sending it to the smart contract. Remember - all data sent to a smart contract on a blockchain is inherently public, which means that anyone can see it. However, Fhenix operates differently. To maintain user confidentiality and protect sensitive input data, Fhenix utilizes **Cofhejs** to provide built-in encryption methods that you must apply before sending any data to an FHE-enabled contract.
Expand Down
4 changes: 4 additions & 0 deletions cofhejs/guides/error-handling.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ title: Error Handling
description: "Handle errors effectively when working with Cofhejs using the Result type pattern"
---

<Warning>
**`cofhejs` is the legacy client library.** New projects should use [`@cofhe/sdk`](/client-sdk/guides/error-handling) instead. See [Migrating from cofhejs](/client-sdk/introduction/migrating-from-cofhejs) for a side-by-side guide. These pages remain for reference for projects that haven't migrated yet.
</Warning>

## Error Handling

`cofhejs` uses a consistent error handling pattern based on the `Result` type to provide predictable and type-safe error handling throughout the library. This guide explains how error handling works and how to properly handle errors in your applications.
Expand Down
4 changes: 4 additions & 0 deletions cofhejs/guides/permits-management.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ title: Permits Management
description: "Create and manage permits for accessing encrypted data in FHE-enabled smart contracts"
---

<Warning>
**`cofhejs` is the legacy client library.** New projects should use [`@cofhe/sdk`](/client-sdk/guides/permits) instead. See [Migrating from cofhejs](/client-sdk/introduction/migrating-from-cofhejs) for a side-by-side guide. These pages remain for reference for projects that haven't migrated yet.
</Warning>

## Creating Permits

After encryption, values can be passed into FHE-enabled smart contracts, and the contract can operate on this data securely, within its own logic. However, to ensure that only the respective user can view the processed (encrypted) data, **permissions** and **sealing** mechanisms are used. These ensure that data remains private and viewable exclusively by the user who owns it.
Expand Down
4 changes: 4 additions & 0 deletions cofhejs/guides/sealing-unsealing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ title: Sealing & Unsealing
description: "Unseal encrypted data returned from FHE-enabled smart contracts"
---

<Warning>
**`cofhejs` is the legacy client library.** New projects should use [`@cofhe/sdk`](/client-sdk/guides/decrypt-to-view) instead — sealing/unsealing is handled internally by `decryptForView` / `decryptForTx`. See [Migrating from cofhejs](/client-sdk/introduction/migrating-from-cofhejs) for a side-by-side guide. These pages remain for reference for projects that haven't migrated yet.
</Warning>

## Overview

In Fhenix's FHE system, data returned from smart contracts is "sealed" (internally re-encrypted since it already exists in an encrypted state) to maintain confidentiality during transmission. The unsealing process converts this encrypted data back into readable values using your permit's sealing key pair.
Expand Down
4 changes: 4 additions & 0 deletions cofhejs/introduction/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ title: Manual Installation
description: "Install and set up Cofhejs for FHE-enabled smart contract development"
---

<Warning>
**`cofhejs` is the legacy client library.** New projects should use [`@cofhe/sdk`](/client-sdk/introduction/installation) instead. See [Migrating from cofhejs](/client-sdk/introduction/migrating-from-cofhejs) for a side-by-side guide. These pages remain for reference for projects that haven't migrated yet.
</Warning>

To get started with Cofhejs, you need to install it as a dependency in your JavaScript project. You can do this using npm (Node Package Manager), Yarn, or pnpm. Open your terminal and navigate to your project's directory, then run the following:

<CodeGroup>
Expand Down
4 changes: 4 additions & 0 deletions cofhejs/introduction/mental-model.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ title: Mental Model
description: "Understand how data flows through FHE-enabled dApps"
---

<Warning>
**`cofhejs` is the legacy client library.** New projects should use [`@cofhe/sdk`](/client-sdk/introduction/mental-model) instead. See [Migrating from cofhejs](/client-sdk/introduction/migrating-from-cofhejs) for a side-by-side guide. These pages remain for reference for projects that haven't migrated yet.
</Warning>

To understand how **Cofhejs** fits into the Fhenix framework, you'll explore a simple mental model using a Counter smart contract example. This will show you how data flows through FHE-enabled dApps—from encryption to computation to decryption.

## The Counter Example
Expand Down
3 changes: 3 additions & 0 deletions cofhejs/introduction/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ title: Overview
description: "Introduction to Cofhejs - a TypeScript package for interacting with FHE-enabled smart contracts"
---

<Warning>
**`cofhejs` is the legacy client library.** New projects should use [`@cofhe/sdk`](/client-sdk/introduction/overview) instead. See [Migrating from cofhejs](/client-sdk/introduction/migrating-from-cofhejs) for a side-by-side guide. These pages remain for reference for projects that haven't migrated yet.
</Warning>

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.

Expand Down
4 changes: 4 additions & 0 deletions cofhejs/resources/templates.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ title: "Development Templates"
description: "Ready-to-use templates, tools, and tutorials to accelerate your FHE-enabled dApp development with Cofhejs"
---

<Warning>
**`cofhejs` is the legacy client library.** New projects should use [`@cofhe/sdk`](/client-sdk/examples/templates) instead — see the templates page on the Client SDK tab for the current starter repos. These pages remain for reference for projects that haven't migrated yet.
</Warning>

## GitHub Templates

Production-ready code repositories that you can clone and deploy immediately to start building FHE-enabled dApps.
Expand Down