Compare commits

...

1 commit

Author SHA1 Message Date
Sasha
9a46c1ef04 Generate RSA keypairs when the client starts 2019-07-18 22:37:05 +02:00
3 changed files with 12 additions and 0 deletions

View file

@ -7,6 +7,7 @@
<script src="UnitJS/dom.js"></script> <script src="UnitJS/dom.js"></script>
<script src="translations.js"></script> <script src="translations.js"></script>
<script src="i18n.js"></script> <script src="i18n.js"></script>
<script src="lib/jsencrypt.min.js"></script>
<script src="fun.js"></script> <script src="fun.js"></script>
<script src="screen.js"></script> <script src="screen.js"></script>
<script src="messaging.js"></script> <script src="messaging.js"></script>

1
www/lib/jsencrypt.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,7 @@
function Session(modules) { function Session(modules) {
var key = null; var key = null;
var name = null; var name = null;
var keys = JSON.parse(localStorage.getItem('keys')) || generateKeyPair();
modules.messaging.addEventListener(["Welcome"], function(o) { modules.messaging.addEventListener(["Welcome"], function(o) {
key = o.key; key = o.key;
@ -29,4 +30,13 @@ function Session(modules) {
function loggedIn() { function loggedIn() {
return name != undefined; return name != undefined;
} }
function generateKeyPair() {
var crypt = new JSEncrypt({default_key_size: 1024});
crypt.getKey();
return {
priv: crypt.getPrivateKey(),
pub: crypt.getPublicKey()
};
}
} }