[grilo] core: Add binary API key to GrlConfig



commit 2af67ac6606487c044eb51e9df51359e1775da5a
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date:   Thu Jan 20 11:23:05 2011 +0000

    core: Add binary API key to GrlConfig
    
    Add "api-key-blob" to store binary API keys.
    
    Signed-off-by: Juan A. Suarez Romero <jasuarez igalia com>

 src/data/grl-config.c |   26 ++++++++++++++++++++++++++
 src/data/grl-config.h |    5 +++++
 2 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/src/data/grl-config.c b/src/data/grl-config.c
index 86bf88d..740fc84 100644
--- a/src/data/grl-config.c
+++ b/src/data/grl-config.c
@@ -295,6 +295,19 @@ grl_config_set_api_key (GrlConfig *config, const gchar *key)
 }
 
 /**
+ * grl_config_set_api_key_blob:
+ * @config: the config instance
+ * @key: the binary API key
+ *
+ * Set the binary API key in the configuration
+ */
+void
+grl_config_set_api_key_blob (GrlConfig *config, const guint8 *blob, gsize size)
+{
+  grl_config_set_binary (config, GRL_CONFIG_KEY_APIKEY_BLOB, blob, size);
+}
+
+/**
  * grl_config_set_api_token:
  * @config: the config instance
  * @token: the API token
@@ -393,6 +406,19 @@ grl_config_get_api_key (GrlConfig *config)
 }
 
 /**
+ * grl_config_get_api_key_blob:
+ * @config: the config instance
+ * @size: pointer to size of data
+ *
+ * Returns: the binary API key, size will reflect the size of the buffer
+ */
+guint8 *
+grl_config_get_api_key_blob (GrlConfig *config, gsize *size)
+{
+  return grl_config_get_binary (config, GRL_CONFIG_KEY_APIKEY_BLOB, size);
+}
+
+/**
  * grl_config_get_api_token:
  * @config: the config instance
  *
diff --git a/src/data/grl-config.h b/src/data/grl-config.h
index 0f0697a..d37d8b3 100644
--- a/src/data/grl-config.h
+++ b/src/data/grl-config.h
@@ -66,6 +66,7 @@ G_BEGIN_DECLS
 #define GRL_CONFIG_KEY_PLUGIN      "target-plugin"
 #define GRL_CONFIG_KEY_SOURCE      "target-source"
 #define GRL_CONFIG_KEY_APIKEY      "api-key"
+#define GRL_CONFIG_KEY_APIKEY_BLOB "api-key-blob"
 #define GRL_CONFIG_KEY_APITOKEN    "api-token"
 #define GRL_CONFIG_KEY_APISECRET   "api-secret"
 #define GRL_CONFIG_KEY_USERNAME    "username"
@@ -105,6 +106,8 @@ void grl_config_set_source (GrlConfig *config, const gchar *source);
 
 void grl_config_set_api_key (GrlConfig *config, const gchar *key);
 
+void grl_config_set_api_key_blob (GrlConfig *config, const guint8 *blob, gsize size);
+
 void grl_config_set_api_token (GrlConfig *config, const gchar *token);
 
 void grl_config_set_api_secret (GrlConfig *config, const gchar *secret);
@@ -117,6 +120,8 @@ gchar *grl_config_get_plugin (GrlConfig *config);
 
 gchar *grl_config_get_api_key (GrlConfig *config);
 
+guint8 *grl_config_get_api_key_blob (GrlConfig *config, gsize *size);
+
 gchar *grl_config_get_api_token (GrlConfig *config);
 
 gchar *grl_config_get_api_secret (GrlConfig *config);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]