[epiphany/wip/sync: 23/86] sync-service: #define the certificate duration



commit 103ae716caa29e76299c395b7691403bc425c375
Author: Gabriel Ivascu <ivascu gabriel59 gmail com>
Date:   Thu Feb 23 14:42:05 2017 +0200

    sync-service: #define the certificate duration

 src/sync/ephy-sync-service.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/sync/ephy-sync-service.c b/src/sync/ephy-sync-service.c
index 31fe94f..1d446ba 100644
--- a/src/sync/ephy-sync-service.c
+++ b/src/sync/ephy-sync-service.c
@@ -39,6 +39,10 @@
 #define MOZILLA_FXA_SERVER_URL    "https://api.accounts.firefox.com/v1/";
 #define EPHY_BOOKMARKS_COLLECTION "ephy-bookmarks"
 #define SYNC_FREQUENCY            (15 * 60) /* seconds */
+/* The lifetime of the certificate in milliseconds. The Firefox Accounts server
+ * limits the duration to 24 hours. For our purposes, a duration of 30 minutes
+ * will suffice. */
+#define CERTIFICATE_DURATION      (30 * 60 * 1000)
 
 struct _EphySyncService {
   GObject      parent_instance;
@@ -541,11 +545,8 @@ ephy_sync_service_obtain_signed_certificate (EphySyncService *self,
   n = mpz_get_str (NULL, 10, self->keypair->public.n);
   e = mpz_get_str (NULL, 10, self->keypair->public.e);
   public_key_json = ephy_sync_utils_build_json_string ("algorithm", "RS", "n", n, "e", e, NULL);
-  /* Duration is the lifetime of the certificate in milliseconds. The FxA server
-   * limits the duration to 24 hours. For our purposes, a duration of 30 minutes
-   * will suffice. */
   request_body = g_strdup_printf ("{\"publicKey\": %s, \"duration\": %d}",
-                                  public_key_json, 30 * 60 * 1000);
+                                  public_key_json, CERTIFICATE_DURATION);
   ephy_sync_service_fxa_hawk_post_async (self, "certificate/sign", tokenID_hex,
                                          reqHMACkey, EPHY_SYNC_TOKEN_LENGTH, request_body,
                                          obtain_signed_certificate_response_cb, user_data);


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