diff --git a/404.html b/404.html index 775c5e36..b9c81871 100644 --- a/404.html +++ b/404.html @@ -4,7 +4,7 @@
Permits are generated using the getPermit
method in fhenix.js
. This method requires the following parameters:
Permits are generated using the generatePermit
method in fhenix.js
. This method receives the following parameters:
contractAddress
(required, string): The address of the contract.provider
(required): An ethers
(or compatible) object that can sign EIP-712 formatted data. (Note that if you want to unseal data using your wallet's encryption key you can't use "JsonRpcProvider")provider
(optional): An ethers
(or compatible) object that can sign EIP-712 formatted data. (Note that if you want to unseal data using your wallet's encryption key you can't use "JsonRpcProvider")signer
(optional): Another ethers
(or compatible) signer if you want to use a different signer than the one in the provider (chain-id requests are still made via the provider)const permit = await getPermit(contractAddress);
const permit = await generatePermit(contractAddress);
// passing a custom signer
let permit = await fhenixjs.generatePermit(
contractAddress,
undefined, // use the internal provider
signer, // created from, e.g. `ethers.getSigners()[0]`
);
In Fhenix, a permission is that part of a permit that supplies proof that callers are who they say they are. A permission contains the signature and corresponding public key. @@ -38,6 +39,6 @@
Once generated, the permission can be used and sent to the contract. It can also be used to unseal the output of the sealoutput
function, assuming it was sealed using that same permission.
The following code snippet shows how to implement the added cryptographic functionality of Fhenix (specifically, permits and permissions) on Ethereum using the Fhenix library.
-import { BrowserProvider } from "ethers";
import { FhenixClient, getPermit } from "fhenixjs";
const provider = new BrowserProvider(window.ethereum);
const client = new FhenixClient({ provider });
const permit = await getPermit(contractAddress, provider);
const permission = client.extractPemitPermissions(permit);
client.storePermit(permit); // Stores a permit for a specific contract address.
const response = await contract.connect(owner).getValue(permission); // Calling "getValue" which is a view function in "contract"
const plaintext = await client.unseal(contractAddress, response);
import { BrowserProvider } from "ethers";
import { FhenixClient, getPermit } from "fhenixjs";
const provider = new BrowserProvider(window.ethereum);
const client = new FhenixClient({ provider });
const permit = await generatePermit(contractAddress, provider);
const permission = client.extractPemitPermissions(permit);
const response = await contract.connect(owner).getValue(permission); // Calling "getValue" which is a view function in "contract"
const plaintext = await client.unseal(contractAddress, response);