fixed data decryption error

This commit is contained in:
antelle 2021-04-26 23:55:44 +02:00
parent d3fcbcb6a5
commit 946a063993
No known key found for this signature in database
GPG Key ID: 63C9777AAB7C563C
1 changed files with 3 additions and 0 deletions

View File

@ -84,6 +84,9 @@ function decryptRequest(request) {
const message = kdbxweb.ByteUtils.base64ToBytes(request.message);
const data = tweetnaclBox.open(message, nonce, client.publicKey, client.keys.secretKey);
if (!data) {
throw new Error('Failed to decrypt data');
}
const json = new TextDecoder().decode(data);
const payload = JSON.parse(json);