forked from Mirrors/doipjs
Expose key revocation status
This commit is contained in:
parent
fa73b062fa
commit
4c9b96af1a
2 changed files with 41 additions and 1 deletions
|
@ -240,15 +240,20 @@ exports.process = (publicKey) => {
|
|||
email: user.userId ? user.userId.email : null,
|
||||
comment: user.userId ? user.userId.comment : null,
|
||||
isPrimary: primaryUser.index === i,
|
||||
isRevoked: false,
|
||||
},
|
||||
claims: [],
|
||||
}
|
||||
|
||||
if ('selfCertifications' in user && user.selfCertifications.length > 0) {
|
||||
const notations = user.selfCertifications[0].rawNotations
|
||||
const selfCertification = user.selfCertifications[0]
|
||||
|
||||
const notations = selfCertification.rawNotations
|
||||
usersOutput[i].claims = notations
|
||||
.filter(({ name, humanReadable }) => humanReadable && name === 'proof@metacode.biz')
|
||||
.map(({ value }) => new Claim(openpgp.util.decode_utf8(value)), fingerprint)
|
||||
|
||||
usersOutput[i].userData.isRevoked = selfCertification.revoked
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -62,6 +62,34 @@ Yn6RMQ8=
|
|||
=Oo3X
|
||||
-----END PGP PUBLIC KEY BLOCK-----`
|
||||
|
||||
const pubKeyWithRevokedUID = `-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
|
||||
mI0EYLitOQEEAMUKTmcNdy46gjcuz0oRsUyq0BythQGSrcLvLGAyZIzKR8NZXZSA
|
||||
UAIHuQkWVwqJjYPSRrTp8op8LZIHmhP3W3TgG5WHSOhcPeIYe1JTB0b7XceIIJ3p
|
||||
/FfT9xFhWgeAVfAHQUcK/p4+mhvQRfDDf5Jbh/i37cY3iF5huNyXZYY9ABEBAAG0
|
||||
F1lhcm1vJ3MgU3VwZXIgRXZpbCBUd2luiLYEMAEKACAWIQQKQsh7jbmy9ycMulRn
|
||||
U1zbmU0aJAUCYLiu7QIdIAAKCRBnU1zbmU0aJGr1A/9VMS9xexufTLHenWCquAsL
|
||||
cnzciPTvYy7h+OYAkXQEmzOcUcy9a71w5/ElEWubqySZuUUeB7Y8UHjowXOV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
kRIDpwkXa08iG0GXBV/ZEPGNzPbaMCZVqqiVlf9+BxX1rnG6ENseGKPn8Q+RIKUb
|
||||
Q+AZdYCbM0hdBjP4xdKZcpqak8ksb+aQFXjGacDL/XN4VrP+tBGxkqIqreoDcgIb
|
||||
7t1hISc09hWrGQ==
|
||||
=tVW7
|
||||
-----END PGP PUBLIC KEY BLOCK-----`
|
||||
|
||||
describe('keys.fetchURI', () => {
|
||||
it('should be a function (1 argument)', () => {
|
||||
|
@ -145,4 +173,11 @@ describe('keys.process', () => {
|
|||
expect(obj.users[0].claims).to.be.lengthOf(1)
|
||||
expect(obj.users[0].claims[0].uri).to.be.equal('dns:yarmo.eu?type=TXT')
|
||||
})
|
||||
it('should properly handle revoked UIDs', async () => {
|
||||
const pubKey = await doipjs.keys.fetchPlaintext(pubKeyWithRevokedUID)
|
||||
const obj = await doipjs.keys.process(pubKey)
|
||||
expect(obj.users).to.be.lengthOf(2)
|
||||
expect(obj.users[0].userData.isRevoked).to.be.true
|
||||
expect(obj.users[1].userData.isRevoked).to.be.false
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue