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 dev
Open 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
});