diff --git a/.gitignore b/.gitignore index 7d7e2bc1..c11ba12e 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ node_modules .DS_Store +.idea/ diff --git a/lib/main.js b/lib/main.js index b1fa5bfd..f5b4ffa6 100644 --- a/lib/main.js +++ b/lib/main.js @@ -241,9 +241,9 @@ function decrypt (encrypted, keyStr) { const key = Buffer.from(keyStr.slice(-64), 'hex') let ciphertext = Buffer.from(encrypted, 'base64') - const nonce = ciphertext.slice(0, 12) - const authTag = ciphertext.slice(-16) - ciphertext = ciphertext.slice(12, -16) + const nonce = ciphertext.subarray(0, 12) + const authTag = ciphertext.subarray(-16) + ciphertext = ciphertext.subarray(12, -16) try { const aesgcm = crypto.createDecipheriv('aes-256-gcm', key, nonce)