throw instead of log

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

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

Loading…
Cancel
Save