Add utils

This commit is contained in:
Yarmo Mackenbach 2020-10-25 00:31:14 +02:00
parent 94dcfcca52
commit 1f29accb5f

17
src/utils.js Normal file
View file

@ -0,0 +1,17 @@
const generateClaim = (spData) => {
switch (spData.claim.format) {
case 'uri':
return `openpgp4fpr:${spData.claim.fingerprint}`
break;
case 'message':
return `[Verifying my OpenPGP key: openpgp4fpr:${spData.claim.fingerprint}]`
break;
case 'fingerprint':
return pData.claim.fingerprint
break;
default:
throw new Error('No valid claim format')
}
}
exports.generateClaim = generateClaim