keyring_core/sample/
mod.rs

1/*!
2
3# Sample Credential Store
4
5This sample store is provided for two purposes:
6
7- It provides a cross-platform way to test your client code during development.
8  (To help with this, all of its internal structures are public.)
9- It provides a template for developers who want to write credential stores.
10  (The tests as well as the source structure can be adapted.)
11
12This store is explicitly *not* for use in production apps! It's neither robust
13nor secure.
14
15# Persistence
16
17When creating an instance of this store, you specify whether you want to use a
18"backing file" to store credentials between runs (or to make them available to
19other applications). If you don't specify a backing file, this is an in-memory
20store only, and the credentials vanish when your application terminates.
21
22The "backing file" is _not_ kept up to date as credentials are created, deleted,
23or modified! The in-memory credentials are only saved to the backing file when
24explicitly requested or when a store is destroyed (that is, the last reference
25to it is released). The backing file is only read when a store is first created.
26(To read a backing file, you have to create a new store.)
27
28# Ambiguity
29
30This store supports ambiguity, that is, the ability to create
31multiple credentials associated with the same service name
32and username. If you specify the `force-create` modifier when
33creating an entry, a new credential with an empty password
34will be created immediately for the specified service name and username.
35
36* If there was _not_ an existing credential for your service name
37  and username, then the newly created credential will be the
38  only one, so the returned entry will not be ambiguous.
39* If there _was_ an existing credential for your service name and username,
40  then the returned entry will be ambiguous.
41
42In all cases, the use of the `force-create` modifier will cause
43the created credential to have two additional attributes:
44
45* *creation-date*, an HTTP-style date showing when the
46  credential was created. This cannot be updated, nor
47  can it be added to credentials that don't have it.
48* *comment*, the string value of the `target` modifier.
49  This can be updated, and it can be added to credentials
50  that don't have it.
51
52# Attributes
53
54Credentials in this store, in addition to the attributes
55described in the section on Ambiguity above, have
56a single read-only attribute `uuid` which is the
57unique ID of the credential in the store.
58
59# Search
60
61This store implements credential search. Specs can specify
62desired regular expressions for the `service` and `user` a
63credential is attached to, and for the `comment` and `uuid` attributes
64of the credential itself. (All other key/value pairs in the spec
65are ignored.) Credentials are returned only if _all_ the
66specified regular expressions match against its values.
67
68Note: Search is implemented by iterating over every credential
69in the store. This is an in-memory store, so it happens
70pretty quickly.
71
72 */
73
74pub mod credential;
75pub use credential::CredKey;
76
77pub mod store;
78pub use store::Store;
79
80#[cfg(test)]
81mod test;