I try to read my public key with 6 notations from armored text by OpenPGP.js, but I got 4 notations and somehow it has same two notations each.
notations are:
gpg> showpref
[ultimate] (1). NyaightHazard (OpenPGP) <■■■■■■■■■■■■■■■■■■■■■>
Cipher: AES256, AES192, AES, 3DES
AEAD:
Digest: SHA512, SHA384, SHA256, SHA224, SHA1
Compression: ZLIB, BZIP2, ZIP, Uncompressed
Features: MDC, AEAD, Keyserver no-modify
Notations: proof@ariadne.id=https://log.nyaight.me/o/6f698e9b9b124f69b837a617982c0156
proof@ariadne.id=https://misskey.io/@Nyaight_Hazard
proof@ariadne.id=dns:links.nyaight.me?type=TXT
proof@ariadne.id=dns:nyaight.me?type=TXT
proof@ariadne.id=https://twitter.com/NyaightHazard/status/1816532354665787521
proof@ariadne.id=https://gist.github.com/NyaightHazard/0632dddca832ad7705049fe9d19d4dfa
I typed key=await openpgp.readKeys({armoredKeys: text})
command on browser console and result object contains [0]>users>[0]>selfCertifications: (4) [xs,xs,xs,xs]
and that's notations are:
[proof@ariadne.id:https://log.nyaight.me/o/6f698e9b9b124f69b837a617982c0156],
[proof@ariadne.id:https://log.nyaight.me/o/6f698e9b9b124f69b837a617982c0156],
[proof@ariadne.id:dns:nyaight.me?type=TXT],
[proof@ariadne.id:dns:nyaight.me?type=TXT]
Is this glitch of openpgp.js or I missed something?
PS: I tried on v5.11.2 and v6(beta) but results are same.
PPS: I tried on Node.js but still same.
I digged around the intetnet and find the answer.
const publicKey=await openpgp.readKey({ armoredKey:publicKeyArmored });
const td=new TextDecoder();
for(const {selfCertifications} of publicKey.users){
if(selfCertifications.length==0)continue;
const latestCert=selfCertifications.sort((a,b)=>
b.created.getTime()-a.created.getTime()
)[0];
if(latestCert.revoked)continue;
for(const {name,value} of latestCert.rawNotations){
console.log(`${name}=${td.decode(value)}`);
}
}