diff options
-rw-r--r-- | README.md | 52 |
1 files changed, 28 insertions, 24 deletions
@@ -1,27 +1,31 @@ | |||
1 | # Simple AES-256-CCM-PSK drop in front end script for the sjcl library | 1 | # Simple AES-256-CCM-PSK drop in front end script for the sjcl library |
2 | 2 | ||
3 | This script is intended to be just included in any HTML document via a simple <script src="sjcl-front.js"></script> | 3 | This script is intended to be just included in any HTML document via a simple |
4 | and provide ad-hoc group crypto for that site. | 4 | `<script src="sjcl-front.js"></script>` and provide ad-hoc group crypto for that |
5 | 5 | site. | |
6 | The script walks through all text nodes and checks for the sjcl-front signature sjcl:// | 6 | |
7 | and tries to retrieve a key from localStorage or sessionStorage whose name matches the | 7 | The script walks through all text nodes and checks for the sjcl-front signature |
8 | one encoded as associated data in the encoded sjcl dictionary. If it can decrypt the | 8 | sjcl:// and tries to retrieve a key from localStorage or sessionStorage whose |
9 | string, the text node's content is replaced by the plaintext and a class sjcl-decrypted | 9 | name matches the one encoded as associated data in the encoded sjcl dictionary. |
10 | is added to its parent node. | 10 | If it can decrypt the string, the text node's content is replaced by the |
11 | 11 | plaintext and a class sjcl-decrypted is added to its parent node. | |
12 | If the respective key can not be found, the class sjcl-undecrypted is added to the | 12 | |
13 | parent node, which also receives a copy of the ciphertext, before the text node is | 13 | If the respective key can not be found, the class sjcl-undecrypted is added to |
14 | replaced by an informative message. A click handler for sjcl-undecrypted objects allows | 14 | the parent node, which also receives a copy of the ciphertext, before the text |
15 | to later re-decrypt the text by providing a key. | 15 | node is replaced by an informative message. A click handler for sjcl-undecrypted |
16 | 16 | objects allows to later re-decrypt the text by providing a key. | |
17 | During initialisation, the script also walks through all TEXTAREA nodes and injects a | 17 | |
18 | hook revealing a contextual drop down menu that allows encrypting the TEXTAREA's content, | 18 | During initialisation, the script also walks through all TEXTAREA nodes and |
19 | decrypting it and adding/deleting keys in localStorage. Future versions may allow adding | 19 | injects a hook revealing a contextual drop down menu that allows encrypting the |
20 | that hook to text input fields or filtering by class or id. | 20 | TEXTAREA's content, decrypting it and adding/deleting keys in localStorage. |
21 | 21 | Future versions may allow adding that hook to text input fields or filtering by | |
22 | Finally the script injects CSS to the document's head to get the injected nodes working. | 22 | class or id. |
23 | 23 | ||
24 | You can try the script at [https://erdgeist.org/webcrypto/]. | 24 | Finally the script injects CSS to the document's head to get the injected nodes |
25 | 25 | working. | |
26 | The library that does the heavy lifting can be found here: https://github.com/bitwiseshiftleft/sjcl | 26 | |
27 | You can try the script at https://erdgeist.org/webcrypto/. | ||
28 | |||
29 | The library that does the heavy lifting can be found here: | ||
30 | https://github.com/bitwiseshiftleft/sjcl | ||
27 | 31 | ||