Fix minor JSDoc and style issues (#1156)
This commit is contained in:
parent
a620fc0276
commit
400ae63c5e
|
@ -56,11 +56,11 @@ export function constructParams(types, data) {
|
|||
* Encrypts data using specified algorithm and public key parameters.
|
||||
* See {@link https://tools.ietf.org/html/rfc4880#section-9.1|RFC 4880 9.1} for public key algorithms.
|
||||
* @param {module:enums.publicKey} algo Public key algorithm
|
||||
* @param {Object} pubParams Algorithm-specific public key parameters
|
||||
* @param {Object} publicParams Algorithm-specific public key parameters
|
||||
* @param {Uint8Array} data Data to be encrypted
|
||||
* @param {Uint8Array} fingerprint Recipient fingerprint
|
||||
* @returns {Array<module:type/mpi|
|
||||
* module:type/ecdh_symkey>} encrypted session key parameters
|
||||
* module:type/ecdh_symkey>} Encrypted session key parameters
|
||||
* @async
|
||||
*/
|
||||
export async function publicKeyEncrypt(algo, publicParams, data, fingerprint) {
|
||||
|
@ -95,10 +95,9 @@ export async function publicKeyEncrypt(algo, publicParams, data, fingerprint) {
|
|||
* @param {Object} publicKeyParams Algorithm-specific public key parameters
|
||||
* @param {Object} privateKeyParams Algorithm-specific private key parameters
|
||||
* @param {Array<module:type/mpi|
|
||||
module:type/ecdh_symkey>}
|
||||
data_params encrypted session key parameters
|
||||
module:type/ecdh_symkey>} data_params Encrypted session key parameters
|
||||
* @param {Uint8Array} fingerprint Recipient fingerprint
|
||||
* @returns {Uint8Array} decrypted data
|
||||
* @returns {Uint8Array} Decrypted data
|
||||
* @async
|
||||
*/
|
||||
export async function publicKeyDecrypt(algo, publicKeyParams, privateKeyParams, data_params, fingerprint) {
|
||||
|
@ -134,8 +133,7 @@ export async function publicKeyDecrypt(algo, publicKeyParams, privateKeyParams,
|
|||
* Parse public key material in binary form to get the key parameters
|
||||
* @param {module:enums.publicKey} algo The key algorithm
|
||||
* @param {Uint8Array} bytes The key material to parse
|
||||
* @returns {Object} key parameters referenced by name
|
||||
* @returns { read: Number, publicParams: Object } number of read bytes plus key parameters referenced by name
|
||||
* @returns {{ read: Number, publicParams: Object }} Number of read bytes plus key parameters referenced by name
|
||||
*/
|
||||
export function parsePublicKeyParams(algo, bytes) {
|
||||
let read = 0;
|
||||
|
@ -143,7 +141,6 @@ export function parsePublicKeyParams(algo, bytes) {
|
|||
case enums.publicKey.rsaEncrypt:
|
||||
case enums.publicKey.rsaEncryptSign:
|
||||
case enums.publicKey.rsaSign: {
|
||||
let read = 0;
|
||||
const n = util.readMPI(bytes.subarray(read)); read += n.length + 2;
|
||||
const e = util.readMPI(bytes.subarray(read)); read += e.length + 2;
|
||||
return { read, publicParams: { n, e } };
|
||||
|
@ -188,7 +185,7 @@ export function parsePublicKeyParams(algo, bytes) {
|
|||
* @param {module:enums.publicKey} algo The key algorithm
|
||||
* @param {Uint8Array} bytes The key material to parse
|
||||
* @param {Object} publicParams (ECC only) public params, needed to format some private params
|
||||
* @returns { read: Number, privateParams: Object } number of read bytes plus the key parameters referenced by name
|
||||
* @returns {{ read: Number, privateParams: Object }} Number of read bytes plus the key parameters referenced by name
|
||||
*/
|
||||
export function parsePrivateKeyParams(algo, bytes, publicParams) {
|
||||
let read = 0;
|
||||
|
@ -270,7 +267,7 @@ export function serializeKeyParams(algo, params) {
|
|||
* @param {module:enums.publicKey} algo The public key algorithm
|
||||
* @param {Integer} bits Bit length for RSA keys
|
||||
* @param {module:type/oid} oid Object identifier for ECC keys
|
||||
* @returns { publicParams, privateParams: {Object} } The parameters referenced by name
|
||||
* @returns {{ publicParams: {Object}, privateParams: {Object} }} The parameters referenced by name
|
||||
* @async
|
||||
*/
|
||||
export function generateParams(algo, bits, oid) {
|
||||
|
@ -315,7 +312,7 @@ export function generateParams(algo, bits, oid) {
|
|||
* @param {module:enums.publicKey} algo The public key algorithm
|
||||
* @param {Object} publicParams Algorithm-specific public key parameters
|
||||
* @param {Object} privateParams Algorithm-specific private key parameters
|
||||
* @returns {Promise<Boolean>} whether the parameters are valid
|
||||
* @returns {Promise<Boolean>} Whether the parameters are valid
|
||||
* @async
|
||||
*/
|
||||
export async function validateParams(algo, publicParams, privateParams) {
|
||||
|
|
|
@ -2017,7 +2017,7 @@ zUdJ3Sg6Eu+OC2ae5II63iB5fG+lCwZtfuepWnePDv8RDKNHCVP/LoBNpGOZ
|
|||
U9I6AUkZWdcsueib9ghKDDy+HbUbf2kCJWUnuyeOCKqQifDb8bsLmdQY4Wb6
|
||||
EBeLgD8oZHVsH3NLjPakPw==
|
||||
=STqy
|
||||
-----END PGP MESSAGE-----`
|
||||
-----END PGP MESSAGE-----`;
|
||||
|
||||
function versionSpecificTests() {
|
||||
it('Preferences of generated key', function() {
|
||||
|
@ -2584,7 +2584,6 @@ function versionSpecificTests() {
|
|||
}
|
||||
|
||||
module.exports = () => describe('Key', function() {
|
||||
let rsaGenStub;
|
||||
let v5KeysVal;
|
||||
let aeadProtectVal;
|
||||
|
||||
|
@ -2614,7 +2613,6 @@ module.exports = () => describe('Key', function() {
|
|||
});
|
||||
|
||||
it('Parsing armored text with RSA key and ECC subkey', async function() {
|
||||
openpgp.config.tolerant = true;
|
||||
const pubKeys = await openpgp.readArmoredKeys(rsa_ecc_pub);
|
||||
expect(pubKeys).to.exist;
|
||||
expect(pubKeys).to.have.length(1);
|
||||
|
|
|
@ -173,7 +173,7 @@ module.exports = () => (openpgp.config.ci ? describe.skip : describe)('X25519 Cr
|
|||
const signed = await openpgp.sign({ privateKeys: [priv], message: openpgp.CleartextMessage.fromText(randomData)});
|
||||
const pub = await load_pub_key(name);
|
||||
const msg = await openpgp.readArmoredCleartextMessage(signed);
|
||||
const result = await openpgp.verify({ publicKeys: [pub], message: msg});
|
||||
const result = await openpgp.verify({ publicKeys: [pub], message: msg });
|
||||
|
||||
expect(result).to.exist;
|
||||
expect(result.data).to.equal(randomData.replace(/[ \t]+$/mg, ''));
|
||||
|
@ -392,7 +392,6 @@ module.exports = () => (openpgp.config.ci ? describe.skip : describe)('X25519 Cr
|
|||
].join('\n');
|
||||
const hi = await openpgp.readArmoredKey(pubKey);
|
||||
const results = await hi.getPrimaryUser();
|
||||
// console.log(results);
|
||||
expect(results).to.exist;
|
||||
expect(results.user).to.exist;
|
||||
const user = results.user;
|
||||
|
|
Loading…
Reference in New Issue
Block a user