throw instead of log

pull/823/head
Ryan Tharp 5 years ago
parent 0ac79b2275
commit dfb5b0ed9f

@ -49,7 +49,7 @@
async encrypt(plaintext) { async encrypt(plaintext) {
const myKeyPair = await textsecure.storage.protocol.getIdentityKeyPair(); const myKeyPair = await textsecure.storage.protocol.getIdentityKeyPair();
if (!myKeyPair) { if (!myKeyPair) {
throw new Error("Failed to get keypair for encryption"); throw new Error('Failed to get keypair for encryption');
} }
const myPrivateKey = myKeyPair.privKey; const myPrivateKey = myKeyPair.privKey;
const symmetricKey = libsignal.Curve.calculateAgreement( const symmetricKey = libsignal.Curve.calculateAgreement(
@ -67,7 +67,7 @@
async decrypt(ivAndCiphertext) { async decrypt(ivAndCiphertext) {
const myKeyPair = await textsecure.storage.protocol.getIdentityKeyPair(); const myKeyPair = await textsecure.storage.protocol.getIdentityKeyPair();
if (!myKeyPair) { if (!myKeyPair) {
throw new Error("Failed to get keypair for decryption"); throw new Error('Failed to get keypair for decryption');
} }
const myPrivateKey = myKeyPair.privKey; const myPrivateKey = myKeyPair.privKey;
const symmetricKey = libsignal.Curve.calculateAgreement( const symmetricKey = libsignal.Curve.calculateAgreement(
@ -176,7 +176,7 @@
const myKeyPair = await textsecure.storage.protocol.getIdentityKeyPair(); const myKeyPair = await textsecure.storage.protocol.getIdentityKeyPair();
if (!myKeyPair) { if (!myKeyPair) {
throw new Error("Failed to get keypair for pairing signature generation"); throw new Error('Failed to get keypair for pairing signature generation');
} }
const signature = await libsignal.Curve.async.calculateSignature( const signature = await libsignal.Curve.async.calculateSignature(
myKeyPair.privKey, myKeyPair.privKey,
@ -300,10 +300,11 @@
const serverPubKey = new Uint8Array( const serverPubKey = new Uint8Array(
dcodeIO.ByteBuffer.fromBase64(serverPubKey64).toArrayBuffer() dcodeIO.ByteBuffer.fromBase64(serverPubKey64).toArrayBuffer()
); );
const { privKey } = await textsecure.storage.protocol.getIdentityKeyPair(); const keyPair = await textsecure.storage.protocol.getIdentityKeyPair();
if (!privKey) { if (!keyPair) {
throw new Error("Failed to get keypair for token decryption"); throw new Error('Failed to get keypair for token decryption');
} }
const { privKey } = keyPair;
const symmetricKey = libsignal.Curve.calculateAgreement( const symmetricKey = libsignal.Curve.calculateAgreement(
serverPubKey, serverPubKey,
privKey privKey

Loading…
Cancel
Save