Encrypt
Wander Injected API encrypt() function
Argument
Type
Description
Example usage
// connect to the extension
await window.arweaveWallet.connect(["ENCRYPT"]);
// encrypt data using RSA-OAEP
const encrypted = await arweaveWallet.encrypt(
new TextEncoder().encode("This message will be encrypted"),
{ name: "RSA-OAEP" }
);
console.log("Encrypted bytes:", encrypted);Old (deprecated) usage
// connect to the extension
await window.arweaveWallet.connect(["ENCRYPT"]);
// encrypt data
const encrypted = await window.arweaveWallet.encrypt(
new TextEncoder().encode("This message will be encrypted"),
{
algorithm: "RSA-OAEP",
hash: "SHA-256",
}
);
console.log("Encrypted bytes", encrypted);Last updated
Was this helpful?