Use positive cert for self-signatures (#1769)

To uniform behaviour with other openpgp libs.
This commit is contained in:
larabr 2024-06-25 12:50:26 +02:00 committed by GitHub
parent 4026e24585
commit 7af16be62b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View File

@ -257,7 +257,7 @@ async function wrapKeyObject(secretKeyPacket, secretSubkeyPackets, options, conf
key: secretKeyPacket
};
const signatureProperties = secretKeyPacket.version !== 6 ? getKeySignatureProperties() : {};
signatureProperties.signatureType = enums.signature.certGeneric;
signatureProperties.signatureType = enums.signature.certPositive;
if (index === 0) {
signatureProperties.isPrimaryUserID = true;
}

View File

@ -35,6 +35,8 @@ export async function generateSecretKey(options, config) {
* Returns the valid and non-expired signature that has the latest creation date, while ignoring signatures created in the future.
* @param {Array<SignaturePacket>} signatures - List of signatures
* @param {PublicKeyPacket|PublicSubkeyPacket} publicKey - Public key packet to verify the signature
* @param {module:enums.signature} signatureType - Signature type to determine how to hash the data (NB: for userID signatures,
* `enums.signatures.certGeneric` should be given regardless of the actual trust level)
* @param {Date} date - Use the given date instead of the current time
* @param {Object} config - full configuration
* @returns {Promise<SignaturePacket>} The latest valid signature.