1
1
## Keyring-rs
2
- [ ![ CI] ( https://github.com/hwchen/keyring-rs/actions/workflows/build.yaml/badge.svg )] ( https://github.com/hwchen/keyring-rs/actions?query=workflow%3Abuild )
3
- [ ![ Crates.io] ( https://img.shields.io/crates/v/keyring.svg?style=flat-square )] ( https://crates.io/crates/keyring )
4
- [ ![ API Documentation on docs.rs] ( https://docs.rs/keyring/badge.svg )] ( https://docs.rs/keyring )
2
+ [ ![ build] ( https://github.com/hwchen/keyring-rs/actions/workflows/build.yaml/badge.svg )] ( https://github.com/hwchen/keyring-rs/actions )
3
+ [ ![ dependencies] ( https://deps.rs/repo/github/hwchen/keyring-rs/status.svg )] ( https://github.com/hwchen/keyring-rs )
4
+ [ ![ crates.io] ( https://img.shields.io/crates/v/keyring.svg?style=flat-square )] ( https://crates.io/crates/keyring )
5
+ [ ![ docs.rs] ( https://docs.rs/keyring/badge.svg )] ( https://docs.rs/keyring )
5
6
6
7
A cross-platform library to manage storage and retrieval of passwords
7
8
(and other secrets) in the underlying platform secure store,
8
9
with a fully-developed example that provides a command-line interface.
9
10
10
11
## Usage
11
12
12
- ** Currently supports Linux, iOS, macOS, and Windows.**
13
- Please file issues if you have have questions or problems.
14
-
15
13
To use this library in your project add the following to your ` Cargo.toml ` file:
16
14
17
15
``` toml
@@ -26,11 +24,7 @@ and a user name which together identify the entry.
26
24
27
25
Passwords can be added to an entry using its ` set_password ` method.
28
26
They can then be read back using the ` get_password ` method,
29
- and removed using the ` delete_password ` method.
30
- (The persistence of the ` Entry ` is determined via Rust rules,
31
- so deleting the password doesn't delete the entry,
32
- but it does delete the underlying platform credential
33
- which is used to store the password.)
27
+ and removed using the ` delete_password ` method.
34
28
35
29
``` rust
36
30
use keyring :: {Entry , Result };
@@ -57,16 +51,12 @@ underlying platform errors or more information about what went wrong.
57
51
The keychain-rs project contains a sample application (` cli ` )
58
52
and a sample library (` ios ` ).
59
53
60
- The application is a command-line interface to the keyring.
54
+ The ` cli ` application is a command-line interface to the keyring.
61
55
It can be used to explore how the library is used.
62
56
It can also be used in debugging keyring-based applications
63
57
to probe the contents of the credential store.
64
- When run in "singly verbose" mode (-v),
65
- it outputs the retrieved credentials on each ` get ` run.
66
- When run in "doubly verbose" mode (-vv),
67
- it also outputs any errors returned.
68
58
69
- The sample library is a full exercise of all the iOS functionality;
59
+ The ` ios ` library is a full exercise of all the iOS functionality;
70
60
it's meant to be loaded into an iOS test harness
71
61
such as the one found in
72
62
[ this project] ( https://github.com/brotskydotcom/rust-on-ios ) .
@@ -75,23 +65,55 @@ doing so doesn't provide any advantages over the standard macOS tests.
75
65
76
66
## Client Testing
77
67
78
- This crate comes with a " mock" credential store
68
+ This crate comes with a mock credential store
79
69
that can be used by clients who want to test
80
70
without accessing the native platform store.
81
71
The mock store is cross-platform
82
72
and allows mocking errors as well as successes.
83
73
84
74
## Extensibility
85
75
86
- This crate comes with built-in support for the keychain on Mac,
87
- the credential manager on Windows,
88
- and both secret-service and the kernel keyutils on Linux.
89
- But it's also designed to allow clients
90
- to "bring their own credential stores"
76
+ This crate allows clients
77
+ to "bring their own credential store"
91
78
by providing traits that clients can implement.
92
79
See the [ developer docs] ( https://docs.rs/keyring/latest/keyring/ )
93
80
for details.
94
81
82
+ ## Platforms
83
+
84
+ This crate provides secure storage support for
85
+ Linux (secret-service and kernel keyutils),
86
+ iOS (keychain), macOS (keychain),
87
+ and Windows (credential manager).
88
+
89
+ It also builds on FreeBSD (secret-service),
90
+ and probably works there,
91
+ but since neither the maintainers nor GitHub do
92
+ building and testing on FreeBSD, we can't be sure.
93
+
94
+ Please file issues if you have questions or problems.
95
+
96
+ ## Upgrading from v1
97
+
98
+ The v2 release,
99
+ although it adds a lot of functionality relative to v1,
100
+ is fully compatible with respect to persisted entry data:
101
+ it will both read and set passwords on entries that were
102
+ originally written by v1, and entries written
103
+ by v2 will be readable and updatable by v1.
104
+
105
+ From a client API point of view, the biggest difference
106
+ between v2 and v1 is that entry creation using ` Entry::new `
107
+ and ` Entry::new_with_target ` can now fail, so v1 client
108
+ code will need to add an ` unwrap ` or other error handling
109
+ in order to work with v2.
110
+
111
+ There are also new ` Error ` variants in v2, and the enum
112
+ has been declared non-exhaustive (to allow for variants
113
+ to be added without breaking client code).
114
+ This means that v1 client code that relies on exhaustive
115
+ matching will need to be updated.
116
+
95
117
## License
96
118
97
119
Licensed under either of
@@ -123,6 +145,7 @@ whether through contributing code, discussion, or bug reports!
123
145
- @MaikKlein
124
146
- @Phrohdoh
125
147
- @Rukenshia
148
+ - @ryanavella
126
149
- @samuela
127
150
- @stankec
128
151
- @steveatinfincia
0 commit comments