[epiphany/wip/sync: 71/86] sync-service: Add _get_key_bundle() function



commit 8318c997dcdf3efa8ea241e3b540de05e9e2a1ce
Author: Gabriel Ivascu <ivascu gabriel59 gmail com>
Date:   Sat Mar 11 17:23:27 2017 +0200

    sync-service: Add _get_key_bundle() function

 src/sync/ephy-sync-service.c |   10 +++++
 src/sync/ephy-sync-service.h |   77 ++++++++++++++++++++++--------------------
 2 files changed, 50 insertions(+), 37 deletions(-)
---
diff --git a/src/sync/ephy-sync-service.c b/src/sync/ephy-sync-service.c
index fad01f4..1072319 100644
--- a/src/sync/ephy-sync-service.c
+++ b/src/sync/ephy-sync-service.c
@@ -792,6 +792,16 @@ ephy_sync_service_set_token (EphySyncService   *self,
   }
 }
 
+SyncCryptoKeyBundle *
+ephy_sync_service_get_key_bundle (EphySyncService *self,
+                                  const char      *collection)
+{
+  g_return_val_if_fail (EPHY_IS_SYNC_SERVICE (self), NULL);
+  g_return_val_if_fail (collection, NULL);
+
+  return g_hash_table_lookup (self->key_bundles, collection);
+}
+
 void
 ephy_sync_service_clear_storage_credentials (EphySyncService *self)
 {
diff --git a/src/sync/ephy-sync-service.h b/src/sync/ephy-sync-service.h
index 55c6f58..f29cca8 100644
--- a/src/sync/ephy-sync-service.h
+++ b/src/sync/ephy-sync-service.h
@@ -21,6 +21,7 @@
 #pragma once
 
 #include "ephy-bookmark.h"
+#include "ephy-sync-crypto.h"
 #include "ephy-sync-utils.h"
 
 #include <glib-object.h>
@@ -32,42 +33,44 @@ G_BEGIN_DECLS
 
 G_DECLARE_FINAL_TYPE (EphySyncService, ephy_sync_service, EPHY, SYNC_SERVICE, GObject)
 
-EphySyncService  *ephy_sync_service_new                        (void);
-gboolean          ephy_sync_service_is_signed_in               (EphySyncService   *self);
-const char       *ephy_sync_service_get_user_email             (EphySyncService   *self);
-void              ephy_sync_service_set_user_email             (EphySyncService   *self,
-                                                                const char        *email);
-double            ephy_sync_service_get_sync_time              (EphySyncService   *self);
-void              ephy_sync_service_set_sync_time              (EphySyncService   *self,
-                                                                double             time);
-const char       *ephy_sync_service_get_token                  (EphySyncService   *self,
-                                                                EphySyncTokenType  type);
-void              ephy_sync_service_set_token                  (EphySyncService   *self,
-                                                                const char        *value,
-                                                                EphySyncTokenType  type);
-void              ephy_sync_service_clear_storage_credentials  (EphySyncService   *self);
-void              ephy_sync_service_clear_tokens               (EphySyncService   *self);
-void              ephy_sync_service_destroy_session            (EphySyncService   *self,
-                                                                const char        *sessionToken);
-void              ephy_sync_service_do_sign_in                 (EphySyncService   *self,
-                                                                const char        *email,
-                                                                const char        *uid,
-                                                                const char        *sessionToken,
-                                                                const char        *keyFetchToken,
-                                                                const char        *unwrapBKey);
-void              ephy_sync_service_do_sign_out                (EphySyncService   *self);
-void              ephy_sync_service_upload_bookmark            (EphySyncService   *self,
-                                                                EphyBookmark      *bookmark,
-                                                                gboolean           force);
-void              ephy_sync_service_download_bookmark          (EphySyncService   *self,
-                                                                EphyBookmark      *bookmark);
-void              ephy_sync_service_delete_bookmark            (EphySyncService   *self,
-                                                                EphyBookmark      *bookmark,
-                                                                gboolean           conditional);
-void              ephy_sync_service_sync_bookmarks             (EphySyncService   *self,
-                                                                gboolean           first);
-void              ephy_sync_service_start_periodical_sync      (EphySyncService   *self,
-                                                                gboolean           now);
-void              ephy_sync_service_stop_periodical_sync       (EphySyncService   *self);
+EphySyncService     *ephy_sync_service_new                        (void);
+gboolean             ephy_sync_service_is_signed_in               (EphySyncService   *self);
+const char          *ephy_sync_service_get_user_email             (EphySyncService   *self);
+void                 ephy_sync_service_set_user_email             (EphySyncService   *self,
+                                                                   const char        *email);
+double               ephy_sync_service_get_sync_time              (EphySyncService   *self);
+void                 ephy_sync_service_set_sync_time              (EphySyncService   *self,
+                                                                   double             time);
+const char          *ephy_sync_service_get_token                  (EphySyncService   *self,
+                                                                   EphySyncTokenType  type);
+void                 ephy_sync_service_set_token                  (EphySyncService   *self,
+                                                                   const char        *value,
+                                                                   EphySyncTokenType  type);
+SyncCryptoKeyBundle *ephy_sync_service_get_key_bundle             (EphySyncService   *self,
+                                                                   const char        *collection);
+void                 ephy_sync_service_clear_storage_credentials  (EphySyncService   *self);
+void                 ephy_sync_service_clear_tokens               (EphySyncService   *self);
+void                 ephy_sync_service_destroy_session            (EphySyncService   *self,
+                                                                   const char        *sessionToken);
+void                 ephy_sync_service_do_sign_in                 (EphySyncService   *self,
+                                                                   const char        *email,
+                                                                   const char        *uid,
+                                                                   const char        *sessionToken,
+                                                                   const char        *keyFetchToken,
+                                                                   const char        *unwrapBKey);
+void                 ephy_sync_service_do_sign_out                (EphySyncService   *self);
+void                 ephy_sync_service_upload_bookmark            (EphySyncService   *self,
+                                                                   EphyBookmark      *bookmark,
+                                                                   gboolean           force);
+void                 ephy_sync_service_download_bookmark          (EphySyncService   *self,
+                                                                   EphyBookmark      *bookmark);
+void                 ephy_sync_service_delete_bookmark            (EphySyncService   *self,
+                                                                   EphyBookmark      *bookmark,
+                                                                   gboolean           conditional);
+void                 ephy_sync_service_sync_bookmarks             (EphySyncService   *self,
+                                                                   gboolean           first);
+void                 ephy_sync_service_start_periodical_sync      (EphySyncService   *self,
+                                                                   gboolean           now);
+void                 ephy_sync_service_stop_periodical_sync       (EphySyncService   *self);
 
 G_END_DECLS


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