OthentKMS decrypt() function

The decrypt() function allows applications to decrypt data that has been encrypted using the connected user’s private key.

Example Usage

To use the decrypt() function, import it from the @othent/kms package and call it within an asynchronous function as follows:

import { decrypt, encrypt } from "@othent/kms";

const handleDecrypt = async () => {
	const data = "Decrypt this data please.";
  const encryptedData = await encrypt(data);
  const res = await decrypt(encryptedData);
  console.log(res);
}; 

The decrypt() function requires a valid response from the encrypt() function for successful execution.

<aside> ⚠️ Note: A user must be logged in to an application to successfully decrypt data.

</aside>

Result

On successful execution, the function returns the decrypted data as follows:

"Decrypt this data please."

Applications can then display this decrypted information or use it for other operations.