lib/repo: Include WKD update URLs in GPG key listing

If the key UID contains a valid email address, include the GPG WKD
update URLs in GVariant returned by ostree_repo_remote_get_gpg_keys().
This commit is contained in:
Dan Nicholson 2019-08-26 11:15:25 -06:00 committed by Dan Nicholson
parent 4fa403aee5
commit 27dc5d7d38
2 changed files with 16 additions and 0 deletions

View File

@ -2439,6 +2439,16 @@ ostree_repo_remote_get_gpg_keys (OstreeRepo *self,
for (gpgme_user_id_t uid = key->uids; uid != NULL; uid = uid->next) for (gpgme_user_id_t uid = key->uids; uid != NULL; uid = uid->next)
{ {
/* Get WKD update URLs if address set */
g_autofree char *advanced_url = NULL;
g_autofree char *direct_url = NULL;
if (uid->address != NULL)
{
if (!ot_gpg_wkd_urls (uid->address, &advanced_url, &direct_url,
error))
return FALSE;
}
g_auto(GVariantDict) uid_dict = OT_VARIANT_BUILDER_INITIALIZER; g_auto(GVariantDict) uid_dict = OT_VARIANT_BUILDER_INITIALIZER;
g_variant_dict_init (&uid_dict, NULL); g_variant_dict_init (&uid_dict, NULL);
g_variant_dict_insert_value (&uid_dict, "uid", g_variant_dict_insert_value (&uid_dict, "uid",
@ -2453,6 +2463,10 @@ ostree_repo_remote_get_gpg_keys (OstreeRepo *self,
g_variant_new_boolean (uid->revoked)); g_variant_new_boolean (uid->revoked));
g_variant_dict_insert_value (&uid_dict, "invalid", g_variant_dict_insert_value (&uid_dict, "invalid",
g_variant_new_boolean (uid->invalid)); g_variant_new_boolean (uid->invalid));
g_variant_dict_insert_value (&uid_dict, "advanced_url",
g_variant_new ("ms", advanced_url));
g_variant_dict_insert_value (&uid_dict, "direct_url",
g_variant_new ("ms", direct_url));
g_variant_builder_add (&uids_builder, "(@a{sv})", g_variant_builder_add (&uids_builder, "(@a{sv})",
g_variant_dict_end (&uid_dict)); g_variant_dict_end (&uid_dict));
} }

View File

@ -1449,6 +1449,8 @@ gboolean ostree_repo_remote_get_gpg_verify_summary (OstreeRepo *self,
* - key: `email`, value: `s`, user ID email component * - key: `email`, value: `s`, user ID email component
* - key: `revoked`, value: `b`, whether user ID is revoked * - key: `revoked`, value: `b`, whether user ID is revoked
* - key: `invalid`, value: `b`, whether user ID is invalid * - key: `invalid`, value: `b`, whether user ID is invalid
* - key: `advanced_url`, value: `ms`, advanced WKD update URL
* - key: `direct_url`, value: `ms`, direct WKD update URL
* - a{sv} - Additional metadata dictionary. There are currently no * - a{sv} - Additional metadata dictionary. There are currently no
* additional metadata keys defined. * additional metadata keys defined.
* *