From fa73b062fa7830995244bed759ab7215c67c204c Mon Sep 17 00:00:00 2001 From: Yarmo Mackenbach Date: Thu, 3 Jun 2021 11:59:35 +0200 Subject: [PATCH] Fix previous commit --- src/keys.js | 13 ++----------- test/keys.test.js | 5 ++--- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/keys.js b/src/keys.js index b5a8f78..c4fc203 100644 --- a/src/keys.js +++ b/src/keys.js @@ -246,18 +246,9 @@ exports.process = (publicKey) => { if ('selfCertifications' in user && user.selfCertifications.length > 0) { const notations = user.selfCertifications[0].rawNotations - usersOutput[i].notations = notations + usersOutput[i].claims = notations .filter(({ name, humanReadable }) => humanReadable && name === 'proof@metacode.biz') - .map(({ value }) => openpgp.util.decode_utf8(value)) - - 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) - } - } - ) + .map(({ value }) => new Claim(openpgp.util.decode_utf8(value)), fingerprint) } }) diff --git a/test/keys.test.js b/test/keys.test.js index 786a994..06f7e33 100644 --- a/test/keys.test.js +++ b/test/keys.test.js @@ -141,9 +141,8 @@ describe('keys.process', () => { it('should ignore non-proof notations', async () => { const pubKey = await doipjs.keys.fetchPlaintext(pubKeyWithOtherNotations) const obj = await doipjs.keys.process(pubKey) - console.log(obj.users[0]); expect(obj.users).to.be.lengthOf(1) - expect(obj.users[0].notations).to.be.lengthOf(1) - expect(obj.users[0].notations[0]).to.be.equal('dns:yarmo.eu?type=TXT') + expect(obj.users[0].claims).to.be.lengthOf(1) + expect(obj.users[0].claims[0].uri).to.be.equal('dns:yarmo.eu?type=TXT') }) })