The function fails in node environment.
/**
* Receives an exported CryptoKey string, creates a key,
* and decrypts cipher text with the reconstructed key.
*
* @param key - The CryptoKey to export.
* @returns A key string.
*/
async function exportKey(key) {
const exportedKey = await window.crypto.subtle.exportKey(EXPORT_FORMAT, key);
return JSON.stringify(exportedKey);
}```