mirror of
https://codeberg.org/keyoxide/doipjs.git
synced 2024-12-22 22:49:28 -07:00
Run prettier
This commit is contained in:
parent
9db48d627d
commit
6c2aa92187
2 changed files with 10 additions and 7 deletions
|
@ -20,7 +20,8 @@ const keys = require('./keys')
|
|||
|
||||
const verify = (signature, opts) => {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
let errors = [], sigData
|
||||
let errors = [],
|
||||
sigData
|
||||
try {
|
||||
sigData = await openpgp.cleartext.readArmored(signature)
|
||||
} catch (error) {
|
||||
|
@ -44,7 +45,7 @@ const verify = (signature, opts) => {
|
|||
case 'proof':
|
||||
sigClaims.push(match[2])
|
||||
break
|
||||
|
||||
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
@ -54,10 +55,10 @@ const verify = (signature, opts) => {
|
|||
errors.push('no_linked_keys')
|
||||
reject({ errors: errors })
|
||||
}
|
||||
|
||||
|
||||
const keyData = await keys.fetch.uri(sigKeys[0])
|
||||
const fingerprint = keyData.keyPacket.getFingerprint()
|
||||
|
||||
|
||||
try {
|
||||
const sigVerification = await sigData.verify([keyData])
|
||||
await sigVerification[0].verified
|
||||
|
@ -72,9 +73,9 @@ const verify = (signature, opts) => {
|
|||
errors: errors,
|
||||
publicKey: keyData,
|
||||
fingerprint: fingerprint,
|
||||
claims: claimVerifications
|
||||
claims: claimVerifications,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
exports.verify = verify
|
||||
exports.verify = verify
|
||||
|
|
|
@ -49,7 +49,9 @@ describe('signatures.verify', () => {
|
|||
it('should verify the demonstration signature', async () => {
|
||||
const verification = await doipjs.signatures.verify(sigProfile)
|
||||
expect(verification.errors).to.be.length(0)
|
||||
expect(verification.fingerprint).to.be.equal('3637202523e7c1309ab79e99ef2dc5827b445f4b')
|
||||
expect(verification.fingerprint).to.be.equal(
|
||||
'3637202523e7c1309ab79e99ef2dc5827b445f4b'
|
||||
)
|
||||
expect(verification.claims).to.be.length(1)
|
||||
expect(verification.claims[0].isVerified).to.be.true
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue