diff --git a/src/api/v0/index.js b/src/api/v0/index.js index b43dbeb..32c7764 100644 --- a/src/api/v0/index.js +++ b/src/api/v0/index.js @@ -327,7 +327,7 @@ router.get('/profile/fetch', } if (data.errors.length > 0) { - delete data.key + data.key = undefined res.status(500).send(data) } @@ -335,7 +335,7 @@ router.get('/profile/fetch', if (req.query.returnPublicKey) { data.keyData.key.data = data.key.publicKey } - delete data.key + data.key = undefined // Do verification if (req.query.doVerification) { diff --git a/src/api/v2/keyoxide_profile.js b/src/api/v2/keyoxide_profile.js index cf6c08b..f13a7c2 100644 --- a/src/api/v2/keyoxide_profile.js +++ b/src/api/v2/keyoxide_profile.js @@ -298,7 +298,7 @@ router.get('/fetch', } if (data.errors.length > 0) { - delete data.key + data.key = undefined res.status(500).send(data) } @@ -306,7 +306,7 @@ router.get('/fetch', if (req.query.returnPublicKey) { data.keyData.key.data = data.key.publicKey } - delete data.key + data.key = undefined // Do verification if (req.query.doVerification) { diff --git a/src/api/v2/proxy_get.js b/src/api/v2/proxy_get.js index e31e992..5cacfa6 100644 --- a/src/api/v2/proxy_get.js +++ b/src/api/v2/proxy_get.js @@ -118,9 +118,7 @@ router.get( query('id').isEmail(), async (req, res) => { if ( - !opts.claims.xmpp.service || - !opts.claims.xmpp.username || - !opts.claims.xmpp.password + !((opts.claims.xmpp.service && opts.claims.xmpp.username) && opts.claims.xmpp.password) ) { return res.status(501).json({ errors: 'XMPP not enabled on server' }) } @@ -166,7 +164,7 @@ router.get( query('roomId').isString(), query('eventId').isString(), async (req, res) => { - if (!opts.claims.matrix.instance || !opts.claims.matrix.accessToken) { + if (!(opts.claims.matrix.instance && opts.claims.matrix.accessToken)) { return res.status(501).json({ errors: 'Matrix not enabled on server' }) } const errors = validationResult(req) diff --git a/src/server/index.js b/src/server/index.js index e247f99..b92240d 100644 --- a/src/server/index.js +++ b/src/server/index.js @@ -151,7 +151,7 @@ const generateSignatureProfile = async (signature) => { .then(async key => { let keyData = key.keyData keyData.openpgp4fpr = `openpgp4fpr:${keyData.fingerprint.toLowerCase()}` - delete key.keyData + key.keyData = undefined keyData.key.data = {} keyData = processKeyData(keyData) diff --git a/src/server/keys.js b/src/server/keys.js index 793e1b4..474efab 100644 --- a/src/server/keys.js +++ b/src/server/keys.js @@ -49,7 +49,7 @@ const fetchWKD = (id) => { } const [, localPart, domain] = /([^@]*)@(.*)/.exec(id) - if (!localPart || !domain) { + if (!(localPart && domain)) { reject(new Error(`The WKD identifier "${id}" is invalid`)) } const localEncoded = await computeWKDLocalPart(localPart)