feat: Make ENCRYPT and VERIFY buttons optional

For now, these functions will be hardcoded off until a decent opt-in solution is found.
This commit is contained in:
Yarmo Mackenbach 2023-03-01 18:20:45 +01:00
parent d5fb80cf2c
commit dfc28173a5
2 changed files with 71 additions and 33 deletions

View file

@ -42,42 +42,74 @@ router.post('/sig', bodyParser, async (req, res) => {
const data = await generateSignatureProfile(req.body.signature)
const title = utils.generatePageTitle('profile', data)
res.set('ariadne-identity-proof', data.keyData.openpgp4fpr)
res.render('profile', { title, data, isSignature: true, signature: req.body.signature })
res.render('profile', {
title,
data,
isSignature: true,
signature: req.body.signature,
enable_message_encryption: false,
enable_signature_verification: false
})
})
router.get('/wkd/:id', async (req, res) => {
const data = await generateWKDProfile(req.params.id)
const title = utils.generatePageTitle('profile', data)
res.set('ariadne-identity-proof', data.keyData.openpgp4fpr)
res.render('profile', { title, data })
res.render('profile', {
title,
data,
enable_message_encryption: false,
enable_signature_verification: false
})
})
router.get('/hkp/:id', async (req, res) => {
const data = await generateHKPProfile(req.params.id)
const title = utils.generatePageTitle('profile', data)
res.set('ariadne-identity-proof', data.keyData.openpgp4fpr)
res.render('profile', { title, data })
res.render('profile', {
title,
data,
enable_message_encryption: false,
enable_signature_verification: false
})
})
router.get('/hkp/:server/:id', async (req, res) => {
const data = await generateHKPProfile(req.params.id, req.params.server)
const title = utils.generatePageTitle('profile', data)
res.set('ariadne-identity-proof', data.keyData.openpgp4fpr)
res.render('profile', { title, data })
res.render('profile', {
title,
data,
enable_message_encryption: false,
enable_signature_verification: false
})
})
router.get('/keybase/:username/:fingerprint', async (req, res) => {
const data = await generateKeybaseProfile(req.params.username, req.params.fingerprint)
const title = utils.generatePageTitle('profile', data)
res.set('ariadne-identity-proof', data.keyData.openpgp4fpr)
res.render('profile', { title, data })
res.render('profile', {
title,
data,
enable_message_encryption: false,
enable_signature_verification: false
})
})
router.get('/:id', async (req, res) => {
const data = await generateAutoProfile(req.params.id)
const title = utils.generatePageTitle('profile', data)
res.set('ariadne-identity-proof', data.keyData.openpgp4fpr)
res.render('profile', { title, data })
res.render('profile', {
title,
data,
enable_message_encryption: false,
enable_signature_verification: false
})
})
export default router

View file

@ -62,31 +62,33 @@ block content
noscript
p Keyoxide requires JavaScript to function.
dialog#dialog--encryptMessage
div
form(method='post')
label(for="encryptionInput") Message to encrypt
textarea#encryptionInput.input(name='message')
input.no-margin(type='submit' name='submit' value='ENCRYPT MESSAGE')
br
br
label(for="encryptionOutput") Encryption result
textarea#encryptionOutput.output(name='message' placeholder='Waiting for input' readonly)
form(method="dialog")
input(type="submit" value="Close")
if (enable_message_encryption)
dialog#dialog--encryptMessage
div
form(method='post')
label(for="encryptionInput") Message to encrypt
textarea#encryptionInput.input(name='message')
input.no-margin(type='submit' name='submit' value='ENCRYPT MESSAGE')
br
br
label(for="encryptionOutput") Encryption result
textarea#encryptionOutput.output(name='message' placeholder='Waiting for input' readonly)
form(method="dialog")
input(type="submit" value="Close")
dialog#dialog--verifySignature
div
form(method='post')
label(for="sigVerInput") Signature
textarea#sigVerInput.input(name='signature')
input.no-margin(type='submit' name='submit' value='VERIFY SIGNATURE')
br
br
label(for="sigVerOutput") Verification result
textarea#sigVerOutput.output(name='message' placeholder='Waiting for input' readonly)
form(method="dialog")
input(type="submit" value="Close")
if (enable_signature_verification)
dialog#dialog--verifySignature
div
form(method='post')
label(for="sigVerInput") Signature
textarea#sigVerInput.input(name='signature')
input.no-margin(type='submit' name='submit' value='VERIFY SIGNATURE')
br
br
label(for="sigVerOutput") Verification result
textarea#sigVerOutput.output(name='message' placeholder='Waiting for input' readonly)
form(method="dialog")
input(type="submit" value="Close")
dialog#dialog--qr
div
@ -109,9 +111,13 @@ block content
img#profileAvatar.u-logo(src=data.extra.avatarURL alt="avatar")
p#profileName.p-name= data.keyData.users[data.keyData.primaryUserIndex].userData.name
.button-wrapper
button(onClick="document.querySelector('#dialog--encryptMessage').showModal();") Encrypt message
button(onClick="document.querySelector('#dialog--verifySignature').showModal();") Verify signature
if (enable_message_encryption || enable_signature_verification)
.button-wrapper
if (enable_message_encryption)
button(onClick="document.querySelector('#dialog--encryptMessage').showModal();") Encrypt message
if (enable_signature_verification)
button(onClick="document.querySelector('#dialog--verifySignature').showModal();") Verify signature
#profileProofs.card.card--transparent
h2 Key