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.
|
* 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.
|
* 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 {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} data Data to be encrypted
|
||||||
* @param {Uint8Array} fingerprint Recipient fingerprint
|
* @param {Uint8Array} fingerprint Recipient fingerprint
|
||||||
* @returns {Array<module:type/mpi|
|
* @returns {Array<module:type/mpi|
|
||||||
* module:type/ecdh_symkey>} encrypted session key parameters
|
* module:type/ecdh_symkey>} Encrypted session key parameters
|
||||||
* @async
|
* @async
|
||||||
*/
|
*/
|
||||||
export async function publicKeyEncrypt(algo, publicParams, data, fingerprint) {
|
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} publicKeyParams Algorithm-specific public key parameters
|
||||||
* @param {Object} privateKeyParams Algorithm-specific private key parameters
|
* @param {Object} privateKeyParams Algorithm-specific private key parameters
|
||||||
* @param {Array<module:type/mpi|
|
* @param {Array<module:type/mpi|
|
||||||
module:type/ecdh_symkey>}
|
module:type/ecdh_symkey>} data_params Encrypted session key parameters
|
||||||
data_params encrypted session key parameters
|
|
||||||
* @param {Uint8Array} fingerprint Recipient fingerprint
|
* @param {Uint8Array} fingerprint Recipient fingerprint
|
||||||
* @returns {Uint8Array} decrypted data
|
* @returns {Uint8Array} Decrypted data
|
||||||
* @async
|
* @async
|
||||||
*/
|
*/
|
||||||
export async function publicKeyDecrypt(algo, publicKeyParams, privateKeyParams, data_params, fingerprint) {
|
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
|
* Parse public key material in binary form to get the key parameters
|
||||||
* @param {module:enums.publicKey} algo The key algorithm
|
* @param {module:enums.publicKey} algo The key algorithm
|
||||||
* @param {Uint8Array} bytes The key material to parse
|
* @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) {
|
export function parsePublicKeyParams(algo, bytes) {
|
||||||
let read = 0;
|
let read = 0;
|
||||||
|
@ -143,7 +141,6 @@ export function parsePublicKeyParams(algo, bytes) {
|
||||||
case enums.publicKey.rsaEncrypt:
|
case enums.publicKey.rsaEncrypt:
|
||||||
case enums.publicKey.rsaEncryptSign:
|
case enums.publicKey.rsaEncryptSign:
|
||||||
case enums.publicKey.rsaSign: {
|
case enums.publicKey.rsaSign: {
|
||||||
let read = 0;
|
|
||||||
const n = util.readMPI(bytes.subarray(read)); read += n.length + 2;
|
const n = util.readMPI(bytes.subarray(read)); read += n.length + 2;
|
||||||
const e = util.readMPI(bytes.subarray(read)); read += e.length + 2;
|
const e = util.readMPI(bytes.subarray(read)); read += e.length + 2;
|
||||||
return { read, publicParams: { n, e } };
|
return { read, publicParams: { n, e } };
|
||||||
|
@ -188,7 +185,7 @@ export function parsePublicKeyParams(algo, bytes) {
|
||||||
* @param {module:enums.publicKey} algo The key algorithm
|
* @param {module:enums.publicKey} algo The key algorithm
|
||||||
* @param {Uint8Array} bytes The key material to parse
|
* @param {Uint8Array} bytes The key material to parse
|
||||||
* @param {Object} publicParams (ECC only) public params, needed to format some private params
|
* @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) {
|
export function parsePrivateKeyParams(algo, bytes, publicParams) {
|
||||||
let read = 0;
|
let read = 0;
|
||||||
|
@ -270,7 +267,7 @@ export function serializeKeyParams(algo, params) {
|
||||||
* @param {module:enums.publicKey} algo The public key algorithm
|
* @param {module:enums.publicKey} algo The public key algorithm
|
||||||
* @param {Integer} bits Bit length for RSA keys
|
* @param {Integer} bits Bit length for RSA keys
|
||||||
* @param {module:type/oid} oid Object identifier for ECC 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
|
* @async
|
||||||
*/
|
*/
|
||||||
export function generateParams(algo, bits, oid) {
|
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 {module:enums.publicKey} algo The public key algorithm
|
||||||
* @param {Object} publicParams Algorithm-specific public key parameters
|
* @param {Object} publicParams Algorithm-specific public key parameters
|
||||||
* @param {Object} privateParams Algorithm-specific private 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
|
* @async
|
||||||
*/
|
*/
|
||||||
export async function validateParams(algo, publicParams, privateParams) {
|
export async function validateParams(algo, publicParams, privateParams) {
|
||||||
|
|
|
@ -2017,7 +2017,7 @@ zUdJ3Sg6Eu+OC2ae5II63iB5fG+lCwZtfuepWnePDv8RDKNHCVP/LoBNpGOZ
|
||||||
U9I6AUkZWdcsueib9ghKDDy+HbUbf2kCJWUnuyeOCKqQifDb8bsLmdQY4Wb6
|
U9I6AUkZWdcsueib9ghKDDy+HbUbf2kCJWUnuyeOCKqQifDb8bsLmdQY4Wb6
|
||||||
EBeLgD8oZHVsH3NLjPakPw==
|
EBeLgD8oZHVsH3NLjPakPw==
|
||||||
=STqy
|
=STqy
|
||||||
-----END PGP MESSAGE-----`
|
-----END PGP MESSAGE-----`;
|
||||||
|
|
||||||
function versionSpecificTests() {
|
function versionSpecificTests() {
|
||||||
it('Preferences of generated key', function() {
|
it('Preferences of generated key', function() {
|
||||||
|
@ -2584,7 +2584,6 @@ function versionSpecificTests() {
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = () => describe('Key', function() {
|
module.exports = () => describe('Key', function() {
|
||||||
let rsaGenStub;
|
|
||||||
let v5KeysVal;
|
let v5KeysVal;
|
||||||
let aeadProtectVal;
|
let aeadProtectVal;
|
||||||
|
|
||||||
|
@ -2614,7 +2613,6 @@ module.exports = () => describe('Key', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Parsing armored text with RSA key and ECC subkey', async 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);
|
const pubKeys = await openpgp.readArmoredKeys(rsa_ecc_pub);
|
||||||
expect(pubKeys).to.exist;
|
expect(pubKeys).to.exist;
|
||||||
expect(pubKeys).to.have.length(1);
|
expect(pubKeys).to.have.length(1);
|
||||||
|
|
|
@ -392,7 +392,6 @@ module.exports = () => (openpgp.config.ci ? describe.skip : describe)('X25519 Cr
|
||||||
].join('\n');
|
].join('\n');
|
||||||
const hi = await openpgp.readArmoredKey(pubKey);
|
const hi = await openpgp.readArmoredKey(pubKey);
|
||||||
const results = await hi.getPrimaryUser();
|
const results = await hi.getPrimaryUser();
|
||||||
// console.log(results);
|
|
||||||
expect(results).to.exist;
|
expect(results).to.exist;
|
||||||
expect(results.user).to.exist;
|
expect(results.user).to.exist;
|
||||||
const user = results.user;
|
const user = results.user;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user