Made key generation async

pull/1090/head
Mikunj 5 years ago
parent b339651bda
commit d8ed1258e1

@ -98,7 +98,7 @@ const sendToProxy = async (
payloadObj.body = false; // free memory
// make temporary key for this request/response
const ephemeralKey = libsignal.Curve.generateKeyPair();
const ephemeralKey = await libsignal.Curve.async.generateKeyPair();
// mix server pub key with our priv key
const symKey = libsignal.Curve.calculateAgreement(

@ -18,7 +18,7 @@ const encryptForNode = async (node, payload) => {
const textEncoder = new TextEncoder();
const plaintext = textEncoder.encode(payload);
const ephemeral = libloki.crypto.generateEphemeralKeyPair();
const ephemeral = await libloki.crypto.generateEphemeralKeyPair();
const snPubkey = StringView.hexToArrayBuffer(node.pubkey_x25519);
@ -235,7 +235,7 @@ const sendToProxy = async (options = {}, targetNode, retryNumber = 0) => {
const snPubkeyHex = StringView.hexToArrayBuffer(targetNode.pubkey_x25519);
const myKeys = window.libloki.crypto.generateEphemeralKeyPair();
const myKeys = await window.libloki.crypto.generateEphemeralKeyPair();
const symmetricKey = libsignal.Curve.calculateAgreement(
snPubkeyHex,

@ -144,8 +144,8 @@
return Multibase.decode(`${base32zCode}${snodeAddressClean}`);
}
function generateEphemeralKeyPair() {
const keys = libsignal.Curve.generateKeyPair();
async function generateEphemeralKeyPair() {
const keys = await libsignal.Curve.async.generateKeyPair();
// Signal protocol prepends with "0x05"
keys.pubKey = keys.pubKey.slice(1);
return keys;

Loading…
Cancel
Save