Comparing version 4.5.0 to 4.5.1
@@ -117,6 +117,6 @@ (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ | ||
} | ||
// construct ReadableStreams from MessagePorts | ||
openpgp.util.restoreStreams(options); | ||
// parse cloned packets | ||
options = openpgp.packet.clone.parseClonedPackets(options, method); | ||
// construct ReadableStreams from MessagePorts | ||
openpgp.util.restoreStreams(options); | ||
openpgp[method](options).then(function(data) { | ||
@@ -123,0 +123,0 @@ // clone packets (for web worker structured cloning algorithm) |
@@ -1,2 +0,2 @@ | ||
/*! OpenPGP.js v4.5.0 - 2019-05-02 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */ | ||
!function(){return function e(n,t,r){function o(a,f){if(!t[a]){if(!n[a]){var s="function"==typeof require&&require;if(!f&&s)return s(a,!0);if(i)return i(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var c=t[a]={exports:{}};n[a][0].call(c.exports,function(e){return o(n[a][1][e]||e)},c,c.exports,e,n,t,r)}return t[a].exports}for(var i="function"==typeof require&&require,a=0;a<r.length;a++)o(r[a]);return o}}()({1:[function(e,n,t){self.window=self,importScripts("openpgp.min.js");var r=window.openpgp,o=[],i=6e4;function a(e){self.postMessage(e,r.util.getTransferables(e.data,!0))}r.crypto.random.randomBuffer.init(i,function(){return o.length||self.postMessage({event:"request-seed",amount:i}),new Promise(function(e){o.push(e)})}),self.onmessage=function(e){var n,t=e.data||{};switch(t.event){case"configure":n=t.config,Object.keys(n).forEach(function(e){r.config[e]=n[e]});break;case"seed-random":!function(e){e instanceof Uint8Array||(e=new Uint8Array(e));r.crypto.random.randomBuffer.set(e)}(t.buf);var i=o;o=[];for(var f=0;f<i.length;f++)i[f]();break;default:!function(e,n,t){if("function"!=typeof r[n])return void a({id:e,event:"method-return",err:"Unknown Worker Event"});t=r.packet.clone.parseClonedPackets(t,n),r.util.restoreStreams(t),r[n](t).then(function(n){a({id:e,event:"method-return",data:r.packet.clone.clonePackets(n)})}).catch(function(n){r.util.print_debug_error(n),a({id:e,event:"method-return",err:n.message,stack:n.stack})})}(t.id,t.event,t.options||{})}},postMessage({event:"loaded"})},{}]},{},[1]); | ||
/*! OpenPGP.js v4.5.1 - 2019-05-06 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */ | ||
!function(){return function e(n,t,r){function o(a,f){if(!t[a]){if(!n[a]){var s="function"==typeof require&&require;if(!f&&s)return s(a,!0);if(i)return i(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var c=t[a]={exports:{}};n[a][0].call(c.exports,function(e){return o(n[a][1][e]||e)},c,c.exports,e,n,t,r)}return t[a].exports}for(var i="function"==typeof require&&require,a=0;a<r.length;a++)o(r[a]);return o}}()({1:[function(e,n,t){self.window=self,importScripts("openpgp.min.js");var r=window.openpgp,o=[],i=6e4;function a(e){self.postMessage(e,r.util.getTransferables(e.data,!0))}r.crypto.random.randomBuffer.init(i,function(){return o.length||self.postMessage({event:"request-seed",amount:i}),new Promise(function(e){o.push(e)})}),self.onmessage=function(e){var n,t=e.data||{};switch(t.event){case"configure":n=t.config,Object.keys(n).forEach(function(e){r.config[e]=n[e]});break;case"seed-random":!function(e){e instanceof Uint8Array||(e=new Uint8Array(e));r.crypto.random.randomBuffer.set(e)}(t.buf);var i=o;o=[];for(var f=0;f<i.length;f++)i[f]();break;default:!function(e,n,t){if("function"!=typeof r[n])return void a({id:e,event:"method-return",err:"Unknown Worker Event"});r.util.restoreStreams(t),t=r.packet.clone.parseClonedPackets(t,n),r[n](t).then(function(n){a({id:e,event:"method-return",data:r.packet.clone.clonePackets(n)})}).catch(function(n){r.util.print_debug_error(n),a({id:e,event:"method-return",err:n.message,stack:n.stack})})}(t.id,t.event,t.options||{})}},postMessage({event:"loaded"})},{}]},{},[1]); |
@@ -117,6 +117,6 @@ (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ | ||
} | ||
// construct ReadableStreams from MessagePorts | ||
openpgp.util.restoreStreams(options); | ||
// parse cloned packets | ||
options = openpgp.packet.clone.parseClonedPackets(options, method); | ||
// construct ReadableStreams from MessagePorts | ||
openpgp.util.restoreStreams(options); | ||
openpgp[method](options).then(function(data) { | ||
@@ -123,0 +123,0 @@ // clone packets (for web worker structured cloning algorithm) |
@@ -1,2 +0,2 @@ | ||
/*! OpenPGP.js v4.5.0 - 2019-05-02 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */ | ||
!function(){return function e(n,t,r){function o(a,f){if(!t[a]){if(!n[a]){var s="function"==typeof require&&require;if(!f&&s)return s(a,!0);if(i)return i(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var c=t[a]={exports:{}};n[a][0].call(c.exports,function(e){return o(n[a][1][e]||e)},c,c.exports,e,n,t,r)}return t[a].exports}for(var i="function"==typeof require&&require,a=0;a<r.length;a++)o(r[a]);return o}}()({1:[function(e,n,t){self.window=self,importScripts("openpgp.min.js");var r=window.openpgp,o=[],i=6e4;function a(e){self.postMessage(e,r.util.getTransferables(e.data,!0))}r.crypto.random.randomBuffer.init(i,function(){return o.length||self.postMessage({event:"request-seed",amount:i}),new Promise(function(e){o.push(e)})}),self.onmessage=function(e){var n,t=e.data||{};switch(t.event){case"configure":n=t.config,Object.keys(n).forEach(function(e){r.config[e]=n[e]});break;case"seed-random":!function(e){e instanceof Uint8Array||(e=new Uint8Array(e));r.crypto.random.randomBuffer.set(e)}(t.buf);var i=o;o=[];for(var f=0;f<i.length;f++)i[f]();break;default:!function(e,n,t){if("function"!=typeof r[n])return void a({id:e,event:"method-return",err:"Unknown Worker Event"});t=r.packet.clone.parseClonedPackets(t,n),r.util.restoreStreams(t),r[n](t).then(function(n){a({id:e,event:"method-return",data:r.packet.clone.clonePackets(n)})}).catch(function(n){r.util.print_debug_error(n),a({id:e,event:"method-return",err:n.message,stack:n.stack})})}(t.id,t.event,t.options||{})}},postMessage({event:"loaded"})},{}]},{},[1]); | ||
/*! OpenPGP.js v4.5.1 - 2019-05-06 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */ | ||
!function(){return function e(n,t,r){function o(a,f){if(!t[a]){if(!n[a]){var s="function"==typeof require&&require;if(!f&&s)return s(a,!0);if(i)return i(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var c=t[a]={exports:{}};n[a][0].call(c.exports,function(e){return o(n[a][1][e]||e)},c,c.exports,e,n,t,r)}return t[a].exports}for(var i="function"==typeof require&&require,a=0;a<r.length;a++)o(r[a]);return o}}()({1:[function(e,n,t){self.window=self,importScripts("openpgp.min.js");var r=window.openpgp,o=[],i=6e4;function a(e){self.postMessage(e,r.util.getTransferables(e.data,!0))}r.crypto.random.randomBuffer.init(i,function(){return o.length||self.postMessage({event:"request-seed",amount:i}),new Promise(function(e){o.push(e)})}),self.onmessage=function(e){var n,t=e.data||{};switch(t.event){case"configure":n=t.config,Object.keys(n).forEach(function(e){r.config[e]=n[e]});break;case"seed-random":!function(e){e instanceof Uint8Array||(e=new Uint8Array(e));r.crypto.random.randomBuffer.set(e)}(t.buf);var i=o;o=[];for(var f=0;f<i.length;f++)i[f]();break;default:!function(e,n,t){if("function"!=typeof r[n])return void a({id:e,event:"method-return",err:"Unknown Worker Event"});r.util.restoreStreams(t),t=r.packet.clone.parseClonedPackets(t,n),r[n](t).then(function(n){a({id:e,event:"method-return",data:r.packet.clone.clonePackets(n)})}).catch(function(n){r.util.print_debug_error(n),a({id:e,event:"method-return",err:n.message,stack:n.stack})})}(t.id,t.event,t.options||{})}},postMessage({event:"loaded"})},{}]},{},[1]); |
{ | ||
"name": "openpgp", | ||
"description": "OpenPGP.js is a Javascript implementation of the OpenPGP protocol. This is defined in RFC 4880.", | ||
"version": "4.5.0", | ||
"version": "4.5.1", | ||
"license": "LGPL-3.0+", | ||
@@ -73,3 +73,2 @@ "homepage": "https://openpgpjs.org/", | ||
"whatwg-fetch": "^2.0.3", | ||
"@mattiasbuelens/web-streams-polyfill": "^0.3.1", | ||
@@ -76,0 +75,0 @@ "address-rfc2822": "^2.0.3", |
/** | ||
* @fileoverview Provides functions for asymmetric signing and signature verification | ||
* @requires bn.js | ||
* @requires crypto/crypto | ||
* @requires crypto/public_key | ||
@@ -12,2 +13,3 @@ * @requires crypto/pkcs1 | ||
import BN from 'bn.js'; | ||
import crypto from './crypto'; | ||
import publicKey from './public_key'; | ||
@@ -34,2 +36,6 @@ import pkcs1 from './pkcs1'; | ||
verify: async function(algo, hash_algo, msg_MPIs, pub_MPIs, data, hashed) { | ||
const types = crypto.getPubKeyParamTypes(algo); | ||
if (pub_MPIs.length < types.length) { | ||
throw new Error('Missing public key parameters'); | ||
} | ||
switch (algo) { | ||
@@ -88,2 +94,6 @@ case enums.publicKey.rsa_encrypt_sign: | ||
sign: async function(algo, hash_algo, key_params, data, hashed) { | ||
const types = [].concat(crypto.getPubKeyParamTypes(algo), crypto.getPrivKeyParamTypes(algo)); | ||
if (key_params.length < types.length) { | ||
throw new Error('Missing private key parameters'); | ||
} | ||
switch (algo) { | ||
@@ -90,0 +100,0 @@ case enums.publicKey.rsa_encrypt_sign: |
@@ -84,4 +84,6 @@ // OpenPGP.js - An OpenPGP implementation in javascript | ||
const packets = (await signature).packets; | ||
await verified; | ||
delete packets[0].signature; | ||
try { | ||
await verified; | ||
delete packets[0].signature; | ||
} catch(e) {} | ||
return packets; | ||
@@ -92,2 +94,5 @@ }); | ||
} | ||
if (verObject.error) { | ||
verObject.error = verObject.error.message; | ||
} | ||
return verObject; | ||
@@ -156,2 +161,3 @@ } | ||
clone.signature = stream.readToEnd(clone.signature, ([signature]) => new Signature(List.fromStructuredClone(signature))); | ||
clone.signature.catch(() => {}); | ||
} else { | ||
@@ -161,2 +167,6 @@ clone.signature = new Signature(List.fromStructuredClone(clone.signature)); | ||
clone.verified = stream.readToEnd(clone.verified, ([verified]) => verified); | ||
clone.verified.catch(() => {}); | ||
if (clone.error) { | ||
clone.error = new Error(clone.error); | ||
} | ||
return clone; | ||
@@ -163,0 +173,0 @@ } |
@@ -226,2 +226,5 @@ /* eslint-disable callback-return */ | ||
} | ||
if (packetlistClone.stream) { | ||
packetlist.stream = stream.transform(packetlistClone.stream, packet => packets.fromStructuredClone(packet)); | ||
} | ||
return packetlist; | ||
@@ -228,0 +231,0 @@ }; |
@@ -167,2 +167,7 @@ // GPG4Browsers - An OpenPGP implementation in javascript | ||
SecretKey.prototype.encrypt = async function (passphrase) { | ||
if (this.isDecrypted() && this.encrypted) { // gnu-dummy | ||
this.isEncrypted = true; | ||
return false; | ||
} | ||
if (this.isDecrypted() && !passphrase) { | ||
@@ -261,2 +266,6 @@ this.encrypted = null; | ||
if (s2k.type === 'gnu-dummy') { | ||
this.isEncrypted = false; | ||
return false; | ||
} | ||
key = await produceEncryptionKey(s2k, passphrase, symmetric); | ||
@@ -263,0 +272,0 @@ } else { |
@@ -70,3 +70,6 @@ // GPG4Browsers - An OpenPGP implementation in javascript | ||
this.type = enums.read(enums.s2k, bytes[i++]); | ||
this.algorithm = enums.read(enums.hash, bytes[i++]); | ||
this.algorithm = bytes[i++]; | ||
if (this.type !== 'gnu') { | ||
this.algorithm = enums.read(enums.hash, this.algorithm); | ||
} | ||
@@ -91,7 +94,7 @@ switch (this.type) { | ||
case 'gnu': | ||
if (util.Uint8Array_to_str(bytes.subarray(i, 3)) === "GNU") { | ||
if (util.Uint8Array_to_str(bytes.subarray(i, i + 3)) === "GNU") { | ||
i += 3; // GNU | ||
const gnuExtType = 1000 + bytes[i++]; | ||
if (gnuExtType === 1001) { | ||
this.type = gnuExtType; | ||
this.type = 'gnu-dummy'; | ||
// GnuPG extension mode 1001 -- don't write secret key at all | ||
@@ -98,0 +101,0 @@ } else { |
@@ -86,6 +86,11 @@ // GPG4Browsers - An OpenPGP implementation in javascript | ||
if (action === 'read') { | ||
const result = await reader.read(); | ||
port1.postMessage(result, util.getTransferables(result, true)); | ||
try { | ||
const result = await reader.read(); | ||
port1.postMessage(result, util.getTransferables(result)); | ||
} catch(e) { | ||
port1.postMessage({ error: e.message }); | ||
} | ||
} else if (action === 'cancel') { | ||
port1.postMessage(await transformed.cancel()); | ||
await transformed.cancel(); | ||
port1.postMessage(); | ||
} | ||
@@ -120,4 +125,6 @@ }; | ||
value.onmessage = evt => { | ||
const { done, value } = evt.data; | ||
if (!done) { | ||
const { done, value, error } = evt.data; | ||
if (error) { | ||
controller.error(new Error(error)); | ||
} else if (!done) { | ||
controller.enqueue(value); | ||
@@ -124,0 +131,0 @@ } else { |
@@ -116,6 +116,6 @@ // GPG4Browsers - An OpenPGP implementation in javascript | ||
} | ||
// construct ReadableStreams from MessagePorts | ||
openpgp.util.restoreStreams(options); | ||
// parse cloned packets | ||
options = openpgp.packet.clone.parseClonedPackets(options, method); | ||
// construct ReadableStreams from MessagePorts | ||
openpgp.util.restoreStreams(options); | ||
openpgp[method](options).then(function(data) { | ||
@@ -122,0 +122,0 @@ // clone packets (for web worker structured cloning algorithm) |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
6124678
115049
7