Closed wiktor-k closed 4 years ago
Probably the best solution at the moment would be to add it as an extended property:
VCard vcard = new VCard();
vcard.addExtendedProperty("KEY", "OPENPGP4FPR:ABAF11C65A2970B130ABE3C479BE3E4300411886");
Thanks @mangstadt!
What do you think about allowing construction of Key
s from URI
s? I could work on a PR to allow that...
I'm working on it now, but thanks for offering. :)
See commit: 4dd4ed1d2f0071fad0bff384b0e4f976eb17e46f
Ok, so I have basically just adjusted the Javadocs to dual-purpose the existing "URL" constructor/field in the class.
VCard vcard = new VCard();
Key key = new Key("OPENPGP4FPR:ABAF11C65A2970B130ABE3C479BE3E4300411886", null);
key.getUrl(); //returns the URI
Using the URI
class would be a little problematic because that code is shared via inheritance, and I would hate to break the API at this point without good reason.
It would also complicate the parsing logic because it would need to handle the edge case of when an input string can't be parsed into a URI
object.
Let me know your thoughts!
Yes, I did try it out (SNAPSHOT from master) and it works well! The null
at the end surprised me a little but I guess this is OK.
BEGIN:VCARD VERSION:4.0 PRODID:ez-vcard 0.10.6-SNAPSHOT N:Doe;Jonathan;;Mr; FN:John Doe KEY:OPENPGP4FPR:ABAF11C65A2970B130ABE3C479BE3E4300411886 END:VCARD
Thanks a lot for your quick implementation! :+1:
(I'll close the ticket as this is already done).
Hello,
Is there a way to insert OpenPGP key fingerprint as a
KEY
property usingopenpgp4fpr
URI scheme?There are quite a few apps (most notably OpenKeychain) using VCards with this kind of property. For example:
For more details about this scheme see https://metacode.biz/openpgp/openpgp4fpr