Skip to content

Commit fbe88fd

Browse files
committed
otherwise re-reading of the script will raise error due to redeclaration of const
1 parent d449c36 commit fbe88fd

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

encryptcontent/decrypt-contents.tpl.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
/* encryptcontent/decrypt-contents.tpl.js */
22
{%- if webcrypto %}
33
// https://stackoverflow.com/a/50868276
4-
const fromHex = hexString => new Uint8Array(hexString.match(/.{1,2}/g).map(byte => parseInt(byte, 16)));
4+
function fromHex(hexString) {
5+
return new Uint8Array(hexString.match(/.{1,2}/g).map(byte => parseInt(byte, 16)));
6+
}
57
// https://stackoverflow.com/a/41106346
6-
const fromBase64 = base64String => Uint8Array.from(atob(base64String), c => c.charCodeAt(0));
8+
function fromBase64(base64String) {
9+
return Uint8Array.from(atob(base64String), c => c.charCodeAt(0));
10+
}
711

812
async function digestSHA256toBase64(message) {
913
const data = new TextEncoder().encode(message);

0 commit comments

Comments
 (0)