Fix previous commit

This commit is contained in:
Yarmo Mackenbach 2021-06-03 11:59:35 +02:00
parent cd7f3dfd8d
commit fa73b062fa
No known key found for this signature in database
GPG key ID: 37367F4AF4087AD1
2 changed files with 4 additions and 14 deletions

View file

@ -246,18 +246,9 @@ exports.process = (publicKey) => {
if ('selfCertifications' in user && user.selfCertifications.length > 0) { if ('selfCertifications' in user && user.selfCertifications.length > 0) {
const notations = user.selfCertifications[0].rawNotations const notations = user.selfCertifications[0].rawNotations
usersOutput[i].notations = notations usersOutput[i].claims = notations
.filter(({ name, humanReadable }) => humanReadable && name === 'proof@metacode.biz') .filter(({ name, humanReadable }) => humanReadable && name === 'proof@metacode.biz')
.map(({ value }) => openpgp.util.decode_utf8(value)) .map(({ value }) => new Claim(openpgp.util.decode_utf8(value)), fingerprint)
usersOutput[i].claims = notations.map(
({ name, value, humanReadable }) => {
if (humanReadable && name === 'proof@metacode.biz') {
const notation = openpgp.util.decode_utf8(value)
return new Claim(notation, fingerprint)
}
}
)
} }
}) })

View file

@ -141,9 +141,8 @@ describe('keys.process', () => {
it('should ignore non-proof notations', async () => { it('should ignore non-proof notations', async () => {
const pubKey = await doipjs.keys.fetchPlaintext(pubKeyWithOtherNotations) const pubKey = await doipjs.keys.fetchPlaintext(pubKeyWithOtherNotations)
const obj = await doipjs.keys.process(pubKey) const obj = await doipjs.keys.process(pubKey)
console.log(obj.users[0]);
expect(obj.users).to.be.lengthOf(1) expect(obj.users).to.be.lengthOf(1)
expect(obj.users[0].notations).to.be.lengthOf(1) expect(obj.users[0].claims).to.be.lengthOf(1)
expect(obj.users[0].notations[0]).to.be.equal('dns:yarmo.eu?type=TXT') expect(obj.users[0].claims[0].uri).to.be.equal('dns:yarmo.eu?type=TXT')
}) })
}) })