mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-09-20 07:35:55 +08:00
parent
70f261d5f3
commit
f64cf601ce
|
@ -51,7 +51,7 @@ function AddOpenPgpKeyPopupView()
|
|||
do
|
||||
{
|
||||
match = reg.exec(key);
|
||||
if (match && 0 > count)
|
||||
if (match && 0 < count)
|
||||
{
|
||||
if (match[0] && match[1] && match[2] && match[1] === match[2])
|
||||
{
|
||||
|
@ -66,12 +66,14 @@ function AddOpenPgpKeyPopupView()
|
|||
}
|
||||
|
||||
count -= 1;
|
||||
done = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
done = true;
|
||||
}
|
||||
|
||||
done = true;
|
||||
|
||||
}
|
||||
while (done);
|
||||
while (!done);
|
||||
|
||||
openpgpKeyring.store();
|
||||
|
||||
|
|
|
@ -144,13 +144,13 @@ cfg.paths.js = {
|
|||
openpgp: {
|
||||
name: 'openpgp.min.js',
|
||||
src: [
|
||||
'vendors/openpgp/2.3.0/openpgp.min.js'
|
||||
'node_modules/openpgp/dist/openpgp.min.js'
|
||||
]
|
||||
},
|
||||
openpgpworker: {
|
||||
name: 'openpgp.worker.min.js',
|
||||
src: [
|
||||
'vendors/openpgp/2.3.0/openpgp.worker.min.js'
|
||||
'node_modules/openpgp/dist/openpgp.worker.min.js'
|
||||
]
|
||||
},
|
||||
encrypt: {
|
||||
|
|
|
@ -83,6 +83,7 @@
|
|||
"node-fs": "*",
|
||||
"node-notifier": "~4.2.3",
|
||||
"normalize.css": "^4.2.0",
|
||||
"openpgp": "^2.3.2",
|
||||
"pikaday": "^1.4.0",
|
||||
"raw-loader": "^0.5.1",
|
||||
"rimraf": "*",
|
||||
|
|
8
vendors/openpgp/1.2.0/openpgp.min.js
vendored
8
vendors/openpgp/1.2.0/openpgp.min.js
vendored
File diff suppressed because one or more lines are too long
1
vendors/openpgp/1.2.0/openpgp.worker.min.js
vendored
1
vendors/openpgp/1.2.0/openpgp.worker.min.js
vendored
|
@ -1 +0,0 @@
|
|||
/*! OpenPGPjs.org this is LGPL licensed code, see LICENSE/our website for more information.- v1.2.0 - 2015-06-12 */!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){function d(a){window.openpgp.crypto.random.randomBuffer.size<g&&postMessage({event:"request-seed"}),postMessage(a)}function e(a){var b=window.openpgp.packet.List.fromStructuredClone(a);return new window.openpgp.key.Key(b)}function f(a){var b=window.openpgp.packet.List.fromStructuredClone(a);return new window.openpgp.message.Message(b)}window={},Function.prototype.bind||(Function.prototype.bind=function(a){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var b=Array.prototype.slice.call(arguments,1),c=this,d=function(){},e=function(){return c.apply(this instanceof d&&a?this:a,b.concat(Array.prototype.slice.call(arguments)))};return d.prototype=this.prototype,e.prototype=new d,e}),importScripts("openpgp.min.js");var g=4e4,h=6e4;window.openpgp.crypto.random.randomBuffer.init(h),self.onmessage=function(a){var b=null,c=null,g=a.data,h=!1;switch(g.event){case"configure":for(var i in g.config)window.openpgp.config[i]=g.config[i];break;case"seed-random":g.buf instanceof Uint8Array||(g.buf=new Uint8Array(g.buf)),window.openpgp.crypto.random.randomBuffer.set(g.buf);break;case"encrypt-message":g.keys.length||(g.keys=[g.keys]),g.keys=g.keys.map(e),window.openpgp.encryptMessage(g.keys,g.text).then(function(a){d({event:"method-return",data:a})})["catch"](function(a){d({event:"method-return",err:a.message})});break;case"sign-and-encrypt-message":g.publicKeys.length||(g.publicKeys=[g.publicKeys]),g.publicKeys=g.publicKeys.map(e),g.privateKey=e(g.privateKey),window.openpgp.signAndEncryptMessage(g.publicKeys,g.privateKey,g.text).then(function(a){d({event:"method-return",data:a})})["catch"](function(a){d({event:"method-return",err:a.message})});break;case"decrypt-message":g.privateKey=e(g.privateKey),g.message=f(g.message.packets),window.openpgp.decryptMessage(g.privateKey,g.message).then(function(a){d({event:"method-return",data:a})})["catch"](function(a){d({event:"method-return",err:a.message})});break;case"decrypt-and-verify-message":g.privateKey=e(g.privateKey),g.publicKeys.length||(g.publicKeys=[g.publicKeys]),g.publicKeys=g.publicKeys.map(e),g.message=f(g.message.packets),window.openpgp.decryptAndVerifyMessage(g.privateKey,g.publicKeys,g.message).then(function(a){d({event:"method-return",data:a})})["catch"](function(a){d({event:"method-return",err:a.message})});break;case"sign-clear-message":g.privateKeys=g.privateKeys.map(e),window.openpgp.signClearMessage(g.privateKeys,g.text).then(function(a){d({event:"method-return",data:a})})["catch"](function(a){d({event:"method-return",err:a.message})});break;case"verify-clear-signed-message":g.publicKeys.length||(g.publicKeys=[g.publicKeys]),g.publicKeys=g.publicKeys.map(e);var j=window.openpgp.packet.List.fromStructuredClone(g.message.packets);g.message=new window.openpgp.cleartext.CleartextMessage(g.message.text,j),window.openpgp.verifyClearSignedMessage(g.publicKeys,g.message).then(function(a){d({event:"method-return",data:a})})["catch"](function(a){d({event:"method-return",err:a.message})});break;case"generate-key-pair":window.openpgp.generateKeyPair(g.options).then(function(a){a.key=a.key.toPacketlist(),d({event:"method-return",data:a})})["catch"](function(a){d({event:"method-return",err:a.message})});break;case"decrypt-key":try{g.privateKey=e(g.privateKey),h=g.privateKey.decrypt(g.password),h?b=g.privateKey.toPacketlist():c="Wrong password"}catch(k){c=k.message}d({event:"method-return",data:b,err:c});break;case"decrypt-key-packet":try{g.privateKey=e(g.privateKey),g.keyIds=g.keyIds.map(window.openpgp.Keyid.fromClone),h=g.privateKey.decryptKeyPacket(g.keyIds,g.password),h?b=g.privateKey.toPacketlist():c="Wrong password"}catch(k){c=k.message}d({event:"method-return",data:b,err:c});break;default:throw new Error("Unknown Worker Event.")}}},{}]},{},[1]);
|
20497
vendors/openpgp/2.3.0/openpgp.js
vendored
20497
vendors/openpgp/2.3.0/openpgp.js
vendored
File diff suppressed because one or more lines are too long
10
vendors/openpgp/2.3.0/openpgp.min.js
vendored
10
vendors/openpgp/2.3.0/openpgp.min.js
vendored
File diff suppressed because one or more lines are too long
70
vendors/openpgp/2.3.0/openpgp.worker.js
vendored
70
vendors/openpgp/2.3.0/openpgp.worker.js
vendored
|
@ -1,70 +0,0 @@
|
|||
(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);
|
||||
|
||||
self.onmessage = function (event) {
|
||||
var msg = event.data || {},
|
||||
options = msg.options || {};
|
||||
|
||||
switch (msg.event) {
|
||||
case 'configure':
|
||||
for (var i in msg.config) {
|
||||
openpgp.config[i] = msg.config[i];
|
||||
}
|
||||
break;
|
||||
|
||||
case 'seed-random':
|
||||
if (!(msg.buf instanceof Uint8Array)) {
|
||||
msg.buf = new Uint8Array(msg.buf);
|
||||
}
|
||||
openpgp.crypto.random.randomBuffer.set(msg.buf);
|
||||
break;
|
||||
|
||||
default:
|
||||
if (typeof openpgp[msg.event] !== 'function') {
|
||||
throw new Error('Unknown Worker Event');
|
||||
}
|
||||
|
||||
// parse cloned packets
|
||||
openpgp[msg.event](openpgp.packet.clone.parseClonedPackets(options, msg.event)).then(function(data) {
|
||||
// clone packets (for web worker structured cloning algorithm)
|
||||
response({ event:'method-return', data:openpgp.packet.clone.clonePackets(data) });
|
||||
}).catch(function(e) {
|
||||
response({ event:'method-return', err:e.message });
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
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]);
|
1
vendors/openpgp/2.3.0/openpgp.worker.min.js
vendored
1
vendors/openpgp/2.3.0/openpgp.worker.min.js
vendored
|
@ -1 +0,0 @@
|
|||
/*! OpenPGP.js v2.3.0 - 2016-05-03 - this is LGPL licensed code, see LICENSE/our website http://openpgpjs.org/ for more information. */!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){function d(a){e.crypto.random.randomBuffer.size<f&&self.postMessage({event:"request-seed"}),self.postMessage(a,e.util.getTransferables.call(e.util,a.data))}self.window={},importScripts("openpgp.min.js");var e=window.openpgp,f=4e4,g=6e4;e.crypto.random.randomBuffer.init(g),self.onmessage=function(a){var b=a.data||{},c=b.options||{};switch(b.event){case"configure":for(var f in b.config)e.config[f]=b.config[f];break;case"seed-random":b.buf instanceof Uint8Array||(b.buf=new Uint8Array(b.buf)),e.crypto.random.randomBuffer.set(b.buf);break;default:if("function"!=typeof e[b.event])throw new Error("Unknown Worker Event");e[b.event](e.packet.clone.parseClonedPackets(c,b.event)).then(function(a){d({event:"method-return",data:e.packet.clone.clonePackets(a)})})["catch"](function(a){d({event:"method-return",err:a.message})})}}},{}]},{},[1]);
|
Loading…
Reference in a new issue