Commit 1a2e7b23 authored by JC Brand's avatar JC Brand

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

parent 1dfdb36d
......@@ -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>
......
......@@ -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 {
......@@ -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 {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment