-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add keyring-util #50
Add keyring-util #50
Conversation
Regarding |
7879fe1
to
0e190a6
Compare
7165572
to
dd66e26
Compare
dd66e26
to
67ab437
Compare
Looks good to me but still lacks CI bits :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
I have one suggestion though and I'm not sure it's possible to implement. It would be great if keyring-util
can handle a scenario like the following,
./target/debug/keyring-util store 'My password' key1 value1
Error: The collection 'default' doesn't exists
So, we need a new command to create a keyring or collection. What do you think @A6GibKm ?
I would check first what is the behaviour of secret-tool in this case. Collections are not widely used so maybe we should automatically create the default collection if it doesn't exists? |
keyring-util/src/main.rs
Outdated
} | ||
|
||
async fn collection<'a>() -> Result<Collection<'a>, Error> { | ||
let service = Service::new(Algorithm::Encrypted) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated but as we have the same constructor that fallsback to a plain connection, we should add such constructor to the API itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two common patterns we use repeatedly fallback the encrypted to a plain service, and load or create+load the default keyring, both used here (after the last force-push).
Regarding the first one, I am not sure how to call such method. Regarding the second, I don't think it is justified to create a helper for this, this might not be something users of the library should be doing often.
async fn store(label: &str, attributes: HashMap<&str, &str>) -> Result<(), Error> { | ||
let collection = collection().await?; | ||
|
||
print!("Type a secret: "); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be translatable ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure how I feel about translating CLI utils, maybe it makes sense here since we request an input. In any case this requires to have meson.
45eafbf
to
a6600e4
Compare
For the moment I will just create one if needed. |
|
bfb47d0
to
0f5a4f7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otherwise looks good! thanks
.github/workflows/CI.yml
Outdated
@@ -40,6 +46,9 @@ jobs: | |||
- name: Build and test (OpenSSL) | |||
run: | | |||
dbus-run-session -- cargo test --no-default-features --features async-std --features openssl_crypto | |||
- name: Build and test keyring-util |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't have tests for keyring-util, so just drop this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed to Build
and used cargo build
instead.
ccba964
to
e8c9a47
Compare
00cb0e6
to
7387b62
Compare
7387b62
to
185369a
Compare
Fixes: #48