keyring 1.0.0

This commit is contained in:
veeso
2022-01-05 12:59:32 +01:00
committed by Christian Visintin
parent 4897253932
commit 332284fec3
4 changed files with 618 additions and 437 deletions

View File

@@ -24,7 +24,7 @@
## 0.8.0
Released on FIXME:
Released on 06/01/2022
> ❄️ Winter update 2022 ⛄
@@ -76,6 +76,8 @@ Released on FIXME:
- It is now possible to enable the `TRACE` level with the `-D` CLI option.
- Dependencies:
- Added `unicode-width 0.1.8`
- Updated `argh` to `0.1.7`
- Updated `keyring` to `1.0.0`
- Updated `tui-realm` to `1.4.2`
- Updated `tui-realm-stdlib` to `1.1.4`
- Removed `rust-s3`, `ssh2`, `suppaftp`; replaced by `remotefs 0.2.0`, `remotefs-aws-s3 0.1.0`, `remotefs-ftp 0.1.0` and `remotefs-ssh 0.1.0`

1018
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -24,7 +24,7 @@ termscp = { path = "/usr/bin/termscp" }
[package.metadata.deb]
maintainer = "Christian Visintin <christian.visintin1997@gmail.com>"
copyright = "2021, Christian Visintin <christian.visintin1997@gmail.com>"
copyright = "2022, Christian Visintin <christian.visintin1997@gmail.com>"
extended-description-file = "docs/misc/README.deb.txt"
[[bin]]
@@ -32,7 +32,7 @@ name = "termscp"
path = "src/main.rs"
[dependencies]
argh = "0.1.6"
argh = "0.1.7"
bitflags = "1.3.2"
bytesize = "1.1.0"
chrono = "0.4.19"
@@ -40,7 +40,7 @@ content_inspector = "0.2.4"
dirs = "4.0.0"
edit = "0.1.3"
hostname = "0.3.1"
keyring = { version = "0.10.1", optional = true }
keyring = { version = "1.0.0", optional = true }
lazy_static = "1.4.0"
log = "0.4.14"
magic-crypt = "3.1.7"

View File

@@ -28,7 +28,7 @@
// Local
use super::{KeyStorage, KeyStorageError};
// Ext
use keyring::{Keyring, KeyringError};
use keyring::{Entry as Keyring, Error as KeyringError};
/// provides a `KeyStorage` implementation using the keyring crate
pub struct KeyringStorage {
@@ -53,15 +53,13 @@ impl KeyStorage for KeyringStorage {
match storage.get_password() {
Ok(s) => Ok(s),
Err(e) => match e {
KeyringError::NoPasswordFound => Err(KeyStorageError::NoSuchKey),
#[cfg(target_os = "windows")]
KeyringError::WindowsVaultError => Err(KeyStorageError::NoSuchKey),
#[cfg(target_os = "macos")]
KeyringError::MacOsKeychainError(_) => Err(KeyStorageError::NoSuchKey),
#[cfg(target_os = "linux")]
KeyringError::SecretServiceError(_) => Err(KeyStorageError::ProviderError),
KeyringError::Parse(_) => Err(KeyStorageError::BadSytax),
_ => Err(KeyStorageError::ProviderError),
KeyringError::NoEntry => Err(KeyStorageError::NoSuchKey),
KeyringError::PlatformFailure(_)
| KeyringError::NoStorageAccess(_)
| KeyringError::WrongCredentialPlatform => Err(KeyStorageError::ProviderError),
KeyringError::BadEncoding(_) | KeyringError::TooLong(_, _) => {
Err(KeyStorageError::BadSytax)
}
},
}
}
@@ -84,13 +82,8 @@ impl KeyStorage for KeyringStorage {
// Check what kind of error is returned
match storage.get_password() {
Ok(_) => true,
#[cfg(not(target_os = "linux"))]
Err(err) => !matches!(err, KeyringError::NoBackendFound),
#[cfg(target_os = "linux")]
Err(err) => !matches!(
err,
KeyringError::NoBackendFound | KeyringError::SecretServiceError(_)
),
Err(KeyringError::NoStorageAccess(_) | KeyringError::PlatformFailure(_)) => false,
Err(_) => true,
}
}
}