New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

openpgp

Package Overview
Dependencies
Maintainers
3
Versions
181
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openpgp - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

9

dist/openpgp.worker.js

@@ -23,2 +23,11 @@ (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){

/**
* @fileoverview Provides functions for communicating with workers
* @see module:openpgp.initWorker
* @see module:openpgp.getWorker
* @see module:openpgp.destroyWorker
* @see module:worker/async_proxy
* @module worker/worker
*/
self.window = {}; // to make UMD bundles work

@@ -25,0 +34,0 @@

2

dist/openpgp.worker.min.js

@@ -1,2 +0,2 @@

/*! OpenPGP.js v3.0.0 - 2018-03-08 - this is LGPL licensed code, see LICENSE/our website https://openpgpjs.org/ for more information. */
/*! OpenPGP.js v3.0.1 - 2018-03-15 - 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]);
{
"name": "openpgp",
"description": "OpenPGP.js is a Javascript implementation of the OpenPGP protocol. This is defined in RFC 4880.",
"version": "3.0.0",
"version": "3.0.1",
"license": "LGPL-3.0+",

@@ -6,0 +6,0 @@ "homepage": "https://openpgpjs.org/",

@@ -38,4 +38,4 @@ // GPG4Browsers - An OpenPGP implementation in javascript

* See {@link https://tools.ietf.org/html/rfc4880#section-7}
* @param {String} text The cleartext of the signed message
* @param {module:signature} signature The detached signature or an empty signature if message not yet signed
* @param {String} text The cleartext of the signed message
* @param {module:signature.Signature} signature The detached signature or an empty signature for unsigned messages
*/

@@ -69,6 +69,6 @@ export function CleartextMessage(text, signature) {

* Sign the cleartext message
* @param {Array<module:key~Key>} privateKeys private keys with decrypted secret key data for signing
* @param {Array<module:key.Key>} privateKeys private keys with decrypted secret key data for signing
* @param {Signature} signature (optional) any existing detached signature
* @param {Date} date (optional) The creation time of the signature that should be created
* @returns {Promise<module:message~CleartextMessage>} new cleartext message with signed content
* @returns {Promise<module:cleartext.CleartextMessage>} new cleartext message with signed content
* @async

@@ -82,6 +82,6 @@ */

* Sign the cleartext message
* @param {Array<module:key~Key>} privateKeys private keys with decrypted secret key data for signing
* @param {Array<module:key.Key>} privateKeys private keys with decrypted secret key data for signing
* @param {Signature} signature (optional) any existing detached signature
* @param {Date} date (optional) The creation time of the signature that should be created
* @returns {Promise<module:signature~Signature>} new detached signature of message content
* @returns {Promise<module:signature.Signature>} new detached signature of message content
* @async

@@ -98,3 +98,3 @@ */

* Verify signatures of cleartext signed message
* @param {Array<module:key~Key>} keys array of keys to verify signatures
* @param {Array<module:key.Key>} keys array of keys to verify signatures
* @param {Date} date (optional) Verify the signature against the given date, i.e. check signature creation time < date < expiration time

@@ -110,3 +110,3 @@ * @returns {Promise<Array<{keyid: module:type/keyid, valid: Boolean}>>} list of signer's keyid and validity of signature

* Verify signatures of cleartext signed message
* @param {Array<module:key~Key>} keys array of keys to verify signatures
* @param {Array<module:key.Key>} keys array of keys to verify signatures
* @param {Date} date (optional) Verify the signature against the given date, i.e. check signature creation time < date < expiration time

@@ -154,3 +154,3 @@ * @returns {Promise<Array<{keyid: module:type/keyid, valid: Boolean}>>} list of signer's keyid and validity of signature

* @param {String} armoredText text to be parsed
* @returns {module:cleartext~CleartextMessage} new cleartext message object
* @returns {module:cleartext.CleartextMessage} new cleartext message object
* @static

@@ -172,5 +172,5 @@ */

* Compare hash algorithm specified in the armor header with signatures
* @param {Array<String>} headers Armor headers
* @param {module:packet.List} packetlist The packetlist with signature packets
* @private
* @param {Array<String>} headers Armor headers
* @param {module:packet/packetlist} packetlist The packetlist with signature packets
*/

@@ -177,0 +177,0 @@ function verifyHeaders(headers, packetlist) {

@@ -22,3 +22,3 @@ // GPG4Browsers - An OpenPGP implementation in javascript

* @see module:crypto/public_key/elliptic/ecdh
* @see module:packet/public_key_encrypted_session_key
* @see module:packet.PublicKeyEncryptedSessionKey
* @requires crypto/random

@@ -25,0 +25,0 @@ * @requires crypto/hash

@@ -20,3 +20,3 @@ // OpenPGP.js - An OpenPGP implementation in javascript

* @fileoverview Functions to add and remove PKCS5 padding
* @see module:packet/public_key_encrypted_session_key
* @see module:packet.PublicKeyEncryptedSessionKey
* @module crypto/pkcs5

@@ -23,0 +23,0 @@ */

@@ -20,3 +20,3 @@ // OpenPGP.js - An OpenPGP implementation in javascript

* @fileoverview Key encryption and decryption for RFC 6637 ECDH
* @requires crypto/public_key/elliptic/curves
* @requires crypto/public_key/elliptic/curve
* @requires crypto/aes_kw

@@ -67,9 +67,9 @@ * @requires crypto/cipher

*
* @param {module:type/oid} oid Elliptic curve object identifier
* @param {Enums} cipher_algo Symmetric cipher to use
* @param {Enums} hash_algo Hash algorithm to use
* @param {module:type/mpi} m Value derived from session key (RFC 6637)
* @param {Uint8Array} Q Recipient public key
* @param {String} fingerprint Recipient fingerprint
* @returns {{V: BN, C: BN}} Returns ephemeral key and encoded session key
* @param {module:type/oid} oid Elliptic curve object identifier
* @param {module:enums.symmetric} cipher_algo Symmetric cipher to use
* @param {module:enums.hash} hash_algo Hash algorithm to use
* @param {module:type/mpi} m Value derived from session key (RFC 6637)
* @param {Uint8Array} Q Recipient public key
* @param {String} fingerprint Recipient fingerprint
* @returns {{V: BN, C: BN}} Returns ephemeral key and encoded session key
* @async

@@ -96,10 +96,10 @@ */

*
* @param {module:type/oid} oid Elliptic curve object identifier
* @param {Enums} cipher_algo Symmetric cipher to use
* @param {Enums} hash_algo Hash algorithm to use
* @param {BN} V Public part of ephemeral key
* @param {Uint8Array} C Encrypted and wrapped value derived from session key
* @param {Uint8Array} d Recipient private key
* @param {String} fingerprint Recipient fingerprint
* @returns {Uint8Array} Value derived from session
* @param {module:type/oid} oid Elliptic curve object identifier
* @param {module:enums.symmetric} cipher_algo Symmetric cipher to use
* @param {module:enums.hash} hash_algo Hash algorithm to use
* @param {BN} V Public part of ephemeral key
* @param {Uint8Array} C Encrypted and wrapped value derived from session key
* @param {Uint8Array} d Recipient private key
* @param {String} fingerprint Recipient fingerprint
* @returns {Uint8Array} Value derived from session
* @async

@@ -106,0 +106,0 @@ */

@@ -21,3 +21,3 @@ // OpenPGP.js - An OpenPGP implementation in javascript

* @requires crypto/hash
* @requires crypto/public_key/elliptic/curves
* @requires crypto/public_key/elliptic/curve
* @module crypto/public_key/elliptic/ecdsa

@@ -31,6 +31,6 @@ */

* Sign a message using the provided key
* @param {module:type/oid} oid Elliptic curve object identifier
* @param {enums.hash} hash_algo Hash algorithm used to sign
* @param {Uint8Array} m Message to sign
* @param {Uint8Array} d Private key used to sign the message
* @param {module:type/oid} oid Elliptic curve object identifier
* @param {module:enums.hash} hash_algo Hash algorithm used to sign
* @param {Uint8Array} m Message to sign
* @param {Uint8Array} d Private key used to sign the message
* @returns {{r: Uint8Array,

@@ -50,8 +50,8 @@ * s: Uint8Array}} Signature of the message

* Verifies if a signature is valid for a message
* @param {module:type/oid} oid Elliptic curve object identifier
* @param {enums.hash} hash_algo Hash algorithm used in the signature
* @param {module:type/oid} oid Elliptic curve object identifier
* @param {module:enums.hash} hash_algo Hash algorithm used in the signature
* @param {{r: Uint8Array,
s: Uint8Array}} signature Signature to verify
* @param {Uint8Array} m Message to verify
* @param {Uint8Array} Q Public key used to verify the message
s: Uint8Array}} signature Signature to verify
* @param {Uint8Array} m Message to verify
* @param {Uint8Array} Q Public key used to verify the message
* @returns {Boolean}

@@ -58,0 +58,0 @@ * @async

@@ -22,3 +22,3 @@ // OpenPGP.js - An OpenPGP implementation in javascript

* @requires crypto/hash
* @requires crypto/public_key/elliptic/curves
* @requires crypto/public_key/elliptic/curve
* @module crypto/public_key/elliptic/eddsa

@@ -33,6 +33,6 @@ */

* Sign a message using the provided key
* @param {module:type/oid} oid Elliptic curve object identifier
* @param {enums.hash} hash_algo Hash algorithm used to sign
* @param {Uint8Array} m Message to sign
* @param {Uint8Array} d Private key used to sign
* @param {module:type/oid} oid Elliptic curve object identifier
* @param {module:enums.hash} hash_algo Hash algorithm used to sign
* @param {Uint8Array} m Message to sign
* @param {Uint8Array} d Private key used to sign
* @returns {{R: Uint8Array,

@@ -53,8 +53,8 @@ * S: Uint8Array}} Signature of the message

* Verifies if a signature is valid for a message
* @param {module:type/oid} oid Elliptic curve object identifier
* @param {enums.hash} hash_algo Hash algorithm used in the signature
* @param {module:type/oid} oid Elliptic curve object identifier
* @param {module:enums.hash} hash_algo Hash algorithm used in the signature
* @param {{R: Uint8Array,
S: Uint8Array}} signature Signature to verify the message
* @param {Uint8Array} m Message to verify
* @param {Uint8Array} Q Public key used to verify the message
S: Uint8Array}} signature Signature to verify the message
* @param {Uint8Array} m Message to verify
* @param {Uint8Array} Q Public key used to verify the message
* @returns {Boolean}

