mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-08 17:07:03 +03:00
Move old OpenPGP.js to /vendors instead of npm
This commit is contained in:
parent
a7ae087f18
commit
5e63adc904
78 changed files with 39023 additions and 60 deletions
21615
vendors/openpgp-2.6.2/dist/openpgp.js
vendored
Normal file
21615
vendors/openpgp-2.6.2/dist/openpgp.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2
vendors/openpgp-2.6.2/dist/openpgp.min.js
vendored
Normal file
2
vendors/openpgp-2.6.2/dist/openpgp.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
104
vendors/openpgp-2.6.2/dist/openpgp.worker.js
vendored
Normal file
104
vendors/openpgp-2.6.2/dist/openpgp.worker.js
vendored
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
||||
// GPG4Browsers - An OpenPGP implementation in javascript
|
||||
// Copyright (C) 2011 Recurity Labs GmbH
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 3.0 of the License, or (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// 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 */
|
||||
|
||||
self.window = {}; // to make UMD bundles work
|
||||
|
||||
importScripts('openpgp.js');
|
||||
var openpgp = window.openpgp;
|
||||
|
||||
var MIN_SIZE_RANDOM_BUFFER = 40000;
|
||||
var MAX_SIZE_RANDOM_BUFFER = 60000;
|
||||
|
||||
openpgp.crypto.random.randomBuffer.init(MAX_SIZE_RANDOM_BUFFER);
|
||||
|
||||
/**
|
||||
* Handle messages from the main window.
|
||||
* @param {Object} event Contains event type and data
|
||||
*/
|
||||
self.onmessage = function(event) {
|
||||
var msg = event.data || {};
|
||||
|
||||
switch (msg.event) {
|
||||
case 'configure':
|
||||
configure(msg.config);
|
||||
break;
|
||||
|
||||
case 'seed-random':
|
||||
seedRandom(msg.buf);
|
||||
break;
|
||||
|
||||
default:
|
||||
delegate(msg.id, msg.event, msg.options || {});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Set config from main context to worker context.
|
||||
* @param {Object} config The openpgp configuration
|
||||
*/
|
||||
function configure(config) {
|
||||
for (var i in config) {
|
||||
openpgp.config[i] = config[i];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Seed the library with entropy gathered window.crypto.getRandomValues
|
||||
* as this api is only avalible in the main window.
|
||||
* @param {ArrayBuffer} buffer Some random bytes
|
||||
*/
|
||||
function seedRandom(buffer) {
|
||||
if (!(buffer instanceof Uint8Array)) {
|
||||
buffer = new Uint8Array(buffer);
|
||||
}
|
||||
openpgp.crypto.random.randomBuffer.set(buffer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic proxy function that handles all commands from the public api.
|
||||
* @param {String} method The public api function to be delegated to the worker thread
|
||||
* @param {Object} options The api function's options
|
||||
*/
|
||||
function delegate(id, method, options) {
|
||||
if (typeof openpgp[method] !== 'function') {
|
||||
response({ id:id, event:'method-return', err:'Unknown Worker Event' });
|
||||
return;
|
||||
}
|
||||
// parse cloned packets
|
||||
options = openpgp.packet.clone.parseClonedPackets(options, method);
|
||||
openpgp[method](options).then(function(data) {
|
||||
// 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 });
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Respond to the main window.
|
||||
* @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'});
|
||||
}
|
||||
self.postMessage(event, openpgp.util.getTransferables.call(openpgp.util, event.data));
|
||||
}
|
||||
},{}]},{},[1]);
|
||||
2
vendors/openpgp-2.6.2/dist/openpgp.worker.min.js
vendored
Normal file
2
vendors/openpgp-2.6.2/dist/openpgp.worker.min.js
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
/*! OpenPGP.js v2.6.2 - 2018-01-21 - this is LGPL licensed code, see LICENSE/our website http://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]);
|
||||
Loading…
Add table
Add a link
Reference in a new issue