Implement gnome keyring data store.
authorKevin Wasserman <krwasserman@hotmail.com>
Tue, 3 Sep 2013 17:48:07 +0000 (13:48 -0400)
committerKevin Wasserman <krwasserman@hotmail.com>
Fri, 13 Sep 2013 15:14:28 +0000 (11:14 -0400)
Keyring store is used by default.
Old flat file store is accessible using new --FlatFileStore option

Makefile.am
src/moonshot-identities-manager.vala
src/moonshot-identity-manager-app.vala
src/moonshot-keyring-store.vala [new file with mode: 0644]
vapi/moonshot-gnome-keyring.vapi [new file with mode: 0644]

index c3b9fd7..0d37532 100644 (file)
@@ -40,6 +40,7 @@ src_moonshot_SOURCES = \
         src/moonshot-identity-manager-app.vala \
         src/moonshot-identity-management-view.vala \
         src/moonshot-local-flat-file-store.vala \
+        src/moonshot-keyring-store.vala \
         src/moonshot-idcard-store.vala \
         src/moonshot-id.vala \
         src/moonshot-add-dialog.vala \
@@ -95,6 +96,10 @@ endif
 
 if OS_LINUX
 
+AM_CPPFLAGS += -I/usr/include/gnome-keyring-1
+AM_VALAFLAGS += --pkg moonshot-gnome-keyring --define=GNOME_KEYRING
+src_moonshot_LDFLAGS += -lgnome-keyring
+
 ## Installing mime type data
 mimedir = $(datadir)/mime/packages
 mime_DATA = webprovisioning/moonshot.xml
