Add openpgp4fpr to keyData object

This commit is contained in:
Yarmo Mackenbach 2021-10-17 09:08:56 +02:00
parent a5040cb223
commit 29ccb63bf1
No known key found for this signature in database
GPG key ID: 37367F4AF4087AD1
2 changed files with 7 additions and 0 deletions

View file

@ -42,6 +42,9 @@ const apiProfileSchema = {
fingerprint: {
type: "string"
},
openpgp4fpr: {
type: "string"
},
users: {
type: "array",
items: {

View file

@ -35,6 +35,7 @@ const generateWKDProfile = async (id) => {
return keys.fetchWKD(id)
.then(async key => {
let keyData = await doip.keys.process(key.publicKey)
keyData.openpgp4fpr = `openpgp4fpr:${keyData.fingerprint.toLowerCase()}`
keyData.key.fetchMethod = 'wkd'
keyData.key.uri = key.fetchURL
keyData.key.data = {}
@ -61,6 +62,7 @@ const generateHKPProfile = async (id, keyserverDomain) => {
return keys.fetchHKP(id, keyserverDomain)
.then(async key => {
let keyData = await doip.keys.process(key.publicKey)
keyData.openpgp4fpr = `openpgp4fpr:${keyData.fingerprint.toLowerCase()}`
keyData.key.fetchMethod = 'hkp'
keyData.key.uri = key.fetchURL
keyData.key.data = {}
@ -87,6 +89,7 @@ const generateSignatureProfile = async (signature) => {
return keys.fetchSignature(signature)
.then(async key => {
let keyData = key.keyData
keyData.openpgp4fpr = `openpgp4fpr:${keyData.fingerprint.toLowerCase()}`
delete key.keyData
keyData.key.data = {}
keyData = processKeyData(keyData)
@ -112,6 +115,7 @@ const generateKeybaseProfile = async (username, fingerprint) => {
return keys.fetchKeybase(id, keyserverDomain)
.then(async key => {
let keyData = await doip.keys.process(key.publicKey)
keyData.openpgp4fpr = `openpgp4fpr:${keyData.fingerprint.toLowerCase()}`
keyData.key.fetchMethod = 'hkp'
keyData.key.uri = key.fetchURL
keyData.key.data = {}