diff --git a/src/worker/async_proxy.js b/src/worker/async_proxy.js index 6d08b07a..2a9b6699 100644 --- a/src/worker/async_proxy.js +++ b/src/worker/async_proxy.js @@ -54,6 +54,7 @@ function AsyncProxy(path, options) { this.seedRandom(INITIAL_RANDOM_SEED); // FIFO this.tasks = []; + this.worker.postMessage({event: 'configure', config: config}); } /** diff --git a/src/worker/worker.js b/src/worker/worker.js index 5959ec23..2b20f0e9 100644 --- a/src/worker/worker.js +++ b/src/worker/worker.js @@ -53,6 +53,11 @@ self.onmessage = function (event) { correct = false; switch (msg.event) { + case 'configure': + for(var i in msg.config){ + window.openpgp.config[i] = msg.config[i]; + } + break; case 'seed-random': if (!(msg.buf instanceof Uint8Array)) { msg.buf = new Uint8Array(msg.buf); diff --git a/test/worker/api.js b/test/worker/api.js index 1fea6b07..424c3b6d 100644 --- a/test/worker/api.js +++ b/test/worker/api.js @@ -200,8 +200,21 @@ describe('High level API', function() { initKeys(); }); - describe('Encryption', function() { + describe('Main', function(){ + it('Configuration', function(done){ + openpgp.config.show_comment = false; + openpgp.config.show_version = false; + openpgp.initWorker('../dist/openpgp.worker.js'); + openpgp.encryptMessage([pubKeyRSA], plaintext).then(function(data) { + expect(data).to.exist; + expect(data).not.to.match(/^Version:/); + expect(data).not.to.match(/^Comment:/); + done(); + }); + }); + }); + describe('Encryption', function() { it('RSA: encryptMessage async', function (done) { openpgp.encryptMessage([pubKeyRSA], plaintext).then(function(data) { expect(data).to.exist;