[epiphany/wip/sync] sync-secret: Don't use hardcoded values for token names



commit 0e4a9d94e5840e75f5c637b772ab3bb7e864ec9f
Author: Gabriel Ivascu <ivascu gabriel59 gmail com>
Date:   Thu Mar 9 18:28:02 2017 +0200

    sync-secret: Don't use hardcoded values for token names

 src/sync/ephy-sync-secret.c |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)
---
diff --git a/src/sync/ephy-sync-secret.c b/src/sync/ephy-sync-secret.c
index a09af8b..c384897 100644
--- a/src/sync/ephy-sync-secret.c
+++ b/src/sync/ephy-sync-secret.c
@@ -218,14 +218,22 @@ ephy_sync_secret_store_tokens (EphySyncService *service)
   char *tokens;
   char *label;
 
-  tokens = ephy_sync_utils_build_json_string ("uid", ephy_sync_service_get_token (service, TOKEN_UID),
-                                              "sessionToken", ephy_sync_service_get_token (service, 
TOKEN_SESSIONTOKEN),
-                                              "keyFetchToken", ephy_sync_service_get_token (service, 
TOKEN_KEYFETCHTOKEN),
-                                              "unwrapBKey", ephy_sync_service_get_token (service, 
TOKEN_UNWRAPBKEY),
-                                              "kA", ephy_sync_service_get_token (service, TOKEN_KA),
-                                              "kB", ephy_sync_service_get_token (service, TOKEN_KB),
-                                              "defaultAESKey", ephy_sync_service_get_token (service, 
TOKEN_DEFAULT_AES_KEY),
-                                              "defaultHMACKey", ephy_sync_service_get_token (service, 
TOKEN_DEFAULT_HMAC_KEY),
+  tokens = ephy_sync_utils_build_json_string (ephy_sync_utils_token_name_from_type (TOKEN_UID),
+                                              ephy_sync_service_get_token (service, TOKEN_UID),
+                                              ephy_sync_utils_token_name_from_type (TOKEN_SESSIONTOKEN),
+                                              ephy_sync_service_get_token (service, TOKEN_SESSIONTOKEN),
+                                              ephy_sync_utils_token_name_from_type (TOKEN_KEYFETCHTOKEN),
+                                              ephy_sync_service_get_token (service, TOKEN_KEYFETCHTOKEN),
+                                              ephy_sync_utils_token_name_from_type (TOKEN_UNWRAPBKEY),
+                                              ephy_sync_service_get_token (service, TOKEN_UNWRAPBKEY),
+                                              ephy_sync_utils_token_name_from_type (TOKEN_KA),
+                                              ephy_sync_service_get_token (service, TOKEN_KA),
+                                              ephy_sync_utils_token_name_from_type (TOKEN_KB),
+                                              ephy_sync_service_get_token (service, TOKEN_KB),
+                                              ephy_sync_utils_token_name_from_type (TOKEN_DEFAULT_AES_KEY),
+                                              ephy_sync_service_get_token (service, TOKEN_DEFAULT_AES_KEY),
+                                              ephy_sync_utils_token_name_from_type (TOKEN_DEFAULT_HMAC_KEY),
+                                              ephy_sync_service_get_token (service, TOKEN_DEFAULT_HMAC_KEY),
                                               NULL);
   value = secret_value_new (tokens, -1, "text/plain");
   attributes = secret_attributes_build (EPHY_SYNC_TOKEN_SCHEMA, EMAIL_KEY,


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