ArweaveKit Docs
  • ArweaveKit
    • Introduction
  • 🔐Wallets
    • Introduction to Wallets
    • Create Wallet
    • Get Wallet Address
    • Get Wallet Balance
    • Wallet Plugins
  • 💳ARWEAVE WALLET KIT
    • Introduction to Arweave Wallet Kit
    • Setup
    • Connect Button
    • Hooks
    • Customization
  • 🏦Transactions
    • Introduction to Transactions
    • Create Transaction
    • Sign Transaction
    • Post Transaction
    • Get Transaction Status
    • Get Transaction
    • Create and Post Transaction with Othent
    • Transaction Plugins
  • 📄SMART CONTRACTS
    • Introduction to Smart Contracts
    • Create Contract
    • Write Contract
    • Read Contract State
    • View Contract State
    • Write Contract with Othent
    • Read Contract with Othent
    • Smart Contract Plugins
  • ✅AUTH
    • Introduction to Auth
    • Connect
    • Disconnect
    • Get Active Address
    • Get Permissions
    • Get Wallet Names
    • Get All Addresses
    • Get Active Public Key
    • Is Installed
    • Log In with Othent
    • Log Out with Othent
    • Get User Details with Othent
    • Auth Plugins
  • 🔐Encryption
    • Introduction to Encryption
    • Encrypt Data with AES
    • Decrypt Data with AES
    • Encrypt AES Key with RSA
    • Decrypt AES Key with RSA
    • Encryption Plugins
  • 🌐GRAPHQL
    • Introduction to GraphQL
    • Query All Arweave Transactions
    • Query Arweave Data
    • Query Arweave Transactions
    • GraphQL Plugins
  • 🗺️RoadMap
    • Features
  • 📘REFERENCES
    • ArweaveKit in Browser Environments
  • 🛠️SUPPORTING TOOLS
    • Arweave StarterKit
Powered by GitBook
On this page
  • Basic Syntax
  • Input Parameters
  • Returned Data

Was this helpful?

  1. Encryption

Decrypt AES Key with RSA

Decrypt an AES Key with an RSA Private Key

PreviousEncrypt AES Key with RSANextEncryption Plugins

Last updated 1 year ago

Was this helpful?

The decryptAESKeyWithRSA performs asymmetric decryption using an RSA Private Key and the RSA-OAEP algorithm. The permissions are requested with the help of the Arweave Wallet (Window Object) in a browser environment if no wallet or use_wallet is passed. The node environment expects Arweave JWK to be passed.

Installation of is suggested for successful use of this function in a browser environment.

Basic Syntax

The function is called as follows:

import { decryptAESKeyWithRSA } from 'arweavekit/encryption';

const decryptedAESKey = await decryptAESKeyWithRSA({params});

Input Parameters

The following params are available for this function and they must be passed in as an object:

  • key: Uint8Array : The encrypted AES key received from the encryptAESKeyWithRSA function.

  • wallet: ArWallet(optional): A value of type JWKInterface or use_wallet can be passed. If use_wallet or nothing is passed to this param, it expects ArConnect to be installed to run the decryption successfully.

Example
// In a browser environment, use_wallet or nothing can be passed.
const wallet = "use_wallet"
// In a node environment, Arweave wallet JWK can be passed.
const wallet = JSON.parse(fs.readFileSync('wallet.json').toString());

const decryptedAESKey = await decryptAESKeyWithRSA({
    key: Uint8Array,
});

This decrypts the provided AES Key using the RSA-OAEP algorithm.

Returned Data

The function call returns the following data:

{
    decryptedKey: string,
}
  • decryptedKey: string : The AES key decrypted using an RSA Public Key returned as a Base64 string.

🔐
ArConnect