diff --git a/src/cleartext.js b/src/cleartext.js index 5574ea52..a3aa4516 100644 --- a/src/cleartext.js +++ b/src/cleartext.js @@ -57,11 +57,11 @@ export class CleartextMessage { /** * Sign the cleartext message * @param {Array} privateKeys private keys with decrypted secret key data for signing - * @param {Signature} signature (optional) any existing detached signature + * @param {Signature} [signature] - any existing detached signature * @param {Array} signingKeyIds (optional) array of key IDs to use for signing. Each signingKeyIds[i] corresponds to privateKeys[i] - * @param {Date} date (optional) The creation time of the signature that should be created - * @param {Array} userIds (optional) user IDs to sign with, e.g. [{ name:'Steve Sender', email:'steve@openpgp.org' }] - * @param {Object} config (optional) full configuration, defaults to openpgp.config + * @param {Date} [date] - The creation time of the signature that should be created + * @param {Array} [userIds] - user IDs to sign with, e.g. [{ name:'Steve Sender', email:'steve@openpgp.org' }] + * @param {Object} [config] - full configuration, defaults to openpgp.config * @returns {Promise} new cleartext message with signed content * @async */ @@ -72,11 +72,11 @@ export class CleartextMessage { /** * Sign the cleartext message * @param {Array} privateKeys private keys with decrypted secret key data for signing - * @param {Signature} signature (optional) any existing detached signature + * @param {Signature} [signature] - any existing detached signature * @param {Array} signingKeyIds (optional) array of key IDs to use for signing. Each signingKeyIds[i] corresponds to privateKeys[i] - * @param {Date} date (optional) The creation time of the signature that should be created - * @param {Array} userIds (optional) user IDs to sign with, e.g. [{ name:'Steve Sender', email:'steve@openpgp.org' }] - * @param {Object} config (optional) full configuration, defaults to openpgp.config + * @param {Date} [date] - The creation time of the signature that should be created + * @param {Array} [userIds] - user IDs to sign with, e.g. [{ name:'Steve Sender', email:'steve@openpgp.org' }] + * @param {Object} [config] - full configuration, defaults to openpgp.config * @returns {Promise} new detached signature of message content * @async */ @@ -155,8 +155,9 @@ export class CleartextMessage { /** * Reads an OpenPGP cleartext signed message and returns a CleartextMessage object - * @param {String | ReadableStream} cleartextMessage text to be parsed - * @param {Object} config (optional) custom configuration settings to overwrite those in openpgp.config + * @param {Object} options + * @param {String | ReadableStream} options.cleartextMessage - text to be parsed + * @param {Object} [options.config] - custom configuration settings to overwrite those in [config]{@link module:config} * @returns {CleartextMessage} new cleartext message object * @async * @static diff --git a/src/encoding/armor.js b/src/encoding/armor.js index 16890fab..c8d41837 100644 --- a/src/encoding/armor.js +++ b/src/encoding/armor.js @@ -23,7 +23,7 @@ import defaultConfig from '../config'; /** * Finds out which Ascii Armoring type is used. Throws error if unknown type. - * @param {String} text [String] ascii armored text + * @param {String} text - ascii armored text * @returns {Integer} 0 = MESSAGE PART n of m * 1 = MESSAGE PART n * 2 = SIGNED MESSAGE @@ -88,7 +88,7 @@ function getType(text) { * packet block. * @author Alex * @version 2011-12-16 - * @param {String} customComment (optional) additional comment to add to the armored string + * @param {String} [customComment] - additional comment to add to the armored string * @returns {String} The header information * @private */ @@ -158,7 +158,7 @@ const isLittleEndian = (function() { /** * Internal function to calculate a CRC-24 checksum over a given string (data) - * @param {String | ReadableStream} data Data to create a CRC-24 checksum for + * @param {String | ReadableStream} input Data to create a CRC-24 checksum for * @returns {Uint8Array | ReadableStream} The CRC-24 checksum * @private */ @@ -220,9 +220,9 @@ function splitChecksum(text) { } /** - * DeArmor an OpenPGP armored message; verify the checksum and return + * Dearmor an OpenPGP armored message; verify the checksum and return * the encoded bytes - * @param {String} text OpenPGP armored message + * @param {String} input OpenPGP armored message * @returns {Promise} An object with attribute "text" containing the message text, * an attribute "data" containing a stream of bytes and "type" for the ASCII armor type * @async @@ -346,38 +346,38 @@ export function unarmor(input, config = defaultConfig) { /** * Armor an OpenPGP binary packet block - * @param {Integer} messagetype type of the message - * @param body - * @param {Integer} partindex - * @param {Integer} parttotal - * @param {String} customComment (optional) additional comment to add to the armored string + * @param {module:enums.armor} messageType type of the message + * @param {Uint8Array | ReadableStream} body the message body to armor + * @param {Integer} [partIndex] + * @param {Integer} [partTotal] + * @param {String} [customComment] - additional comment to add to the armored string * @returns {String | ReadableStream} Armored text * @static */ -export function armor(messagetype, body, partindex, parttotal, customComment, config = defaultConfig) { +export function armor(messageType, body, partIndex, partTotal, customComment, config = defaultConfig) { let text; let hash; - if (messagetype === enums.armor.signed) { + if (messageType === enums.armor.signed) { text = body.text; hash = body.hash; body = body.data; } const bodyClone = stream.passiveClone(body); const result = []; - switch (messagetype) { + switch (messageType) { case enums.armor.multipartSection: - result.push("-----BEGIN PGP MESSAGE, PART " + partindex + "/" + parttotal + "-----\n"); + result.push("-----BEGIN PGP MESSAGE, PART " + partIndex + "/" + partTotal + "-----\n"); result.push(addheader(customComment, config)); result.push(base64.encode(body)); result.push("=", getCheckSum(bodyClone)); - result.push("-----END PGP MESSAGE, PART " + partindex + "/" + parttotal + "-----\n"); + result.push("-----END PGP MESSAGE, PART " + partIndex + "/" + partTotal + "-----\n"); break; case enums.armor.multipartLast: - result.push("-----BEGIN PGP MESSAGE, PART " + partindex + "-----\n"); + result.push("-----BEGIN PGP MESSAGE, PART " + partIndex + "-----\n"); result.push(addheader(customComment, config)); result.push(base64.encode(body)); result.push("=", getCheckSum(bodyClone)); - result.push("-----END PGP MESSAGE, PART " + partindex + "-----\n"); + result.push("-----END PGP MESSAGE, PART " + partIndex + "-----\n"); break; case enums.armor.signed: result.push("\n-----BEGIN PGP SIGNED MESSAGE-----\n"); diff --git a/src/key/factory.js b/src/key/factory.js index f6372aa3..91ec3116 100644 --- a/src/key/factory.js +++ b/src/key/factory.js @@ -244,9 +244,10 @@ async function wrapKeyObject(secretKeyPacket, secretSubkeyPackets, options, conf /** * Reads an (optionally armored) OpenPGP key and returns a key object - * @param {String} armoredKey armored key to be parsed - * @param {Uint8Array} binaryKey binary key to be parsed - * @param {Object} config (optional) custom configuration settings to overwrite those in openpgp.config + * @param {Object} options + * @param {String | ReadableStream} [options.armoredKey] - armored key to be parsed + * @param {Uint8Array | ReadableStream} [options.binaryKey] - binary key to be parsed + * @param {Object} [options.config] - custom configuration settings to overwrite those in [config]{@link module:config} * @returns {Promise} key object * @async * @static @@ -273,9 +274,10 @@ export async function readKey({ armoredKey, binaryKey, config }) { /** * Reads an (optionally armored) OpenPGP key block and returns a list of key objects - * @param {String | ReadableStream} armoredKeys armored keys to be parsed - * @param {Uint8Array | ReadableStream} binaryKeys binary keys to be parsed - * @param {Object} config (optional) custom configuration settings to overwrite those in openpgp.config + * @param {Object} options + * @param {String | ReadableStream} [options.armoredKeys] - armored keys to be parsed + * @param {Uint8Array | ReadableStream} [options.binaryKeys] - binary keys to be parsed + * @param {Object} [options.config] - custom configuration settings to overwrite those in [config]{@link module:config} * @returns {Promise>} key objects * @async * @static diff --git a/src/key/helper.js b/src/key/helper.js index 64669a9f..4ce7e458 100644 --- a/src/key/helper.js +++ b/src/key/helper.js @@ -203,11 +203,11 @@ export async function getPreferredAlgo(type, keys, date = new Date(), userIds = * @param {Object} dataToSign Contains packets to be signed * @param {SecretKeyPacket| * SecretSubkeyPacket} signingKeyPacket secret key packet for signing - * @param {Object} signatureProperties (optional) properties to write on the signature packet before signing - * @param {Date} date (optional) override the creationtime of the signature - * @param {Object} userId (optional) user ID - * @param {Object} detached (optional) whether to create a detached signature packet - * @param {Boolean} streaming (optional) whether to process data as a stream + * @param {Object} [signatureProperties] - properties to write on the signature packet before signing + * @param {Date} [date] - override the creationtime of the signature + * @param {Object} [userId] - user ID + * @param {Object} [detached] - whether to create a detached signature packet + * @param {Boolean} [streaming] - whether to process data as a stream * @param {Object} config full configuration * @returns {Promise} signature packet */ diff --git a/src/key/key.js b/src/key/key.js index 531d6978..92e5d8a7 100644 --- a/src/key/key.js +++ b/src/key/key.js @@ -881,7 +881,7 @@ class Key { * @param {Number} options.keyExpirationTime (optional) Number of seconds from the key creation time after which the key expires * @param {Date} options.date (optional) Override the creation date of the key and the key signatures * @param {Boolean} options.sign (optional) Indicates whether the subkey should sign rather than encrypt. Defaults to false - * @param {Object} options.config (optional) custom configuration settings to overwrite those in openpgp.config + * @param {Object} options.config (optional) custom configuration settings to overwrite those in [config]{@link module:config} * @returns {Promise} * @async */ diff --git a/src/keyring/keyring.js b/src/keyring/keyring.js index 5582fcb7..2e3f6d7b 100644 --- a/src/keyring/keyring.js +++ b/src/keyring/keyring.js @@ -71,7 +71,7 @@ class KeyArray { /** * Imports a key from an ascii armored message * @param {String} armored message to read the keys/key from - * @param {Object} config (optional) full configuration, defaults to openpgp.config + * @param {Object} [config] - full configuration, defaults to openpgp.config * @async */ async importKey(armored, config = defaultConfig) { @@ -118,7 +118,7 @@ class Keyring { /** * Initialization routine for the keyring. * @param {keyring/localstore} [storeHandler] class implementing loadPublic(), loadPrivate(), storePublic(), and storePrivate() methods - * @param {Object} config (optional) full configuration, defaults to openpgp.config + * @param {Object} [config] - full configuration, defaults to openpgp.config */ constructor(storeHandler, config = defaultConfig) { this.storeHandler = storeHandler || new LocalStore(undefined, config); diff --git a/src/keyring/localstore.js b/src/keyring/localstore.js index 25c65dc5..eef2ec8b 100644 --- a/src/keyring/localstore.js +++ b/src/keyring/localstore.js @@ -32,7 +32,7 @@ import defaultConfig from '../config'; class LocalStore { /** * @param {String} prefix prefix for itemnames in localstore - * @param {Object} config (optional) full configuration, defaults to openpgp.config + * @param {Object} [config] - full configuration, defaults to openpgp.config */ constructor(prefix, config = defaultConfig) { prefix = prefix || 'openpgp-'; @@ -56,7 +56,7 @@ class LocalStore { /** * Load the private keys from HTML5 local storage. - * @param {Object} config (optional) full configuration, defaults to openpgp.config + * @param {Object} [config] - full configuration, defaults to openpgp.config * @returns {Array} array of keys retrieved from localstore * @async */ @@ -68,7 +68,7 @@ class LocalStore { * Saves the current state of the public keys to HTML5 local storage. * The key array gets stringified using JSON * @param {Array} keys array of keys to save in localstore - * @param {Object} config (optional) full configuration, defaults to openpgp.config + * @param {Object} [config] - full configuration, defaults to openpgp.config * @async */ async storePublic(keys, config = defaultConfig) { @@ -79,7 +79,7 @@ class LocalStore { * Saves the current state of the private keys to HTML5 local storage. * The key array gets stringified using JSON * @param {Array} keys array of keys to save in localstore - * @param {Object} config (optional) full configuration, defaults to openpgp.config + * @param {Object} [config] - full configuration, defaults to openpgp.config * @async */ async storePrivate(keys, config = defaultConfig) { diff --git a/src/message.js b/src/message.js index dd5ff311..1b2a3913 100644 --- a/src/message.js +++ b/src/message.js @@ -88,11 +88,11 @@ export class Message { /** * Decrypt the message. Either a private key, a session key, or a password must be specified. - * @param {Array} privateKeys (optional) private keys with decrypted secret data - * @param {Array} passwords (optional) passwords used to decrypt - * @param {Array} sessionKeys (optional) session keys in the form: { data:Uint8Array, algorithm:String, [aeadAlgorithm:String] } - * @param {Boolean} streaming (optional) whether to process data as a stream - * @param {Object} config (optional) full configuration, defaults to openpgp.config + * @param {Array} [privateKeys] - private keys with decrypted secret data + * @param {Array} [passwords] - passwords used to decrypt + * @param {Array} [sessionKeys] - session keys in the form: { data:Uint8Array, algorithm:String, [aeadAlgorithm:String] } + * @param {Boolean} [streaming] - whether to process data as a stream + * @param {Object} [config] - full configuration, defaults to openpgp.config * @returns {Promise} new message with decrypted content * @async */ @@ -140,9 +140,9 @@ export class Message { /** * Decrypt encrypted session keys either with private keys or passwords. - * @param {Array} privateKeys (optional) private keys with decrypted secret data - * @param {Array} passwords (optional) passwords used to decrypt - * @param {Object} config (optional) full configuration, defaults to openpgp.config + * @param {Array} [privateKeys] - private keys with decrypted secret data + * @param {Array} [passwords] - passwords used to decrypt + * @param {Object} [config] - full configuration, defaults to openpgp.config * @returns {Promise>} array of object with potential sessionKey, algorithm pairs * @async @@ -275,10 +275,10 @@ export class Message { /** * Generate a new session key object, taking the algorithm preferences of the passed public keys into account, if any. - * @param {Array} keys (optional) public key(s) to select algorithm preferences for - * @param {Date} date (optional) date to select algorithm preferences at - * @param {Array} userIds (optional) user IDs to select algorithm preferences for - * @param {Object} config (optional) full configuration, defaults to openpgp.config + * @param {Array} [keys] - public key(s) to select algorithm preferences for + * @param {Date} [date] - date to select algorithm preferences at + * @param {Array} [userIds] - user IDs to select algorithm preferences for + * @param {Object} [config] - full configuration, defaults to openpgp.config * @returns {Promise<{ data: Uint8Array, algorithm: String }>} object with session key data and algorithm * @async */ @@ -293,15 +293,15 @@ export class Message { /** * Encrypt the message either with public keys, passwords, or both at once. - * @param {Array} keys (optional) public key(s) for message encryption - * @param {Array} passwords (optional) password(s) for message encryption - * @param {Object} sessionKey (optional) session key in the form: { data:Uint8Array, algorithm:String, [aeadAlgorithm:String] } - * @param {Boolean} wildcard (optional) use a key ID of 0 instead of the public key IDs - * @param {Array} encryptionKeyIds (optional) array of key IDs to use for encryption. Each encryptionKeyIds[i] corresponds to publicKeys[i] - * @param {Date} date (optional) override the creation date of the literal package - * @param {Array} userIds (optional) user IDs to encrypt for, e.g. [{ name:'Robert Receiver', email:'robert@openpgp.org' }] - * @param {Boolean} streaming (optional) whether to process data as a stream - * @param {Object} config (optional) full configuration, defaults to openpgp.config + * @param {Array} [keys] - public key(s) for message encryption + * @param {Array} [passwords] - password(s) for message encryption + * @param {Object} [sessionKey] - session key in the form: { data:Uint8Array, algorithm:String, [aeadAlgorithm:String] } + * @param {Boolean} [wildcard] - use a key ID of 0 instead of the public key IDs + * @param {Array} [encryptionKeyIds] - array of key IDs to use for encryption. Each encryptionKeyIds[i] corresponds to publicKeys[i] + * @param {Date} [date] - override the creation date of the literal package + * @param {Array} [userIds] - user IDs to encrypt for, e.g. [{ name:'Robert Receiver', email:'robert@openpgp.org' }] + * @param {Boolean} [streaming] - whether to process data as a stream + * @param {Object} [config] - full configuration, defaults to openpgp.config * @returns {Promise} new message with encrypted content * @async */ @@ -344,14 +344,14 @@ export class Message { * Encrypt a session key either with public keys, passwords, or both at once. * @param {Uint8Array} sessionKey session key for encryption * @param {String} algorithm session key algorithm - * @param {String} aeadAlgorithm (optional) aead algorithm, e.g. 'eax' or 'ocb' - * @param {Array} publicKeys (optional) public key(s) for message encryption - * @param {Array} passwords (optional) for message encryption - * @param {Boolean} wildcard (optional) use a key ID of 0 instead of the public key IDs - * @param {Array} encryptionKeyIds (optional) array of key IDs to use for encryption. Each encryptionKeyIds[i] corresponds to publicKeys[i] - * @param {Date} date (optional) override the date - * @param {Array} userIds (optional) user IDs to encrypt for, e.g. [{ name:'Robert Receiver', email:'robert@openpgp.org' }] - * @param {Object} config (optional) full configuration, defaults to openpgp.config + * @param {String} [aeadAlgorithm] - aead algorithm, e.g. 'eax' or 'ocb' + * @param {Array} [publicKeys] - public key(s) for message encryption + * @param {Array} [passwords] - for message encryption + * @param {Boolean} [wildcard] - use a key ID of 0 instead of the public key IDs + * @param {Array} [encryptionKeyIds] - array of key IDs to use for encryption. Each encryptionKeyIds[i] corresponds to publicKeys[i] + * @param {Date} [date] - override the date + * @param {Array} [userIds] - user IDs to encrypt for, e.g. [{ name:'Robert Receiver', email:'robert@openpgp.org' }] + * @param {Object} [config] - full configuration, defaults to openpgp.config * @returns {Promise} new message with encrypted content * @async */ @@ -414,12 +414,12 @@ export class Message { /** * Sign the message (the literal data packet of the message) * @param {Array} privateKeys private keys with decrypted secret key data for signing - * @param {Signature} signature (optional) any existing detached signature to add to the message + * @param {Signature} [signature] - any existing detached signature to add to the message * @param {Array} signingKeyIds (optional) array of key IDs to use for signing. Each signingKeyIds[i] corresponds to privateKeys[i] - * @param {Date} date (optional) override the creation time of the signature - * @param {Array} userIds (optional) user IDs to sign with, e.g. [{ name:'Steve Sender', email:'steve@openpgp.org' }] - * @param {Boolean} streaming (optional) whether to process data as a stream - * @param {Object} config (optional) full configuration, defaults to openpgp.config + * @param {Date} [date] - override the creation time of the signature + * @param {Array} [userIds] - user IDs to sign with, e.g. [{ name:'Steve Sender', email:'steve@openpgp.org' }] + * @param {Boolean} [streaming] - whether to process data as a stream + * @param {Object} [config] - full configuration, defaults to openpgp.config * @returns {Promise} new message with signed content * @async */ @@ -500,12 +500,12 @@ export class Message { /** * Create a detached signature for the message (the literal data packet of the message) * @param {Array} privateKeys private keys with decrypted secret key data for signing - * @param {Signature} signature (optional) any existing detached signature + * @param {Signature} [signature] - any existing detached signature * @param {Array} signingKeyIds (optional) array of key IDs to use for signing. Each signingKeyIds[i] corresponds to privateKeys[i] - * @param {Date} date (optional) override the creation time of the signature - * @param {Array} userIds (optional) user IDs to sign with, e.g. [{ name:'Steve Sender', email:'steve@openpgp.org' }] - * @param {Boolean} streaming (optional) whether to process data as a stream - * @param {Object} config (optional) full configuration, defaults to openpgp.config + * @param {Date} [date] - override the creation time of the signature + * @param {Array} [userIds] - user IDs to sign with, e.g. [{ name:'Steve Sender', email:'steve@openpgp.org' }] + * @param {Boolean} [streaming] - whether to process data as a stream + * @param {Object} [config] - full configuration, defaults to openpgp.config * @returns {Promise} new detached signature of message content * @async */ @@ -688,13 +688,13 @@ export class Message { * Create signature packets for the message * @param {LiteralDataPacket} literalDataPacket the literal data packet to sign * @param {Array} privateKeys private keys with decrypted secret key data for signing - * @param {Signature} signature (optional) any existing detached signature to append + * @param {Signature} [signature] - any existing detached signature to append * @param {Array} signingKeyIds (optional) array of key IDs to use for signing. Each signingKeyIds[i] corresponds to privateKeys[i] - * @param {Date} date (optional) override the creationtime of the signature - * @param {Array} userIds (optional) user IDs to sign with, e.g. [{ name:'Steve Sender', email:'steve@openpgp.org' }] - * @param {Boolean} detached (optional) whether to create detached signature packets - * @param {Boolean} streaming (optional) whether to process data as a stream - * @param {Object} config (optional) full configuration, defaults to openpgp.config + * @param {Date} [date] - override the creationtime of the signature + * @param {Array} [userIds] - user IDs to sign with, e.g. [{ name:'Steve Sender', email:'steve@openpgp.org' }] + * @param {Boolean} [detached] - whether to create detached signature packets + * @param {Boolean} [streaming] - whether to process data as a stream + * @param {Object} [config] - full configuration, defaults to openpgp.config * @returns {Promise} list of signature packets * @async * @private @@ -811,9 +811,10 @@ export async function createVerificationObjects(signatureList, literalDataList, /** * Reads an (optionally armored) OpenPGP message and returns a Message object - * @param {String | ReadableStream} armoredMessage armored message to be parsed - * @param {Uint8Array | ReadableStream} binaryMessage binary to be parsed - * @param {Object} config (optional) custom configuration settings to overwrite those in openpgp.config + * @param {Object} options + * @param {String | ReadableStream} [options.armoredMessage] - armored message to be parsed + * @param {Uint8Array | ReadableStream} [options.binaryMessage] - binary to be parsed + * @param {Object} [options.config] - custom configuration settings to overwrite those in [config]{@link module:config} * @returns {Promise} new message object * @async * @static diff --git a/src/openpgp.js b/src/openpgp.js index 46bcc326..5a611546 100644 --- a/src/openpgp.js +++ b/src/openpgp.js @@ -39,18 +39,19 @@ if (globalThis.ReadableStream) { /** * Generates a new OpenPGP key pair. Supports RSA and ECC keys. By default, primary and subkeys will be of same type. - * @param {ecc|rsa} type (optional) The primary key algorithm type: ECC (default) or RSA - * @param {Object|Array} userIds User IDs as objects: { name:'Jo Doe', email:'info@jo.com' } - * @param {String} passphrase (optional) The passphrase used to encrypt the resulting private key - * @param {Number} rsaBits (optional) Number of bits for RSA keys, defaults to 4096 - * @param {String} curve (optional) Elliptic curve for ECC keys: + * @param {Object} options + * @param {'ecc'|'rsa'} [options.type='ecc'] - The primary key algorithm type: ECC (default) or RSA + * @param {Object|Array} options.userIds - User IDs as objects: `{ name:'Jo Doe', email:'info@jo.com' }` + * @param {String} [options.passphrase] - The passphrase used to encrypt the resulting private key + * @param {Number} [options.rsaBits=4096] - Number of bits for RSA keys + * @param {String} [options.curve='curve25519'] - Elliptic curve for ECC keys: * curve25519 (default), p256, p384, p521, secp256k1, * brainpoolP256r1, brainpoolP384r1, or brainpoolP512r1 - * @param {Date} date (optional) Override the creation date of the key and the key signatures - * @param {Number} keyExpirationTime (optional) Number of seconds from the key creation time after which the key expires - * @param {Array} subkeys (optional) Options for each subkey, default to main key options. e.g. [{sign: true, passphrase: '123'}] + * @param {Date} [options.date=current date] - Override the creation date of the key and the key signatures + * @param {Number} [options.keyExpirationTime=0 (never expires)] - Number of seconds from the key creation time after which the key expires + * @param {Array} [options.subkeys=a single encryption subkey] - Options for each subkey, default to main key options. e.g. [{sign: true, passphrase: '123'}] * sign parameter defaults to false, and indicates whether the subkey should sign rather than encrypt - * @param {Object} config (optional) custom configuration settings to overwrite those in openpgp.config + * @param {Object} [options.config] - custom configuration settings to overwrite those in [config]{@link module:config} * @returns {Promise} The generated key object in the form: * { key:Key, privateKeyArmored:String, publicKeyArmored:String, revocationCertificate:String } * @async @@ -81,11 +82,12 @@ export function generateKey({ userIds = [], passphrase = "", type = "ecc", rsaBi /** * Reformats signature packets for a key and rewraps key object. - * @param {Key} privateKey Private key to reformat - * @param {Object|Array} userIds User IDs as objects: { name:'Jo Doe', email:'info@jo.com' } - * @param {String} passphrase (optional) The passphrase used to encrypt the resulting private key - * @param {Number} keyExpirationTime (optional) Number of seconds from the key creation time after which the key expires - * @param {Object} config (optional) custom configuration settings to overwrite those in openpgp.config + * @param {Object} options + * @param {Key} options.privateKey - Private key to reformat + * @param {Object|Array} options.userIds - User IDs as objects: `{ name:'Jo Doe', email:'info@jo.com' }` + * @param {String} [options.passphrase="" (not protected)] - The passphrase used to encrypt the resulting private key + * @param {Number} [options.keyExpirationTime=0 (never expires)] - Number of seconds from the key creation time after which the key expires + * @param {Object} [options.config] - custom configuration settings to overwrite those in [config]{@link module:config} * @returns {Promise} The generated key object in the form: * { key:Key, privateKeyArmored:String, publicKeyArmored:String, revocationCertificate:String } * @async @@ -114,15 +116,16 @@ export function reformatKey({ privateKey, userIds = [], passphrase = "", keyExpi /** * Revokes a key. Requires either a private key or a revocation certificate. * If a revocation certificate is passed, the reasonForRevocation parameters will be ignored. - * @param {Key} key (optional) public or private key to revoke - * @param {String} revocationCertificate (optional) revocation certificate to revoke the key with - * @param {Object} reasonForRevocation (optional) object indicating the reason for revocation - * @param {module:enums.reasonForRevocation} reasonForRevocation.flag (optional) flag indicating the reason for revocation - * @param {String} reasonForRevocation.string (optional) string explaining the reason for revocation - * @param {Object} config (optional) custom configuration settings to overwrite those in openpgp.config + * @param {Object} options + * @param {Key} options.key - public or private key to revoke + * @param {String} [options.revocationCertificate] - revocation certificate to revoke the key with + * @param {Object} [options.reasonForRevocation] - object indicating the reason for revocation + * @param {module:enums.reasonForRevocation} [options.reasonForRevocation.flag=[noReason]{@link module:enums.reasonForRevocation}] - flag indicating the reason for revocation + * @param {String} [options.reasonForRevocation.string=""] - string explaining the reason for revocation + * @param {Object} [options.config] - custom configuration settings to overwrite those in [config]{@link module:config} * @returns {Promise} The revoked key object in the form: - * { privateKey:Key, privateKeyArmored:String, publicKey:Key, publicKeyArmored:String } - * (if private key is passed) or { publicKey:Key, publicKeyArmored:String } (otherwise) + * `{ privateKey:Key, privateKeyArmored:String, publicKey:Key, publicKeyArmored:String }` + * (if private key is passed) or `{ publicKey:Key, publicKeyArmored:String }` (otherwise) * @async * @static */ @@ -154,9 +157,10 @@ export function revokeKey({ key, revocationCertificate, reasonForRevocation, con /** * Unlock a private key with the given passphrase. * This method does not change the original key. - * @param {Key} privateKey the private key to decrypt - * @param {String|Array} passphrase the user's passphrase(s) - * @param {Object} config (optional) custom configuration settings to overwrite those in openpgp.config + * @param {Object} options + * @param {Key} options.privateKey - the private key to decrypt + * @param {String|Array} options.passphrase - the user's passphrase(s) + * @param {Object} [options.config] - custom configuration settings to overwrite those in [config]{@link module:config} * @returns {Promise} the unlocked key object * @async */ @@ -182,9 +186,10 @@ export async function decryptKey({ privateKey, passphrase, config }) { /** * Lock a private key with the given passphrase. * This method does not change the original key. - * @param {Key} privateKey the private key to encrypt - * @param {String|Array} passphrase if multiple passphrases, they should be in the same order as the packets each should encrypt - * @param {Object} config (optional) custom configuration settings to overwrite those in openpgp.config + * @param {Object} options + * @param {Key} options.privateKey - the private key to encrypt + * @param {String|Array} options.passphrase - if multiple passphrases, they should be in the same order as the packets each should encrypt + * @param {Object} [options.config] - custom configuration settings to overwrite those in [config]{@link module:config} * @returns {Promise} the locked key object * @async */ @@ -225,21 +230,22 @@ export async function encryptKey({ privateKey, passphrase, config }) { /** * Encrypts message text/data with public keys, passwords or both at once. At least either public keys or passwords * must be specified. If private keys are specified, those will be used to sign the message. - * @param {Message} message message to be encrypted as created by openpgp.Message.fromText or openpgp.Message.fromBinary - * @param {Key|Array} publicKeys (optional) array of keys or single key, used to encrypt the message - * @param {Key|Array} privateKeys (optional) private keys for signing. If omitted message will not be signed - * @param {String|Array} passwords (optional) array of passwords or a single password to encrypt the message - * @param {Object} sessionKey (optional) session key in the form: { data:Uint8Array, algorithm:String } - * @param {Boolean} armor (optional) whether the return values should be ascii armored (true, the default) or binary (false) - * @param {'web'|'ponyfill'|'node'|false} streaming (optional) whether to return data as a stream. Defaults to the type of stream `message` was created from, if any. - * @param {Signature} signature (optional) a detached signature to add to the encrypted message - * @param {Boolean} wildcard (optional) use a key ID of 0 instead of the public key IDs - * @param {Array} signingKeyIds (optional) array of key IDs to use for signing. Each signingKeyIds[i] corresponds to privateKeys[i] - * @param {Array} encryptionKeyIds (optional) array of key IDs to use for encryption. Each encryptionKeyIds[i] corresponds to publicKeys[i] - * @param {Date} date (optional) override the creation date of the message signature - * @param {Array} fromUserIds (optional) array of user IDs to sign with, one per key in `privateKeys`, e.g. [{ name:'Steve Sender', email:'steve@openpgp.org' }] - * @param {Array} toUserIds (optional) array of user IDs to encrypt for, one per key in `publicKeys`, e.g. [{ name:'Robert Receiver', email:'robert@openpgp.org' }] - * @param {Object} config (optional) custom configuration settings to overwrite those in openpgp.config + * @param {Object} options + * @param {Message} options.message - message to be encrypted as created by {@link Message.fromText} or {@link Message.fromBinary} + * @param {Key|Array} [options.publicKeys] - array of keys or single key, used to encrypt the message + * @param {Key|Array} [options.privateKeys] - private keys for signing. If omitted message will not be signed + * @param {String|Array} [options.passwords] - array of passwords or a single password to encrypt the message + * @param {Object} [options.sessionKey] - session key in the form: `{ data:Uint8Array, algorithm:String }` + * @param {Boolean} [options.armor=true] - whether the return values should be ascii armored (true, the default) or binary (false) + * @param {'web'|'ponyfill'|'node'|false} [options.streaming=type of stream `message` was created from, if any] - whether to return data as a stream + * @param {Signature} [options.signature] - a detached signature to add to the encrypted message + * @param {Boolean} [options.wildcard=false] - use a key ID of 0 instead of the public key IDs + * @param {Array} [options.signingKeyIds=latest-created valid signing (sub)keys] - array of key IDs to use for signing. Each `signingKeyIds[i]` corresponds to `privateKeys[i]` + * @param {Array} [options.encryptionKeyIds=latest-created valid encryption (sub)keys] - array of key IDs to use for encryption. Each `encryptionKeyIds[i]` corresponds to `publicKeys[i]` + * @param {Date} [options.date=current date] - override the creation date of the message signature + * @param {Array} [options.fromUserIds=primary user IDs] - array of user IDs to sign with, one per key in `privateKeys`, e.g. [{ name:'Steve Sender', email:'steve@openpgp.org' }] + * @param {Array} [options.toUserIds=primary user IDs] - array of user IDs to encrypt for, one per key in `publicKeys`, e.g. [{ name:'Robert Receiver', email:'robert@openpgp.org' }] + * @param {Object} [options.config] - custom configuration settings to overwrite those in [config]{@link module:config} * @returns {Promise|NodeStream|Uint8Array|ReadableStream|NodeStream>} (String if `armor` was true, the default; Uint8Array if `armor` was false) * @async * @static @@ -268,16 +274,17 @@ export function encrypt({ message, publicKeys, privateKeys, passwords, sessionKe /** * Decrypts a message with the user's private key, a session key or a password. Either a private key, * a session key or a password must be specified. - * @param {Message} message the message object with the encrypted data - * @param {Key|Array} privateKeys (optional) private keys with decrypted secret key data or session key - * @param {String|Array} passwords (optional) passwords to decrypt the message - * @param {Object|Array} sessionKeys (optional) session keys in the form: { data:Uint8Array, algorithm:String } - * @param {Key|Array} publicKeys (optional) array of public keys or single key, to verify signatures - * @param {'utf8'|'binary'} format (optional) whether to return data as a string(Stream) or Uint8Array(Stream). If 'utf8' (the default), also normalize newlines. - * @param {'web'|'ponyfill'|'node'|false} streaming (optional) whether to return data as a stream. Defaults to the type of stream `message` was created from, if any. - * @param {Signature} signature (optional) detached signature for verification - * @param {Date} date (optional) use the given date for verification instead of the current time - * @param {Object} config (optional) custom configuration settings to overwrite those in openpgp.config + * @param {Object} options + * @param {Message} options.message - the message object with the encrypted data + * @param {Key|Array} [options.privateKeys] - private keys with decrypted secret key data or session key + * @param {String|Array} [options.passwords] - passwords to decrypt the message + * @param {Object|Array} [options.sessionKeys] - session keys in the form: { data:Uint8Array, algorithm:String } + * @param {Key|Array} [options.publicKeys] - array of public keys or single key, to verify signatures + * @param {'utf8'|'binary'} [options.format] - whether to return data as a string(Stream) or Uint8Array(Stream). If 'utf8' (the default), also normalize newlines. + * @param {'web'|'ponyfill'|'node'|false} [options.streaming=type of stream `message` was created from, if any] - whether to return data as a stream. Defaults to the type of stream `message` was created from, if any. + * @param {Signature} [options.signature] - detached signature for verification + * @param {Date} [options.date=current date] - use the given date for verification instead of the current time + * @param {Object} [options.config] - custom configuration settings to overwrite those in [config]{@link module:config} * @returns {Promise} Object containing decrypted and verified message in the form: * * { @@ -325,15 +332,16 @@ export function decrypt({ message, privateKeys, passwords, sessionKeys, publicKe /** * Signs a message. - * @param {CleartextMessage|Message} message (cleartext) message to be signed - * @param {Key|Array} privateKeys array of keys or single key with decrypted secret key data to sign cleartext - * @param {Boolean} armor (optional) whether the return values should be ascii armored (true, the default) or binary (false) - * @param {'web'|'ponyfill'|'node'|false} streaming (optional) whether to return data as a stream. Defaults to the type of stream `message` was created from, if any. - * @param {Boolean} detached (optional) if the return value should contain a detached signature - * @param {Array} signingKeyIds (optional) array of key IDs to use for signing. Each signingKeyIds[i] corresponds to privateKeys[i] - * @param {Date} date (optional) override the creation date of the signature - * @param {Array} fromUserIds (optional) array of user IDs to sign with, one per key in `privateKeys`, e.g. [{ name:'Steve Sender', email:'steve@openpgp.org' }] - * @param {Object} config (optional) custom configuration settings to overwrite those in openpgp.config + * @param {Object} options + * @param {CleartextMessage|Message} options.message - (cleartext) message to be signed + * @param {Key|Array} options.privateKeys - array of keys or single key with decrypted secret key data to sign cleartext + * @param {Boolean} [options.armor=true] - whether the return values should be ascii armored (true, the default) or binary (false) + * @param {'web'|'ponyfill'|'node'|false} [options.streaming=type of stream `message` was created from, if any] - whether to return data as a stream. Defaults to the type of stream `message` was created from, if any. + * @param {Boolean} [options.detached=false] - if the return value should contain a detached signature + * @param {Array} [options.signingKeyIds=latest-created valid signing (sub)keys] - array of key IDs to use for signing. Each signingKeyIds[i] corresponds to privateKeys[i] + * @param {Date} [options.date=current date] - override the creation date of the signature + * @param {Array} [options.fromUserIds=primary user IDs] - array of user IDs to sign with, one per key in `privateKeys`, e.g. [{ name:'Steve Sender', email:'steve@openpgp.org' }] + * @param {Object} [options.config] - custom configuration settings to overwrite those in [config]{@link module:config} * @returns {Promise|NodeStream|Uint8Array|ReadableStream|NodeStream>} (String if `armor` was true, the default; Uint8Array if `armor` was false) * @async * @static @@ -369,13 +377,14 @@ export function sign({ message, privateKeys, armor = true, streaming = message & /** * Verifies signatures of cleartext signed message - * @param {Key|Array} publicKeys array of publicKeys or single key, to verify signatures - * @param {CleartextMessage|Message} message (cleartext) message object with signatures - * @param {'utf8'|'binary'} format (optional) whether to return data as a string(Stream) or Uint8Array(Stream). If 'utf8' (the default), also normalize newlines. - * @param {'web'|'ponyfill'|'node'|false} streaming (optional) whether to return data as a stream. Defaults to the type of stream `message` was created from, if any. - * @param {Signature} signature (optional) detached signature for verification - * @param {Date} date (optional) use the given date for verification instead of the current time - * @param {Object} config (optional) custom configuration settings to overwrite those in openpgp.config + * @param {Object} options + * @param {Key|Array} options.publicKeys - array of publicKeys or single key, to verify signatures + * @param {CleartextMessage|Message} options.message - (cleartext) message object with signatures + * @param {'utf8'|'binary'} [options.format] - whether to return data as a string(Stream) or Uint8Array(Stream). If 'utf8' (the default), also normalize newlines. + * @param {'web'|'ponyfill'|'node'|false} [options.streaming=type of stream `message` was created from, if any] - whether to return data as a stream. Defaults to the type of stream `message` was created from, if any. + * @param {Signature} [options.signature] - detached signature for verification + * @param {Date} [options.date=current date] - use the given date for verification instead of the current time + * @param {Object} [options.config] - custom configuration settings to overwrite those in [config]{@link module:config} * @returns {Promise} Object containing verified message in the form: * * { @@ -422,10 +431,11 @@ export function verify({ message, publicKeys, format = 'utf8', streaming = messa /** * Generate a new session key object, taking the algorithm preferences of the passed public keys into account. - * @param {Key|Array} publicKeys array of public keys or single key used to select algorithm preferences for - * @param {Date} date (optional) date to select algorithm preferences at - * @param {Array} toUserIds (optional) user IDs to select algorithm preferences for - * @param {Object} config (optional) custom configuration settings to overwrite those in openpgp.config + * @param {Object} options + * @param {Key|Array} options.publicKeys - array of public keys or single key used to select algorithm preferences for + * @param {Date} [options.date=current date] - date to select algorithm preferences at + * @param {Array} [options.toUserIds=primary user IDs] - user IDs to select algorithm preferences for + * @param {Object} [options.config] - custom configuration settings to overwrite those in [config]{@link module:config} * @returns {Promise<{ data: Uint8Array, algorithm: String }>} object with session key data and algorithm * @async * @static @@ -444,17 +454,18 @@ export function generateSessionKey({ publicKeys, date = new Date(), toUserIds = /** * Encrypt a symmetric session key with public keys, passwords, or both at once. At least either public keys * or passwords must be specified. - * @param {Uint8Array} data the session key to be encrypted e.g. 16 random bytes (for aes128) - * @param {String} algorithm algorithm of the symmetric session key e.g. 'aes128' or 'aes256' - * @param {String} aeadAlgorithm (optional) aead algorithm, e.g. 'eax' or 'ocb' - * @param {Key|Array} publicKeys (optional) array of public keys or single key, used to encrypt the key - * @param {String|Array} passwords (optional) passwords for the message - * @param {Boolean} armor (optional) whether the return values should be ascii armored (true, the default) or binary (false) - * @param {Boolean} wildcard (optional) use a key ID of 0 instead of the public key IDs - * @param {Array} encryptionKeyIds (optional) array of key IDs to use for encryption. Each encryptionKeyIds[i] corresponds to publicKeys[i] - * @param {Date} date (optional) override the date - * @param {Array} toUserIds (optional) array of user IDs to encrypt for, one per key in `publicKeys`, e.g. [{ name:'Phil Zimmermann', email:'phil@openpgp.org' }] - * @param {Object} config (optional) custom configuration settings to overwrite those in openpgp.config + * @param {Object} options + * @param {Uint8Array} options.data - the session key to be encrypted e.g. 16 random bytes (for aes128) + * @param {String} options.algorithm - algorithm of the symmetric session key e.g. 'aes128' or 'aes256' + * @param {String} [options.aeadAlgorithm] - aead algorithm, e.g. 'eax' or 'ocb' + * @param {Key|Array} [options.publicKeys] - array of public keys or single key, used to encrypt the key + * @param {String|Array} [options.passwords] - passwords for the message + * @param {Boolean} [options.armor=true] - whether the return values should be ascii armored (true, the default) or binary (false) + * @param {Boolean} [options.wildcard] - use a key ID of 0 instead of the public key IDs + * @param {Array} [options.encryptionKeyIds=latest-created valid encryption (sub)keys] - array of key IDs to use for encryption. Each encryptionKeyIds[i] corresponds to publicKeys[i] + * @param {Date} [options.date=current date] - override the date + * @param {Array} [options.toUserIds=primary user IDs] - array of user IDs to encrypt for, one per key in `publicKeys`, e.g. [{ name:'Phil Zimmermann', email:'phil@openpgp.org' }] + * @param {Object} [options.config] - custom configuration settings to overwrite those in [config]{@link module:config} * @returns {Promise} (String if `armor` was true, the default; Uint8Array if `armor` was false) * @async * @static @@ -474,10 +485,11 @@ export function encryptSessionKey({ data, algorithm, aeadAlgorithm, publicKeys, /** * Decrypt symmetric session keys with a private key or password. Either a private key or * a password must be specified. - * @param {Message} message a message object containing the encrypted session key packets - * @param {Key|Array} privateKeys (optional) private keys with decrypted secret key data - * @param {String|Array} passwords (optional) passwords to decrypt the session key - * @param {Object} config (optional) custom configuration settings to overwrite those in openpgp.config + * @param {Object} options + * @param {Message} options.message - a message object containing the encrypted session key packets + * @param {Key|Array} [options.privateKeys] - private keys with decrypted secret key data + * @param {String|Array} [options.passwords] - passwords to decrypt the session key + * @param {Object} [options.config] - custom configuration settings to overwrite those in [config]{@link module:config} * @returns {Promise} Array of decrypted session key, algorithm pairs in form: * { data:Uint8Array, algorithm:String } * or 'undefined' if no key packets found @@ -544,8 +556,8 @@ function toArray(param) { /** * Convert data to or from Stream * @param {Object} data the data to convert - * @param {'web'|'ponyfill'|'node'|false} streaming (optional) whether to return a ReadableStream, and of what type - * @param {'utf8'|'binary'} encoding (optional) how to return data in Node Readable streams + * @param {'web'|'ponyfill'|'node'|false} [options.streaming] - whether to return a ReadableStream, and of what type + * @param {'utf8'|'binary'} [options.encoding] - how to return data in Node Readable streams * @returns {Object} the data in the respective format * @private */ diff --git a/src/packet/aead_encrypted_data.js b/src/packet/aead_encrypted_data.js index 4045f4f6..401b5e19 100644 --- a/src/packet/aead_encrypted_data.js +++ b/src/packet/aead_encrypted_data.js @@ -97,7 +97,7 @@ class AEADEncryptedDataPacket { * @param {String} sessionKeyAlgorithm The session key's cipher algorithm e.g. 'aes128' * @param {Uint8Array} key The session key used to encrypt the payload * @param {Boolean} streaming Whether the top-level function will return a stream - * @param {Object} config (optional) full configuration, defaults to openpgp.config + * @param {Object} [config] - full configuration, defaults to openpgp.config * @throws {Error} if encryption was not successful * @async */ diff --git a/src/packet/public_key.js b/src/packet/public_key.js index 5ad5170a..aa01e7a6 100644 --- a/src/packet/public_key.js +++ b/src/packet/public_key.js @@ -38,8 +38,8 @@ import util from '../util'; */ class PublicKeyPacket { /** - * @param {Date} date (optional) creation date - * @param {Object} config (optional) full configuration, defaults to openpgp.config + * @param {Date} [date] - creation date + * @param {Object} [config] - full configuration, defaults to openpgp.config */ constructor(date = new Date(), config = defaultConfig) { /** diff --git a/src/packet/public_subkey.js b/src/packet/public_subkey.js index a7eae1a9..36fd7383 100644 --- a/src/packet/public_subkey.js +++ b/src/packet/public_subkey.js @@ -28,8 +28,8 @@ import enums from '../enums'; */ class PublicSubkeyPacket extends PublicKeyPacket { /** - * @param {Date} date (optional) creation date - * @param {Object} config (optional) full configuration, defaults to openpgp.config + * @param {Date} [date] - creation date + * @param {Object} [config] - full configuration, defaults to openpgp.config */ constructor(date, config) { super(date, config); diff --git a/src/packet/secret_key.js b/src/packet/secret_key.js index 3c507412..c5c808a6 100644 --- a/src/packet/secret_key.js +++ b/src/packet/secret_key.js @@ -30,8 +30,8 @@ import defaultConfig from '../config'; */ class SecretKeyPacket extends PublicKeyPacket { /** - * @param {Date} date (optional) creation date - * @param {Object} config (optional) full configuration, defaults to openpgp.config + * @param {Date} [date] - creation date + * @param {Object} [config] - full configuration, defaults to openpgp.config */ constructor(date = new Date(), config = defaultConfig) { super(date, config); @@ -242,7 +242,7 @@ class SecretKeyPacket extends PublicKeyPacket { /** * Remove private key material, converting the key to a dummy one. * The resulting key cannot be used for signing/decrypting but can still verify signatures. - * @param {Object} config (optional) full configuration, defaults to openpgp.config + * @param {Object} [config] - full configuration, defaults to openpgp.config */ makeDummy(config = defaultConfig) { if (this.isDummy()) { @@ -267,7 +267,7 @@ class SecretKeyPacket extends PublicKeyPacket { * 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(). * @param {String} passphrase - * @param {Object} config (optional) full configuration, defaults to openpgp.config + * @param {Object} [config] - full configuration, defaults to openpgp.config * @throws {Error} if encryption was not successful * @async */ diff --git a/src/packet/secret_subkey.js b/src/packet/secret_subkey.js index c524258a..fdfe951f 100644 --- a/src/packet/secret_subkey.js +++ b/src/packet/secret_subkey.js @@ -26,8 +26,8 @@ import defaultConfig from '../config'; */ class SecretSubkeyPacket extends SecretKeyPacket { /** - * @param {Date} date (optional) creation date - * @param {Object} config (optional) full configuration, defaults to openpgp.config + * @param {Date} [date] - creation date + * @param {Object} [config] - full configuration, defaults to openpgp.config */ constructor(date = new Date(), config = defaultConfig) { super(date, config); diff --git a/src/packet/signature.js b/src/packet/signature.js index 563fb926..1d4e9ea6 100644 --- a/src/packet/signature.js +++ b/src/packet/signature.js @@ -89,7 +89,7 @@ class SignaturePacket { /** * parsing function for a signature packet (tag 2). * @param {String} bytes payload of a tag 2 packet - * @param {Object} config (optional) full configuration, defaults to openpgp.config + * @param {Object} [config] - full configuration, defaults to openpgp.config * @returns {SignaturePacket} object representation */ read(bytes, config = defaultConfig) { diff --git a/src/packet/sym_encrypted_integrity_protected_data.js b/src/packet/sym_encrypted_integrity_protected_data.js index e22ae8b3..a9e6321a 100644 --- a/src/packet/sym_encrypted_integrity_protected_data.js +++ b/src/packet/sym_encrypted_integrity_protected_data.js @@ -79,7 +79,7 @@ class SymEncryptedIntegrityProtectedDataPacket { * @param {String} sessionKeyAlgorithm The selected symmetric encryption algorithm to be used e.g. 'aes128' * @param {Uint8Array} key The key of cipher blocksize length to be used * @param {Boolean} streaming Whether to set this.encrypted to a stream - * @param {Object} config (optional) full configuration, defaults to openpgp.config + * @param {Object} [config] - full configuration, defaults to openpgp.config * @returns {Promise} * @async */ @@ -102,7 +102,7 @@ class SymEncryptedIntegrityProtectedDataPacket { * @param {String} sessionKeyAlgorithm The selected symmetric encryption algorithm to be used e.g. 'aes128' * @param {Uint8Array} key The key of cipher blocksize length to be used * @param {Boolean} streaming Whether to read this.encrypted as a stream - * @param {Object} config (optional) full configuration, defaults to openpgp.config + * @param {Object} [config] - full configuration, defaults to openpgp.config * @returns {Promise} * @async */ diff --git a/src/signature.js b/src/signature.js index cc489747..f3f986d6 100644 --- a/src/signature.js +++ b/src/signature.js @@ -53,7 +53,7 @@ export class Signature { * reads an (optionally armored) OpenPGP signature and returns a signature object * @param {String | ReadableStream} armoredSignature armored signature to be parsed * @param {Uint8Array | ReadableStream} binarySignature binary signature to be parsed - * @param {Object} config (optional) custom configuration settings to overwrite those in openpgp.config + * @param {Object} config (optional) custom configuration settings to overwrite those in [config]{@link module:config} * @returns {Signature} new signature object * @async * @static