Add "Copy Key Id" entry to OpenPGP Key Manager context menu
Categories
(MailNews Core :: Security: OpenPGP, enhancement)
Tracking
(thunderbird_esr78 wontfix)
| Tracking | Status | |
|---|---|---|
| thunderbird_esr78 | --- | wontfix |
People
(Reporter: lasana, Assigned: lasana)
Details
Attachments
(1 file, 4 obsolete files)
|
12.12 KB,
patch
|
mkmelin
:
review+
|
Details | Diff | Splinter Review |
Sometimes, at least during testing, I need to copy the id of a key to use elsewhere. For example; to include in a test, a file name or when using gpg on the command line.
Including this option may also be convenient to more advanced users of openpgp.
Comment 1•5 years ago
|
||
poor workaround:
double click, select last 4x4 characters of fingerprint (which is the same as the key id)
| Assignee | ||
Comment 2•5 years ago
|
||
Simple patch, no test, tested manually.
As I understand it, the key manager is set to be redesigned once the details are worked out and this change may no longer be relevant. Still, I think it's a convenient feature to have in the meantime.
Updated•5 years ago
|
Comment 3•5 years ago
|
||
| Assignee | ||
Comment 4•5 years ago
|
||
That will have to be manually added somewhere in this function?
https://searchfox.org/comm-central/source/mail/extensions/am-e2e/am-e2e.js#672
Comment 5•5 years ago
|
||
Yes, specifically here: https://searchfox.org/comm-central/rev/93bfded213518bb71f465d6fa17baaafafb9a846/mail/extensions/am-e2e/am-e2e.js#945
This is where the menupopup is generated and all the menu items created.
Comment 6•5 years ago
|
||
Well for the e2ee page, it could be preferable to just make the key id selectable - so one can copy paste it like any normal text. I don't know why it's not selectable atm. I think we should add context menus to do things that can be done through other means (select+ctrl+c) - otherwise next we get overwhelmed by trivial context menus. Here, e.g. not clear the fingerprint wouldn't deserve the same treatment, as it's even more important.
Comment 7•5 years ago
|
||
The fingerprint is already selectable in the e2ee page. I guess we could add another row with the selectable key id.
Currently that's not selectable as it's used as the clickable label for the radio button, and we shouldn't change that.
The addition of a context menu item definitely makes sense for the Key Manager since we handle the selection and copying of multiple keys at once.
For the e2ee page, we could consider a simpler approach if you think we shouldn't add the context menu item also there.
I think we should to present the same amount of options in both locations, but I'm okay with postponing this to a follow up bug if you think otherwise.
Comment 8•5 years ago
|
||
Having it clickable shouldn't prevent the id from being selectable. Yes, let's only do the key manager at least for now.
Comment 9•5 years ago
|
||
| Assignee | ||
Updated•5 years ago
|
Comment 10•5 years ago
|
||
Can you update the commit message to add r=aleca at the end?
Comment 11•5 years ago
|
||
Updated•5 years ago
|
| Assignee | ||
Comment 12•5 years ago
|
||
Like this?
Comment 13•5 years ago
|
||
| Assignee | ||
Comment 14•5 years ago
|
||
You're in the OpenPGP key manager, so this will never be null
I saw this in another function not sure if it's to circumvent some kind of bug so I used it here too.
I don't think this can ever happen. If no key is selected, the menu item should be disabled (and seems to be). And in context menus we don't
show items that can't be used.
The way the context menu is configured right now, the entry is available even if no keys are selected. This could probably be improved in a follow up bug if desirable.
would \n be better?
Not sure. That may be kind of weird, pasting text that spans multiple lines I was thinking you may want to paste them in a bash script (as a list) or spreadsheet or something.
Finally, if you're adding copy key id, might as well add the fingerprint too.
Sure... Which display are your referring to? The e2ee page or something in this patch?
The copy public key doesn't seem to work for multiple keys. And I'm not sure it makes sense for it to do so either
I'm looking into that but got a little side tracked. Should I still try to fix it?
Comment 15•5 years ago
|
||
(In reply to Lasana Murray from comment #14)
You're in the OpenPGP key manager, so this will never be null
I saw this in another function not sure if it's to circumvent some kind of bug so I used it here too.
It's for when openpgp is disabled, but the you would not get the key manager either.
I don't think this can ever happen. If no key is selected, the menu item should be disabled (and seems to be). And in context menus we don't
show items that can't be used.The way the context menu is configured right now, the entry is available even if no keys are selected. This could probably be improved in a follow up bug if desirable.
I don't see that. How do you get a context menu without a context? As soon as I right click to get the context menu, I also get a selection.
would \n be better?
Not sure. That may be kind of weird, pasting text that spans multiple lines I was thinking you may want to paste them in a bash script (as a list) or spreadsheet or something.
Conceptually, what you would output is a list. Lists in plain text is a set of lines.
Finally, if you're adding copy key id, might as well add the fingerprint too.
Sure... Which display are your referring to? The e2ee page or something in this patch?
Only the context in the key manager you're touching yes.
The copy public key doesn't seem to work for multiple keys. And I'm not sure it makes sense for it to do so either
I'm looking into that but got a little side tracked. Should I still try to fix it?
I don't know about that, maybe it should always be for the one key only. I can't think of a case where you'd want to multi-select and copy paste all those public keys to the clipboard, though maybe such cases exist. Patrick, do you think that's something worth keeping (well, fixing, since it doesn't work)?
| Assignee | ||
Comment 16•5 years ago
|
||
I don't see that. How do you get a context menu without a context? As soon as I right click to get the context menu, I also get a selection.
Right click on an empty area of the tree view, then select the "Copy Public Keys..." operation. You will get an alert saying "You should select at least one key in order to perform the selected operation". An outline is around the first key but it does not look like it's actually selected.
| Assignee | ||
Comment 17•5 years ago
|
||
This seems to be using a <broadcaster> api to disable the copy operation in the dropdown menu.
https://developer.mozilla.org/en-US/docs/Archive/Mozilla/XUL/broadcaster
Reminds me a little of AngularJS. Do we still use this pattern? I'd prefer something more explicit.
Comment 18•5 years ago
|
||
(In reply to Magnus Melin [:mkmelin] from comment #15)
I don't know about that, maybe it should always be for the one key only. I can't think of a case where you'd want to multi-select and copy paste all those public keys to the clipboard, though maybe such cases exist. Patrick, do you think that's something worth keeping (well, fixing, since it doesn't work)?
There are use-cases when you want to be able to copy a public key. For example to upload a key to a keyserver (since TB currently only supports keys.openpgp.org, the only quick alternative is copy & paste). But I only see a valid case for a single key, not if multiple keys are selected.
| Assignee | ||
Comment 19•5 years ago
|
||
Made a few changes; removed enigmailSvc checks, disable the context menu entries when no keys are selected, changed the key ids to be prefixed with 0x, added an option to export fingerprints.
Comment 20•5 years ago
|
||
(In reply to Lasana Murray from comment #17)
This seems to be using a <broadcaster> api to disable the copy operation in the dropdown menu.
https://developer.mozilla.org/en-US/docs/Archive/Mozilla/XUL/broadcaster
Reminds me a little of AngularJS. Do we still use this pattern? I'd prefer something more explicit.
Broadcasters should not be used no. Removed the usage in bug 1489447, but yeah, looks like Enigmail brought some back.
Comment 21•5 years ago
|
||
Filed bug 1676727
Comment 22•5 years ago
|
||
| Assignee | ||
Comment 23•5 years ago
|
||
Renamed added functions, updated fluent id.
| Assignee | ||
Comment 24•5 years ago
•
|
||
It is, really async. backupSecretKeysInteractive e.g. is async, just not awaited
backupSecretKeysInteractive() is marked async but does not appear to await anything or return a Promise either, it's also using formatValueSync. I'll clean this up in another bug this patch already became more than I expected.
https://searchfox.org/comm-central/source/mail/extensions/openpgp/content/modules/keyRing.jsm#586
Comment 25•5 years ago
|
||
| Assignee | ||
Comment 26•5 years ago
|
||
Id -> ID
Comment 27•5 years ago
|
||
| Assignee | ||
Updated•5 years ago
|
Comment 28•5 years ago
|
||
Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/4b19adc64fc2
Add entries for copying key ids and fingerprints in the openpgp key manager context menu. r=aleca,mkmelin
Updated•5 years ago
|
Description
•