mirror of
https://gitlab.gnome.org/GNOME/libsecret.git
synced 2024-12-22 12:48:51 +00:00
Add secret_value_get_text() function to return NULL terminated secret
This commit is contained in:
parent
227a5b2904
commit
cec740fea9
@ -296,6 +296,7 @@ SecretValue
|
||||
secret_value_new
|
||||
secret_value_new_full
|
||||
secret_value_get
|
||||
secret_value_get_text
|
||||
secret_value_get_content_type
|
||||
secret_value_ref
|
||||
secret_value_unref
|
||||
|
@ -44,6 +44,8 @@
|
||||
* Stability: Unstable
|
||||
*/
|
||||
|
||||
static gboolean is_password_value (SecretValue *value);
|
||||
|
||||
/**
|
||||
* SecretValue:
|
||||
*
|
||||
@ -169,6 +171,26 @@ secret_value_get (SecretValue *value,
|
||||
return value->secret;
|
||||
}
|
||||
|
||||
/**
|
||||
* secret_value_get_text:
|
||||
* @value: the value
|
||||
*
|
||||
* Get the secret data in the #SecretValue if it contains a textual
|
||||
* value. The content type must be <literal>text/plain</literal>.
|
||||
*
|
||||
* Returns: (allow-none): the content type
|
||||
*/
|
||||
const gchar *
|
||||
secret_value_get_text (SecretValue *value)
|
||||
{
|
||||
g_return_val_if_fail (value, NULL);
|
||||
|
||||
if (!is_password_value (value))
|
||||
return NULL;
|
||||
|
||||
return value->secret;
|
||||
}
|
||||
|
||||
/**
|
||||
* secret_value_get_content_type:
|
||||
* @value: the value
|
||||
|
@ -43,6 +43,8 @@ SecretValue * secret_value_new_full (gchar *secret,
|
||||
const gchar * secret_value_get (SecretValue *value,
|
||||
gsize *length);
|
||||
|
||||
const gchar * secret_value_get_text (SecretValue *value);
|
||||
|
||||
const gchar * secret_value_get_content_type (SecretValue *value);
|
||||
|
||||
SecretValue * secret_value_ref (SecretValue *value);
|
||||
|
Loading…
Reference in New Issue
Block a user