aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeodor Zlatanov2012-04-05 13:55:55 +0000
committerKatsumi Yamaoka2012-04-05 13:55:55 +0000
commitca2c89b638e8a3f04bab427262b83d616b2ccba1 (patch)
treeb400488c813160171e63a85547859ebd9dc1393a
parent0a0a3573ec4454519ebfaf33f1742003a0b8a5a0 (diff)
downloademacs-ca2c89b638e8a3f04bab427262b83d616b2ccba1.tar.gz
emacs-ca2c89b638e8a3f04bab427262b83d616b2ccba1.zip
auth.texi (Secret Service API): Edit further and give examples.
-rw-r--r--doc/misc/ChangeLog4
-rw-r--r--doc/misc/auth.texi110
2 files changed, 68 insertions, 46 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index 525b03e929d..f6260ecc4ab 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,3 +1,7 @@
12012-04-05 Teodor Zlatanov <tzz@lifelogs.com>
2
3 * auth.texi (Secret Service API): Edit further and give examples.
4
12012-04-04 Glenn Morris <rgm@gnu.org> 52012-04-04 Glenn Morris <rgm@gnu.org>
2 6
3 * auth.texi (Secret Service API): Copyedits. 7 * auth.texi (Secret Service API): Copyedits.
diff --git a/doc/misc/auth.texi b/doc/misc/auth.texi
index 83975659405..bb413ad138b 100644
--- a/doc/misc/auth.texi
+++ b/doc/misc/auth.texi
@@ -229,13 +229,14 @@ necessary if you have an unusual (see earlier comment on those) setup.
229 229
230The @dfn{Secret Service API} is a standard from 230The @dfn{Secret Service API} is a standard from
231@uref{http://www.freedesktop.org/wiki/Specifications/secret-storage-spec,,freedesktop.org} 231@uref{http://www.freedesktop.org/wiki/Specifications/secret-storage-spec,,freedesktop.org}
232to securely store passwords and other confidential information. 232to securely store passwords and other confidential information. This
233Implementations of compliant daemons are the GNOME Keyring and the KDE 233API is implemented by system daemons such as the GNOME Keyring and the
234Wallet. 234KDE Wallet (these are GNOME and KDE packages respectively and should
235be available on most modern GNU/Linux systems).
235 236
236The auth-source library uses the @file{secrets.el} library as an 237The auth-source library uses the @file{secrets.el} library to connect
237interface to this feature. You can also use that library in other 238through the Secret Service API. You can also use that library in
238packages. 239other packages, it's not exclusive to auth-source.
239 240
240@defvar secrets-enabled 241@defvar secrets-enabled
241After loading @file{secrets.el}, a non-@code{nil} value of this 242After loading @file{secrets.el}, a non-@code{nil} value of this
@@ -244,63 +245,60 @@ Service API.
244@end defvar 245@end defvar
245 246
246@deffn Command secrets-show-secrets 247@deffn Command secrets-show-secrets
247This command inspects all collections, items, and their attributes. 248This command shows all collections, items, and their attributes.
248@end deffn 249@end deffn
249 250
250The atomic objects to be managed by the Secret Service API are 251The atomic objects managed by the Secret Service API are @dfn{secret
251@dfn{secret items}, which are something an application wishes to store 252items}, which contain things an application wishes to store securely,
252securely. A good example is a password that an application needs to 253like a password. Secret items have a label (a name), the @dfn{secret}
253save and use at a later date. 254(which is the string we want, like a password), and a set of lookup
255attributes. The attributes can be used to search and retrieve a
256secret item at a later date.
254 257
255Secret items are grouped in @dfn{collections}. A collection is 258Secret items are grouped in @dfn{collections}. A collection is
256similar in concept to the terms @samp{keyring} or @samp{wallet}. A 259sometimes called a @samp{keyring} or @samp{wallet} in GNOME Keyring
257common collection is called @samp{"login"}. A collection is stored 260and KDE Wallet but it's the same thing, a group of secrets.
258permanently under the user's permissions, and can be accessed in a 261Collections are personal and protected so only the owner can open them.
259user session context.
260 262
261A collection can have an alias name. The use case for this is to 263The most common collection is called @samp{login}.
262set the alias @samp{"default"} for a given collection, making it 264
263transparent to clients as to which collection is used. Other aliases 265A collection can have an alias. The alias @samp{default} is
264are not supported (yet). Since an alias is visible to all 266commonly used so the clients don't have to know the specific name of
265applications, this setting should be performed with care. 267the collection they open. Other aliases are not supported yet.
268Since aliases are globally accessible, set the @samp{default} alias
269only when you're sure it's appropriate.
266 270
267@defun secrets-list-collections 271@defun secrets-list-collections
268This function returns a list of collection names. 272This function returns all the collection names as a list.
269@end defun 273@end defun
270 274
271@defun secrets-set-alias collection alias 275@defun secrets-set-alias collection alias
272Set @var{alias} as alias of collection labeled @var{collection}. 276Set @var{alias} as alias of collection labeled @var{collection}.
273For the time being, only the alias @samp{"default"} is supported. 277Currently only the alias @samp{default} is supported.
274@end defun 278@end defun
275 279
276@defun secrets-get-alias alias 280@defun secrets-get-alias alias
277Return the collection name @var{alias} is referencing to. 281Return the collection name @var{alias} is referencing to.
278For the time being, only the alias @samp{"default"} is supported. 282Currently only the alias @samp{default} is supported.
279@end defun 283@end defun
280 284
281Collections can be created and deleted by the functions 285Collections can be created and deleted by the functions
282@code{secrets-create-collection} and @code{secrets-delete-collection}. 286@code{secrets-create-collection} and @code{secrets-delete-collection}.
283Usually, this is not applied from within Emacs. Common collections, 287Usually, this is not done from within Emacs. Do not delete standard
284like @samp{"login"}, should never be deleted. 288collections such as @samp{login}.
285 289
286There exists a special collection called @samp{"session"}, which has 290The special collection @samp{session} exists for the lifetime of the
287the lifetime of the corresponding client session (aka Emacs's 291corresponding client session (in our case, Emacs's lifetime). It is
288lifetime). It is created automatically when Emacs uses the Secret 292created automatically when Emacs uses the Secret Service interface and
289Service interface, and it is deleted when Emacs is killed. Therefore, 293it is deleted when Emacs is killed. Therefore, it can be used to
290it can be used to store and retrieve secret items temporarily. This 294store and retrieve secret items temporarily. The @samp{session}
291should be preferred over creation of a persistent collection, when the 295collection is better than a persistent collection when the secret
292information should not live longer than Emacs. The session collection 296items should not live longer than Emacs. The session collection can
293can be addressed either by the string @samp{"session"}, or by 297be specified either by the string @samp{session}, or by @code{nil},
294@code{nil}, whenever a collection parameter is needed in the following 298whenever a collection parameter is needed in the following functions.
295functions.
296
297As already said, a collection is a group of secret items. A secret
298item has a label, the @dfn{secret} (which is a string), and a set of
299lookup attributes. The attributes can be used to search and retrieve
300a secret item at a later date.
301 299
302@defun secrets-list-items collection 300@defun secrets-list-items collection
303Returns a list of all item labels of @var{collection}. 301Returns all the item labels of @var{collection} as a list.
304@end defun 302@end defun
305 303
306@defun secrets-create-item collection item password &rest attributes 304@defun secrets-create-item collection item password &rest attributes
@@ -310,6 +308,8 @@ key-value pairs set for the created item. The keys are keyword
310symbols, starting with a colon. Example: 308symbols, starting with a colon. Example:
311 309
312@example 310@example
311;;; The session "session", the label is "my item"
312;;; and the secret (password) is "geheim"
313(secrets-create-item "session" "my item" "geheim" 313(secrets-create-item "session" "my item" "geheim"
314 :method "sudo" :user "joe" :host "remote-host") 314 :method "sudo" :user "joe" :host "remote-host")
315@end example 315@end example
@@ -327,7 +327,7 @@ This function deletes item @var{item} in @var{collection}.
327The lookup attributes, which are specified during creation of a 327The lookup attributes, which are specified during creation of a
328secret item, must be a key-value pair. Keys are keyword symbols, 328secret item, must be a key-value pair. Keys are keyword symbols,
329starting with a colon; values are strings. They can be retrieved 329starting with a colon; values are strings. They can be retrieved
330from a given secret item, and they can be used for searching of items. 330from a given secret item and they can be used for searching of items.
331 331
332@defun secrets-get-attribute collection item attribute 332@defun secrets-get-attribute collection item attribute
333Returns the value of key @var{attribute} of item labeled @var{item} in 333Returns the value of key @var{attribute} of item labeled @var{item} in
@@ -347,9 +347,9 @@ attributes, it returns @code{nil}. Example:
347@end defun 347@end defun
348 348
349@defun secrets-search-items collection &rest attributes 349@defun secrets-search-items collection &rest attributes
350Search items in @var{collection} with @var{attributes}. 350Search for the items in @var{collection} with matching
351@var{attributes} are key-value pairs, as used in 351@var{attributes}. The @var{attributes} are key-value pairs, as used
352@code{secrets-create-item}. Example: 352in @code{secrets-create-item}. Example:
353 353
354@example 354@example
355(secrets-search-items "session" :user "joe") 355(secrets-search-items "session" :user "joe")
@@ -357,6 +357,24 @@ Search items in @var{collection} with @var{attributes}.
357@end example 357@end example
358@end defun 358@end defun
359 359
360The auth-source library uses the @file{secrets.el} library and thus
361the Secret Service API when you specify a source matching
362@samp{secrets:COLLECTION}. For instance, you could use
363@samp{secrets:session} to use the @samp{session} collection, open only
364for the lifetime of Emacs. Or you could use @samp{secrets:Login} to
365open the @samp{Login} collection. As a special case, you can use the
366symbol @code{default} in @code{auth-sources} (not a string, but a
367symbol) to specify the @samp{default} alias. Here is a contrived
368example that sets @code{auth-sources} to search three collections and
369then fall back to @file{~/.authinfo.gpg}.
370
371@example
372(setq auth-sources '(default
373 "secrets:session"
374 "secrets:Login"
375 "~/.authinfo.gpg"))
376@end example
377
360@node Help for developers 378@node Help for developers
361@chapter Help for developers 379@chapter Help for developers
362 380