Prepare for asynchronous e2e APIs
the js-sdk is making some of its APIs asynchronous, and adding an `initCrypto` method which you have to call. Particular methods we need to worry about are: * `getStoredDevice` * `getStoredDevicesForUser` * `getEventSenderDeviceInfo` * `isEventSenderVerified`
This commit is contained in:
parent
b9dfaf777e
commit
4998d1b359
5 changed files with 93 additions and 62 deletions
|
@ -78,6 +78,18 @@ class MatrixClientPeg {
|
|||
}
|
||||
|
||||
async start() {
|
||||
// try to initialise e2e on the new client
|
||||
try {
|
||||
// check that we have a version of the js-sdk which includes initCrypto
|
||||
if (this.matrixClient.initCrypto) {
|
||||
await this.matrixClient.initCrypto();
|
||||
}
|
||||
} catch(e) {
|
||||
// this can happen for a number of reasons, the most likely being
|
||||
// that the olm library was missing. It's not fatal.
|
||||
console.warn("Unable to initialise e2e: " + e);
|
||||
}
|
||||
|
||||
const opts = utils.deepCopy(this.opts);
|
||||
// the react sdk doesn't work without this, so don't allow
|
||||
opts.pendingEventOrdering = "detached";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue