fix(js): fix not defined recipients

Romain J 6 months ago
parent 86697143b6
commit 89d7d5909a
No known key found for this signature in database
GPG Key ID: 3227578329C2A3A7
  1. 14
      README.rst
  2. 23
      chat/static/js/project.js
  3. 2
      chat/static/js/project.min.js
  4. 2
      chat/templates/guild/channels/details.html

@ -40,21 +40,13 @@ Running type checking and linter with:
$ make style
Test coverage
Run development
^^^^^^^^^^^^^
To run the tests, check your test coverage, and generate an HTML coverage report::
To run the development server:
$ coverage run -m pytest
$ coverage html
$ open htmlcov/index.html
$ make gulp
Running tests with py.test
~~~~~~~~~~~~~~~~~~~~~~~~~~
::
$ pytest
Live reloading and Sass CSS compilation
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

@ -5,15 +5,20 @@ function constructKeyPair(keyPair) {
}
function decipher(message, author) {
const sharedKey = nacl.box.before(
nacl.util.decodeBase64(recipients[author]), usableKeyPair.secretKey
);
(async () => {
while (!window.hasOwnProperty("recipients"))
await new Promise(resolve => setTimeout(resolve, 1000));
const payload = nacl.box.open.after(
nacl.util.decodeBase64(message.box),
nacl.util.decodeBase64(message.nonce),
sharedKey
);
const sharedKey = nacl.box.before(
nacl.util.decodeBase64(recipients[author]), usableKeyPair.secretKey
);
return nacl.util.encodeUTF8(payload);
const payload = nacl.box.open.after(
nacl.util.decodeBase64(message.box),
nacl.util.decodeBase64(message.nonce),
sharedKey
);
return nacl.util.encodeUTF8(payload);
})();
}

@ -1 +1 @@
function constructKeyPair(e){return nacl.box.keyPair.fromSecretKey(nacl.util.decodeBase64(e[1]))}function decipher(e,c){const n=nacl.box.before(nacl.util.decodeBase64(recipients[c]),usableKeyPair.secretKey),a=nacl.box.open.after(nacl.util.decodeBase64(e.box),nacl.util.decodeBase64(e.nonce),n);return nacl.util.encodeUTF8(a)}
function constructKeyPair(e){return nacl.box.keyPair.fromSecretKey(nacl.util.decodeBase64(e[1]))}function decipher(e,c){(async()=>{for(;!window.hasOwnProperty("recipients");)await new Promise(e=>setTimeout(e,1e3));const n=nacl.box.before(nacl.util.decodeBase64(recipients[c]),usableKeyPair.secretKey),o=nacl.box.open.after(nacl.util.decodeBase64(e.box),nacl.util.decodeBase64(e.nonce),n);nacl.util.encodeUTF8(o)})()}

@ -90,7 +90,7 @@
nacl.util.decodeUTF8(textarea.value),
nonce,
sharedKey
)
);
const message = {box, nonce};
ws.send(JSON.stringify({

Loading…
Cancel
Save