mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
provide random value for IE11
This commit is contained in:
parent
ba323c65d6
commit
f5480b7708
@ -39,7 +39,13 @@ export class OlmWorker {
|
|||||||
|
|
||||||
async createOutboundOlmSession(account, newSession, theirIdentityKey, theirOneTimeKey) {
|
async createOutboundOlmSession(account, newSession, theirIdentityKey, theirOneTimeKey) {
|
||||||
const accountPickle = account.pickle("");
|
const accountPickle = account.pickle("");
|
||||||
const sessionPickle = await this._workerPool.send({type: "olm_create_outbound", accountPickle, theirIdentityKey, theirOneTimeKey}).response();
|
let randomValues;
|
||||||
|
if (window.msCrypto) {
|
||||||
|
randomValues = [
|
||||||
|
window.msCrypto.getRandomValues(new Uint8Array(64)),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
const sessionPickle = await this._workerPool.send({type: "olm_create_outbound", accountPickle, theirIdentityKey, theirOneTimeKey, randomValues}).response();
|
||||||
newSession.unpickle("", sessionPickle);
|
newSession.unpickle("", sessionPickle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,8 +142,9 @@ class MessageHandler {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_olmCreateOutbound(accountPickle, theirIdentityKey, theirOneTimeKey) {
|
_olmCreateOutbound(randomValues, accountPickle, theirIdentityKey, theirOneTimeKey) {
|
||||||
return this._toMessage(() => {
|
return this._toMessage(() => {
|
||||||
|
this._feedRandomValues(randomValues);
|
||||||
const account = new this._olm.Account();
|
const account = new this._olm.Account();
|
||||||
const newSession = new this._olm.Session();
|
const newSession = new this._olm.Session();
|
||||||
try {
|
try {
|
||||||
@ -168,7 +169,7 @@ class MessageHandler {
|
|||||||
} else if (type === "olm_create_account_otks") {
|
} else if (type === "olm_create_account_otks") {
|
||||||
this._sendReply(message, this._olmCreateAccountAndOTKs(message.randomValues, message.otkAmount));
|
this._sendReply(message, this._olmCreateAccountAndOTKs(message.randomValues, message.otkAmount));
|
||||||
} else if (type === "olm_create_outbound") {
|
} else if (type === "olm_create_outbound") {
|
||||||
this._sendReply(message, this._olmCreateOutbound(message.accountPickle, message.theirIdentityKey, message.theirOneTimeKey));
|
this._sendReply(message, this._olmCreateOutbound(message.randomValues, message.accountPickle, message.theirIdentityKey, message.theirOneTimeKey));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user