Fixes dead links in the documentation
This commit is contained in:
parent
4ded3f9d58
commit
96c9cd0d73
|
@ -36,7 +36,7 @@ import { createVerificationObjects, createSignaturePackets } from './message';
|
|||
* @classdesc Class that represents an OpenPGP cleartext signed message.
|
||||
* 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 {module:signature.Signature} signature The detached signature or an empty signature for unsigned messages
|
||||
*/
|
||||
export function CleartextMessage(text, signature) {
|
||||
if (!(this instanceof CleartextMessage)) {
|
||||
|
@ -65,10 +65,10 @@ CleartextMessage.prototype.getSigningKeyIds = function() {
|
|||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
CleartextMessage.prototype.sign = async function(privateKeys, signature=null, date=new Date()) {
|
||||
|
@ -77,10 +77,10 @@ CleartextMessage.prototype.sign = async function(privateKeys, signature=null, da
|
|||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
CleartextMessage.prototype.signDetached = async function(privateKeys, signature=null, date=new Date()) {
|
||||
|
@ -92,7 +92,7 @@ CleartextMessage.prototype.signDetached = async function(privateKeys, 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
|
||||
* @returns {Promise<Array<{keyid: module:type/keyid, valid: Boolean}>>} list of signer's keyid and validity of signature
|
||||
* @async
|
||||
|
@ -103,7 +103,7 @@ CleartextMessage.prototype.verify = function(keys, date=new Date()) {
|
|||
|
||||
/**
|
||||
* 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
|
||||
* @returns {Promise<Array<{keyid: module:type/keyid, valid: Boolean}>>} list of signer's keyid and validity of signature
|
||||
* @async
|
||||
|
@ -146,7 +146,7 @@ CleartextMessage.prototype.armor = function() {
|
|||
/**
|
||||
* reads an OpenPGP cleartext signed message and returns a CleartextMessage object
|
||||
* @param {String} armoredText text to be parsed
|
||||
* @returns {module:cleartext~CleartextMessage} new cleartext message object
|
||||
* @returns {module:cleartext.CleartextMessage} new cleartext message object
|
||||
* @static
|
||||
*/
|
||||
export function readArmored(armoredText) {
|
||||
|
@ -163,9 +163,9 @@ export function readArmored(armoredText) {
|
|||
|
||||
/**
|
||||
* Compare hash algorithm specified in the armor header with signatures
|
||||
* @private
|
||||
* @param {Array<String>} headers Armor headers
|
||||
* @param {module:packet/packetlist} packetlist The packetlist with signature packets
|
||||
* @param {module:packet.List} packetlist The packetlist with signature packets
|
||||
* @private
|
||||
*/
|
||||
function verifyHeaders(headers, packetlist) {
|
||||
const checkHashAlgos = function(hashAlgos) {
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
* @fileoverview Provides EME-PKCS1-v1_5 encoding and decoding and EMSA-PKCS1-v1_5 encoding function
|
||||
* @see module:crypto/public_key/rsa
|
||||
* @see module:crypto/public_key/elliptic/ecdh
|
||||
* @see module:packet/public_key_encrypted_session_key
|
||||
* @see module:packet.PublicKeyEncryptedSessionKey
|
||||
* @requires crypto/random
|
||||
* @requires crypto/hash
|
||||
* @requires util
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
/**
|
||||
* @fileoverview Functions to add and remove PKCS5 padding
|
||||
* @see module:packet/public_key_encrypted_session_key
|
||||
* @see module:packet.PublicKeyEncryptedSessionKey
|
||||
* @module crypto/pkcs5
|
||||
*/
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
/**
|
||||
* @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
|
||||
* @requires crypto/cipher
|
||||
* @requires crypto/hash
|
||||
|
@ -64,8 +64,8 @@ function kdf(hash_algo, X, length, param) {
|
|||
* Encrypt and wrap a session key
|
||||
*
|
||||
* @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: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
|
||||
|
@ -92,8 +92,8 @@ async function encrypt(oid, cipher_algo, hash_algo, m, Q, fingerprint) {
|
|||
* Decrypt and unwrap the value derived from session key
|
||||
*
|
||||
* @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: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
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
/**
|
||||
* @fileoverview Implementation of ECDSA following RFC6637 for Openpgpjs
|
||||
* @requires crypto/hash
|
||||
* @requires crypto/public_key/elliptic/curves
|
||||
* @requires crypto/public_key/elliptic/curve
|
||||
* @module crypto/public_key/elliptic/ecdsa
|
||||
*/
|
||||
|
||||
|
@ -28,7 +28,7 @@ import Curve from './curves';
|
|||
/**
|
||||
* 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 {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,
|
||||
|
@ -46,7 +46,7 @@ async function sign(oid, hash_algo, m, d) {
|
|||
/**
|
||||
* 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: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
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
* @fileoverview Implementation of EdDSA following RFC4880bis-03 for OpenPGP
|
||||
* @requires bn.js
|
||||
* @requires crypto/hash
|
||||
* @requires crypto/public_key/elliptic/curves
|
||||
* @requires crypto/public_key/elliptic/curve
|
||||
* @module crypto/public_key/elliptic/eddsa
|
||||
*/
|
||||
|
||||
|
@ -30,7 +30,7 @@ import Curve from './curves';
|
|||
/**
|
||||
* 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 {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,
|
||||
|
@ -49,7 +49,7 @@ async function sign(oid, hash_algo, m, d) {
|
|||
/**
|
||||
* 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: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
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
/**
|
||||
* @fileoverview Wrapper for a KeyPair of an Elliptic Curve
|
||||
* @requires bn.js
|
||||
* @requires crypto/public_key/elliptic/curves
|
||||
* @requires crypto/public_key/elliptic/curve
|
||||
* @requires crypto/hash
|
||||
* @requires util
|
||||
* @requires enums
|
||||
|
|
178
src/key.js
178
src/key.js
|
@ -36,9 +36,8 @@ import util from './util';
|
|||
* @class
|
||||
* @classdesc Class that represents an OpenPGP key. Must contain a primary key.
|
||||
* 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) {
|
||||
if (!(this instanceof Key)) {
|
||||
return new Key(packetlist);
|
||||
|
@ -57,7 +56,7 @@ export function Key(packetlist) {
|
|||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
Key.prototype.packetlist2structure = function(packetlist) {
|
||||
let user;
|
||||
|
@ -132,7 +131,7 @@ 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
|
||||
*/
|
||||
Key.prototype.toPacketlist = function() {
|
||||
const packetlist = new packet.List();
|
||||
|
@ -148,7 +147,7 @@ Key.prototype.toPacketlist = function() {
|
|||
* Returns packetlist containing all public or private subkey packets matching keyId;
|
||||
* If keyId is not present, returns all subkey packets.
|
||||
* @param {type/keyid} keyId
|
||||
* @returns {module:packet/packetlist}
|
||||
* @returns {module:packet.List}
|
||||
*/
|
||||
Key.prototype.getSubkeyPackets = function(keyId=null) {
|
||||
const packets = new packet.List();
|
||||
|
@ -164,7 +163,7 @@ Key.prototype.getSubkeyPackets = function(keyId=null) {
|
|||
* Returns a packetlist containing all public or private key packets matching keyId.
|
||||
* If keyId is not present, returns all key packets starting with the primary key.
|
||||
* @param {type/keyid} keyId
|
||||
* @returns {module:packet/packetlist}
|
||||
* @returns {module:packet.List}
|
||||
*/
|
||||
Key.prototype.getKeyPackets = function(keyId=null) {
|
||||
const packets = new packet.List();
|
||||
|
@ -211,7 +210,7 @@ Key.prototype.isPrivate = function() {
|
|||
|
||||
/**
|
||||
* Returns key as public key (shallow copy)
|
||||
* @returns {module:key~Key} new public Key
|
||||
* @returns {module:key.Key} new public Key
|
||||
*/
|
||||
Key.prototype.toPublic = function() {
|
||||
const packetlist = new packet.List();
|
||||
|
@ -263,8 +262,8 @@ function isValidSigningKeyPacket(keyPacket, signature, date=new Date()) {
|
|||
* Returns first key packet or key packet by given keyId that is available for signing and verification
|
||||
* @param {module:type/keyid} keyId, optional
|
||||
* @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
|
||||
*/
|
||||
Key.prototype.getSigningKeyPacket = async function (keyId=null, date=new Date()) {
|
||||
|
@ -306,10 +305,10 @@ function isValidEncryptionKeyPacket(keyPacket, signature, date=new Date()) {
|
|||
* Returns first key packet or key packet by given keyId that is available for encryption or decryption
|
||||
* @param {module:type/keyid} keyId, optional
|
||||
* @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
|
||||
*/
|
||||
Key.prototype.getEncryptionKeyPacket = async function(keyId, date=new Date()) {
|
||||
|
@ -341,7 +340,7 @@ Key.prototype.getEncryptionKeyPacket = async function(keyId, date=new Date()) {
|
|||
* Encrypts all secret key and subkey packets matching keyId
|
||||
* @param {module:type/keyid} keyId
|
||||
* @param {String} passphrase
|
||||
* @returns {Promise<Array<module:packet/secret_key|module:packet/secret_subkey>>}
|
||||
* @returns {Promise<Array<module:packet.SecretKey|module:packet.SecretSubkey>>}
|
||||
* @async
|
||||
*/
|
||||
Key.prototype.encrypt = async function(passphrase, keyId=null) {
|
||||
|
@ -376,12 +375,12 @@ Key.prototype.decrypt = async function(passphrase, keyId=null) {
|
|||
|
||||
/**
|
||||
* 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
|
||||
* @returns {Promise<Boolean>} True if the certificate is revoked
|
||||
* @async
|
||||
|
@ -474,8 +473,8 @@ Key.prototype.getExpirationTime = async function() {
|
|||
* - if multiple primary users exist, returns the one with the latest self signature
|
||||
* - otherwise, returns the user with the latest 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
|
||||
*/
|
||||
Key.prototype.getPrimaryUser = async function(date=new Date()) {
|
||||
|
@ -530,7 +529,7 @@ Key.prototype.getPrimaryUser = async function(date=new Date()) {
|
|||
*
|
||||
* If the specified key is a private key and the destination key is public,
|
||||
* 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
|
||||
*/
|
||||
Key.prototype.update = async function(key) {
|
||||
const that = this;
|
||||
|
@ -623,8 +622,8 @@ Key.prototype.revoke = function() {
|
|||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
Key.prototype.signPrimaryUser = async function(privateKeys) {
|
||||
|
@ -640,8 +639,8 @@ Key.prototype.signPrimaryUser = async function(privateKeys) {
|
|||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
Key.prototype.signAllUsers = async function(privateKeys) {
|
||||
|
@ -657,7 +656,7 @@ Key.prototype.signAllUsers = async function(privateKeys) {
|
|||
* Verifies primary user of key
|
||||
* - if no arguments are given, verifies the self certificates;
|
||||
* - 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,
|
||||
* valid: Boolean}>>} List of signer's keyid and validity of signature
|
||||
* @async
|
||||
|
@ -677,7 +676,7 @@ Key.prototype.verifyPrimaryUser = async function(keys) {
|
|||
* Verifies all users of key
|
||||
* - if no arguments are given, verifies the self certificates;
|
||||
* - 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,
|
||||
* keyid: module:type/keyid,
|
||||
* valid: Boolean}>>} list of userid, signer's keyid and validity of signature
|
||||
|
@ -717,7 +716,7 @@ function User(userPacket) {
|
|||
|
||||
/**
|
||||
* Transforms structured user data to packetlist
|
||||
* @returns {module:packet/packetlist}
|
||||
* @returns {module:packet.List}
|
||||
*/
|
||||
User.prototype.toPacketlist = function() {
|
||||
const packetlist = new packet.List();
|
||||
|
@ -730,10 +729,10 @@ 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
|
||||
*/
|
||||
User.prototype.sign = async function(primaryKey, privateKeys) {
|
||||
|
@ -770,13 +769,13 @@ User.prototype.sign = async function(primaryKey, privateKeys) {
|
|||
|
||||
/**
|
||||
* 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
|
||||
* @returns {Promise<Boolean>} True if the certificate is revoked
|
||||
* @async
|
||||
|
@ -792,10 +791,10 @@ User.prototype.isRevoked = async function(primaryKey, certificate, key, date=new
|
|||
|
||||
/**
|
||||
* 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
|
||||
* @returns {Promise<module:enums.keyStatus>} status of the certificate
|
||||
* @async
|
||||
|
@ -823,9 +822,9 @@ User.prototype.verifyCertificate = async function(primaryKey, certificate, keys,
|
|||
|
||||
/**
|
||||
* 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,
|
||||
* valid: Boolean}>>} List of signer's keyid and validity of signature
|
||||
* @async
|
||||
|
@ -845,8 +844,8 @@ User.prototype.verifyAllCertifications = async function(primaryKey, keys) {
|
|||
/**
|
||||
* Verify User. Checks for existence of self signatures, revocation signatures
|
||||
* 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
|
||||
* @async
|
||||
*/
|
||||
|
@ -876,9 +875,9 @@ User.prototype.verify = async function(primaryKey) {
|
|||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
User.prototype.update = async function(user, primaryKey) {
|
||||
const dataToVerify = { userid: this.userId || this.userAttribute, key: primaryKey };
|
||||
|
@ -909,7 +908,7 @@ function SubKey(subKeyPacket) {
|
|||
|
||||
/**
|
||||
* Transforms structured subkey data to packetlist
|
||||
* @returns {module:packet/packetlist}
|
||||
* @returns {module:packet.List}
|
||||
*/
|
||||
SubKey.prototype.toPacketlist = function() {
|
||||
const packetlist = new packet.List();
|
||||
|
@ -921,13 +920,13 @@ 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
|
||||
* @returns {Promise<Boolean>} True if the binding signature is revoked
|
||||
* @async
|
||||
|
@ -944,8 +943,8 @@ SubKey.prototype.isRevoked = async function(primaryKey, signature, key, date=new
|
|||
/**
|
||||
* Verify subkey. Checks for revocation signatures, expiration time
|
||||
* 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
|
||||
* @returns {Promise<module:enums.keyStatus>} The status of the subkey
|
||||
* @async
|
||||
|
@ -1000,9 +999,9 @@ SubKey.prototype.getExpirationTime = function() {
|
|||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
SubKey.prototype.update = async function(subKey, primaryKey) {
|
||||
if (await subKey.verify(primaryKey) === enums.keyStatus.invalid) {
|
||||
|
@ -1042,7 +1041,7 @@ SubKey.prototype.update = async function(subKey, primaryKey) {
|
|||
/**
|
||||
* Reads an unarmored OpenPGP key list and returns one or multiple key objects
|
||||
* @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
|
||||
* @static
|
||||
*/
|
||||
|
@ -1076,7 +1075,7 @@ export function read(data) {
|
|||
/**
|
||||
* Reads an OpenPGP armored text and returns one or multiple key objects
|
||||
* @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
|
||||
* @static
|
||||
*/
|
||||
|
@ -1097,15 +1096,18 @@ export function readArmored(armoredText) {
|
|||
/**
|
||||
* Generates a new OpenPGP key. Supports RSA and ECC keys.
|
||||
* 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
|
||||
* @static
|
||||
*/
|
||||
|
@ -1174,14 +1176,16 @@ export function generate(options) {
|
|||
|
||||
/**
|
||||
* 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
|
||||
* @static
|
||||
*/
|
||||
|
@ -1317,15 +1321,15 @@ async function wrapKeyObject(secretKeyPacket, secretSubkeyPacket, options) {
|
|||
|
||||
/**
|
||||
* 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
|
||||
* @returns {Promise<Boolean>} True if the signature revokes the data
|
||||
* @async
|
||||
|
@ -1412,7 +1416,7 @@ export async function getPreferredHashAlgo(key) {
|
|||
|
||||
/**
|
||||
* 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
|
||||
* @async
|
||||
*/
|
||||
|
|
|
@ -58,7 +58,7 @@ Keyring.prototype.clear = function() {
|
|||
* @param {String} keyId provided as string of lowercase hex number
|
||||
* withouth 0x prefix (can be 16-character key ID or fingerprint)
|
||||
* @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
|
||||
*/
|
||||
Keyring.prototype.getKeysForId = function (keyId, deep) {
|
||||
let result = [];
|
||||
|
@ -71,7 +71,7 @@ Keyring.prototype.getKeysForId = function (keyId, deep) {
|
|||
* Removes keys having the specified key id from the keyring
|
||||
* @param {String} keyId provided as string of lowercase hex number
|
||||
* 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
|
||||
*/
|
||||
Keyring.prototype.removeKeysForId = function (keyId) {
|
||||
let result = [];
|
||||
|
@ -82,7 +82,7 @@ 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
|
||||
*/
|
||||
Keyring.prototype.getAllKeys = function () {
|
||||
return this.publicKeys.keys.concat(this.privateKeys.keys);
|
||||
|
@ -90,7 +90,7 @@ 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
|
||||
*/
|
||||
function KeyArray(keys) {
|
||||
this.keys = keys;
|
||||
|
@ -99,7 +99,7 @@ function KeyArray(keys) {
|
|||
/**
|
||||
* Searches all keys in the KeyArray matching the address or address part of the user ids
|
||||
* @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.
|
||||
*/
|
||||
KeyArray.prototype.getForAddress = function(email) {
|
||||
const results = [];
|
||||
|
@ -115,7 +115,7 @@ KeyArray.prototype.getForAddress = function(email) {
|
|||
* Checks a key to see if it matches the specified email address
|
||||
* @private
|
||||
* @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
|
||||
*/
|
||||
function emailCheck(email, key) {
|
||||
|
@ -138,7 +138,7 @@ function emailCheck(email, key) {
|
|||
* @private
|
||||
* @param {String} keyId provided as string of lowercase hex number
|
||||
* 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
|
||||
*/
|
||||
function keyIdCheck(keyId, keypacket) {
|
||||
|
@ -153,7 +153,7 @@ function keyIdCheck(keyId, keypacket) {
|
|||
* @param {String} keyId provided as string of lowercase hex number
|
||||
* withouth 0x prefix (can be 16-character key ID or fingerprint)
|
||||
* @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
|
||||
*/
|
||||
KeyArray.prototype.getForId = function (keyId, deep) {
|
||||
for (let i = 0; i < this.keys.length; i++) {
|
||||
|
@ -197,7 +197,7 @@ KeyArray.prototype.importKey = async function (armored) {
|
|||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
KeyArray.prototype.push = function (key) {
|
||||
|
@ -208,7 +208,7 @@ KeyArray.prototype.push = function (key) {
|
|||
* Removes a key with the specified keyid from the keyring
|
||||
* @param {String} keyId provided as string of lowercase hex number
|
||||
* 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
|
||||
*/
|
||||
KeyArray.prototype.removeForId = function (keyId) {
|
||||
for (let i = 0; i < this.keys.length; i++) {
|
||||
|
|
|
@ -52,7 +52,7 @@ LocalStore.prototype.privateKeysItem = 'private-keys';
|
|||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
LocalStore.prototype.loadPublic = function () {
|
||||
return loadKeys(this.storage, this.publicKeysItem);
|
||||
|
@ -60,7 +60,7 @@ 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
|
||||
*/
|
||||
LocalStore.prototype.loadPrivate = function () {
|
||||
return loadKeys(this.storage, this.privateKeysItem);
|
||||
|
@ -86,7 +86,7 @@ function loadKeys(storage, itemname) {
|
|||
/**
|
||||
* Saves the current state of the public keys to HTML5 local storage.
|
||||
* 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
|
||||
*/
|
||||
LocalStore.prototype.storePublic = function (keys) {
|
||||
storeKeys(this.storage, this.publicKeysItem, keys);
|
||||
|
@ -95,7 +95,7 @@ LocalStore.prototype.storePublic = function (keys) {
|
|||
/**
|
||||
* Saves the current state of the private keys to HTML5 local storage.
|
||||
* 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
|
||||
*/
|
||||
LocalStore.prototype.storePrivate = function (keys) {
|
||||
storeKeys(this.storage, this.privateKeysItem, keys);
|
||||
|
|
|
@ -16,9 +16,10 @@
|
|||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
/**
|
||||
* @requires encoding/armor
|
||||
* @requires type/keyid
|
||||
* @requires config
|
||||
* @requires crypto
|
||||
* @requires encoding/armor
|
||||
* @requires enums
|
||||
* @requires util
|
||||
* @requires packet
|
||||
|
@ -27,13 +28,13 @@
|
|||
* @module message
|
||||
*/
|
||||
|
||||
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';
|
||||
import { getPreferredHashAlgo, getPreferredSymAlgo } from './key';
|
||||
|
||||
|
@ -42,7 +43,7 @@ import { getPreferredHashAlgo, getPreferredSymAlgo } from './key';
|
|||
* @class
|
||||
* @classdesc Class that represents an OpenPGP message.
|
||||
* 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}
|
||||
*/
|
||||
|
||||
|
@ -361,7 +362,7 @@ export async function encryptSessionKey(sessionKey, symAlgo, publicKeys, passwor
|
|||
|
||||
/**
|
||||
* 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
|
||||
* @param {Date} date} (optional) override the creation time of the signature
|
||||
* @returns {Promise<Message>} new message with signed content
|
||||
|
@ -428,7 +429,7 @@ Message.prototype.sign = async function(privateKeys=[], signature=null, date=new
|
|||
/**
|
||||
* Compresses the message (the literal and -if signed- signature data packets of the message)
|
||||
* @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
|
||||
*/
|
||||
Message.prototype.compress = function(compression) {
|
||||
if (compression === enums.compression.uncompressed) {
|
||||
|
@ -447,10 +448,10 @@ 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
|
||||
*/
|
||||
Message.prototype.signDetached = async function(privateKeys=[], signature=null, date=new Date()) {
|
||||
|
@ -463,11 +464,11 @@ Message.prototype.signDetached = async function(privateKeys=[], signature=null,
|
|||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
export async function createSignaturePackets(literalDataPacket, privateKeys, signature=null, date=new Date()) {
|
||||
|
@ -508,7 +509,7 @@ export async function createSignaturePackets(literalDataPacket, privateKeys, sig
|
|||
|
||||
/**
|
||||
* 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
|
||||
* @returns {Promise<Array<({keyid: module:type/keyid, valid: Boolean})>>} list of signer's keyid and validity of signature
|
||||
* @async
|
||||
|
@ -525,7 +526,7 @@ Message.prototype.verify = function(keys, date=new Date()) {
|
|||
|
||||
/**
|
||||
* 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
|
||||
* @param {Date} date Verify the signature against the given date, i.e. check signature creation time < date < expiration time
|
||||
* @returns {Promise<Array<({keyid: module:type/keyid, valid: Boolean})>>} list of signer's keyid and validity of signature
|
||||
|
@ -543,9 +544,9 @@ Message.prototype.verifyDetached = function(signature, keys, date=new Date()) {
|
|||
|
||||
/**
|
||||
* 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,
|
||||
* i.e. check signature creation time < date < expiration time
|
||||
* @returns {Promise<Array<{keyid: module:type/keyid,
|
||||
|
@ -578,7 +579,7 @@ export async function createVerificationObjects(signatureList, literalDataList,
|
|||
|
||||
/**
|
||||
* Unwrap compressed message
|
||||
* @returns {module:message~Message} message Content of compressed message
|
||||
* @returns {module:message.Message} message Content of compressed message
|
||||
*/
|
||||
Message.prototype.unwrapCompressed = function() {
|
||||
const compressed = this.packets.filterByTag(enums.packet.compressed);
|
||||
|
@ -607,7 +608,7 @@ Message.prototype.armor = function() {
|
|||
/**
|
||||
* reads an OpenPGP armored message and returns a message object
|
||||
* @param {String} armoredText text to be parsed
|
||||
* @returns {module:message~Message} new message object
|
||||
* @returns {module:message.Message} new message object
|
||||
* @static
|
||||
*/
|
||||
export function readArmored(armoredText) {
|
||||
|
@ -634,7 +635,7 @@ export function read(input) {
|
|||
* @param {String} text
|
||||
* @param {String} filename (optional)
|
||||
* @param {Date} date (optional)
|
||||
* @returns {module:message~Message} new message object
|
||||
* @returns {module:message.Message} new message object
|
||||
* @static
|
||||
*/
|
||||
export function fromText(text, filename, date=new Date()) {
|
||||
|
@ -654,7 +655,7 @@ export function fromText(text, filename, date=new Date()) {
|
|||
* @param {Uint8Array} bytes
|
||||
* @param {String} filename (optional)
|
||||
* @param {Date} date (optional)
|
||||
* @returns {module:message~Message} new message object
|
||||
* @returns {module:message.Message} new message object
|
||||
* @static
|
||||
*/
|
||||
export function fromBinary(bytes, filename, date=new Date()) {
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @requires cleartext
|
||||
* @requires key
|
||||
|
@ -26,10 +29,12 @@
|
|||
* @module openpgp
|
||||
*/
|
||||
|
||||
// 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}
|
||||
*/
|
||||
|
||||
import * as messageLib from './message';
|
||||
|
@ -68,7 +73,7 @@ export function initWorker({ path='openpgp.worker.js', n = 1, workers = [] } = {
|
|||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
export function getWorker() {
|
||||
return asyncProxy;
|
||||
|
|
|
@ -1,44 +1,80 @@
|
|||
/**
|
||||
* @fileoverview Exports all OpenPGP packet types
|
||||
* @requires enums
|
||||
* @module packet/all_packets
|
||||
*/
|
||||
|
||||
import enums from '../enums.js';
|
||||
import * as packets from './all_packets.js'; // re-import module to parse packets from tag
|
||||
|
||||
/** @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';
|
||||
|
||||
/**
|
||||
* Allocate a new packet
|
||||
|
|
|
@ -47,7 +47,7 @@ function Compressed() {
|
|||
this.tag = enums.packet.compressed;
|
||||
/**
|
||||
* List of packets
|
||||
* @type {module:packet/packetlist}
|
||||
* @type {module:packet.List}
|
||||
*/
|
||||
this.packets = null;
|
||||
/**
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/**
|
||||
* @fileoverview OpenPGP packet types
|
||||
* @see module:packet/all_packets
|
||||
* @see module:packet/packetlist
|
||||
* @see module:packet/clone
|
||||
* @see module:packet.List
|
||||
* @module packet
|
||||
*/
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ Literal.prototype.getFilename = function() {
|
|||
* Parsing function for a literal data packet (tag 11).
|
||||
*
|
||||
* @param {Uint8Array} input Payload of a tag 11 packet
|
||||
* @returns {module:packet/literal} object representation
|
||||
* @returns {module:packet.Literal} object representation
|
||||
*/
|
||||
Literal.prototype.read = function(bytes) {
|
||||
// - A one-octet field that describes how the data is formatted.
|
||||
|
|
|
@ -47,7 +47,7 @@ function Marker() {
|
|||
* @param {Integer} len
|
||||
* Length of the packet or the remaining length of
|
||||
* input at position
|
||||
* @returns {module:packet/marker} Object representation
|
||||
* @returns {module:packet.Marker} Object representation
|
||||
*/
|
||||
Marker.prototype.read = function (bytes) {
|
||||
if (bytes[0] === 0x50 && // P
|
||||
|
|
|
@ -74,7 +74,7 @@ function OnePassSignature() {
|
|||
/**
|
||||
* parsing function for a one-pass signature packet (tag 4).
|
||||
* @param {Uint8Array} bytes payload of a tag 4 packet
|
||||
* @returns {module:packet/one_pass_signature} object representation
|
||||
* @returns {module:packet.OnePassSignature} object representation
|
||||
*/
|
||||
OnePassSignature.prototype.read = function (bytes) {
|
||||
let mypos = 0;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/* eslint-disable callback-return */
|
||||
/**
|
||||
* @fileoverview Provides a class for representing lists of OpenPGP packets.
|
||||
* @requires packet/all_packets
|
||||
* @requires packet/packet
|
||||
* @requires config
|
||||
|
|
|
@ -16,13 +16,6 @@
|
|||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @requires type/mpi
|
||||
* @requires crypto
|
||||
|
@ -37,20 +30,43 @@ import enums from '../enums';
|
|||
import util from '../util';
|
||||
|
||||
/**
|
||||
* 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
|
||||
* key (sometimes called an OpenPGP certificate).
|
||||
* @memberof module:packet
|
||||
* @constructor
|
||||
*/
|
||||
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;
|
||||
/**
|
||||
* Fingerprint in lowercase hex
|
||||
|
@ -110,7 +126,7 @@ PublicKey.prototype.read = function (bytes) {
|
|||
|
||||
/**
|
||||
* Alias of read()
|
||||
* @see module:packet/public_key~PublicKey#read
|
||||
* @see module:packet.PublicKey#read
|
||||
*/
|
||||
PublicKey.prototype.readPublicKey = PublicKey.prototype.read;
|
||||
|
||||
|
@ -140,7 +156,7 @@ PublicKey.prototype.write = function () {
|
|||
|
||||
/**
|
||||
* Alias of write()
|
||||
* @see module:packet/public_key~PublicKey#write
|
||||
* @see module:packet.PublicKey#write
|
||||
*/
|
||||
PublicKey.prototype.writePublicKey = PublicKey.prototype.write;
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ function PublicKeyEncryptedSessionKey() {
|
|||
* @param {Integer} position Position to start reading from the input string
|
||||
* @param {Integer} len Length of the packet or the remaining length of
|
||||
* input at position
|
||||
* @returns {module:packet/public_key_encrypted_session_key} Object representation
|
||||
* @returns {module:packet.PublicKeyEncryptedSessionKey} Object representation
|
||||
*/
|
||||
PublicKeyEncryptedSessionKey.prototype.read = function (bytes) {
|
||||
this.version = bytes[0];
|
||||
|
@ -102,7 +102,7 @@ PublicKeyEncryptedSessionKey.prototype.write = function () {
|
|||
|
||||
/**
|
||||
* Encrypt session key packet
|
||||
* @param {module:packet/public_key} key Public key
|
||||
* @param {module:packet.PublicKey} key Public key
|
||||
* @returns {Promise<Boolean>}
|
||||
* @async
|
||||
*/
|
||||
|
@ -130,7 +130,7 @@ PublicKeyEncryptedSessionKey.prototype.encrypt = async function (key) {
|
|||
* Decrypts the session key (only for public key encrypted session key
|
||||
* packets (tag 1)
|
||||
*
|
||||
* @param {module:packet/secret_key} key
|
||||
* @param {module:packet.SecretKey} key
|
||||
* Private key with secret params unlocked
|
||||
* @returns {Promise<Boolean>}
|
||||
* @async
|
||||
|
|
|
@ -16,13 +16,6 @@
|
|||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @requires type/keyid
|
||||
* @requires type/s2k
|
||||
|
@ -48,10 +41,18 @@ import util from '../util';
|
|||
*/
|
||||
function SecretKey() {
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -123,7 +124,8 @@ function write_cleartext_params(hash_algorithm, algorithm, params) {
|
|||
// 5.5.3. Secret-Key Packet Formats
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
SecretKey.prototype.read = function (bytes) {
|
||||
|
@ -154,7 +156,8 @@ SecretKey.prototype.read = function (bytes) {
|
|||
}
|
||||
};
|
||||
|
||||
/** Creates an OpenPGP key packet for the given key.
|
||||
/**
|
||||
* 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 () {
|
||||
|
@ -171,7 +174,8 @@ SecretKey.prototype.write = function () {
|
|||
};
|
||||
|
||||
|
||||
/** 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)
|
||||
* and the passphrase is empty or undefined, the key will be set as not encrypted.
|
||||
* This can be used to remove passphrase protection after calling decrypt().
|
||||
|
@ -213,9 +217,8 @@ function produceEncryptionKey(s2k, passphrase, algorithm) {
|
|||
|
||||
/**
|
||||
* 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
|
||||
* @returns {Promise<Boolean>}
|
||||
* @async
|
||||
|
|
|
@ -94,7 +94,7 @@ function Signature(date=new Date()) {
|
|||
* @param {String} bytes payload of a tag 2 packet
|
||||
* @param {Integer} position position to start reading from the bytes string
|
||||
* @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
|
||||
*/
|
||||
Signature.prototype.read = function (bytes) {
|
||||
let i = 0;
|
||||
|
@ -210,7 +210,7 @@ Signature.prototype.write = function () {
|
|||
|
||||
/**
|
||||
* 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.
|
||||
* @returns {Promise<Boolean>}
|
||||
* @async
|
||||
|
@ -619,8 +619,8 @@ Signature.prototype.calculateTrailer = function () {
|
|||
/**
|
||||
* verifys the signature packet. Note: not signature types are implemented
|
||||
* @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.
|
||||
* @async
|
||||
*/
|
||||
|
|
|
@ -63,7 +63,7 @@ function SymEncryptedSessionKey() {
|
|||
* @param {Integer} len
|
||||
* Length of the packet or the remaining length of
|
||||
* input at position
|
||||
* @returns {module:packet/sym_encrypted_session_key} Object representation
|
||||
* @returns {module:packet.SymEncryptedSessionKey} Object representation
|
||||
*/
|
||||
SymEncryptedSessionKey.prototype.read = function(bytes) {
|
||||
// A one-octet version number. The only currently defined version is 4.
|
||||
|
|
|
@ -38,11 +38,24 @@ import enums from '../enums';
|
|||
* @constructor
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -56,8 +69,8 @@ SymmetricallyEncrypted.prototype.write = function () {
|
|||
|
||||
/**
|
||||
* 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
|
||||
* @returns {Promise<Boolean>}
|
||||
* @async
|
||||
|
@ -78,8 +91,8 @@ SymmetricallyEncrypted.prototype.decrypt = async function (sessionKeyAlgorithm,
|
|||
|
||||
/**
|
||||
* 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
|
||||
* @returns {Promise<Boolean>}
|
||||
* @async
|
||||
|
|
|
@ -79,7 +79,7 @@ UserAttribute.prototype.write = function() {
|
|||
|
||||
/**
|
||||
* Compare for equality
|
||||
* @param {module:user_attribute~UserAttribute} usrAttr
|
||||
* @param {module:packet.UserAttribute} usrAttr
|
||||
* @returns {Boolean} true if equal
|
||||
*/
|
||||
UserAttribute.prototype.equals = function(usrAttr) {
|
||||
|
|
|
@ -16,22 +16,21 @@
|
|||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
/**
|
||||
* @requires enums
|
||||
* @requires packet
|
||||
* @requires encoding/armor
|
||||
* @requires packet
|
||||
* @requires enums
|
||||
* @module signature
|
||||
*/
|
||||
|
||||
import armor from './encoding/armor';
|
||||
import packet from './packet';
|
||||
import enums from './enums';
|
||||
import armor from './encoding/armor';
|
||||
|
||||
/**
|
||||
* @class
|
||||
* @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) {
|
||||
if (!(this instanceof Signature)) {
|
||||
return new Signature(packetlist);
|
||||
|
|
|
@ -63,11 +63,11 @@ function handleMessage(workerId) {
|
|||
|
||||
/**
|
||||
* Initializes a new proxy and loads the web worker
|
||||
* @constructor
|
||||
* @param {String} path The path to the worker or 'openpgp.worker.js' by default
|
||||
* @param {Number} n number of workers to initialize if path given
|
||||
* @param {Object} config config The worker configuration
|
||||
* @param {Array<Object>} worker alternative to path parameter: web worker initialized with 'openpgp.worker.js'
|
||||
* @constructor
|
||||
*/
|
||||
function AsyncProxy({ path='openpgp.worker.js', n = 1, workers = [], config } = {}) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user