FhenixProtocol / fhenix.js

The JavaScript SDK for Fhenix
https://fhenixjs.fhenix.zone/
Other
2 stars 1 forks source link

The JavaScript SDK for Fhenix

npm ci

Explore the Docs »

General

fhenix.js allows developers to add support for encrypted data when developing dApps on Fhenix. fhenix.js includes easy helpers for encryption, unsealing and helpers to create apps that utilize private data.

Installation

# Using npm
npm install fhenixjs

Usage

// initialize your web3 provider
const provider = new JsonRpcProvider("http://localhost:8545");

// initialize Fhenix Client
const client = new FhenixClient({ provider });

// to encrypt data for a Fhenix contract
let encrypted = await client.encrypt(5, EncryptionTypes.uint8);
// ... call contract with `encrypted`

// to unseal data from a Fhenix contract
const cleartext = client.unseal(contractAddress, sealed);

Permits & Access Control

We recommend the helper Permit structure, which is a built-in method for providing access control for your FHE-enabled view functions.

Credits

This project is based on fhevmjs by Zama and utilizes tfhe.rs to provide FHE functionality

Need support?

Open an issue or Pull Request on Github! Or reach out to us on Discord or Telegram