Mercurial > sat_docs
view scripts/minifier/otr/dsa-webworker.js @ 85:bcba1966e6db
docker: certificate generation + various improvments:
- certificate is now auto-generated on first prosody launch is there is not already one
- certificate generated on build is removed to avoid image-wide certificate
- generated certificates are stored in sat_data
- data image is now based on prosody which is itslef based on sat_pubsub
- prosody configuration is moved to /etc/prosody/prosody_sat_cfg, and stored in sat_data
- building order changed to adapt to new images hierarchy
- libervia default configuration set to both without redirection (and with a security warning)
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 18 Feb 2016 17:31:09 +0100 |
parents | 1596660ddf72 |
children |
line wrap: on
line source
;(function (root) { "use strict"; root.OTR = {} root.DSA = {} root.crypto = { randomBytes: function () { throw new Error("Haven't seeded yet.") } } // default imports var imports = [ 'vendor/salsa20.js' , 'vendor/bigint.js' , 'vendor/crypto.js' , 'vendor/eventemitter.js' , 'lib/const.js' , 'lib/helpers.js' , 'lib/dsa.js' ] function sendMsg(type, val) { postMessage({ type: type, val: val }) } onmessage = function (e) { var data = e.data; if (data.imports) imports = data.imports importScripts.apply(root, imports); // use salsa20 since there's no prng in webworkers var state = new root.Salsa20(data.seed.slice(0, 32), data.seed.slice(32)) root.crypto.randomBytes = function (n) { return state.getBytes(n) } if (data.debug) sendMsg('debug', 'DSA key creation started') var dsa try { dsa = new root.DSA() } catch (e) { if (data.debug) sendMsg('debug', e.toString()) return } if (data.debug) sendMsg('debug', 'DSA key creation finished') sendMsg('data', dsa.packPrivate()) } }(this))