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 data = await generateSignatureProfile(req.body.signature)
const title = utils.generatePageTitle('profile', data) const title = utils.generatePageTitle('profile', data)
res.set('ariadne-identity-proof', data.keyData.openpgp4fpr) 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) => { router.get('/wkd/:id', async (req, res) => {
const data = await generateWKDProfile(req.params.id) const data = await generateWKDProfile(req.params.id)
const title = utils.generatePageTitle('profile', data) const title = utils.generatePageTitle('profile', data)
res.set('ariadne-identity-proof', data.keyData.openpgp4fpr) 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) => { router.get('/hkp/:id', async (req, res) => {
const data = await generateHKPProfile(req.params.id) const data = await generateHKPProfile(req.params.id)
const title = utils.generatePageTitle('profile', data) const title = utils.generatePageTitle('profile', data)
res.set('ariadne-identity-proof', data.keyData.openpgp4fpr) 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) => { router.get('/hkp/:server/:id', async (req, res) => {
const data = await generateHKPProfile(req.params.id, req.params.server) const data = await generateHKPProfile(req.params.id, req.params.server)
const title = utils.generatePageTitle('profile', data) const title = utils.generatePageTitle('profile', data)
res.set('ariadne-identity-proof', data.keyData.openpgp4fpr) 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) => { router.get('/keybase/:username/:fingerprint', async (req, res) => {
const data = await generateKeybaseProfile(req.params.username, req.params.fingerprint) const data = await generateKeybaseProfile(req.params.username, req.params.fingerprint)
const title = utils.generatePageTitle('profile', data) const title = utils.generatePageTitle('profile', data)
res.set('ariadne-identity-proof', data.keyData.openpgp4fpr) 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) => { router.get('/:id', async (req, res) => {
const data = await generateAutoProfile(req.params.id) const data = await generateAutoProfile(req.params.id)
const title = utils.generatePageTitle('profile', data) const title = utils.generatePageTitle('profile', data)
res.set('ariadne-identity-proof', data.keyData.openpgp4fpr) 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 export default router

View file

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