Use async/await instead of explicit Promise

This commit is contained in:
JC Brand 2018-11-12 14:45:57 +01:00
parent 77a7397614
commit fa4c555c44

View File

@ -159,14 +159,13 @@ converse.plugins.add('converse-omemo', {
}).then(() => this.buildSessions(devices))
},
buildSession (device) {
async buildSession (device) {
const { _converse } = this.__super__,
address = new libsignal.SignalProtocolAddress(device.get('jid'), device.get('id')),
sessionBuilder = new libsignal.SessionBuilder(_converse.omemo_store, address),
prekey = device.getRandomPreKey();
prekey = device.getRandomPreKey(),
bundle = await device.getBundle();
return device.getBundle()
.then(bundle => {
return sessionBuilder.processPreKey({
'registrationId': parseInt(device.get('id'), 10),
'identityKey': u.base64ToArrayBuffer(bundle.identity_key),
@ -180,7 +179,6 @@ converse.plugins.add('converse-omemo', {
'publicKey': u.base64ToArrayBuffer(prekey.key),
}
});
});
},
getSession (device) {