Made calculateAgreement async

pull/1090/head
Mikunj 5 years ago
parent d8ed1258e1
commit 96d42e24d2

@ -101,7 +101,7 @@ const sendToProxy = async (
const ephemeralKey = await libsignal.Curve.async.generateKeyPair(); const ephemeralKey = await libsignal.Curve.async.generateKeyPair();
// mix server pub key with our priv key // mix server pub key with our priv key
const symKey = libsignal.Curve.calculateAgreement( const symKey = await libsignal.Curve.async.calculateAgreement(
srvPubKey, // server's pubkey srvPubKey, // server's pubkey
ephemeralKey.privKey // our privkey ephemeralKey.privKey // our privkey
); );

@ -22,7 +22,7 @@ const encryptForNode = async (node, payload) => {
const snPubkey = StringView.hexToArrayBuffer(node.pubkey_x25519); const snPubkey = StringView.hexToArrayBuffer(node.pubkey_x25519);
const ephemeralSecret = libsignal.Curve.calculateAgreement( const ephemeralSecret = await libsignal.Curve.async.calculateAgreement(
snPubkey, snPubkey,
ephemeral.privKey ephemeral.privKey
); );
@ -237,7 +237,7 @@ const sendToProxy = async (options = {}, targetNode, retryNumber = 0) => {
const myKeys = await window.libloki.crypto.generateEphemeralKeyPair(); const myKeys = await window.libloki.crypto.generateEphemeralKeyPair();
const symmetricKey = libsignal.Curve.calculateAgreement( const symmetricKey = await libsignal.Curve.async.calculateAgreement(
snPubkeyHex, snPubkeyHex,
myKeys.privKey myKeys.privKey
); );

@ -99,7 +99,7 @@
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 = await libsignal.Curve.async.calculateAgreement(
this.pubKey, this.pubKey,
myPrivateKey myPrivateKey
); );
@ -117,7 +117,7 @@
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 = await libsignal.Curve.async.calculateAgreement(
this.pubKey, this.pubKey,
myPrivateKey myPrivateKey
); );
@ -290,7 +290,7 @@
throw new Error('Failed to get keypair for token decryption'); throw new Error('Failed to get keypair for token decryption');
} }
const { privKey } = keyPair; const { privKey } = keyPair;
const symmetricKey = libsignal.Curve.calculateAgreement( const symmetricKey = await libsignal.Curve.async.calculateAgreement(
serverPubKey, serverPubKey,
privKey privKey
); );

Loading…
Cancel
Save