This template provides a Nextjs implementation of @inco/js sdk for encryption and re-encryption.
- Clone the repository:
git clone https://github.com/Inco-fhevm/nextjs-template.git
cd nextjs-template- Install dependencies:
npm install- Run the development server:
npm run devOpen http://localhost:3000 to view the application.
The project includes main functions in src/utils/inco-lite.ts i.e encryptValue and reencryptValue:
Encrypts a numeric value for a specific contract and address:
const encryptedData = await encryptValue({
value: BigInt("1000"), // Value to encrypt
address: "0x...", // User's wallet address
contractAddress: "0x...", // Contract address
});Re-encrypts a value using a wallet client and handle:
const decryptedValue = await reEncryptValue({
walletClient: yourWalletClient,
handle: "0x...", // Encryption handle
});