-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for storing encryption passkey in system keyring (#265)
- add keyring package - add keyring id field to manifest - automatically attempt to load encryption passkey from keyring - have decrypt delete the passkey on decrypt - have encrypt command ask if it should store the passkey in the keyring - fix lints closes #117
- Loading branch information
Showing
11 changed files
with
985 additions
and
62 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use keyring::Entry; | ||
use secrecy::{ExposeSecret, SecretString}; | ||
|
||
const KEYRING_SERVICE: &str = "steamguard-cli"; | ||
|
||
pub fn init_keyring(keyring_id: String) -> keyring::Result<Entry> { | ||
Entry::new(KEYRING_SERVICE, &keyring_id) | ||
} | ||
|
||
pub fn try_passkey_from_keyring(keyring_id: String) -> keyring::Result<Option<SecretString>> { | ||
let entry = init_keyring(keyring_id)?; | ||
let passkey = entry.get_password()?; | ||
Ok(Some(SecretString::new(passkey))) | ||
} | ||
|
||
pub fn store_passkey(keyring_id: String, passkey: SecretString) -> keyring::Result<()> { | ||
let entry = init_keyring(keyring_id)?; | ||
entry.set_password(passkey.expose_secret()) | ||
} | ||
|
||
pub fn clear_passkey(keyring_id: String) -> keyring::Result<()> { | ||
let entry = init_keyring(keyring_id)?; | ||
entry.delete_password() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters