Skip to content

Commit 0fff59b

Browse files
committed
Ready the next release.
CLI: Better help and output wording. Changelog update. Bump version to 3.3.0. Tweak typos and clarity of docs.
1 parent 165fc8e commit 0fff59b

File tree

8 files changed

+51
-23
lines changed

8 files changed

+51
-23
lines changed

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
## Version 3.3.0
2+
- Add support for credential-store attributes other than those used by this crate. This allows the creation of credentials that are more compatible with 3rd-party clients, such as the OS-provided GUIs over credentials.
3+
- Make the textual descriptions of entries consistently follow the form `user@service` (or `user@service:target` if a target was specified).
4+
5+
## Version 3.2.1
6+
- Re-enable access to v1 credentials. The fixes of version 3.2 meant that legacy credentials with no target attribute couldn't be accessed.
7+
8+
## Version 3.2.0
9+
- Improve secret-service handling of targets, so that searches on locked items distinguish items with different targets properly.
10+
11+
## Version 3.1.0
12+
- enhance the CLI to allow empty user names and better info about `Ambiguous` credentials.
13+
14+
## Version 3.0.5
15+
- updated docs and clean up dead code. No code changes.
16+
17+
## Version 3.0.4
18+
- expose a cross-platform module alias via the `default` module.
19+
20+
## Version 3.0.3
21+
- fix feature `linux-native`, which was causing compile errors.
22+
123
## Version 3.0.2
224
- add missing implementations for iOS `set_secret` and `get_secret`
325

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ keywords = ["password", "credential", "keychain", "keyring", "cross-platform"]
66
license = "MIT OR Apache-2.0"
77
name = "keyring"
88
repository = "https://github.com/hwchen/keyring-rs.git"
9-
version = "3.2.1"
9+
version = "3.3.0"
1010
rust-version = "1.75"
1111
edition = "2021"
1212
exclude = [".github/"]
@@ -64,6 +64,7 @@ path = "examples/cli.rs"
6464
base64 = "0.22"
6565
clap = { version = "4", features = ["derive", "wrap_help"] }
6666
rpassword = "7"
67+
rprompt = "2"
6768
rand = "0.8"
6869
doc-comment = "0.3"
6970
whoami = "1"

build-xplat-docs.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
cargo doc --no-deps --target aarch64-unknown-linux-musl $OPEN_DOCS
3-
cargo doc --no-deps --target aarch64-pc-windows-msvc $OPEN_DOCS
4-
cargo doc --no-deps --target aarch64-apple-darwin $OPEN_DOCS
5-
cargo doc --no-deps --target aarch64-apple-ios $OPEN_DOCS
2+
cargo doc --no-deps --features=linux-native --target aarch64-unknown-linux-musl $OPEN_DOCS
3+
cargo doc --no-deps --features=windows-native --target aarch64-pc-windows-msvc $OPEN_DOCS
4+
cargo doc --no-deps --features=apple-native --target aarch64-apple-darwin $OPEN_DOCS
5+
cargo doc --no-deps --features=apple-native --target aarch64-apple-ios $OPEN_DOCS

examples/cli.rs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ pub enum Command {
107107

108108
#[clap(value_parser)]
109109
/// The input to parse. If not specified, it will be
110-
/// read interactively (without echo) from the terminal.
110+
/// read interactively from the terminal. Password/secret
111+
/// input will not be echoed.
111112
input: Option<String>,
112113
},
113114
/// Retrieve the (string) password from the secure store
@@ -123,18 +124,20 @@ pub enum Command {
123124
}
124125

125126
#[derive(Debug, Args)]
126-
#[group(multiple = false)]
127+
#[group(multiple = false, required = true)]
127128
pub struct What {
128-
#[clap(short, long, action)]
129-
// The input is a password.
129+
#[clap(short, long, action, help = "The input is a password")]
130130
password: bool,
131131

132-
#[clap(short, long, action)]
133-
// The input is a base64-encoded secret.
132+
#[clap(short, long, action, help = "The input is a base64-encoded secret")]
134133
secret: bool,
135134

136-
#[clap(short, long, action)]
137-
// The input is comma-separated, key=val attribute pairs.
135+
#[clap(
136+
short,
137+
long,
138+
action,
139+
help = "The input is comma-separated, key=val attribute pairs"
140+
)]
138141
attributes: bool,
139142
}
140143

