Mercurial > sat_docs
view scripts/minifier/otr/dsa-webworker.js @ 17:c6824592e3ef
privileged entity xep update:
- the xep is now for any entity, not only components
- updated according to standard@ feedbacks:
- <privileged/> element removed
- permissions are also managed in admin mode
- in permission form, it is now recommended to use namespaces for 'var' attribute
- filled the missing required parts
- "privileged" and "managed" entity are now the terms used
- if client can't revoke permissions by itself, they must be revoked on disconnection
- renamed "xmlns" attribute of <perm/> to "namespace"
- server must notify privileged entity if permissions change during session
- various typos fixes
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 17 Sep 2014 20:38:18 +0200 |
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))