index 1aa5fe7..64a87b9 100644 (file)
@@ -73,8 +73,15 @@ public class IdentityManagerModel : Object {
 
     private IdentityManagerApp parent;
 
-    public IdentityManagerModel(IdentityManagerApp parent_app) {
+    public IdentityManagerModel(IdentityManagerApp parent_app, bool use_flat_file_store) {
         parent = parent_app;
+#if IPC_MSRPC
         store = new LocalFlatFileStore();
+#else
+        if (use_flat_file_store)
+            store = new LocalFlatFileStore();
+        else
+            store = new KeyringStore();
+#endif
     }
 }
index 891ee6a..cb9c196 100644 (file)
@@ -39,8 +39,8 @@ public class IdentityManagerApp {
         if (view != null) view.show();    
     }
        
-    public IdentityManagerApp (bool headless) {
-        model = new IdentityManagerModel(this);
+    public IdentityManagerApp (bool headless, bool use_flat_file_store) {
+        model = new IdentityManagerModel(this, headless || use_flat_file_store);
         if (!headless)
             view = new IdentityManagerView(this);
         LinkedList<IdCard> card_list = model.get_card_list() ;
@@ -295,9 +295,12 @@ public class IdentityManagerApp {
 }
 
 static bool explicitly_launched = true;
+static bool use_flat_file_store = false;
 const GLib.OptionEntry[] options = {
     {"DBusLaunch",0,GLib.OptionFlags.REVERSE,GLib.OptionArg.NONE,
      ref explicitly_launched,"launch for dbus rpc use",null},
+    {"FlatFileStore",0,0,GLib.OptionArg.NONE,
+     ref use_flat_file_store,"force use of flat file identity store (used by default only for headless operation)",null},
     {null}
 };
 
@@ -332,7 +335,7 @@ public static int main(string[] args){
         Intl.textdomain (Config.GETTEXT_PACKAGE);
        
           
-        var app = new IdentityManagerApp(headless);
+        var app = new IdentityManagerApp(headless, use_flat_file_store);
         app.explicitly_launched = explicitly_launched;
         
        if (app.explicitly_launched) {
diff --git a/src/moonshot-keyring-store.vala b/src/moonshot-keyring-store.vala
new file mode 100644 (file)
index 0000000..96c036c
--- /dev/null
@@ -0,0 +1,143 @@
+using Gee;
+
+#if GNOME_KEYRING
+public class KeyringStore : Object, IIdentityCardStore {
+    private LinkedList<IdCard> id_card_list;
+    private const string keyring_store_attribute = "Moonshot";
+    private const string keyring_store_version = "1.0";
+    private const GnomeKeyring.ItemType item_type = GnomeKeyring.ItemType.GENERIC_SECRET;
+
+    public void add_card(IdCard card) {
+        id_card_list.add(card);
+        store_id_cards ();
+    }
+
+    public void update_card(IdCard card) {
+        id_card_list.remove(card);
+        id_card_list.add(card);
+        store_id_cards ();
+    }
+
+    public void remove_card(IdCard card) {
+        id_card_list.remove(card);
+        store_id_cards ();
+    }
+
+    public LinkedList<IdCard> get_card_list() {
+        return id_card_list;
+    }
+
+    /* clear all keyring-stored ids (in preparation to store current list) */
+    private void clear_keyring() {
+       GnomeKeyring.AttributeList match = new GnomeKeyring.AttributeList();
+       match.append_string(keyring_store_attribute, keyring_store_version);
+       GLib.List<GnomeKeyring.Found> items;
+        GnomeKeyring.find_items_sync(item_type, match, out items);
+        items.foreach((entry) => {
+            GnomeKeyring.Result result = GnomeKeyring.item_delete_sync(null, entry.item_id);
+            if (result != GnomeKeyring.Result.OK) {
+                stdout.printf("GnomeKeyring.item_delete_sync() failed. result: %d", result);
+            }
+        });
+    }
+     
+    private void load_id_cards() {
+        id_card_list.clear();
+
+       GnomeKeyring.AttributeList match = new GnomeKeyring.AttributeList();
+       match.append_string(keyring_store_attribute, keyring_store_version);
+       GLib.List<GnomeKeyring.Found> items;
+        GnomeKeyring.find_items_sync(item_type, match, out items);
+        items.foreach((entry) => {
+            IdCard id_card = new IdCard ();
+            int i;
+            int rules_patterns_index = -1;
+            int rules_always_confirm_index = -1;
+            for (i=0; i<entry.attributes.len; i++) {
+                var attribute = entry.attributes.data[i];
+               string value = attribute.string_value;
+               if (attribute.name == "Issuer") {
+                    id_card.issuer = value;
+               } else if (attribute.name == "Username") {
+                    id_card.username = value;
+               } else if (attribute.name == "DisplayName") {
+                    id_card.display_name = value;
+               } else if (attribute.name == "Services") {
+                    id_card.services = value.split(";");
+                } else if (attribute.name == "Rules-Pattern") {
+                    rules_patterns_index = i;
+                } else if (attribute.name == "Rules-AlwaysConfirm") {
+                    rules_always_confirm_index = i;
+                } else if (attribute.name == "CA-Cert") {
+                    id_card.trust_anchor.ca_cert = value;
+                } else if (attribute.name == "Server-Cert") {
+                    id_card.trust_anchor.server_cert = value;
+                } else if (attribute.name == "Subject") {
+                    id_card.trust_anchor.subject = value;
+                } else if (attribute.name == "Subject-Alt") {
+                    id_card.trust_anchor.subject_alt = value;
+                }
+            }
+            if ((rules_always_confirm_index != -1) && (rules_patterns_index != -1)) {
+                string rules_patterns_all = entry.attributes.data[rules_patterns_index].string_value;
+                string rules_always_confirm_all = entry.attributes.data[rules_always_confirm_index].string_value;
+                string [] rules_always_confirm = rules_always_confirm_all.split(";");
+                string [] rules_patterns = rules_patterns_all.split(";");
+                if (rules_patterns.length == rules_always_confirm.length) {
+                   Rule[] rules = new Rule[rules_patterns.length];
+                   for (int j=0; j<rules_patterns.length; j++) {
+                       rules[j].pattern = rules_patterns[j];
+                       rules[j].always_confirm = rules_always_confirm[j];
+                   }
+                   id_card.rules = rules;
+                }
+            }
+            id_card.password = entry.secret;
+            id_card_list.add(id_card);
+        });
+    }
+
+    public void store_id_cards () {
+        clear_keyring();
+        foreach (IdCard id_card in this.id_card_list) {
+            string[] rules_patterns = new string[id_card.rules.length];
+            string[] rules_always_conf = new string[id_card.rules.length];
+            
+            for (int i=0; i<id_card.rules.length; i++) {
+                rules_patterns[i] = id_card.rules[i].pattern;
+                rules_always_conf[i] = id_card.rules[i].always_confirm;
+            }
+            string patterns = string.joinv(";", rules_patterns);
+            string always_conf = string.joinv(";", rules_always_conf);
+            string services = string.joinv(";", id_card.services);
+            GnomeKeyring.AttributeList attributes = new GnomeKeyring.AttributeList();
+            uint32 item_id;
+            attributes.append_string(keyring_store_attribute, keyring_store_version);
+            attributes.append_string("Issuer", id_card.issuer);
+            attributes.append_string("Username", id_card.username);
+            attributes.append_string("DisplayName", id_card.display_name);
+            attributes.append_string("Services", services);
+            attributes.append_string("Rules-Pattern", patterns);
+            attributes.append_string("Rules-AlwaysConfirm", always_conf);
+            attributes.append_string("CA-Cert", id_card.trust_anchor.ca_cert);
+            attributes.append_string("Server-Cert", id_card.trust_anchor.server_cert);
+            attributes.append_string("Subject", id_card.trust_anchor.subject);
+            attributes.append_string("Subject-Alt", id_card.trust_anchor.subject_alt);
+
+            GnomeKeyring.Result result = GnomeKeyring.item_create_sync(null,
+                item_type, id_card.display_name,
+                attributes, id_card.password, true, out item_id);
+            if (result != GnomeKeyring.Result.OK) {
+                stdout.printf("GnomeKeyring.item_create_sync() failed. result: %d", result);
+            }
+        }
+        load_id_cards();
+    }
+
+    public KeyringStore () {
+        id_card_list = new LinkedList<IdCard>();
+        load_id_cards();
+    }
+}
+
+#endif
diff --git a/vapi/moonshot-gnome-keyring.vapi b/vapi/moonshot-gnome-keyring.vapi
new file mode 100644 (file)
index 0000000..4593965
--- /dev/null
@@ -0,0 +1,327 @@
+/* Adapted from gnome-keyring-1.vapi to improve functionality */
+/* specifically: modified class Attribute to allow access to string value */
+/* also modified class PasswordSchema to appropriate use of attributes */
+
+
+/* gnome-keyring-1.vapi generated by vapigen, do not modify. */
+
+namespace GnomeKeyring {
+       [CCode (cheader_filename = "gnome-keyring.h", copy_function = "gnome_keyring_access_control_copy")]
+       [Compact]
+       public class AccessControl {
+               [CCode (has_construct_function = false)]
+               public AccessControl (GnomeKeyring.ApplicationRef application, GnomeKeyring.AccessType types_allowed);
+               public GnomeKeyring.AccessControl copy ();
+       }
+       [CCode (cheader_filename = "gnome-keyring.h", copy_function = "gnome_keyring_application_ref_copy")]
+       [Compact]
+       public class ApplicationRef {
+               [CCode (has_construct_function = false)]
+               public ApplicationRef ();
+               public GnomeKeyring.ApplicationRef copy ();
+       }
+       [CCode (cheader_filename = "gnome-keyring.h", copy_function = "gnome_keyring_attribute_list_copy", free_function = "gnome_keyring_attribute_list_free")]
+       [Compact]
+       public class AttributeList {
+               [CCode (array_length = false)]
+               public GnomeKeyring.Attribute[] data;
+               public uint len;
+               public AttributeList ();
+               public void append_string (string name, string value);
+               public void append_uint32 (string name, uint32 value);
+               public GnomeKeyring.AttributeList copy ();
+               public GnomeKeyring.Attribute index (int i);
+       }
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       [Compact]
+       public class Found {
+               public weak GnomeKeyring.AttributeList attributes;
+               public uint item_id;
+               public weak string keyring;
+               public weak string secret;
+       }
+       [CCode (cheader_filename = "gnome-keyring.h", copy_function = "gnome_keyring_info_copy")]
+       [Compact]
+       public class Info {
+               public GnomeKeyring.Info copy ();
+               public ulong get_ctime ();
+               public bool get_is_locked ();
+               public bool get_lock_on_idle ();
+               public uint32 get_lock_timeout ();
+               public ulong get_mtime ();
+               public void set_lock_on_idle (bool value);
+               public void set_lock_timeout (uint32 value);
+       }
+       [CCode (cheader_filename = "gnome-keyring.h", copy_function = "gnome_keyring_item_info_copy")]
+       [Compact]
+       public class ItemInfo {
+               [CCode (has_construct_function = false)]
+               public ItemInfo ();
+               public GnomeKeyring.ItemInfo copy ();
+               public ulong get_ctime ();
+               public unowned string get_display_name ();
+               public ulong get_mtime ();
+               public unowned string get_secret ();
+               public void set_display_name (string value);
+               public void set_secret (string value);
+               public void set_type (GnomeKeyring.ItemType type);
+       }
+       [CCode (cheader_filename = "gnome-keyring.h", free_function = "gnome_keyring_network_password_free")]
+       [Compact]
+       public class NetworkPasswordData {
+               public weak string authtype;
+               public weak string domain;
+               public uint32 item_id;
+               public weak string keyring;
+               public weak string object;
+               public weak string password;
+               public uint32 port;
+               public weak string protocol;
+               public weak string server;
+               public weak string user;
+       }
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       [Compact]
+       public class PasswordSchema {
+               public void* attributes;
+               public GnomeKeyring.ItemType item_type;
+               public void* reserved1;
+               public void* reserved2;
+               public void* reserved3;
+       }
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public struct Attribute {
+               public weak string name;
+               public GnomeKeyring.AttributeType type;
+               [CCode (cname="value.string")]
+               unowned string string_value;
+                [CCode (cname="value.integer")]
+               uint32 integer_value;
+       }
+       [CCode (cheader_filename = "gnome-keyring.h", cprefix = "GNOME_KEYRING_ACCESS_", has_type_id = false)]
+       public enum AccessRestriction {
+               ASK,
+               DENY,
+               ALLOW
+       }
+       [CCode (cheader_filename = "gnome-keyring.h", cprefix = "GNOME_KEYRING_ACCESS_", has_type_id = false)]
+       public enum AccessType {
+               READ,
+               WRITE,
+               REMOVE
+       }
+       [CCode (cheader_filename = "gnome-keyring.h", cprefix = "GNOME_KEYRING_ATTRIBUTE_TYPE_", has_type_id = false)]
+       public enum AttributeType {
+               STRING,
+               UINT32
+       }
+       [CCode (cheader_filename = "gnome-keyring.h", cprefix = "GNOME_KEYRING_ITEM_INFO_", has_type_id = false)]
+       public enum ItemInfoFlags {
+               ALL,
+               BASICS,
+               SECRET
+       }
+       [CCode (cheader_filename = "gnome-keyring.h", cprefix = "GNOME_KEYRING_ITEM_", has_type_id = false)]
+       public enum ItemType {
+               APPLICATION_SECRET,
+               ITEM_TYPE_MASK,
+               GENERIC_SECRET,
+               NETWORK_PASSWORD,
+               NOTE,
+               CHAINED_KEYRING_PASSWORD,
+               ENCRYPTION_KEY_PASSWORD,
+               PK_STORAGE,
+               LAST_TYPE
+       }
+       [CCode (cheader_filename = "gnome-keyring.h", cprefix = "GNOME_KEYRING_RESULT_", has_type_id = false)]
+       public enum Result {
+               OK,
+               DENIED,
+               NO_KEYRING_DAEMON,
+               ALREADY_UNLOCKED,
+               NO_SUCH_KEYRING,
+               BAD_ARGUMENTS,
+               IO_ERROR,
+               CANCELLED,
+               KEYRING_ALREADY_EXISTS,
+               NO_MATCH
+       }
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public delegate void OperationDoneCallback (GnomeKeyring.Result result);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public delegate void OperationGetAttributesCallback (GnomeKeyring.Result result, GnomeKeyring.AttributeList attributes);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public delegate void OperationGetIntCallback (GnomeKeyring.Result result, uint32 val);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public delegate void OperationGetItemInfoCallback (GnomeKeyring.Result result, GnomeKeyring.ItemInfo info);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public delegate void OperationGetKeyringInfoCallback (GnomeKeyring.Result result, GnomeKeyring.Info info);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public delegate void OperationGetListCallback (GnomeKeyring.Result result, GLib.List<GnomeKeyring.NetworkPasswordData> list);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public delegate void OperationGetStringCallback (GnomeKeyring.Result result, string? str);
+       [CCode (cheader_filename = "gnome-keyring.h", cname = "GNOME_KEYRING_NETWORK_PASSWORD")]
+       public static GnomeKeyring.PasswordSchema NETWORK_PASSWORD;
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public const string DEFAULT;
+       [CCode (cheader_filename = "gnome-keyring.h", cname = "GNOME_KEYRING_SESSION")]
+       public const string SESSION;
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static GLib.List<GnomeKeyring.AccessControl> acl_copy (GLib.List<GnomeKeyring.AccessControl> list);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void cancel_request (void* request);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void* change_password (string keyring, string? original, string? password, owned GnomeKeyring.OperationDoneCallback callback);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static GnomeKeyring.Result change_password_sync (string keyring, string? original, string? password);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void* create (string keyring_name, string? password, owned GnomeKeyring.OperationDoneCallback callback);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static GnomeKeyring.Result create_sync (string keyring_name, string? password);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static GnomeKeyring.Result daemon_prepare_environment_sync ();
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static GnomeKeyring.Result daemon_set_display_sync (string display);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void* @delete (string keyring, GnomeKeyring.OperationDoneCallback callback, void* data, GLib.DestroyNotify destroy_data);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void* delete_password (GnomeKeyring.PasswordSchema schema, owned GnomeKeyring.OperationDoneCallback callback, ...);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static GnomeKeyring.Result delete_password_sync (GnomeKeyring.PasswordSchema schema, ...);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static GnomeKeyring.Result delete_sync (string keyring);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void* find_items (GnomeKeyring.ItemType type, GnomeKeyring.AttributeList attributes, owned GnomeKeyring.OperationGetListCallback callback);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static GnomeKeyring.Result find_items_sync (GnomeKeyring.ItemType type, GnomeKeyring.AttributeList attributes, out GLib.List<GnomeKeyring.Found> found);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void* find_itemsv (GnomeKeyring.ItemType type, owned GnomeKeyring.OperationGetListCallback callback, ...);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static GnomeKeyring.Result find_itemsv_sync (GnomeKeyring.ItemType type, out GLib.List<GnomeKeyring.Found> found, ...);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void* find_network_password (string? user, string? domain, string? server, string? object, string? protocol, string? authtype, uint32 port, owned GnomeKeyring.OperationGetListCallback callback);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static GnomeKeyring.Result find_network_password_sync (string? user, string? domain, string? server, string? object, string? protocol, string? authtype, uint32 port, out GLib.List<GnomeKeyring.NetworkPasswordData> results);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void* find_password (GnomeKeyring.PasswordSchema schema, owned GnomeKeyring.OperationGetStringCallback callback, ...);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static GnomeKeyring.Result find_password_sync (GnomeKeyring.PasswordSchema schema, out unowned string password, ...);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void free_password (string password);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void* get_default_keyring (owned GnomeKeyring.OperationGetStringCallback callback);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static GnomeKeyring.Result get_default_keyring_sync (out unowned string keyring);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void* get_info (string? keyring, owned GnomeKeyring.OperationGetKeyringInfoCallback callback);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static GnomeKeyring.Result get_info_sync (string? keyring, out unowned GnomeKeyring.Info info);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static bool is_available ();
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static GnomeKeyring.AccessType item_ac_get_access_type (GnomeKeyring.AccessControl ac);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static unowned string item_ac_get_display_name (GnomeKeyring.AccessControl ac);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static unowned string item_ac_get_path_name (GnomeKeyring.AccessControl ac);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void item_ac_set_access_type (GnomeKeyring.AccessControl ac, GnomeKeyring.AccessType value);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void item_ac_set_display_name (GnomeKeyring.AccessControl ac, string value);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void item_ac_set_path_name (GnomeKeyring.AccessControl ac, string value);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void* item_create (string? keyring, GnomeKeyring.ItemType type, string display_name, GnomeKeyring.AttributeList attributes, string secret, bool update_if_exists, owned GnomeKeyring.OperationGetIntCallback callback);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static GnomeKeyring.Result item_create_sync (string? keyring, GnomeKeyring.ItemType type, string display_name, GnomeKeyring.AttributeList attributes, string secret, bool update_if_exists, out uint32 item_id);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void* item_delete (string? keyring, uint32 id, owned GnomeKeyring.OperationDoneCallback callback);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static GnomeKeyring.Result item_delete_sync (string? keyring, uint32 id);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void* item_get_acl (string? keyring, uint32 id, owned GnomeKeyring.OperationGetListCallback callback);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static GnomeKeyring.Result item_get_acl_sync (string? keyring, uint32 id, out GLib.List<GnomeKeyring.AccessControl> acl);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void* item_get_attributes (string? keyring, uint32 id, owned GnomeKeyring.OperationGetAttributesCallback callback);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static GnomeKeyring.Result item_get_attributes_sync (string? keyring, uint32 id, out unowned GnomeKeyring.AttributeList attributes);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void* item_get_info (string? keyring, uint32 id, owned GnomeKeyring.OperationGetItemInfoCallback callback);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void* item_get_info_full (string? keyring, uint32 id, uint32 flags, owned GnomeKeyring.OperationGetItemInfoCallback callback);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static GnomeKeyring.Result item_get_info_full_sync (string? keyring, uint32 id, uint32 flags, out unowned GnomeKeyring.ItemInfo info);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static GnomeKeyring.Result item_get_info_sync (string keyring, uint32 id, out unowned GnomeKeyring.ItemInfo info);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void* item_grant_access_rights (string? keyring, string display_name, string full_path, uint32 id, GnomeKeyring.AccessType rights, owned GnomeKeyring.OperationDoneCallback callback);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static GnomeKeyring.Result item_grant_access_rights_sync (string? keyring, string display_name, string full_path, uint32 id, GnomeKeyring.AccessType rights);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void* item_set_acl (string? keyring, uint32 id, GLib.List<GnomeKeyring.AccessControl> acl, owned GnomeKeyring.OperationDoneCallback callback);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static GnomeKeyring.Result item_set_acl_sync (string? keyring, uint32 id, GLib.List<GnomeKeyring.AccessControl> acl);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void* item_set_attributes (string? keyring, uint32 id, GnomeKeyring.AttributeList attributes, owned GnomeKeyring.OperationDoneCallback callback);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static GnomeKeyring.Result item_set_attributes_sync (string? keyring, uint32 id, GnomeKeyring.AttributeList attributes);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void* item_set_info (string? keyring, uint32 id, GnomeKeyring.ItemInfo info, owned GnomeKeyring.OperationDoneCallback callback);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static GnomeKeyring.Result item_set_info_sync (string? keyring, uint32 id, GnomeKeyring.ItemInfo info);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void* list_item_ids (string? keyring, owned GnomeKeyring.OperationGetListCallback callback);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static GnomeKeyring.Result list_item_ids_sync (string? keyring, out GLib.List<uint> ids);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void* list_keyring_names (owned GnomeKeyring.OperationGetListCallback callback);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static GnomeKeyring.Result list_keyring_names_sync (out GLib.List<string> keyrings);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void* @lock (string keyring, GnomeKeyring.OperationDoneCallback callback, void* data, GLib.DestroyNotify destroy_data);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void* lock_all (owned GnomeKeyring.OperationDoneCallback callback);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static GnomeKeyring.Result lock_all_sync ();
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static GnomeKeyring.Result lock_sync (string? keyring);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void* memory_alloc (ulong sz);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void memory_free (void* p);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static bool memory_is_secure (void* p);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void* memory_realloc (void* p, ulong sz);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static unowned string memory_strdup (string str);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void* memory_try_alloc (ulong sz);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void* memory_try_realloc (void* p, ulong sz);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void network_password_free (GnomeKeyring.NetworkPasswordData data);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static unowned string result_to_message (GnomeKeyring.Result res);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void* set_default_keyring (string keyring, owned GnomeKeyring.OperationDoneCallback callback);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static GnomeKeyring.Result set_default_keyring_sync (string keyring);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void* set_info (string? keyring, GnomeKeyring.Info info, owned GnomeKeyring.OperationDoneCallback callback);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static GnomeKeyring.Result set_info_sync (string? keyring, GnomeKeyring.Info info);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void* set_network_password (string? keyring, string? user, string? domain, string? server, string? object, string? protocol, string? authtype, uint32 port, string? password, owned GnomeKeyring.OperationGetIntCallback callback);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static GnomeKeyring.Result set_network_password_sync (string? keyring, string? user, string? domain, string? server, string? object, string? protocol, string? authtype, uint32 port, string? password, out uint32 item_id);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void* store_password (GnomeKeyring.PasswordSchema schema, string? keyring, string display_name, string password, owned GnomeKeyring.OperationDoneCallback callback, ...);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static GnomeKeyring.Result store_password_sync (GnomeKeyring.PasswordSchema schema, string? keyring, string display_name, string password, ...);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static void* unlock (string? keyring, string? password, owned GnomeKeyring.OperationDoneCallback callback);
+       [CCode (cheader_filename = "gnome-keyring.h")]
+       public static GnomeKeyring.Result unlock_sync (string? keyring, string? password);
+}