json: Return fingerprint as createkey result
* src/gpgme-json.c (op_createkey): Return fingerprint of new key.
This commit is contained in:
parent
6c74a59e88
commit
54146d90dd
@ -2778,7 +2778,7 @@ static const char hlp_createkey[] =
|
|||||||
"expires: Seconds since epoch to expiry as Number. 0 means no expiry.\n"
|
"expires: Seconds since epoch to expiry as Number. 0 means no expiry.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Response on success:\n"
|
"Response on success:\n"
|
||||||
"success: Boolean true.\n"
|
"fingerprint: The fingerprint of the created key.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Note: This interface does not allow key generation if the userid\n"
|
"Note: This interface does not allow key generation if the userid\n"
|
||||||
"of the new key already exists in the keyring.\n";
|
"of the new key already exists in the keyring.\n";
|
||||||
@ -2792,6 +2792,7 @@ op_createkey (cjson_t request, cjson_t result)
|
|||||||
cjson_t j_tmp;
|
cjson_t j_tmp;
|
||||||
const char *algo = "default";
|
const char *algo = "default";
|
||||||
const char *userid;
|
const char *userid;
|
||||||
|
gpgme_genkey_result_t res;
|
||||||
|
|
||||||
#ifdef GPG_AGENT_ALLOWS_KEYGEN_TRHOUGH_BROWSER
|
#ifdef GPG_AGENT_ALLOWS_KEYGEN_TRHOUGH_BROWSER
|
||||||
/* GnuPG forbids keygen through the browser socket so for
|
/* GnuPG forbids keygen through the browser socket so for
|
||||||
@ -2838,7 +2839,14 @@ op_createkey (cjson_t request, cjson_t result)
|
|||||||
if ((err = gpgme_op_createkey (ctx, userid, algo, 0, expires, NULL, flags)))
|
if ((err = gpgme_op_createkey (ctx, userid, algo, 0, expires, NULL, flags)))
|
||||||
goto leave;
|
goto leave;
|
||||||
|
|
||||||
xjson_AddBoolToObject (result, "success", 1);
|
res = gpgme_op_genkey_result (ctx);
|
||||||
|
if (!res)
|
||||||
|
{
|
||||||
|
err = gpg_error (GPG_ERR_GENERAL);
|
||||||
|
goto leave;
|
||||||
|
}
|
||||||
|
|
||||||
|
xjson_AddStringToObject0 (result, "fingerprint", res->fpr);
|
||||||
|
|
||||||
leave:
|
leave:
|
||||||
#ifdef GPG_AGENT_ALLOWS_KEYGEN_TRHOUGH_BROWSER
|
#ifdef GPG_AGENT_ALLOWS_KEYGEN_TRHOUGH_BROWSER
|
||||||
|
Loading…
Reference in New Issue
Block a user