annotate lisp/net/secrets.el @ 108510:b9450230de5c

Simplify linker-related logic in src/Makefile.in. * src/Makefile.in (YMF_PASS_LDFLAGS, LD, LINKER): Simplify the logic. (LINKER_WAS_SPECIFIED): Remove.
author Glenn Morris <rgm@gnu.org>
date Tue, 11 May 2010 20:44:36 -0700
parents 9d443ad80849
children feaedf49cc07
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
107389
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
1 ;;; secrets.el --- Client interface to gnome-keyring and kwallet.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
2
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
3 ;; Copyright (C) 2010 Free Software Foundation, Inc.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
4
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
5 ;; Author: Michael Albinus <michael.albinus@gmx.de>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
6 ;; Keywords: comm password passphrase
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
7
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
9
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
12 ;; the Free Software Foundation, either version 3 of the License, or
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
13 ;; (at your option) any later version.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
14
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
18 ;; GNU General Public License for more details.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
19
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
22
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
23 ;;; Commentary:
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
24
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
25 ;; This package provides an implementation of the Secret Service API
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
26 ;; <http://www.freedesktop.org/wiki/Specifications/secret-storage-spec>.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
27 ;; This API is meant to make GNOME-Keyring- and KWallet-like daemons
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
28 ;; available under a common D-BUS interface and thus increase
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
29 ;; interoperability between GNOME, KDE and other applications having
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
30 ;; the need to securely store passwords and other confidential
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
31 ;; information.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
32
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
33 ;; In order to activate this package, you must add the following code
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
34 ;; into your .emacs:
107396
d5de7ba3f80f * net/secrets.el (top): Register the D-Bus signals only when the
Michael Albinus <albinus@detlef>
parents: 107389
diff changeset
35 ;;
d5de7ba3f80f * net/secrets.el (top): Register the D-Bus signals only when the
Michael Albinus <albinus@detlef>
parents: 107389
diff changeset
36 ;; (require 'secrets)
d5de7ba3f80f * net/secrets.el (top): Register the D-Bus signals only when the
Michael Albinus <albinus@detlef>
parents: 107389
diff changeset
37 ;;
107397
6c48d0b283da * net/secrets.el (secrets-enabled): New variable. Use it instead
Michael Albinus <albinus@detlef>
parents: 107396
diff changeset
38 ;; Afterwards, the variable `secrets-enabled' is non-nil when there is
6c48d0b283da * net/secrets.el (secrets-enabled): New variable. Use it instead
Michael Albinus <albinus@detlef>
parents: 107396
diff changeset
39 ;; a daemon providing this interface.
107389
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
40
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
41 ;; The atomic objects to be managed by the Secret Service API are
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
42 ;; secret items, which are something an application wishes to store
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
43 ;; securely. A good example is a password that an application needs
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
44 ;; to save and use at a later date.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
45
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
46 ;; Secret items are grouped in collections. A collection is similar
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
47 ;; in concept to the terms 'keyring' or 'wallet'. A common collection
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
48 ;; is called "login". A collection is stored permanently under the
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
49 ;; user's permissions, and can be accessed in a user session context.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
50
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
51 ;; A collection can have an alias name. The use case for this is to
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
52 ;; set the alias "default" for a given collection, making it
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
53 ;; transparent for clients, which collection is used. Other aliases
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
54 ;; are not supported (yet). Since an alias is visible to all
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
55 ;; applications, this setting shall be performed with care.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
56
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
57 ;; A list of all available collections is available by
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
58 ;;
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
59 ;; (secrets-list-collections)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
60 ;; => ("session" "login" "ssh keys")
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
61
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
62 ;; The "default" alias could be set to the "login" collection by
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
63 ;;
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
64 ;; (secrets-set-alias "login" "default")
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
65
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
66 ;; An alias can also be dereferenced
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
67 ;;
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
68 ;; (secrets-get-alias "default")
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
69 ;; => "login"
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
70
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
71 ;; Collections can be created and deleted. As already said,
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
72 ;; collections are used by different applications. Therefore, those
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
73 ;; operations shall also be performed with care. Common collections,
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
74 ;; like "login", shall not be changed except adding or deleting secret
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
75 ;; items.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
76 ;;
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
77 ;; (secrets-delete-collection "my collection")
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
78 ;; (secrets-create-collection "my collection")
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
79
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
80 ;; There exists a special collection called "session", which has the
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
81 ;; lifetime of the corrresponding client session (aka Emacs'
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
82 ;; lifetime). It is created automatically when Emacs uses the Secret
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
83 ;; Service interface, and it is deleted when Emacs is killed.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
84 ;; Therefore, it can be used to store and retrieve secret items
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
85 ;; temporarily. This shall be preferred over creation of a persistent
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
86 ;; collection, when the information shall not live longer than Emacs.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
87 ;; The session collection can be addressed either by the string
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
88 ;; "session", or by `nil', whenever a collection parameter is needed.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
89
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
90 ;; As already said, a collection is a group of secret items. A secret
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
91 ;; item has a label, the "secret" (which is a string), and a set of
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
92 ;; lookup attributes. The attributes can be used to search and
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
93 ;; retrieve a secret item at a later date.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
94
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
95 ;; A list of all available secret items of a collection is available by
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
96 ;;
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
97 ;; (secrets-list-items "my collection")
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
98 ;; => ("this item" "another item")
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
99
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
100 ;; Secret items can be added or deleted to a collection. In the
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
101 ;; following examples, we use the special collection "session", which
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
102 ;; is bound to Emacs' lifetime.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
103 ;;
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
104 ;; (secrets-delete-item "session" "my item")
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
105 ;; (secrets-create-item "session" "my item" "geheim"
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
106 ;; :user "joe" :host "remote-host")
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
107
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
108 ;; The string "geheim" is the secret of the secret item "my item".
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
109 ;; The secret string can be retrieved from items:
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
110 ;;
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
111 ;; (secrets-get-secret "session" "my item")
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
112 ;; => "geheim"
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
113
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
114 ;; The lookup attributes, which are specified during creation of a
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
115 ;; secret item, must be a key-value pair. Keys are keyword symbols,
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
116 ;; starting with a colon; values are strings. They can be retrieved
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
117 ;; from a given secret item:
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
118 ;;
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
119 ;; (secrets-get-attribute "session" "my item" :host)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
120 ;; => "remote-host"
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
121 ;;
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
122 ;; (secrets-get-attributes "session" "my item")
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
123 ;; => ((:user . "joe") (:host ."remote-host"))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
124
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
125 ;; The lookup attributes can be used for searching of items. If you,
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
126 ;; for example, are looking for all secret items for the user "joe",
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
127 ;; you would perform
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
128 ;;
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
129 ;; (secrets-search-items "session" :user "joe")
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
130 ;; => ("my item" "another item")
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
131
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
132 ;;; Code:
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
133
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
134 ;; It has been tested with GNOME Keyring 2.29.92. An implementation
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
135 ;; for KWallet will be available at
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
136 ;; svn://anonsvn.kde.org/home/kde/trunk/playground/base/ksecretservice;
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
137 ;; not tested yet.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
138
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
139 ;; Pacify byte-compiler. D-Bus support in the Emacs core can be
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
140 ;; disabled with configuration option "--without-dbus". Declare used
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
141 ;; subroutines and variables of `dbus' therefore.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
142 (eval-when-compile
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
143 (require 'cl))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
144
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
145 (declare-function dbus-call-method "dbusbind.c")
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
146 (declare-function dbus-register-signal "dbusbind.c")
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
147 (defvar dbus-debug)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
148
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
149 (require 'dbus)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
150
107397
6c48d0b283da * net/secrets.el (secrets-enabled): New variable. Use it instead
Michael Albinus <albinus@detlef>
parents: 107396
diff changeset
151 (defvar secrets-enabled nil
107447
9d443ad80849 Fix unbalanced parenthesis in secrets.el.
Ted Zlatanov <tzz@lifelogs.com>
parents: 107397
diff changeset
152 "Whether there is a daemon offering the Secret Service API.")
107397
6c48d0b283da * net/secrets.el (secrets-enabled): New variable. Use it instead
Michael Albinus <albinus@detlef>
parents: 107396
diff changeset
153
107389
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
154 (defvar secrets-debug t
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
155 "Write debug messages")
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
156
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
157 (defconst secrets-service "org.freedesktop.secrets"
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
158 "The D-Bus name used to talk to Secret Service.")
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
159
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
160 (defconst secrets-path "/org/freedesktop/secrets"
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
161 "The D-Bus root object path used to talk to Secret Service.")
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
162
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
163 (defconst secrets-empty-path "/"
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
164 "The D-Bus object path representing an empty object.")
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
165
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
166 (defsubst secrets-empty-path (path)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
167 "Check, whether PATH is a valid object path.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
168 It returns t if not."
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
169 (or (not (stringp path))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
170 (string-equal path secrets-empty-path)))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
171
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
172 (defconst secrets-interface-service "org.freedesktop.Secret.Service"
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
173 "The D-Bus interface managing sessions and collections.")
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
174
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
175 ;; <interface name="org.freedesktop.Secret.Service">
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
176 ;; <property name="Collections" type="ao" access="read"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
177 ;; <method name="OpenSession">
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
178 ;; <arg name="algorithm" type="s" direction="in"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
179 ;; <arg name="input" type="v" direction="in"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
180 ;; <arg name="output" type="v" direction="out"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
181 ;; <arg name="result" type="o" direction="out"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
182 ;; </method>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
183 ;; <method name="CreateCollection">
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
184 ;; <arg name="props" type="a{sv}" direction="in"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
185 ;; <arg name="collection" type="o" direction="out"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
186 ;; <arg name="prompt" type="o" direction="out"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
187 ;; </method>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
188 ;; <method name="SearchItems">
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
189 ;; <arg name="attributes" type="a{ss}" direction="in"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
190 ;; <arg name="unlocked" type="ao" direction="out"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
191 ;; <arg name="locked" type="ao" direction="out"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
192 ;; </method>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
193 ;; <method name="Unlock">
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
194 ;; <arg name="objects" type="ao" direction="in"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
195 ;; <arg name="unlocked" type="ao" direction="out"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
196 ;; <arg name="prompt" type="o" direction="out"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
197 ;; </method>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
198 ;; <method name="Lock">
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
199 ;; <arg name="objects" type="ao" direction="in"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
200 ;; <arg name="locked" type="ao" direction="out"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
201 ;; <arg name="Prompt" type="o" direction="out"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
202 ;; </method>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
203 ;; <method name="GetSecrets">
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
204 ;; <arg name="items" type="ao" direction="in"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
205 ;; <arg name="session" type="o" direction="in"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
206 ;; <arg name="secrets" type="a{o(oayay)}" direction="out"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
207 ;; </method>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
208 ;; <method name="ReadAlias">
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
209 ;; <arg name="name" type="s" direction="in"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
210 ;; <arg name="collection" type="o" direction="out"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
211 ;; </method>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
212 ;; <method name="SetAlias">
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
213 ;; <arg name="name" type="s" direction="in"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
214 ;; <arg name="collection" type="o" direction="in"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
215 ;; </method>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
216 ;; <signal name="CollectionCreated">
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
217 ;; <arg name="collection" type="o"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
218 ;; </signal>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
219 ;; <signal name="CollectionDeleted">
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
220 ;; <arg name="collection" type="o"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
221 ;; </signal>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
222 ;; </interface>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
223
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
224 (defconst secrets-interface-collection "org.freedesktop.Secret.Collection"
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
225 "A collection of items containing secrets.")
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
226
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
227 ;; <interface name="org.freedesktop.Secret.Collection">
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
228 ;; <property name="Items" type="ao" access="read"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
229 ;; <property name="Label" type="s" access="readwrite"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
230 ;; <property name="Locked" type="s" access="read"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
231 ;; <property name="Created" type="t" access="read"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
232 ;; <property name="Modified" type="t" access="read"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
233 ;; <method name="Delete">
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
234 ;; <arg name="prompt" type="o" direction="out"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
235 ;; </method>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
236 ;; <method name="SearchItems">
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
237 ;; <arg name="attributes" type="a{ss}" direction="in"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
238 ;; <arg name="results" type="ao" direction="out"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
239 ;; </method>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
240 ;; <method name="CreateItem">
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
241 ;; <arg name="props" type="a{sv}" direction="in"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
242 ;; <arg name="secret" type="(oayay)" direction="in"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
243 ;; <arg name="replace" type="b" direction="in"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
244 ;; <arg name="item" type="o" direction="out"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
245 ;; <arg name="prompt" type="o" direction="out"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
246 ;; </method>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
247 ;; <signal name="ItemCreated">
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
248 ;; <arg name="item" type="o"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
249 ;; </signal>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
250 ;; <signal name="ItemDeleted">
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
251 ;; <arg name="item" type="o"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
252 ;; </signal>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
253 ;; <signal name="ItemChanged">
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
254 ;; <arg name="item" type="o"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
255 ;; </signal>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
256 ;; </interface>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
257
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
258 (defconst secrets-session-collection-path
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
259 "/org/freedesktop/secrets/collection/session"
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
260 "The D-Bus temporary session collection object path.")
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
261
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
262 (defconst secrets-interface-prompt "org.freedesktop.Secret.Prompt"
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
263 "A session tracks state between the service and a client application.")
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
264
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
265 ;; <interface name="org.freedesktop.Secret.Prompt">
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
266 ;; <method name="Prompt">
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
267 ;; <arg name="window-id" type="s" direction="in"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
268 ;; </method>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
269 ;; <method name="Dismiss"></method>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
270 ;; <signal name="Completed">
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
271 ;; <arg name="dismissed" type="b"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
272 ;; <arg name="result" type="v"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
273 ;; </signal>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
274 ;; </interface>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
275
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
276 (defconst secrets-interface-item "org.freedesktop.Secret.Item"
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
277 "A collection of items containing secrets.")
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
278
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
279 ;; <interface name="org.freedesktop.Secret.Item">
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
280 ;; <property name="Locked" type="b" access="read"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
281 ;; <property name="Attributes" type="a{ss}" access="readwrite"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
282 ;; <property name="Label" type="s" access="readwrite"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
283 ;; <property name="Created" type="t" access="read"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
284 ;; <property name="Modified" type="t" access="read"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
285 ;; <method name="Delete">
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
286 ;; <arg name="prompt" type="o" direction="out"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
287 ;; </method>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
288 ;; <method name="GetSecret">
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
289 ;; <arg name="session" type="o" direction="in"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
290 ;; <arg name="secret" type="(oayay)" direction="out"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
291 ;; </method>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
292 ;; <method name="SetSecret">
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
293 ;; <arg name="secret" type="(oayay)" direction="in"/>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
294 ;; </method>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
295 ;; </interface>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
296 ;;
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
297 ;; STRUCT secret
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
298 ;; OBJECT PATH session
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
299 ;; ARRAY BYTE parameters
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
300 ;; ARRAY BYTE value
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
301
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
302 (defconst secrets-interface-item-type-generic "org.freedesktop.Secret.Generic"
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
303 "The default item type we are using.")
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
304
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
305 (defconst secrets-interface-session "org.freedesktop.Secret.Session"
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
306 "A session tracks state between the service and a client application.")
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
307
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
308 ;; <interface name="org.freedesktop.Secret.Session">
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
309 ;; <method name="Close"></method>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
310 ;; </interface>
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
311
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
312 ;;; Sessions.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
313
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
314 (defvar secrets-session-path secrets-empty-path
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
315 "The D-Bus session path of the active session.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
316 A session path `secrets-empty-path' indicates there is no open session.")
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
317
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
318 (defun secrets-close-session ()
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
319 "Close the secret service session, if any."
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
320 (dbus-ignore-errors
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
321 (dbus-call-method
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
322 :session secrets-service secrets-session-path
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
323 secrets-interface-session "Close"))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
324 (setq secrets-session-path secrets-empty-path))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
325
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
326 (defun secrets-open-session (&optional reopen)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
327 "Open a new session with \"plain\" algorithm.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
328 If there exists another active session, and REOPEN is nil, that
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
329 session will be used. The object path of the session will be
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
330 returned, and it will be stored in `secrets-session-path'."
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
331 (when reopen (secrets-close-session))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
332 (when (secrets-empty-path secrets-session-path)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
333 (setq secrets-session-path
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
334 (cadr
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
335 (dbus-call-method
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
336 :session secrets-service secrets-path
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
337 secrets-interface-service "OpenSession" "plain" '(:variant "")))))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
338 (when secrets-debug
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
339 (message "Secret Service session: %s" secrets-session-path))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
340 secrets-session-path)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
341
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
342 ;;; Prompts.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
343
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
344 (defvar secrets-prompt-signal nil
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
345 "Internal variable to catch signals from `secrets-interface-prompt'.")
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
346
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
347 (defun secrets-prompt (prompt)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
348 "Handle the prompt identified by object path PROMPT."
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
349 (unless (secrets-empty-path prompt)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
350 (let ((object
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
351 (dbus-register-signal
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
352 :session secrets-service prompt
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
353 secrets-interface-prompt "Completed" 'secrets-prompt-handler)))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
354 (dbus-call-method
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
355 :session secrets-service prompt
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
356 secrets-interface-prompt "Prompt" (frame-parameter nil 'window-id))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
357 (unwind-protect
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
358 (progn
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
359 ;; Wait until the returned prompt signal has put the
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
360 ;; result into `secrets-prompt-signal'.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
361 (while (null secrets-prompt-signal)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
362 (read-event nil nil 0.1))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
363 ;; Return the object(s). It is a variant, so we must use a car.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
364 (car secrets-prompt-signal))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
365 ;; Cleanup.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
366 (setq secrets-prompt-signal nil)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
367 (dbus-unregister-object object)))))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
368
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
369 (defun secrets-prompt-handler (&rest args)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
370 "Handler for signals emitted by `secrets-interface-prompt'."
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
371 ;; An empty object path is always identified as `secrets-empty-path'
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
372 ;; or `nil'. Either we set it explicitely, or it is returned by the
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
373 ;; "Completed" signal.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
374 (if (car args) ;; dismissed
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
375 (setq secrets-prompt-signal (list secrets-empty-path))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
376 (setq secrets-prompt-signal (cadr args))))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
377
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
378 ;;; Collections.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
379
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
380 (defvar secrets-collection-paths nil
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
381 "Cached D-Bus object paths of available collections.")
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
382
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
383 (defun secrets-collection-handler (&rest args)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
384 "Handler for signals emitted by `secrets-interface-service'."
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
385 (cond
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
386 ((string-equal (dbus-event-member-name last-input-event) "CollectionCreated")
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
387 (add-to-list 'secrets-collection-paths (car args)))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
388 ((string-equal (dbus-event-member-name last-input-event) "CollectionDeleted")
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
389 (setq secrets-collection-paths
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
390 (delete (car args) secrets-collection-paths)))))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
391
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
392 (defun secrets-get-collections ()
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
393 "Return the object paths of all available collections."
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
394 (setq secrets-collection-paths
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
395 (or secrets-collection-paths
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
396 (dbus-get-property
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
397 :session secrets-service secrets-path
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
398 secrets-interface-service "Collections"))))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
399
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
400 (defun secrets-get-collection-properties (collection-path)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
401 "Return all properties of collection identified by COLLECTION-PATH."
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
402 (unless (secrets-empty-path collection-path)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
403 (dbus-get-all-properties
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
404 :session secrets-service collection-path
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
405 secrets-interface-collection)))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
406
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
407 (defun secrets-get-collection-property (collection-path property)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
408 "Return property PROPERTY of collection identified by COLLECTION-PATH."
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
409 (unless (or (secrets-empty-path collection-path) (not (stringp property)))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
410 (dbus-get-property
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
411 :session secrets-service collection-path
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
412 secrets-interface-collection property)))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
413
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
414 (defun secrets-list-collections ()
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
415 "Return a list of collection names."
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
416 (mapcar
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
417 (lambda (collection-path)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
418 (if (string-equal collection-path secrets-session-collection-path)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
419 "session"
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
420 (secrets-get-collection-property collection-path "Label")))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
421 (secrets-get-collections)))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
422
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
423 (defun secrets-collection-path (collection)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
424 "Return the object path of collection labelled COLLECTION.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
425 If COLLECTION is nil, return the session collection path.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
426 If there is no such COLLECTION, return nil."
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
427 (or
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
428 ;; The "session" collection.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
429 (if (or (null collection) (string-equal "session" collection))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
430 secrets-session-collection-path)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
431 ;; Check for an alias.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
432 (let ((collection-path
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
433 (dbus-call-method
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
434 :session secrets-service secrets-path
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
435 secrets-interface-service "ReadAlias" collection)))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
436 (unless (secrets-empty-path collection-path)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
437 collection-path))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
438 ;; Check the collections.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
439 (catch 'collection-found
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
440 (dolist (collection-path (secrets-get-collections) nil)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
441 (when
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
442 (string-equal
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
443 collection
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
444 (secrets-get-collection-property collection-path "Label"))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
445 (throw 'collection-found collection-path))))))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
446
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
447 (defun secrets-create-collection (collection)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
448 "Create collection labelled COLLECTION if it doesn't exist.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
449 Return the D-Bus object path for collection."
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
450 (let ((collection-path (secrets-collection-path collection)))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
451 ;; Create the collection.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
452 (when (secrets-empty-path collection-path)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
453 (setq collection-path
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
454 (secrets-prompt
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
455 (cadr
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
456 ;; "CreateCollection" returns the prompt path as second arg.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
457 (dbus-call-method
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
458 :session secrets-service secrets-path
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
459 secrets-interface-service "CreateCollection"
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
460 `(:array (:dict-entry "Label" (:variant ,collection))))))))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
461 ;; Return object path of the collection.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
462 collection-path))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
463
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
464 (defun secrets-get-alias (alias)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
465 "Return the collection name ALIAS is referencing to.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
466 For the time being, only the alias \"default\" is supported."
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
467 (secrets-get-collection-property
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
468 (dbus-call-method
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
469 :session secrets-service secrets-path
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
470 secrets-interface-service "ReadAlias" alias)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
471 "Label"))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
472
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
473 (defun secrets-set-alias (collection alias)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
474 "Set ALIAS as alias of collection labelled COLLECTION.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
475 For the time being, only the alias \"default\" is supported."
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
476 (let ((collection-path (secrets-collection-path collection)))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
477 (unless (secrets-empty-path collection-path)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
478 (dbus-call-method
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
479 :session secrets-service secrets-path
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
480 secrets-interface-service "SetAlias"
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
481 alias :object-path collection-path))))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
482
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
483 (defun secrets-unlock-collection (collection)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
484 "Unlock collection labelled COLLECTION.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
485 If successful, return the object path of the collection."
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
486 (let ((collection-path (secrets-collection-path collection)))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
487 (unless (secrets-empty-path collection-path)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
488 (secrets-prompt
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
489 (cadr
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
490 (dbus-call-method
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
491 :session secrets-service secrets-path secrets-interface-service
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
492 "Unlock" `(:array :object-path ,collection-path)))))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
493 collection-path))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
494
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
495 (defun secrets-delete-collection (collection)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
496 "Delete collection labelled COLLECTION."
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
497 (let ((collection-path (secrets-collection-path collection)))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
498 (unless (secrets-empty-path collection-path)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
499 (secrets-prompt
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
500 (dbus-call-method
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
501 :session secrets-service collection-path
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
502 secrets-interface-collection "Delete")))))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
503
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
504 ;;; Items.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
505
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
506 (defun secrets-get-items (collection-path)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
507 "Return the object paths of all available items in COLLECTION-PATH."
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
508 (unless (secrets-empty-path collection-path)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
509 (secrets-open-session)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
510 (dbus-get-property
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
511 :session secrets-service collection-path
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
512 secrets-interface-collection "Items")))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
513
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
514 (defun secrets-get-item-properties (item-path)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
515 "Return all properties of item identified by ITEM-PATH."
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
516 (unless (secrets-empty-path item-path)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
517 (dbus-get-all-properties
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
518 :session secrets-service item-path
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
519 secrets-interface-item)))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
520
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
521 (defun secrets-get-item-property (item-path property)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
522 "Return property PROPERTY of item identified by ITEM-PATH."
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
523 (unless (or (secrets-empty-path item-path) (not (stringp property)))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
524 (dbus-get-property
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
525 :session secrets-service item-path
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
526 secrets-interface-item property)))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
527
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
528 (defun secrets-list-items (collection)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
529 "Return a list of all item labels of COLLECTION."
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
530 (let ((collection-path (secrets-unlock-collection collection)))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
531 (unless (secrets-empty-path collection-path)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
532 (mapcar
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
533 (lambda (item-path)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
534 (secrets-get-item-property item-path "Label"))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
535 (secrets-get-items collection-path)))))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
536
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
537 (defun secrets-search-items (collection &rest attributes)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
538 "Search items in COLLECTION with ATTRIBUTES.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
539 ATTRIBUTES are key-value pairs. The keys are keyword symbols,
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
540 starting with a colon. Example:
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
541
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
542 \(secrets-create-item \"Tramp collection\" \"item\" \"geheim\"
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
543 :method \"sudo\" :user \"joe\" :host \"remote-host\"\)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
544
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
545 The object paths of the found items are returned as list."
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
546 (let ((collection-path (secrets-unlock-collection collection))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
547 result props)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
548 (unless (secrets-empty-path collection-path)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
549 ;; Create attributes list.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
550 (while (consp (cdr attributes))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
551 (unless (keywordp (car attributes))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
552 (error 'wrong-type-argument (car attributes)))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
553 (setq props (add-to-list
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
554 'props
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
555 (list :dict-entry
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
556 (symbol-name (car attributes))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
557 (cadr attributes))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
558 'append)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
559 attributes (cddr attributes)))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
560 ;; Search. The result is a list of two lists, the object paths
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
561 ;; of the unlocked and the locked items.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
562 (setq result
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
563 (dbus-call-method
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
564 :session secrets-service collection-path
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
565 secrets-interface-collection "SearchItems"
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
566 (if props
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
567 (cons :array props)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
568 '(:array :signature "{ss}"))))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
569 ;; Return the found items.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
570 (mapcar
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
571 (lambda (item-path) (secrets-get-item-property item-path "Label"))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
572 (append (car result) (cadr result))))))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
573
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
574 (defun secrets-create-item (collection item password &rest attributes)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
575 "Create a new item in COLLECTION with label ITEM and password PASSWORD.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
576 ATTRIBUTES are key-value pairs set for the created item. The
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
577 keys are keyword symbols, starting with a colon. Example:
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
578
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
579 \(secrets-create-item \"Tramp collection\" \"item\" \"geheim\"
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
580 :method \"sudo\" :user \"joe\" :host \"remote-host\"\)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
581
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
582 The object path of the created item is returned."
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
583 (unless (member item (secrets-list-items collection))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
584 (let ((collection-path (secrets-unlock-collection collection))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
585 result props)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
586 (unless (secrets-empty-path collection-path)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
587 ;; Create attributes list.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
588 (while (consp (cdr attributes))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
589 (unless (keywordp (car attributes))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
590 (error 'wrong-type-argument (car attributes)))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
591 (setq props (add-to-list
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
592 'props
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
593 (list :dict-entry
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
594 (symbol-name (car attributes))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
595 (cadr attributes))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
596 'append)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
597 attributes (cddr attributes)))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
598 ;; Create the item.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
599 (setq result
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
600 (dbus-call-method
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
601 :session secrets-service collection-path
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
602 secrets-interface-collection "CreateItem"
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
603 ;; Properties.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
604 (append
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
605 `(:array
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
606 (:dict-entry "Label" (:variant ,item))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
607 (:dict-entry
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
608 "Type" (:variant ,secrets-interface-item-type-generic)))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
609 (when props
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
610 `((:dict-entry
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
611 "Attributes" (:variant ,(append '(:array) props))))))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
612 ;; Secret.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
613 `(:struct :object-path ,secrets-session-path
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
614 (:array :signature "y") ;; no parameters.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
615 ,(dbus-string-to-byte-array password))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
616 ;; Do not replace. Replace does not seem to work.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
617 nil))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
618 (secrets-prompt (cadr result))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
619 ;; Return the object path.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
620 (car result)))))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
621
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
622 (defun secrets-item-path (collection item)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
623 "Return the object path of item labelled ITEM in COLLECTION.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
624 If there is no such item, return nil."
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
625 (let ((collection-path (secrets-unlock-collection collection)))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
626 (catch 'item-found
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
627 (dolist (item-path (secrets-get-items collection-path))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
628 (when (string-equal item (secrets-get-item-property item-path "Label"))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
629 (throw 'item-found item-path))))))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
630
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
631 (defun secrets-get-secret (collection item)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
632 "Return the secret of item labelled ITEM in COLLECTION.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
633 If there is no such item, return nil."
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
634 (let ((item-path (secrets-item-path collection item)))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
635 (unless (secrets-empty-path item-path)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
636 (dbus-byte-array-to-string
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
637 (caddr
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
638 (dbus-call-method
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
639 :session secrets-service item-path secrets-interface-item
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
640 "GetSecret" :object-path secrets-session-path))))))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
641
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
642 (defun secrets-get-attributes (collection item)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
643 "Return the lookup attributes of item labelled ITEM in COLLECTION.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
644 If there is no such item, or the item has no attributes, return nil."
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
645 (unless (stringp collection) (setq collection "default"))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
646 (let ((item-path (secrets-item-path collection item)))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
647 (unless (secrets-empty-path item-path)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
648 (mapcar
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
649 (lambda (attribute) (cons (intern (car attribute)) (cadr attribute)))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
650 (dbus-get-property
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
651 :session secrets-service item-path
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
652 secrets-interface-item "Attributes")))))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
653
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
654 (defun secrets-get-attribute (collection item attribute)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
655 "Return the value of ATTRIBUTE of item labelled ITEM in COLLECTION.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
656 If there is no such item, or the item doesn't own this attribute, return nil."
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
657 (cdr (assoc attribute (secrets-get-attributes collection item))))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
658
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
659 (defun secrets-delete-item (collection item)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
660 "Delete ITEM in COLLECTION."
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
661 (let ((item-path (secrets-item-path collection item)))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
662 (unless (secrets-empty-path item-path)
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
663 (secrets-prompt
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
664 (dbus-call-method
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
665 :session secrets-service item-path
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
666 secrets-interface-item "Delete")))))
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
667
107397
6c48d0b283da * net/secrets.el (secrets-enabled): New variable. Use it instead
Michael Albinus <albinus@detlef>
parents: 107396
diff changeset
668 (when (dbus-ping :session secrets-service 100)
107396
d5de7ba3f80f * net/secrets.el (top): Register the D-Bus signals only when the
Michael Albinus <albinus@detlef>
parents: 107389
diff changeset
669
107397
6c48d0b283da * net/secrets.el (secrets-enabled): New variable. Use it instead
Michael Albinus <albinus@detlef>
parents: 107396
diff changeset
670 ;; We must reset all variables, when there is a new instance of the
6c48d0b283da * net/secrets.el (secrets-enabled): New variable. Use it instead
Michael Albinus <albinus@detlef>
parents: 107396
diff changeset
671 ;; "org.freedesktop.secrets" service.
6c48d0b283da * net/secrets.el (secrets-enabled): New variable. Use it instead
Michael Albinus <albinus@detlef>
parents: 107396
diff changeset
672 (dbus-register-signal
6c48d0b283da * net/secrets.el (secrets-enabled): New variable. Use it instead
Michael Albinus <albinus@detlef>
parents: 107396
diff changeset
673 :session dbus-service-dbus dbus-path-dbus
6c48d0b283da * net/secrets.el (secrets-enabled): New variable. Use it instead
Michael Albinus <albinus@detlef>
parents: 107396
diff changeset
674 dbus-interface-dbus "NameOwnerChanged"
6c48d0b283da * net/secrets.el (secrets-enabled): New variable. Use it instead
Michael Albinus <albinus@detlef>
parents: 107396
diff changeset
675 (lambda (&rest args)
6c48d0b283da * net/secrets.el (secrets-enabled): New variable. Use it instead
Michael Albinus <albinus@detlef>
parents: 107396
diff changeset
676 (when secrets-debug (message "Secret Service has changed: %S" args))
6c48d0b283da * net/secrets.el (secrets-enabled): New variable. Use it instead
Michael Albinus <albinus@detlef>
parents: 107396
diff changeset
677 (setq secrets-session-path secrets-empty-path
6c48d0b283da * net/secrets.el (secrets-enabled): New variable. Use it instead
Michael Albinus <albinus@detlef>
parents: 107396
diff changeset
678 secrets-prompt-signal nil
6c48d0b283da * net/secrets.el (secrets-enabled): New variable. Use it instead
Michael Albinus <albinus@detlef>
parents: 107396
diff changeset
679 secrets-collection-paths nil))
6c48d0b283da * net/secrets.el (secrets-enabled): New variable. Use it instead
Michael Albinus <albinus@detlef>
parents: 107396
diff changeset
680 secrets-service)
107389
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
681
107397
6c48d0b283da * net/secrets.el (secrets-enabled): New variable. Use it instead
Michael Albinus <albinus@detlef>
parents: 107396
diff changeset
682 ;; We want to refresh our cache, when there is a change in
6c48d0b283da * net/secrets.el (secrets-enabled): New variable. Use it instead
Michael Albinus <albinus@detlef>
parents: 107396
diff changeset
683 ;; collections.
6c48d0b283da * net/secrets.el (secrets-enabled): New variable. Use it instead
Michael Albinus <albinus@detlef>
parents: 107396
diff changeset
684 (dbus-register-signal
6c48d0b283da * net/secrets.el (secrets-enabled): New variable. Use it instead
Michael Albinus <albinus@detlef>
parents: 107396
diff changeset
685 :session secrets-service secrets-path
6c48d0b283da * net/secrets.el (secrets-enabled): New variable. Use it instead
Michael Albinus <albinus@detlef>
parents: 107396
diff changeset
686 secrets-interface-service "CollectionCreated"
6c48d0b283da * net/secrets.el (secrets-enabled): New variable. Use it instead
Michael Albinus <albinus@detlef>
parents: 107396
diff changeset
687 'secrets-collection-handler)
107389
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
688
107397
6c48d0b283da * net/secrets.el (secrets-enabled): New variable. Use it instead
Michael Albinus <albinus@detlef>
parents: 107396
diff changeset
689 (dbus-register-signal
6c48d0b283da * net/secrets.el (secrets-enabled): New variable. Use it instead
Michael Albinus <albinus@detlef>
parents: 107396
diff changeset
690 :session secrets-service secrets-path
6c48d0b283da * net/secrets.el (secrets-enabled): New variable. Use it instead
Michael Albinus <albinus@detlef>
parents: 107396
diff changeset
691 secrets-interface-service "CollectionDeleted"
6c48d0b283da * net/secrets.el (secrets-enabled): New variable. Use it instead
Michael Albinus <albinus@detlef>
parents: 107396
diff changeset
692 'secrets-collection-handler)
107396
d5de7ba3f80f * net/secrets.el (top): Register the D-Bus signals only when the
Michael Albinus <albinus@detlef>
parents: 107389
diff changeset
693
107397
6c48d0b283da * net/secrets.el (secrets-enabled): New variable. Use it instead
Michael Albinus <albinus@detlef>
parents: 107396
diff changeset
694 ;; We shall inform, whether the secret service is enabled on this
6c48d0b283da * net/secrets.el (secrets-enabled): New variable. Use it instead
Michael Albinus <albinus@detlef>
parents: 107396
diff changeset
695 ;; machine.
107447
9d443ad80849 Fix unbalanced parenthesis in secrets.el.
Ted Zlatanov <tzz@lifelogs.com>
parents: 107397
diff changeset
696 (setq secrets-enabled t))
107396
d5de7ba3f80f * net/secrets.el (top): Register the D-Bus signals only when the
Michael Albinus <albinus@detlef>
parents: 107389
diff changeset
697
107397
6c48d0b283da * net/secrets.el (secrets-enabled): New variable. Use it instead
Michael Albinus <albinus@detlef>
parents: 107396
diff changeset
698 (provide 'secrets)
107389
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
699
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
700 ;;; TODO:
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
701
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
702 ;; * secrets-debug should be structured like auth-source-debug to
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
703 ;; prevent leaking sensitive information. Right now I don't see
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
704 ;; anything sensitive though.
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
705 ;; * Check, whether the dh-ietf1024-aes128-cbc-pkcs7 algorithm can be
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
706 ;; used for the transfer of the secrets. Currently, we use the
51ddd70d1fa1 * etc/NEWS: Add secrets.el.
Michael Albinus <albinus@detlef>
parents:
diff changeset
707 ;; plain algorithm.