[calls] Introduce CallsSecretStore to store credentials
- From: Evangelos Ribeiro Tzaras <devrtz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [calls] Introduce CallsSecretStore to store credentials
- Date: Tue, 20 Jul 2021 10:33:29 +0000 (UTC)
commit c5e4c80a47d332a28adc733fb3a6b60a0414b021
Author: Evangelos Ribeiro Tzaras <evangelos tzaras puri sm>
Date: Thu Jul 8 17:34:40 2021 +0200
Introduce CallsSecretStore to store credentials
src/calls-secret-store.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
src/calls-secret-store.h | 36 ++++++++++++++++++++++++++++++++++++
src/meson.build | 2 ++
3 files changed, 83 insertions(+)
---
diff --git a/src/calls-secret-store.c b/src/calls-secret-store.c
new file mode 100644
index 00000000..802e550d
--- /dev/null
+++ b/src/calls-secret-store.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2021 Purism SPC
+ *
+ * This file is part of Calls.
+ *
+ * Calls is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Calls is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Calls. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Evangelos Ribeiro Tzaras <evangelos tzaras puri sm>
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ *
+ */
+
+#define G_LOG_DOMAIN "CallsSecretStore"
+
+#include "calls-secret-store.h"
+
+#include <libsecret/secret.h>
+
+const SecretSchema *
+calls_secret_get_schema (void)
+{
+ static const SecretSchema schema = {
+ "sm.puri.Calls", SECRET_SCHEMA_NONE,
+ {
+ { CALLS_USERNAME_ATTRIBUTE, SECRET_SCHEMA_ATTRIBUTE_STRING },
+ { CALLS_SERVER_ATTRIBUTE, SECRET_SCHEMA_ATTRIBUTE_STRING },
+ { CALLS_PROTOCOL_ATTRIBUTE, SECRET_SCHEMA_ATTRIBUTE_STRING },
+ { NULL, 0 },
+ }
+ };
+
+ return &schema;
+}
diff --git a/src/calls-secret-store.h b/src/calls-secret-store.h
new file mode 100644
index 00000000..e709c0e0
--- /dev/null
+++ b/src/calls-secret-store.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2021 Purism SPC
+ *
+ * This file is part of Calls.
+ *
+ * Calls is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Calls is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Calls. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Evangelos Ribeiro Tzaras <evangelos tzaras puri sm>
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ *
+ */
+
+#pragma once
+
+#include <libsecret/secret.h>
+
+#define CALLS_USERNAME_ATTRIBUTE "username"
+#define CALLS_SERVER_ATTRIBUTE "server"
+#define CALLS_PROTOCOL_ATTRIBUTE "protocol"
+
+const SecretSchema *calls_secret_get_schema (void) G_GNUC_CONST;
+
+#define CALLS_SECRET_SCHEMA calls_secret_get_schema ()
+
diff --git a/src/meson.build b/src/meson.build
index 290b6e2f..d3ea0887 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -38,6 +38,7 @@ calls_deps = [ dependency('gobject-2.0', version: '>= 2.58'),
dependency('libebook-contacts-1.2'),
dependency('folks'),
dependency('libcallaudio-0.1'),
+ dependency('libsecret-1'),
]
calls_vala_deps = [
@@ -111,6 +112,7 @@ calls_sources = files(['calls-message-source.c', 'calls-message-source.h',
'calls-account-overview.c', 'calls-account-overview.h',
'calls-account-row.c', 'calls-account-row.h',
'calls-settings.c', 'calls-settings.h',
+ 'calls-secret-store.c', 'calls-secret-store.h',
]) + calls_generated_sources
calls_config_data = config_data
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]