Quickstart (Testnet)
TACo SDK allows you to use threshold encryption & decryption in your apps.
In just a few minutes you will able to:
- Encrypt your data
- Describe decryption conditions with onchain data
- Threshold-decrypt your data when these conditions are met
Install
taco
and ethers
with your favorite package manager:$ npm install @threshold-network/taco [email protected]
In order to run the code examples below, you will need the
ritualId
encryption parameter. Please reach out to us here if you don't already have it.import taco, { conditions } from '@threshold-network/taco'
import { ethers } from "ethers";
const web3Provider = ethers.getDefaultProvider();
const ownsNFT = new conditions.predefined.ERC721Ownership({
contractAddress: '0x1e988ba4692e52Bc50b375bcC8585b95c48AaD77',
parameters: [3591],
chain: 5,
});
const messageKit = await taco.encrypt(
web3Provider,
message,
ownsNFT,
ritualId
);
Now we just have to pass the
messageKit
to the intended recipient:import taco from '@threshold-network/taco'
import { ethers } from "ethers";
const web3Provider = ethers.getDefaultProvider();
const decryptedMessage = await taco.decrypt(
web3Provider,
messageKit,
web3Provider.getSigner()
);
Since
ownsNFT
condition refers to an NFT owned by the recipient, taco.decrypt
call will prompt the recipient to sign a message and prove the ownership of the caller's wallet.TODO: Link to TACo explainer? High-level overview + trust assumptions
TODO: A list of the most popular/interesting/handy "recipes" for using/integrating TACo into your app.
- Learn more about conditions here
- ... about composing conditions here
- ...
Last modified 18d ago