Skip to content

Commit b82976e

Browse files
Merge pull request #4 from brotskydotcom/next
Update to keyring-core v0.7. Also tweak the module docs.
2 parents acbb2b1 + a4dbe25 commit b82976e

File tree

4 files changed

+15
-18
lines changed

4 files changed

+15
-18
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ edition = "2024"
1616
name = "example"
1717

1818
[dependencies]
19-
keyring-core = { version = "0.5"}
19+
keyring-core = { version = "0.7" }
2020
linux-keyutils = { version = "0.2.4", features = ["std"] }
2121

2222
[dev-dependencies]

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ This library provides a credential store for use with the [keyring ecosystem](ht
66

77
## Usage
88

9-
To use this keychain-compatible credential store provider, you must take a dependency on the [keyring-core crate](https://crates.io/crates/keyring-core) and on [this crate](https://crates.io/crates/linux-keyutils-keyring-store). Then you can instantiate a credential store and set it as your default credential store as shown in the [sample program](examples/example.rs) in this crate.
9+
To use this keychain-compatible credential store provider, you must take a dependency on the [keyring-core crate](https://crates.io/crates/keyring-core) and on [this crate](https://crates.io/crates/linux-keyutils-keyring-store). Then you can instantiate a credential store and set it as your default credential store as shown in the [sample program](https://github.com/open-source-cooperative/linux-keyutils-keyring-store/blob/main/examples/example.rs) in this crate.
10+
11+
## Changelog
12+
13+
See the [release history on GitHub](https://github.com/open-source-cooperative/linux-keyutils-keyring-store/releases) for full details.
1014

1115
## License
1216

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ delimiter string in the service string.
3232
# Attributes
3333
3434
There is no notion of attribute other than the description supported by keyutils,
35-
so the [get_attributes](keyring::Entry::get_attributes)
36-
and [update_attributes](keyring::Entry::update_attributes)
35+
so the [get_attributes](keyring_core::Entry::get_attributes)
36+
and [update_attributes](keyring_core::Entry::update_attributes)
3737
calls are both no-ops for this credential store.
3838
3939
# Persistence

src/store.rs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ use std::fmt::Formatter;
33
use std::sync::Arc;
44
use std::time::{SystemTime, UNIX_EPOCH};
55

6-
use keyring_core::Entry;
76
use keyring_core::api::{CredentialPersistence, CredentialStoreApi};
87
use keyring_core::attributes::parse_attributes;
9-
use keyring_core::error::{Error, Result};
8+
use keyring_core::{Entry, Result};
109

1110
use super::Cred;
1211

@@ -38,7 +37,7 @@ impl Store {
3837
/// the config option `service_no_divider` to `true`.
3938
pub fn new_with_configuration(config: &HashMap<&str, &str>) -> Result<Arc<Self>> {
4039
let config = parse_attributes(
41-
&["prefix", "divider", "suffix", "service_no_divider"],
40+
&["prefix", "divider", "suffix", "*service_no_divider"],
4241
Some(config),
4342
)?;
4443
let prefix = config
@@ -56,17 +55,11 @@ impl Store {
5655
.map(|s| s.as_str())
5756
.unwrap_or("")
5857
.to_string();
59-
let service_no_divider = match config.get("service_no_divider").map(|s| s.as_str()) {
60-
None => false,
61-
Some("true") => true,
62-
Some("false") => false,
63-
Some(_) => {
64-
return Err(Error::Invalid(
65-
"service_no_divider".to_string(),
66-
"must be true or false".to_string(),
67-
));
68-
}
69-
};
58+
let service_no_divider = config
59+
.get("service_no_divider")
60+
.map(|s| s.as_str())
61+
.unwrap_or("false")
62+
.eq("true");
7063
Ok(Self::new_internal(
7164
[prefix, divider, suffix],
7265
service_no_divider,

0 commit comments

Comments
 (0)