OMEMO bugfix. Store prekey as boolean and handle '1' and 'true'

This commit is contained in:
JC Brand 2019-03-30 15:57:36 +01:00
parent 1dfdb36d20
commit 1a2e7b235a
3 changed files with 5 additions and 5 deletions

View File

@ -10,7 +10,7 @@
<meta name="keywords" content="xmpp chat webchat converse.js" />
<link rel="shortcut icon" type="image/ico" href="css/images/favicon.ico"/>
<link type="text/css" rel="stylesheet" media="screen" href="css/converse.css" />
<script src="3rdparty/libsignal-protocol-javascript/dist/libsignal-protocol.js"></script>
<script src="3rdparty/libsignal-protocol.js"></script>
<script src="dist/converse.js"></script>
</head>

4
dist/converse.js vendored
View File

@ -56280,7 +56280,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
const _converse = this.__super__._converse,
session_cipher = this.getSessionCipher(attrs.from, parseInt(attrs.encrypted.device_id, 10)); // https://xmpp.org/extensions/xep-0384.html#usecases-receiving
if (attrs.encrypted.prekey === 'true') {
if (attrs.encrypted.prekey === true) {
let plaintext;
return session_cipher.decryptPreKeyWhisperMessage(u.base64ToArrayBuffer(attrs.encrypted.key), 'binary').then(key_and_tag => {
if (attrs.encrypted.payload) {
@ -56340,7 +56340,7 @@ _converse_headless_converse_core__WEBPACK_IMPORTED_MODULE_0__["default"].plugins
'iv': header.querySelector('iv').textContent,
'key': key.textContent,
'payload': _.get(encrypted.querySelector('payload'), 'textContent', null),
'prekey': key.getAttribute('prekey')
'prekey': _.includes(['true', '1'], key.getAttribute('prekey'))
};
return this.decrypt(attrs);
} else {

View File

@ -234,7 +234,7 @@ converse.plugins.add('converse-omemo', {
session_cipher = this.getSessionCipher(attrs.from, parseInt(attrs.encrypted.device_id, 10));
// https://xmpp.org/extensions/xep-0384.html#usecases-receiving
if (attrs.encrypted.prekey === 'true') {
if (attrs.encrypted.prekey === true) {
let plaintext;
return session_cipher.decryptPreKeyWhisperMessage(u.base64ToArrayBuffer(attrs.encrypted.key), 'binary')
.then(key_and_tag => {
@ -284,7 +284,7 @@ converse.plugins.add('converse-omemo', {
'iv': header.querySelector('iv').textContent,
'key': key.textContent,
'payload': _.get(encrypted.querySelector('payload'), 'textContent', null),
'prekey': key.getAttribute('prekey')
'prekey': _.includes(['true', '1'], key.getAttribute('prekey'))
}
return this.decrypt(attrs);
} else {