Release new version

This commit is contained in:
Sanjana Rajan 2018-03-08 22:01:56 +01:00
parent 08da24de27
commit 184a988d0d
6 changed files with 46601 additions and 12455 deletions

View File

@ -1,6 +1,6 @@
{
"name": "openpgp",
"version": "2.6.2",
"version": "3.0.0",
"license": "LGPL-3.0+",
"homepage": "https://openpgpjs.org/",
"authors": [

50789
dist/openpgp.js vendored

File diff suppressed because it is too large Load Diff

4
dist/openpgp.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -16,17 +16,38 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
/* globals self: true */
/* eslint-disable no-restricted-globals */
/* eslint-disable no-var */
/* eslint-disable vars-on-top */
self.window = {}; // to make UMD bundles work
importScripts('openpgp.js');
var openpgp = window.openpgp;
var randomQueue = [];
var randomRequested = false;
var MIN_SIZE_RANDOM_BUFFER = 40000;
var MAX_SIZE_RANDOM_BUFFER = 60000;
var MIN_SIZE_RANDOM_REQUEST = 20000;
openpgp.crypto.random.randomBuffer.init(MAX_SIZE_RANDOM_BUFFER);
/**
* Handle random buffer exhaustion by requesting more random bytes from the main window
* @returns {Promise<Object>} Empty promise whose resolution indicates that the buffer has been refilled
*/
function randomCallback() {
if (!randomRequested) {
self.postMessage({ event: 'request-seed', amount: MAX_SIZE_RANDOM_BUFFER });
}
randomRequested = true;
return new Promise(function(resolve, reject) {
randomQueue.push(resolve);
});
}
openpgp.crypto.random.randomBuffer.init(MAX_SIZE_RANDOM_BUFFER, randomCallback);
/**
* Handle messages from the main window.
@ -42,6 +63,13 @@ self.onmessage = function(event) {
case 'seed-random':
seedRandom(msg.buf);
var queueCopy = randomQueue;
randomQueue = [];
for (var i = 0; i < queueCopy.length; i++) {
queueCopy[i]();
}
break;
default:
@ -87,7 +115,9 @@ function delegate(id, method, options) {
// clone packets (for web worker structured cloning algorithm)
response({ id:id, event:'method-return', data:openpgp.packet.clone.clonePackets(data) });
}).catch(function(e) {
response({ id:id, event:'method-return', err:e.message, stack:e.stack });
response({
id:id, event:'method-return', err:e.message, stack:e.stack
});
});
}
@ -96,9 +126,10 @@ function delegate(id, method, options) {
* @param {Object} event Contains event type and data
*/
function response(event) {
if (openpgp.crypto.random.randomBuffer.size < MIN_SIZE_RANDOM_BUFFER) {
self.postMessage({event: 'request-seed'});
if (!randomRequested && openpgp.crypto.random.randomBuffer.size < MIN_SIZE_RANDOM_BUFFER) {
self.postMessage({ event: 'request-seed', amount: MIN_SIZE_RANDOM_REQUEST });
}
self.postMessage(event, openpgp.util.getTransferables.call(openpgp.util, event.data));
self.postMessage(event, openpgp.util.getTransferables(event.data));
}
},{}]},{},[1]);

View File

@ -1,2 +1,2 @@
/*! OpenPGP.js v2.6.2 - 2018-01-21 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
!function e(n,r,t){function o(i,f){if(!r[i]){if(!n[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(a)return a(i,!0);var s=new Error("Cannot find module '"+i+"'");throw s.code="MODULE_NOT_FOUND",s}var u=r[i]={exports:{}};n[i][0].call(u.exports,function(e){var r=n[i][1][e];return o(r||e)},u,u.exports,e,n,r,t)}return r[i].exports}for(var a="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}({1:[function(e,n,r){function t(e){o.crypto.random.randomBuffer.size<a&&self.postMessage({event:"request-seed"}),self.postMessage(e,o.util.getTransferables.call(o.util,e.data))}self.window={},importScripts("openpgp.min.js");var o=window.openpgp,a=4e4;o.crypto.random.randomBuffer.init(6e4),self.onmessage=function(e){var n=e.data||{};switch(n.event){case"configure":!function(e){for(var n in e)o.config[n]=e[n]}(n.config);break;case"seed-random":!function(e){e instanceof Uint8Array||(e=new Uint8Array(e)),o.crypto.random.randomBuffer.set(e)}(n.buf);break;default:!function(e,n,r){"function"==typeof o[n]?(r=o.packet.clone.parseClonedPackets(r,n),o[n](r).then(function(n){t({id:e,event:"method-return",data:o.packet.clone.clonePackets(n)})}).catch(function(n){t({id:e,event:"method-return",err:n.message,stack:n.stack})})):t({id:e,event:"method-return",err:"Unknown Worker Event"})}(n.id,n.event,n.options||{})}}},{}]},{},[1]);
/*! OpenPGP.js v3.0.0 - 2018-03-08 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
!function e(n,r,t){function o(i,f){if(!r[i]){if(!n[i]){var s="function"==typeof require&&require;if(!f&&s)return s(i,!0);if(a)return a(i,!0);var u=new Error("Cannot find module '"+i+"'");throw u.code="MODULE_NOT_FOUND",u}var c=r[i]={exports:{}};n[i][0].call(c.exports,function(e){var r=n[i][1][e];return o(r||e)},c,c.exports,e,n,r,t)}return r[i].exports}for(var a="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}({1:[function(e,n,r){self.window={},importScripts("openpgp.min.js");var t=window.openpgp,o=[],a=!1,i=4e4,f=6e4,s=2e4;function u(e){!a&&t.crypto.random.randomBuffer.size<i&&self.postMessage({event:"request-seed",amount:s}),self.postMessage(e,t.util.getTransferables(e.data))}t.crypto.random.randomBuffer.init(f,function(){return a||self.postMessage({event:"request-seed",amount:f}),a=!0,new Promise(function(e,n){o.push(e)})}),self.onmessage=function(e){var n=e.data||{};switch(n.event){case"configure":!function(e){for(var n in e)t.config[n]=e[n]}(n.config);break;case"seed-random":!function(e){e instanceof Uint8Array||(e=new Uint8Array(e));t.crypto.random.randomBuffer.set(e)}(n.buf);var r=o;o=[];for(var a=0;a<r.length;a++)r[a]();break;default:!function(e,n,r){if("function"!=typeof t[n])return void u({id:e,event:"method-return",err:"Unknown Worker Event"});r=t.packet.clone.parseClonedPackets(r,n),t[n](r).then(function(n){u({id:e,event:"method-return",data:t.packet.clone.clonePackets(n)})}).catch(function(n){u({id:e,event:"method-return",err:n.message,stack:n.stack})})}(n.id,n.event,n.options||{})}}},{}]},{},[1]);

8214
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff