Support more query types

- long
- short
- 0xlong
- 0xshort
- fingerprint

Signed-off-by: Georg Pfuetzenreuter <georg.pfuetzenreuter@suse.com>
This commit is contained in:
Georg Pfuetzenreuter 2022-07-05 14:21:24 +02:00
parent cd62e63cc2
commit 53aa292b7e
No known key found for this signature in database
GPG Key ID: 1ED2F138E7E6FF57
3 changed files with 7 additions and 3 deletions

View File

@ -97,7 +97,7 @@ class HKP {
if (!util.isString(id)) {
return false;
}
return /^0x[a-fA-F0-9]{16,40}$/.test(id);
return /^(?:0x)?[a-fA-F0-9]{8,40}$/.test(id);
}
/**

View File

@ -261,8 +261,12 @@ class PublicKey {
}
// query by key id (to prevent key id collision)
if (keyId) {
keyId = keyId.toLowerCase();
if (keyId.length === 8) {
keyId = new RegExp('[a-fA-F0-9]{8}' + keyId);
}
queries.push({
keyId: keyId.toLowerCase(),
keyId: keyId,
'userIds.verified': true
});
}

View File

@ -50,7 +50,7 @@ exports.isKeyId = function(data) {
if (!this.isString(data)) {
return false;
}
return /^[a-fA-F0-9]{16}$/.test(data);
return /^[a-fA-F0-9]{8,16}$/.test(data);
};
/**