decrypt
Decrypts the provided encrypted data using the associated encryption metadata.
Usage
import { EncryptionMetaData, EncryptionType } from '@4thtech-sdk/types';
const encryptedData = new ArrayBuffer(8);
const metadata: EncryptionMetaData = {
type: '4th-tech-aes-gcm',
};
const decryptedData = await encryptionHandler.decrypt(encryptedData, metadata);
Returns
Promise<ArrayBuffer>
A promise that resolves with the decrypted version of the provided encrypted data. The decrypted data will match the original content before it was encrypted, and it will be in the ArrayBuffer format.
Parameters
data
- Type
ArrayBuffer
The encrypted data that you want to decrypt. This data should have been encrypted using one of the encryption types supported by the EncryptionHandler.
encryptionMetaData
- Type
EncryptionMetaData
The metadata associated with the encrypted data. This metadata provides details about how the data was encrypted, and is crucial for successfully decrypting it.
You can access metadata using the getMetadata()
method on encryption instance.