Release new version

This commit is contained in:
Bart Butler 2017-12-02 22:03:17 -08:00
parent e91129aeeb
commit 2ffa221b21
6 changed files with 44 additions and 20 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "openpgp", "name": "openpgp",
"version": "2.5.14", "version": "2.6.0",
"license": "LGPL-3.0+", "license": "LGPL-3.0+",
"homepage": "http://openpgpjs.org/", "homepage": "http://openpgpjs.org/",
"authors": [ "authors": [

52
dist/openpgp.js vendored
View File

@ -5195,7 +5195,7 @@ exports.default = {
tolerant: true, // ignore unsupported/unrecognizable packets instead of throwing an error tolerant: true, // ignore unsupported/unrecognizable packets instead of throwing an error
show_version: true, show_version: true,
show_comment: true, show_comment: true,
versionstring: "OpenPGP.js v2.5.14", versionstring: "OpenPGP.js v2.6.0",
commentstring: "https://openpgpjs.org", commentstring: "https://openpgpjs.org",
keyserver: "https://keyserver.ubuntu.com", keyserver: "https://keyserver.ubuntu.com",
node_store: './openpgp.store' node_store: './openpgp.store'
@ -15435,9 +15435,10 @@ Message.prototype.getText = function () {
* Encrypt the message either with public keys, passwords, or both at once. * Encrypt the message either with public keys, passwords, or both at once.
* @param {Array<Key>} keys (optional) public key(s) for message encryption * @param {Array<Key>} keys (optional) public key(s) for message encryption
* @param {Array<String>} passwords (optional) password(s) for message encryption * @param {Array<String>} passwords (optional) password(s) for message encryption
* @param {Object} sessionKey (optional) session key in the form: { data:Uint8Array, algorithm:String }
* @return {Message} new message with encrypted content * @return {Message} new message with encrypted content
*/ */
Message.prototype.encrypt = function (keys, passwords) { Message.prototype.encrypt = function (keys, passwords, sessionKey) {
var _this2 = this; var _this2 = this;
var symAlgo = void 0, var symAlgo = void 0,
@ -15445,15 +15446,24 @@ Message.prototype.encrypt = function (keys, passwords) {
symEncryptedPacket = void 0; symEncryptedPacket = void 0;
return Promise.resolve().then(function () { return Promise.resolve().then(function () {
if (keys) { if (keys) {
symAlgo = keyModule.getPreferredSymAlgo(keys); symAlgo = _enums2.default.read(_enums2.default.symmetric, keyModule.getPreferredSymAlgo(keys));
} else if (passwords) { } else if (passwords) {
symAlgo = _config2.default.encryption_cipher; symAlgo = _enums2.default.read(_enums2.default.symmetric, _config2.default.encryption_cipher);
} else { } else {
throw new Error('No keys or passwords'); throw new Error('No keys or passwords');
} }
var sessionKey = _crypto2.default.generateSessionKey(_enums2.default.read(_enums2.default.symmetric, symAlgo)); if (sessionKey) {
msg = encryptSessionKey(sessionKey, _enums2.default.read(_enums2.default.symmetric, symAlgo), keys, passwords); if (!_util2.default.isUint8Array(sessionKey.data) || !_util2.default.isString(sessionKey.algorithm)) {
throw new Error('Invalid session key for encryption.');
}
symAlgo = sessionKey.algorithm;
sessionKey = sessionKey.data;
} else {
sessionKey = _crypto2.default.generateSessionKey(symAlgo);
}
msg = encryptSessionKey(sessionKey, symAlgo, keys, passwords);
if (_config2.default.aead_protect) { if (_config2.default.aead_protect) {
symEncryptedPacket = new _packet2.default.SymEncryptedAEADProtected(); symEncryptedPacket = new _packet2.default.SymEncryptedAEADProtected();
@ -15464,11 +15474,17 @@ Message.prototype.encrypt = function (keys, passwords) {
} }
symEncryptedPacket.packets = _this2.packets; symEncryptedPacket.packets = _this2.packets;
return symEncryptedPacket.encrypt(_enums2.default.read(_enums2.default.symmetric, symAlgo), sessionKey); return symEncryptedPacket.encrypt(symAlgo, sessionKey);
}).then(function () { }).then(function () {
msg.packets.push(symEncryptedPacket); msg.packets.push(symEncryptedPacket);
symEncryptedPacket.packets = new _packet2.default.List(); // remove packets after encryption symEncryptedPacket.packets = new _packet2.default.List(); // remove packets after encryption
return msg; return {
message: msg,
sessionKey: {
data: sessionKey,
algorithm: symAlgo
}
};
}); });
}; };
@ -16063,10 +16079,12 @@ function decryptKey(_ref4) {
* @param {Key|Array<Key>} publicKeys (optional) array of keys or single key, used to encrypt the message * @param {Key|Array<Key>} publicKeys (optional) array of keys or single key, used to encrypt the message
* @param {Key|Array<Key>} privateKeys (optional) private keys for signing. If omitted message will not be signed * @param {Key|Array<Key>} privateKeys (optional) private keys for signing. If omitted message will not be signed
* @param {String|Array<String>} passwords (optional) array of passwords or a single password to encrypt the message * @param {String|Array<String>} passwords (optional) array of passwords or a single password to encrypt the message
* @param {Object} sessionKey (optional) session key in the form: { data:Uint8Array, algorithm:String }
* @param {String} filename (optional) a filename for the literal data packet * @param {String} filename (optional) a filename for the literal data packet
* @param {Boolean} armor (optional) if the return values should be ascii armored or the message/signature objects * @param {Boolean} armor (optional) if the return values should be ascii armored or the message/signature objects
* @param {Boolean} detached (optional) if the signature should be detached (if true, signature will be added to returned object) * @param {Boolean} detached (optional) if the signature should be detached (if true, signature will be added to returned object)
* @param {Signature} signature (optional) a detached signature to add to the encrypted message * @param {Signature} signature (optional) a detached signature to add to the encrypted message
* @param {Boolean} returnSessionKey (optional) if the unencrypted session key should be added to returned object
* @return {Promise<Object>} encrypted (and optionally signed message) in the form: * @return {Promise<Object>} encrypted (and optionally signed message) in the form:
* {data: ASCII armored message if 'armor' is true, * {data: ASCII armored message if 'armor' is true,
* message: full Message object if 'armor' is false, signature: detached signature if 'detached' is true} * message: full Message object if 'armor' is false, signature: detached signature if 'detached' is true}
@ -16077,19 +16095,22 @@ function encrypt(_ref5) {
publicKeys = _ref5.publicKeys, publicKeys = _ref5.publicKeys,
privateKeys = _ref5.privateKeys, privateKeys = _ref5.privateKeys,
passwords = _ref5.passwords, passwords = _ref5.passwords,
sessionKey = _ref5.sessionKey,
filename = _ref5.filename, filename = _ref5.filename,
_ref5$armor = _ref5.armor, _ref5$armor = _ref5.armor,
armor = _ref5$armor === undefined ? true : _ref5$armor, armor = _ref5$armor === undefined ? true : _ref5$armor,
_ref5$detached = _ref5.detached, _ref5$detached = _ref5.detached,
detached = _ref5$detached === undefined ? false : _ref5$detached, detached = _ref5$detached === undefined ? false : _ref5$detached,
_ref5$signature = _ref5.signature, _ref5$signature = _ref5.signature,
signature = _ref5$signature === undefined ? null : _ref5$signature; signature = _ref5$signature === undefined ? null : _ref5$signature,
_ref5$returnSessionKe = _ref5.returnSessionKey,
returnSessionKey = _ref5$returnSessionKe === undefined ? false : _ref5$returnSessionKe;
checkData(data);publicKeys = toArray(publicKeys);privateKeys = toArray(privateKeys);passwords = toArray(passwords); checkData(data);publicKeys = toArray(publicKeys);privateKeys = toArray(privateKeys);passwords = toArray(passwords);
if (!nativeAEAD() && asyncProxy) { if (!nativeAEAD() && asyncProxy) {
// use web worker if web crypto apis are not supported // use web worker if web crypto apis are not supported
return asyncProxy.delegate('encrypt', { data: data, publicKeys: publicKeys, privateKeys: privateKeys, passwords: passwords, filename: filename, armor: armor, detached: detached, signature: signature }); return asyncProxy.delegate('encrypt', { data: data, publicKeys: publicKeys, privateKeys: privateKeys, passwords: passwords, sessionKey: sessionKey, filename: filename, armor: armor, detached: detached, signature: signature, returnSessionKey: returnSessionKey });
} }
var result = {}; var result = {};
return Promise.resolve().then(function () { return Promise.resolve().then(function () {
@ -16111,12 +16132,15 @@ function encrypt(_ref5) {
message = message.sign(privateKeys, signature); message = message.sign(privateKeys, signature);
} }
} }
return message.encrypt(publicKeys, passwords); return message.encrypt(publicKeys, passwords, sessionKey);
}).then(function (message) { }).then(function (encrypted) {
if (armor) { if (armor) {
result.data = message.armor(); result.data = encrypted.message.armor();
} else { } else {
result.message = message; result.message = encrypted.message;
}
if (returnSessionKey) {
result.sessionKey = encrypted.sessionKey;
} }
return result; return result;
}).catch(onError.bind(null, 'Error encrypting message')); }).catch(onError.bind(null, 'Error encrypting message'));

4
dist/openpgp.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,2 +1,2 @@
/*! OpenPGP.js v2.5.14 - 2017-12-01 - this is LGPL licensed code, see LICENSE/our website http://openpgpjs.org/ for more information. */ /*! OpenPGP.js v2.6.0 - 2017-12-02 - 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]); !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]);

2
npm-shrinkwrap.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "openpgp", "name": "openpgp",
"version": "2.5.14", "version": "2.6.0",
"dependencies": { "dependencies": {
"abbrev": { "abbrev": {
"version": "1.1.1", "version": "1.1.1",

View File

@ -1,7 +1,7 @@
{ {
"name": "openpgp", "name": "openpgp",
"description": "OpenPGP.js is a Javascript implementation of the OpenPGP protocol. This is defined in RFC 4880.", "description": "OpenPGP.js is a Javascript implementation of the OpenPGP protocol. This is defined in RFC 4880.",
"version": "2.5.14", "version": "2.6.0",
"license": "LGPL-3.0+", "license": "LGPL-3.0+",
"homepage": "http://openpgpjs.org/", "homepage": "http://openpgpjs.org/",
"engines": { "engines": {