@@ -148,7 +151,7 @@ enum Value {
148151
impl Cli {
149152
fn description(&self) -> String {
150153
if let Some(target) = &self.target {
151-
format!("[{target}]{}@{}", &self.user, &self.service)
154+
format!("{}@{}:{target}", &self.user, &self.service)
152155
} else {
153156
format!("{}@{}", &self.user, &self.service)
154157
}
@@ -209,7 +212,7 @@ impl Cli {
209212
eprintln!("Set password for '{description}' to '{password}'");
210213
}
211214
Value::Attributes(attributes) => {
212-
eprintln!("Set attributes for '{description}' to:");
215+
eprintln!("The following attributes for '{description}' were sent for update:");
213216
eprint_attributes(attributes);
214217
}
215218
_ => panic!("Can't set without a value"),
@@ -248,7 +251,7 @@ impl Cli {
248251

249252
fn get_password_and_attributes(&self) -> Value {
250253
if let Command::Set { what, input } = &self.command {
251-
if what.password || (!what.secret && !what.attributes) {
254+
if what.password {
252255
Value::Password(read_password(input))
253256
} else if what.secret {
254257
Value::Secret(decode_secret(input))
@@ -313,7 +316,7 @@ fn parse_attributes(input: &Option<String>) -> HashMap<String, String> {
313316
let input = if let Some(input) = input {
314317
input.clone()
315318
} else {
316-
rpassword::prompt_password("Attributes: ").unwrap_or_else(|_| String::new())
319+
rprompt::prompt_reply("Attributes: ").unwrap_or_else(|_| String::new())
317320
};
318321
if input.is_empty() {
319322
eprintln!("You must specify at least one key=value attribute pair to set")

src/keyutils.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ an explicit `target`, that value is used as the keyutils description. Otherwise
1212
`keyring-rs:user@service` is used (where user and service come from the entry creation call).
1313
1414
There is no notion of attribute other than the description supported by keyutils,
15-
so the [get_attributes](Entry::get_attributes) and [update_attributes](Entry::update_attributes)
15+
so the [get_attributes](crate::Entry::get_attributes)
16+
and [update_attributes](crate::Entry::update_attributes)
1617
calls are both no-ops for this credential store.
1718
1819
# Persistence

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ then retrieving that as a password will return a
148148
[BadEncoding](Error::BadEncoding) error.
149149
The returned error will have the raw bytes attached,
150150
so you can access them, but you can also just fetch
151-
them directly using [get_secret](Entry::get_password) rather than
152-
[get_password](Entry::get_secret).
151+
them directly using [get_secret](Entry::get_secret) rather than
152+
[get_password](Entry::get_password).
153153
154154
While this crate's code is thread-safe, the underlying credential
155155
stores may not handle access from different threads reliably.

src/secret_service.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ In addition, when creating a new credential, this implementation assigns
1313
two additional attributes:
1414
1515
- `application` (set to `rust-keyring-client`)
16-
- `label` (set to a string with the user, service, and keyring version at time of creation)
16+
- `label` (set to a string with the user, service, target, and keyring version at time of creation)
1717
1818
Client code is allowed to retrieve and to set all attributes _except_ the
1919
three that are controlled by this implementation. (N.B. The `label` string

src/windows.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ So if you have a custom algorithm you want to use for computing the Windows targ
2121
you can specify the target name directly. (You still need to provide a service and username,
2222
because they are used in the credential's metadata.)
2323
24-
The [get_attributes](Entry::get_attributes)
24+
The [get_attributes](crate::Entry::get_attributes)
2525
call will return the values in the `username`, `comment`, and `target_alias` fields
26-
(using those strings as the attribute names), and the [update_attributes](Entry::update_attributes)
26+
(using those strings as the attribute names),
27+
and the [update_attributes](crate::Entry::update_attributes)
2728
call allows setting those fields.
2829
2930
## Caveat

0 commit comments

Comments
 (0)