Show import key dialog when clicking on WKD URL
This change extends WKD support for direct Web Key Directory URLs similarily to Facebook key URLs and HKP URLs. When a link with scheme `https` and path starting with `/.well-known/openpgpkey/hu/` is clicked Android will suggest importing the key with OpenKeychain. Fixes #2270.
This commit is contained in:
@@ -24,6 +24,18 @@ public class WebKeyDirectoryUtil {
|
||||
*/
|
||||
@Nullable
|
||||
public static URL toWebKeyDirectoryURL(String name) {
|
||||
if (name == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (name.startsWith("https://") && name.contains("/.well-known/openpgpkey/hu/")) {
|
||||
try {
|
||||
return new URL(name);
|
||||
} catch (MalformedURLException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Matcher matcher = EMAIL_PATTERN.matcher(name);
|
||||
|
||||
if (!matcher.matches()) {
|
||||
|
||||
Reference in New Issue
Block a user