@@ -61,0 +61,0 @@ * @async

@@ -21,3 +21,3 @@ // OpenPGP.js - An OpenPGP implementation in javascript

* @requires bn.js
* @requires crypto/public_key/elliptic/curves
* @requires crypto/public_key/elliptic/curve
* @requires crypto/hash

@@ -24,0 +24,0 @@ * @requires util

@@ -39,5 +39,4 @@ // GPG4Browsers - An OpenPGP implementation in javascript

* Can contain additional subkeys, signatures, user ids, user attributes.
* @param {module:packet/packetlist} packetlist The packets that form this key
* @param {module:packet.List} packetlist The packets that form this key
*/
export function Key(packetlist) {

@@ -61,3 +60,3 @@ if (!(this instanceof Key)) {

* Transforms packetlist to structured key data
* @param {module:packet/packetlist} packetlist The packets that form a key
* @param {module:packet.List} packetlist The packets that form a key
*/

@@ -137,3 +136,3 @@ Key.prototype.packetlist2structure = function(packetlist) {

* Transforms structured key data to packetlist
* @returns {module:packet/packetlist} The packets that form a key
* @returns {module:packet.List} The packets that form a key
*/

@@ -154,3 +153,3 @@ Key.prototype.toPacketlist = function() {

* @param {type/keyid} keyId
* @returns {module:packet/packetlist}
* @returns {module:packet.List}
*/

@@ -171,3 +170,3 @@ Key.prototype.getSubkeyPackets = function(keyId=null) {

* @param {type/keyid} keyId
* @returns {module:packet/packetlist}
* @returns {module:packet.List}
*/

@@ -219,3 +218,3 @@ Key.prototype.getKeyPackets = function(keyId=null) {

* Returns key as public key (shallow copy)
* @returns {module:key~Key} new public Key
* @returns {module:key.Key} new public Key
*/

@@ -272,4 +271,4 @@ Key.prototype.toPublic = function() {

* @param {Date} date use the given date for verification instead of the current time
* @returns {Promise<module:packet/secret_subkey|
module:packet/secret_key|null>} key packet or null if no signing key has been found
* @returns {Promise<module:packet.SecretSubkey|
* module:packet.SecretKey|null>} key packet or null if no signing key has been found
* @async

@@ -279,15 +278,17 @@ */

const primaryKey = this.primaryKey;
const primaryUser = await this.getPrimaryUser(date);
if (primaryUser && (!keyId || primaryKey.getKeyId().equals(keyId)) &&
isValidSigningKeyPacket(primaryKey, primaryUser.selfCertification, date) &&
await this.verifyPrimaryKey(date)) {
return primaryKey;
}
for (let i = 0; i < this.subKeys.length; i++) {
if (!keyId || this.subKeys[i].subKey.getKeyId().equals(keyId)) {
// eslint-disable-next-line no-await-in-loop
await this.subKeys[i].verify(primaryKey, date);
for (let j = 0; j < this.subKeys[i].bindingSignatures.length; j++) {
if (isValidSigningKeyPacket(this.subKeys[i].subKey, this.subKeys[i].bindingSignatures[j], date)) {
return this.subKeys[i].subKey;
if (await this.verifyPrimaryKey(date) === enums.keyStatus.valid) {
const primaryUser = await this.getPrimaryUser(date);
if (primaryUser && (!keyId || primaryKey.getKeyId().equals(keyId)) &&
isValidSigningKeyPacket(primaryKey, primaryUser.selfCertification, date)) {
return primaryKey;
}
for (let i = 0; i < this.subKeys.length; i++) {
if (!keyId || this.subKeys[i].subKey.getKeyId().equals(keyId)) {
// eslint-disable-next-line no-await-in-loop
if (await this.subKeys[i].verify(primaryKey, date) === enums.keyStatus.valid) {
for (let j = 0; j < this.subKeys[i].bindingSignatures.length; j++) {
if (isValidSigningKeyPacket(this.subKeys[i].subKey, this.subKeys[i].bindingSignatures[j], date)) {
return this.subKeys[i].subKey;
}
}
}

@@ -317,6 +318,6 @@ }

* @param {Date} date, optional
* @returns {Promise<module:packet/public_subkey|
* module:packet/secret_subkey|
* module:packet/secret_key|
* module:packet/public_key|null>} key packet or null if no encryption key has been found
* @returns {Promise<module:packet.PublicSubkey|
* module:packet.SecretSubkey|
* module:packet.SecretKey|
* module:packet.PublicKey|null>} key packet or null if no encryption key has been found
* @async

@@ -326,22 +327,24 @@ */

const primaryKey = this.primaryKey;
// V4: by convention subkeys are preferred for encryption service
// V3: keys MUST NOT have subkeys
for (let i = 0; i < this.subKeys.length; i++) {
if (!keyId || this.subKeys[i].subKey.getKeyId().equals(keyId)) {
// eslint-disable-next-line no-await-in-loop
await this.subKeys[i].verify(primaryKey, date);
for (let j = 0; j < this.subKeys[i].bindingSignatures.length; j++) {
if (isValidEncryptionKeyPacket(this.subKeys[i].subKey, this.subKeys[i].bindingSignatures[j], date)) {
return this.subKeys[i].subKey;
if (await this.verifyPrimaryKey(date) === enums.keyStatus.valid) {
// V4: by convention subkeys are preferred for encryption service
// V3: keys MUST NOT have subkeys
for (let i = 0; i < this.subKeys.length; i++) {
if (!keyId || this.subKeys[i].subKey.getKeyId().equals(keyId)) {
// eslint-disable-next-line no-await-in-loop
if (await this.subKeys[i].verify(primaryKey, date) === enums.keyStatus.valid) {
for (let j = 0; j < this.subKeys[i].bindingSignatures.length; j++) {
if (isValidEncryptionKeyPacket(this.subKeys[i].subKey, this.subKeys[i].bindingSignatures[j], date)) {
return this.subKeys[i].subKey;
}
}
}
}
}
// if no valid subkey for encryption, evaluate primary key
const primaryUser = await this.getPrimaryUser(date);
if (primaryUser && (!keyId || primaryKey.getKeyId().equals(keyId)) &&
isValidEncryptionKeyPacket(primaryKey, primaryUser.selfCertification, date)) {
return primaryKey;
}
}
// if no valid subkey for encryption, evaluate primary key
const primaryUser = await this.getPrimaryUser(date);
if (primaryUser && (!keyId || primaryKey.getKeyId().equals(keyId)) &&
isValidEncryptionKeyPacket(primaryKey, primaryUser.selfCertification, date) &&
await this.verifyPrimaryKey(date)) {
return primaryKey;
}
return null;

@@ -354,3 +357,3 @@ };

* @param {String} passphrase
* @returns {Promise<Array<module:packet/secret_key|module:packet/secret_subkey>>}
* @returns {Promise<Array<module:packet.SecretKey|module:packet.SecretSubkey>>}
* @async

@@ -390,8 +393,8 @@ */

* Checks if a signature on a key is revoked
* @param {module:packet/secret_key|
* @param {module:packet/signature} signature The signature to verify
* @param {module:packet/public_subkey|
* module:packet/secret_subkey|
* module:packet/public_key|
* module:packet/secret_key} key, optional The key to verify the signature
* @param {module:packet.SecretKey|
* @param {module:packet.Signature} signature The signature to verify
* @param {module:packet.PublicSubkey|
* module:packet.SecretSubkey|
* module:packet.PublicKey|
* module:packet.SecretKey} key, optional The key to verify the signature
* @param {Date} date Use the given date instead of the current time

@@ -408,29 +411,2 @@ * @returns {Promise<Boolean>} True if the certificate is revoked

/**
* Returns a packetlist containing all verified public or private key packets matching keyId.
* If keyId is not present, returns all verified key packets starting with the primary key.
* Verification is in the context of given date.
* @param {type/keyid} keyId
* @param {Date} date Use the given date instead of the current time
* @returns {Promise<module:packet/packetlist>}
* @async
*/
Key.prototype.verifyKeyPackets = async function(keyId=null, date=new Date()) {
const packets = new packet.List();
const { primaryKey } = this;
if (await this.verifyPrimaryKey(date)) {
if (!keyId || primaryKey.getKeyId().equals(keyId)) {
packets.push(primaryKey);
}
}
await Promise.all(this.subKeys.map(async subKey => {
if (!keyId || subKey.subKey.getKeyId().equals(keyId)) {
if (await subKey.verify(primaryKey, date)) {
packets.push(subKey.subKey);
}
}
}));
return packets;
};
/**
* Verify primary key. Checks for revocation signatures, expiration time

@@ -490,4 +466,4 @@ * and valid self signature

* @param {Date} date use the given date for verification instead of the current time
* @returns {Promise<{user: Array<module:packet/User>,
* selfCertification: Array<module:packet/signature>}|undefined>} The primary user and the self signature
* @returns {Promise<{user: Array<module:key.User>,
* selfCertification: Array<module:packet.Signature>}>} The primary user and the self signature
* @async

@@ -547,3 +523,3 @@ */

* the destination key is transformed to a private key.
* @param {module:key~Key} key Source key to merge
* @param {module:key.Key} key Source key to merge
*/

@@ -641,4 +617,4 @@ Key.prototype.update = async function(key) {

* Signs primary user of key
* @param {Array<module:key~Key>} privateKey decrypted private keys for signing
* @returns {Promise<module:key~Key>} new public key with new certificate signature
* @param {Array<module:key.Key>} privateKey decrypted private keys for signing
* @returns {Promise<module:key.Key>} new public key with new certificate signature
* @async

@@ -659,4 +635,4 @@ */

* Signs all users of key
* @param {Array<module:key~Key>} privateKeys decrypted private keys for signing
* @returns {Promise<module:key~Key>} new public key with new certificate signature
* @param {Array<module:key.Key>} privateKeys decrypted private keys for signing
* @returns {Promise<module:key.Key>} new public key with new certificate signature
* @async

@@ -677,3 +653,3 @@ */

* - otherwise, verifies all certificates signed with given keys.
* @param {Array<module:key~Key>} keys array of keys to verify certificate signatures
* @param {Array<module:key.Key>} keys array of keys to verify certificate signatures
* @returns {Promise<Array<{keyid: module:type/keyid,

@@ -698,3 +674,3 @@ * valid: Boolean}>>} List of signer's keyid and validity of signature

* - otherwise, verifies all certificates signed with given keys.
* @param {Array<module:key~Key>} keys array of keys to verify certificate signatures
* @param {Array<module:key.Key>} keys array of keys to verify certificate signatures
* @returns {Promise<Array<{userid: String,

@@ -739,3 +715,3 @@ * keyid: module:type/keyid,

* Transforms structured user data to packetlist
* @returns {module:packet/packetlist}
* @returns {module:packet.List}
*/

@@ -753,6 +729,6 @@ User.prototype.toPacketlist = function() {

* Signs user
* @param {module:packet/secret_key|
* module:packet/public_key} primaryKey The primary key packet
* @param {Array<module:key~Key>} privateKeys Decrypted private keys for signing
* @returns {Promise<module:key~Key>} New user with new certificate signatures
* @param {module:packet.SecretKey|
* module:packet.PublicKey} primaryKey The primary key packet
* @param {Array<module:key.Key>} privateKeys Decrypted private keys for signing
* @returns {Promise<module:key.Key>} New user with new certificate signatures
* @async

@@ -794,9 +770,9 @@ */

* Checks if a given certificate of the user is revoked
* @param {module:packet/secret_key|
* module:packet/public_key} primaryKey The primary key packet
* @param {module:packet/signature} certificate The certificate to verify
* @param {module:packet/public_subkey|
* module:packet/secret_subkey|
* module:packet/public_key|
* module:packet/secret_key} key, optional The key to verify the signature
* @param {module:packet.SecretKey|
* module:packet.PublicKey} primaryKey The primary key packet
* @param {module:packet.Signature} certificate The certificate to verify
* @param {module:packet.PublicSubkey|
* module:packet.SecretSubkey|
* module:packet.PublicKey|
* module:packet.SecretKey} key, optional The key to verify the signature
* @param {Date} date Use the given date instead of the current time

@@ -817,6 +793,6 @@ * @returns {Promise<Boolean>} True if the certificate is revoked

* Verifies the user certificate
* @param {module:packet/secret_key|
module:packet/public_key} primaryKey The primary key packet
* @param {module:packet/signature} certificate A certificate of this user
* @param {Array<module:key~Key>} keys Array of keys to verify certificate signatures
* @param {module:packet.SecretKey|
* module:packet.PublicKey} primaryKey The primary key packet
* @param {module:packet.Signature} certificate A certificate of this user
* @param {Array<module:key.Key>} keys Array of keys to verify certificate signatures
* @param {Date} date Use the given date instead of the current time

@@ -849,5 +825,5 @@ * @returns {Promise<module:enums.keyStatus>} status of the certificate

* Verifies all user certificates
* @param {module:packet/secret_key|
* module:packet/public_key} primaryKey The primary key packet
* @param {Array<module:key~Key>} keys Array of keys to verify certificate signatures
* @param {module:packet.SecretKey|
* module:packet.PublicKey} primaryKey The primary key packet
* @param {Array<module:key.Key>} keys Array of keys to verify certificate signatures
* @returns {Promise<Array<{keyid: module:type/keyid,

@@ -872,4 +848,4 @@ * valid: Boolean}>>} List of signer's keyid and validity of signature

* and validity of self signature
* @param {module:packet/secret_key|
* module:packet/public_key} primaryKey The primary key packet
* @param {module:packet.SecretKey|
* module:packet.PublicKey} primaryKey The primary key packet
* @returns {Promise<module:enums.keyStatus>} Status of user

@@ -904,5 +880,5 @@ * @async

* Update user with new components from specified user
* @param {module:key~User} user Source user to merge
* @param {module:packet/secret_key|
module:packet/secret_subkey} primaryKey primary key used for validation
* @param {module:key.User} user Source user to merge
* @param {module:packet.SecretKey|
* module:packet.SecretSubkey} primaryKey primary key used for validation
*/

@@ -938,3 +914,3 @@ User.prototype.update = async function(user, primaryKey) {

* Transforms structured subkey data to packetlist
* @returns {module:packet/packetlist}
* @returns {module:packet.List}
*/

@@ -951,9 +927,9 @@ SubKey.prototype.toPacketlist = function() {

* Checks if a binding signature of a subkey is revoked
* @param {module:packet/secret_key|
* module:packet/public_key} primaryKey The primary key packet
* @param {module:packet/signature} signature The binding signature to verify
* @param {module:packet/public_subkey|
* module:packet/secret_subkey|
* module:packet/public_key|
* module:packet/secret_key} key, optional The key to verify the signature
* @param {module:packet.SecretKey|
* module:packet.PublicKey} primaryKey The primary key packet
* @param {module:packet.Signature} signature The binding signature to verify
* @param {module:packet.PublicSubkey|
* module:packet.SecretSubkey|
* module:packet.PublicKey|
* module:packet.SecretKey} key, optional The key to verify the signature
* @param {Date} date Use the given date instead of the current time

@@ -975,4 +951,4 @@ * @returns {Promise<Boolean>} True if the binding signature is revoked

* and valid binding signature
* @param {module:packet/secret_key|
* module:packet/public_key} primaryKey The primary key packet
* @param {module:packet.SecretKey|
* module:packet.PublicKey} primaryKey The primary key packet
* @param {Date} date Use the given date instead of the current time

@@ -1032,5 +1008,5 @@ * @returns {Promise<module:enums.keyStatus>} The status of the subkey

* Update subkey with new components from specified subkey
* @param {module:key~SubKey} subKey Source subkey to merge
* @param {module:packet/secret_key|
module:packet/secret_subkey} primaryKey primary key used for validation
* @param {module:key.SubKey} subKey Source subkey to merge
* @param {module:packet.SecretKey|
module:packet.SecretSubkey} primaryKey primary key used for validation
*/

@@ -1075,3 +1051,3 @@ SubKey.prototype.update = async function(subKey, primaryKey) {

* @param {Uint8Array} data to be parsed
* @returns {{keys: Array<module:key~Key>,
* @returns {{keys: Array<module:key.Key>,
* err: (Array<Error>|null)}} result object with key and error arrays

@@ -1110,3 +1086,3 @@ * @static

* @param {String} armoredText text to be parsed
* @returns {{keys: Array<module:key~Key>,
* @returns {{keys: Array<module:key.Key>,
* err: (Array<Error>|null)}} result object with key and error arrays

@@ -1132,11 +1108,14 @@ * @static

* Primary and subkey will be of same type.
* @param {module:enums.publicKey} [options.keyType=module:enums.publicKey.rsa_encrypt_sign] to indicate what type of key to make.
* @param {module:enums.publicKey} [options.keyType=module:enums.publicKey.rsa_encrypt_sign]
* To indicate what type of key to make.
* RSA is 1. See {@link https://tools.ietf.org/html/rfc4880#section-9.1}
* @param {Integer} options.numBits number of bits for the key creation.
* @param {String|Array<String>} options.userIds assumes already in form of "User Name <username@email.com>"
If array is used, the first userId is set as primary user Id
* @param {String|Array<String>} options.userIds
* Assumes already in form of "User Name <username@email.com>"
* If array is used, the first userId is set as primary user Id
* @param {String} options.passphrase The passphrase used to encrypt the resulting private key
* @param {Boolean} [options.unlocked=false] The secret part of the generated key is unlocked
* @param {Number} [options.keyExpirationTime=0] The number of seconds after the key creation time that the key expires
* @returns {Promise<module:key~Key>}
* @param {Number} [options.keyExpirationTime=0]
* The number of seconds after the key creation time that the key expires
* @returns {Promise<module:key.Key>}
* @async

@@ -1210,10 +1189,12 @@ * @static

* Reformats and signs an OpenPGP with a given User ID. Currently only supports RSA keys.
* @param {module:key~Key} options.privateKey The private key to reformat
* @param {module:key.Key} options.privateKey The private key to reformat
* @param {module:enums.publicKey} [options.keyType=module:enums.publicKey.rsa_encrypt_sign]
* @param {String|Array<String>} options.userIds assumes already in form of "User Name <username@email.com>"
If array is used, the first userId is set as primary user Id
* @param {String|Array<String>} options.userIds
* Assumes already in form of "User Name <username@email.com>"
* If array is used, the first userId is set as primary user Id
* @param {String} options.passphrase The passphrase used to encrypt the resulting private key
* @param {Boolean} [options.unlocked=false] The secret part of the generated key is unlocked
* @param {Number} [options.keyExpirationTime=0] The number of seconds after the key creation time that the key expires
* @returns {Promise<module:key~Key>}
* @param {Number} [options.keyExpirationTime=0]
* The number of seconds after the key creation time that the key expires
* @returns {Promise<module:key.Key>}
* @async

@@ -1354,11 +1335,11 @@ * @static

* Checks if a given certificate or binding signature is revoked
* @param {module:packet/secret_key|
* module:packet/public_key} primaryKey The primary key packet
* @param {module:packet.SecretKey|
* module:packet.PublicKey} primaryKey The primary key packet
* @param {Object} dataToVerify The data to check
* @param {Array<module:packet/signature>} revocations The revocation signatures to check
* @param {module:packet/signature} signature The certificate or signature to check
* @param {module:packet/public_subkey|
* module:packet/secret_subkey|
* module:packet/public_key|
* module:packet/secret_key} key, optional The key packet to check the signature
* @param {Array<module:packet.Signature>} revocations The revocation signatures to check
* @param {module:packet.Signature} signature The certificate or signature to check
* @param {module:packet.PublicSubkey|
* module:packet.SecretSubkey|
* module:packet.PublicKey|
* module:packet.SecretKey} key, optional The key packet to check the signature
* @param {Date} date Use the given date instead of the current time

@@ -1408,3 +1389,3 @@ * @returns {Promise<Boolean>} True if the signature revokes the data

if (keyPacket.version === 4 && signature.keyNeverExpires === false) {
expirationTime = signature.created.getTime() + signature.keyExpirationTime*1000;
expirationTime = keyPacket.created.getTime() + signature.keyExpirationTime*1000;
}

@@ -1451,3 +1432,3 @@ return expirationTime ? new Date(expirationTime) : Infinity;

* Returns the preferred symmetric algorithm for a set of keys
* @param {Array<module:key~Key>} keys Set of keys
* @param {Array<module:key.Key>} keys Set of keys
* @returns {Promise<module:enums.symmetric>} Preferred symmetric algorithm

@@ -1454,0 +1435,0 @@ * @async

@@ -61,3 +61,3 @@ // GPG4Browsers - An OpenPGP implementation in javascript

* @param {Boolean} deep if true search also in subkeys
* @returns {Array<module:key~Key>|null} keys found or null
* @returns {Array<module:key.Key>|null} keys found or null
*/

@@ -75,3 +75,3 @@ Keyring.prototype.getKeysForId = function (keyId, deep) {

* withouth 0x prefix (can be 16-character key ID or fingerprint)
* @returns {Array<module:key~Key>|null} keys found or null
* @returns {Array<module:key.Key>|null} keys found or null
*/

@@ -87,3 +87,3 @@ Keyring.prototype.removeKeysForId = function (keyId) {

* Get all public and private keys
* @returns {Array<module:key~Key>} all keys
* @returns {Array<module:key.Key>} all keys
*/

@@ -96,3 +96,3 @@ Keyring.prototype.getAllKeys = function () {

* Array of keys
* @param {Array<module:key~Key>} keys The keys to store in this array
* @param {Array<module:key.Key>} keys The keys to store in this array
*/

@@ -106,3 +106,3 @@ function KeyArray(keys) {

* @param {String} email email address to search for
* @returns {Array<module:key~Key>} The public keys associated with provided email address.
* @returns {Array<module:key.Key>} The public keys associated with provided email address.
*/

@@ -123,3 +123,3 @@ KeyArray.prototype.getForAddress = function(email) {

* @param {String} email email address to search for
* @param {module:key~Key} key The key to be checked.
* @param {module:key.Key} key The key to be checked.
* @returns {Boolean} True if the email address is defined in the specified key

@@ -147,3 +147,3 @@ */

* withouth 0x prefix (can be 16-character key ID or fingerprint)
* @param {module:packet/secret_key|public_key|public_subkey|secret_subkey} keypacket The keypacket to be checked
* @param {module:packet.SecretKey|public_key|public_subkey|secret_subkey} keypacket The keypacket to be checked
* @returns {Boolean} True if keypacket has the specified keyid

@@ -163,3 +163,3 @@ */

* @param {Boolean} deep if true search also in subkeys
* @returns {module:key~Key|null} key found or null
* @returns {module:key.Key|null} key found or null
*/

@@ -208,3 +208,3 @@ KeyArray.prototype.getForId = function (keyId, deep) {

* Add key to KeyArray
* @param {module:key~Key} key The key that will be added to the keyring
* @param {module:key.Key} key The key that will be added to the keyring
* @returns {Number} The new length of the KeyArray

@@ -220,3 +220,3 @@ */

* withouth 0x prefix (can be 16-character key ID or fingerprint)
* @returns {module:key~Key|null} The key object which has been removed or null
* @returns {module:key.Key|null} The key object which has been removed or null
*/

@@ -223,0 +223,0 @@ KeyArray.prototype.removeForId = function (keyId) {

@@ -55,3 +55,3 @@ // GPG4Browsers - An OpenPGP implementation in javascript

* Load the public keys from HTML5 local storage.
* @returns {Array<module:key~Key>} array of keys retrieved from localstore
* @returns {Array<module:key.Key>} array of keys retrieved from localstore
*/

@@ -64,3 +64,3 @@ LocalStore.prototype.loadPublic = function () {

* Load the private keys from HTML5 local storage.
* @returns {Array<module:key~Key>} array of keys retrieved from localstore
* @returns {Array<module:key.Key>} array of keys retrieved from localstore
*/

@@ -91,3 +91,3 @@ LocalStore.prototype.loadPrivate = function () {

* The key array gets stringified using JSON
* @param {Array<module:key~Key>} keys array of keys to save in localstore
* @param {Array<module:key.Key>} keys array of keys to save in localstore
*/

@@ -101,3 +101,3 @@ LocalStore.prototype.storePublic = function (keys) {

* The key array gets stringified using JSON
* @param {Array<module:key~Key>} keys array of keys to save in localstore
* @param {Array<module:key.Key>} keys array of keys to save in localstore
*/

@@ -104,0 +104,0 @@ LocalStore.prototype.storePrivate = function (keys) {

@@ -19,5 +19,6 @@ // GPG4Browsers - An OpenPGP implementation in javascript

/**
* @requires encoding/armor
* @requires type/keyid
* @requires config
* @requires crypto
* @requires encoding/armor
* @requires enums

@@ -31,9 +32,9 @@ * @requires util

import armor from './encoding/armor';
import type_keyid from './type/keyid';
import config from './config';
import crypto from './crypto';
import armor from './encoding/armor';
import enums from './enums';
import util from './util';
import packet from './packet';
import type_keyid from './type/keyid';
import { Signature } from './signature';

@@ -47,3 +48,3 @@ import { getPreferredHashAlgo, getPreferredSymAlgo } from './key';

* Can be an encrypted message, signed message, compressed message or literal message
* @param {module:packet/packetlist} packetlist The packets that form this message
* @param {module:packet.List} packetlist The packets that form this message
* See {@link https://tools.ietf.org/html/rfc4880#section-11.3}

@@ -367,3 +368,3 @@ */

* Sign the message (the literal data packet of the message)
* @param {Array<module:key~Key>} privateKeys private keys with decrypted secret key data for signing
* @param {Array<module:key.Key>} privateKeys private keys with decrypted secret key data for signing
* @param {Signature} signature (optional) any existing detached signature to add to the message

@@ -435,3 +436,3 @@ * @param {Date} date} (optional) override the creation time of the signature

* @param {module:enums.compression} compression compression algorithm to be used
* @returns {module:message~Message} new message with compressed content
* @returns {module:message.Message} new message with compressed content
*/

@@ -455,6 +456,6 @@ Message.prototype.compress = function(compression) {

* Create a detached signature for the message (the literal data packet of the message)
* @param {Array<module:key~Key>} privateKeys private keys with decrypted secret key data for signing
* @param {Array<module:key.Key>} privateKeys private keys with decrypted secret key data for signing
* @param {Signature} signature (optional) any existing detached signature
* @param {Date} date (optional) override the creation time of the signature
* @returns {Promise<module:signature~Signature>} new detached signature of message content
* @returns {Promise<module:signature.Signature>} new detached signature of message content
* @async

@@ -472,7 +473,7 @@ */

* Create signature packets for the message
* @param {module:packet/literal} literalDataPacket the literal data packet to sign
* @param {Array<module:key~Key>} privateKeys private keys with decrypted secret key data for signing
* @param {module:packet.Literal} literalDataPacket the literal data packet to sign
* @param {Array<module:key.Key>} privateKeys private keys with decrypted secret key data for signing
* @param {Signature} signature (optional) any existing detached signature to append
* @param {Date} date (optional) override the creationtime of the signature
* @returns {Promise<module:packet/packetlist>} list of signature packets
* @returns {Promise<module:packet.List>} list of signature packets
* @async

@@ -518,3 +519,3 @@ */

* Verify message signatures
* @param {Array<module:key~Key>} keys array of keys to verify signatures
* @param {Array<module:key.Key>} keys array of keys to verify signatures
* @param {Date} date (optional) Verify the signature against the given date, i.e. check signature creation time < date < expiration time

@@ -536,3 +537,3 @@ * @returns {Promise<Array<({keyid: module:type/keyid, valid: Boolean})>>} list of signer's keyid and validity of signature

* Verify detached message signature
* @param {Array<module:key~Key>} keys array of keys to verify signatures
* @param {Array<module:key.Key>} keys array of keys to verify signatures
* @param {Signature} signature

@@ -555,5 +556,5 @@ * @param {Date} date Verify the signature against the given date, i.e. check signature creation time < date < expiration time

* Create list of objects containing signer's keyid and validity of signature
* @param {Array<module:packet/signature>} signatureList array of signature packets
* @param {Array<module:packet/literal>} literalDataList array of literal data packets
* @param {Array<module:key~Key>} keys array of keys to verify signatures
* @param {Array<module:packet.Signature>} signatureList array of signature packets
* @param {Array<module:packet.Literal>} literalDataList array of literal data packets
* @param {Array<module:key.Key>} keys array of keys to verify signatures
* @param {Date} date Verify the signature against the given date,

@@ -591,3 +592,3 @@ * i.e. check signature creation time < date < expiration time

* Unwrap compressed message
* @returns {module:message~Message} message Content of compressed message
* @returns {module:message.Message} message Content of compressed message
*/

@@ -621,3 +622,3 @@ Message.prototype.unwrapCompressed = function() {

* @param {String} armoredText text to be parsed
* @returns {module:message~Message} new message object
* @returns {module:message.Message} new message object
* @static

@@ -649,3 +650,3 @@ */

* @param {Date} date (optional)
* @returns {module:message~Message} new message object
* @returns {module:message.Message} new message object
* @static

@@ -670,3 +671,3 @@ */

* @param {Date} date (optional)
* @returns {module:message~Message} new message object
* @returns {module:message.Message} new message object
* @static

@@ -673,0 +674,0 @@ */

@@ -19,2 +19,5 @@ // OpenPGP.js - An OpenPGP implementation in javascript

/**
* @fileoverview The openpgp base module should provide all of the functionality
* to consume the openpgp.js library. All additional classes are documented
* for extending and developing on top of the base library.
* @requires message

@@ -30,6 +33,8 @@ * @requires cleartext

// This file intentionally has two separate file overviews so that
// a reference to this module appears at the end of doc/index.html.
/**
* @fileoverview The openpgp base module should provide all of the functionality
* to consume the openpgp.js library. All additional classes are documented
* for extending and developing on top of the base library.
* @fileoverview To view the full API documentation, start from
* {@link module:openpgp}
*/

@@ -73,3 +78,3 @@

* Returns a reference to the async proxy if the worker was initialized with openpgp.initWorker()
* @returns {module:worker/async_proxy~AsyncProxy|null} the async proxy or null if not initialized
* @returns {module:worker/async_proxy.AsyncProxy|null} the async proxy or null if not initialized
*/

@@ -76,0 +81,0 @@ export function getWorker() {

/**
* @fileoverview Exports all OpenPGP packet types
* @requires enums
* @module packet/all_packets
*/

@@ -8,36 +10,70 @@

/** @see module:packet/compressed */
export { default as Compressed } from './compressed.js';
/** @see module:packet/sym_encrypted_integrity_protected */
export { default as SymEncryptedIntegrityProtected } from './sym_encrypted_integrity_protected.js';
/** @see module:packet/sym_encrypted_aead_protected */
export { default as SymEncryptedAEADProtected } from './sym_encrypted_aead_protected.js';
/** @see module:packet/public_key_encrypted_session_key */
export { default as PublicKeyEncryptedSessionKey } from './public_key_encrypted_session_key.js';
/** @see module:packet/sym_encrypted_session_key */
export { default as SymEncryptedSessionKey } from './sym_encrypted_session_key.js';
/** @see module:packet/literal */
export { default as Literal } from './literal.js';
/** @see module:packet/public_key */
export { default as PublicKey } from './public_key.js';
/** @see module:packet/symmetrically_encrypted */
export { default as SymmetricallyEncrypted } from './symmetrically_encrypted.js';
/** @see module:packet/marker */
export { default as Marker } from './marker.js';
/** @see module:packet/public_subkey */
export { default as PublicSubkey } from './public_subkey.js';
/** @see module:packet/user_attribute */
export { default as UserAttribute } from './user_attribute.js';
/** @see module:packet/one_pass_signature */
export { default as OnePassSignature } from './one_pass_signature.js';
/** @see module:packet/secret_key */
export { default as SecretKey } from './secret_key.js';
/** @see module:packet/userid */
export { default as Userid } from './userid.js';
/** @see module:packet/secret_subkey */
export { default as SecretSubkey } from './secret_subkey.js';
/** @see module:packet/signature */
export { default as Signature } from './signature.js';
/** @see module:packet/trust */
export { default as Trust } from './trust.js';
export {
/** @see module:packet.Compressed */
default as Compressed
} from './compressed.js';
export {
/** @see module:packet.SymEncryptedIntegrityProtected */
default as SymEncryptedIntegrityProtected
} from './sym_encrypted_integrity_protected.js';
export {
/** @see module:packet.SymEncryptedAEADProtected */
default as SymEncryptedAEADProtected
} from './sym_encrypted_aead_protected.js';
export {
/** @see module:packet.PublicKeyEncryptedSessionKey */
default as PublicKeyEncryptedSessionKey
} from './public_key_encrypted_session_key.js';
export {
/** @see module:packet.SymEncryptedSessionKey */
default as SymEncryptedSessionKey
} from './sym_encrypted_session_key.js';
export {
/** @see module:packet.Literal */
default as Literal
} from './literal.js';
export {
/** @see module:packet.PublicKey */
default as PublicKey
} from './public_key.js';
export {
/** @see module:packet.SymmetricallyEncrypted */
default as SymmetricallyEncrypted
} from './symmetrically_encrypted.js';
export {
/** @see module:packet.Marker */
default as Marker
} from './marker.js';
export {
/** @see module:packet.PublicSubkey */
default as PublicSubkey
} from './public_subkey.js';
export {
/** @see module:packet.UserAttribute */
default as UserAttribute
} from './user_attribute.js';
export {
/** @see module:packet.OnePassSignature */
default as OnePassSignature
} from './one_pass_signature.js';
export {
/** @see module:packet.SecretKey */
default as SecretKey
} from './secret_key.js';
export {
/** @see module:packet.Userid */
default as Userid
} from './userid.js';
export {
/** @see module:packet.SecretSubkey */
default as SecretSubkey
} from './secret_subkey.js';
export {
/** @see module:packet.Signature */
default as Signature
} from './signature.js';
export {
/** @see module:packet.Trust */
default as Trust
} from './trust.js';

@@ -44,0 +80,0 @@ /**

@@ -50,3 +50,3 @@ // GPG4Browsers - An OpenPGP implementation in javascript

* List of packets
* @type {module:packet/packetlist}
* @type {module:packet.List}
*/

@@ -53,0 +53,0 @@ this.packets = null;

/**
* @fileoverview OpenPGP packet types
* @see module:packet/all_packets
* @see module:packet/packetlist
* @see module:packet/clone
* @see module:packet.List
* @module packet

@@ -7,0 +7,0 @@ */

@@ -110,3 +110,3 @@ // GPG4Browsers - An OpenPGP implementation in javascript

* @param {Uint8Array} input Payload of a tag 11 packet
* @returns {module:packet/literal} object representation
* @returns {module:packet.Literal} object representation
*/

@@ -113,0 +113,0 @@ Literal.prototype.read = function(bytes) {

@@ -50,3 +50,3 @@ // GPG4Browsers - An OpenPGP implementation in javascript

* input at position
* @returns {module:packet/marker} Object representation
* @returns {module:packet.Marker} Object representation
*/

@@ -53,0 +53,0 @@ Marker.prototype.read = function (bytes) {

@@ -77,3 +77,3 @@ // GPG4Browsers - An OpenPGP implementation in javascript

* @param {Uint8Array} bytes payload of a tag 4 packet
* @returns {module:packet/one_pass_signature} object representation
* @returns {module:packet.OnePassSignature} object representation
*/

@@ -80,0 +80,0 @@ OnePassSignature.prototype.read = function (bytes) {

/* eslint-disable callback-return */
/**
* @fileoverview Provides a class for representing lists of OpenPGP packets.
* @requires packet/all_packets

@@ -5,0 +4,0 @@ * @requires packet/packet

@@ -70,3 +70,3 @@ // GPG4Browsers - An OpenPGP implementation in javascript

* input at position
* @returns {module:packet/public_key_encrypted_session_key} Object representation
* @returns {module:packet.PublicKeyEncryptedSessionKey} Object representation
*/

@@ -106,3 +106,3 @@ PublicKeyEncryptedSessionKey.prototype.read = function (bytes) {

* Encrypt session key packet
* @param {module:packet/public_key} key Public key
* @param {module:packet.PublicKey} key Public key
* @returns {Promise<Boolean>}

@@ -135,3 +135,3 @@ * @async

*
* @param {module:packet/secret_key} key
* @param {module:packet.SecretKey} key
* Private key with secret params unlocked

@@ -138,0 +138,0 @@ * @returns {Promise<Boolean>}

@@ -19,9 +19,2 @@ // GPG4Browsers - An OpenPGP implementation in javascript

/**
* FIXME
* Implementation of the Key Material Packet (Tag 5,6,7,14)
*
* {@link https://tools.ietf.org/html/rfc4880#section-5.5|RFC4480 5.5}:
* A key material packet contains all the information about a public or
* private key. There are four variants of this packet type, and two
* major versions. Consequently, this section is complex.
* @requires type/keyid

@@ -41,2 +34,9 @@ * @requires type/mpi

/**
* Implementation of the Key Material Packet (Tag 5,6,7,14)
*
* {@link https://tools.ietf.org/html/rfc4880#section-5.5|RFC4480 5.5}:
* A key material packet contains all the information about a public or
* private key. There are four variants of this packet type, and two
* major versions.
*
* A Public-Key packet starts a series of packets that forms an OpenPGP

@@ -48,10 +48,26 @@ * key (sometimes called an OpenPGP certificate).

function PublicKey() {
/**
* Packet type
* @type {module:enums.packet}
*/
this.tag = enums.packet.publicKey;
/**
* Packet version
* @type {Integer}
*/
this.version = 4;
/** Key creation date.
* @type {Date} */
/**
* Key creation date.
* @type {Date}
*/
this.created = util.normalizeDate();
/* Algorithm specific params */
/**
* Algorithm specific params
* @type {Array<Object>}
*/
this.params = [];
// time in days (V3 only)
/**
* Time until expiration in days (V3 only)
* @type {Integer}
*/
this.expirationTimeV3 = 0;

@@ -116,3 +132,3 @@ /**

* Alias of read()
* @see module:packet/public_key~PublicKey#read
* @see module:packet.PublicKey#read
*/

@@ -147,3 +163,3 @@ PublicKey.prototype.readPublicKey = PublicKey.prototype.read;

* Alias of write()
* @see module:packet/public_key~PublicKey#write
* @see module:packet.PublicKey#write
*/

@@ -150,0 +166,0 @@ PublicKey.prototype.writePublicKey = PublicKey.prototype.write;

@@ -19,9 +19,2 @@ // GPG4Browsers - An OpenPGP implementation in javascript

/**
* FIXME
* Implementation of the Key Material Packet (Tag 5,6,7,14)
*
* {@link https://tools.ietf.org/html/rfc4880#section-5.5|RFC4480 5.5}:
* A key material packet contains all the information about a public or
* private key. There are four variants of this packet type, and two
* major versions. Consequently, this section is complex.
* @requires packet/public_key

@@ -52,6 +45,14 @@ * @requires type/keyid

publicKey.call(this);
/**
* Packet type
* @type {module:enums.packet}
*/
this.tag = enums.packet.secretKey;
// encrypted secret-key data
/**
* Encrypted secret-key data
*/
this.encrypted = null;
// indicator if secret-key data is available in decrypted form
/**
* Indicator if secret-key data is available in decrypted form
*/
this.isDecrypted = false;

@@ -128,3 +129,4 @@ }

/**
* Internal parser for private keys as specified in {@link https://tools.ietf.org/html/rfc4880#section-5.5.3|RFC 4880 section 5.5.3}
* Internal parser for private keys as specified in
* {@link https://tools.ietf.org/html/rfc4880#section-5.5.3|RFC 4880 section 5.5.3}
* @param {String} bytes Input string to read the packet from

@@ -160,5 +162,6 @@ */

/** Creates an OpenPGP key packet for the given key.
* @returns {String} A string of bytes containing the secret key OpenPGP packet
*/
/**
* Creates an OpenPGP key packet for the given key.
* @returns {String} A string of bytes containing the secret key OpenPGP packet
*/
SecretKey.prototype.write = function () {

@@ -178,3 +181,4 @@ const arr = [this.writePublicKey()];

/** Encrypt the payload. By default, we use aes256 and iterated, salted string
/**
* Encrypt the payload. By default, we use aes256 and iterated, salted string
* to key specifier. If the key is in a decrypted state (isDecrypted === true)

@@ -221,5 +225,4 @@ * and the passphrase is empty or undefined, the key will be set as not encrypted.

* Decrypts the private key params which are needed to use the key.
* @link module:packet/secret_key.isDecrypted should be
* false otherwise a call to this function is not needed
*
* {@link module:packet.SecretKey.isDecrypted} should be false, as
* otherwise calls to this function will throw an error.
* @param {String} passphrase The passphrase for this private key as string

@@ -226,0 +229,0 @@ * @returns {Promise<Boolean>}

@@ -97,3 +97,3 @@ // GPG4Browsers - An OpenPGP implementation in javascript

* @param {Integer} len length of the packet or the remaining length of bytes at position
* @returns {module:packet/signature} object representation
* @returns {module:packet.Signature} object representation
*/

@@ -214,3 +214,3 @@ Signature.prototype.read = function (bytes) {

* Signs provided data. This needs to be done prior to serialization.
* @param {module:packet/secret_key} key private key used to sign the message.
* @param {module:packet.SecretKey} key private key used to sign the message.
* @param {Object} data Contains packets to be signed.

@@ -624,4 +624,4 @@ * @returns {Promise<Boolean>}

* @param {String|Object} data data which on the signature applies
* @param {module:packet/public_subkey|module:packet/public_key|
* module:packet/secret_subkey|module:packet/secret_key} key the public key to verify the signature
* @param {module:packet.PublicSubkey|module:packet.PublicKey|
* module:packet.SecretSubkey|module:packet.SecretKey} key the public key to verify the signature
* @returns {Promise<Boolean>} True if message is verified, else false.

@@ -628,0 +628,0 @@ * @async

@@ -66,3 +66,3 @@ // GPG4Browsers - An OpenPGP implementation in javascript

* input at position
* @returns {module:packet/sym_encrypted_session_key} Object representation
* @returns {module:packet.SymEncryptedSessionKey} Object representation
*/

@@ -69,0 +69,0 @@ SymEncryptedSessionKey.prototype.read = function(bytes) {

@@ -41,7 +41,20 @@ // GPG4Browsers - An OpenPGP implementation in javascript

function SymmetricallyEncrypted() {
/**
* Packet type
* @type {module:enums.packet}
*/
this.tag = enums.packet.symmetricallyEncrypted;
/**
* Encrypted secret-key data
*/
this.encrypted = null;
/** Decrypted packets contained within.
* @type {module:packet/packetlist} */
/**
* Decrypted packets contained within.
* @type {module:packet.List}
*/
this.packets = null;
/**
* When true, decrypt fails if message is not integrity protected
* @see module:config.ignore_mdc_error
*/
this.ignore_mdc_error = config.ignore_mdc_error;

@@ -60,4 +73,4 @@ }

* Decrypt the symmetrically-encrypted packet data
* @param {module:enums.symmetric} sessionKeyAlgorithm
* Symmetric key algorithm to use // See {@link https://tools.ietf.org/html/rfc4880#section-9.2|RFC4880 9.2}
* See {@link https://tools.ietf.org/html/rfc4880#section-9.2|RFC 4880 9.2} for algorithms.
* @param {module:enums.symmetric} sessionKeyAlgorithm Symmetric key algorithm to use
* @param {Uint8Array} key The key of cipher blocksize length to be used

@@ -83,4 +96,4 @@ * @returns {Promise<Boolean>}

* Encrypt the symmetrically-encrypted packet data
* @param {module:enums.symmetric} sessionKeyAlgorithm
* Symmetric key algorithm to use // See {@link https://tools.ietf.org/html/rfc4880#section-9.2|RFC4880 9.2}
* See {@link https://tools.ietf.org/html/rfc4880#section-9.2|RFC 4880 9.2} for algorithms.
* @param {module:enums.symmetric} sessionKeyAlgorithm Symmetric key algorithm to use
* @param {Uint8Array} key The key of cipher blocksize length to be used

@@ -87,0 +100,0 @@ * @returns {Promise<Boolean>}

@@ -82,3 +82,3 @@ // GPG4Browsers - An OpenPGP implementation in javascript

* Compare for equality
* @param {module:user_attribute~UserAttribute} usrAttr
* @param {module:packet.UserAttribute} usrAttr
* @returns {Boolean} true if equal

@@ -85,0 +85,0 @@ */

@@ -19,11 +19,11 @@ // GPG4Browsers - An OpenPGP implementation in javascript

/**
* @requires encoding/armor
* @requires packet
* @requires enums
* @requires packet
* @requires encoding/armor
* @module signature
*/
import armor from './encoding/armor';
import packet from './packet';
import enums from './enums';
import armor from './encoding/armor';

@@ -33,5 +33,4 @@ /**

* @classdesc Class that represents an OpenPGP signature.
* @param {module:packet/packetlist} packetlist The signature packets
* @param {module:packet.List} packetlist The signature packets
*/
export function Signature(packetlist) {

@@ -38,0 +37,0 @@ if (!(this instanceof Signature)) {

@@ -66,3 +66,2 @@ // GPG4Browsers - An OpenPGP implementation in javascript

* Initializes a new proxy and loads the web worker
* @constructor
* @param {String} path The path to the worker or 'openpgp.worker.js' by default

@@ -72,2 +71,3 @@ * @param {Number} n number of workers to initialize if path given

* @param {Array<Object>} worker alternative to path parameter: web worker initialized with 'openpgp.worker.js'
* @constructor
*/

@@ -74,0 +74,0 @@ function AsyncProxy({ path='openpgp.worker.js', n = 1, workers = [], config } = {}) {

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc