Skip to content

Commit

Permalink
fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
soywod committed Dec 17, 2024
1 parent 99f8915 commit c9aa3e6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ name = "keyring"
[features]
default = []
full = [
"apple-native-std",
"windows-native-std",

"secret-service-dbus-std",
"secret-service-dbus-tokio",

Expand Down Expand Up @@ -75,7 +78,7 @@ tracing = "0.1"

[target.'cfg(target_os = "linux")'.dependencies]
aes = { version = "0.8", optional = true }
async-std = { version = "1", default-features = false, optional = true }
async-std = { version = "1", optional = true }
block-padding = { version = "0.3", features = ["std"], optional = true }
cbc = { version = "0.1", features = ["block-padding", "alloc"], optional = true }
dbus = { version = "0.9", optional = true }
Expand Down
11 changes: 9 additions & 2 deletions src/apple/std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,29 @@ pub enum Error {

pub type Result<T> = std::result::Result<T, Error>;

#[derive(Clone, Debug, Default)]
pub struct IoConnector;

impl IoConnector {
pub fn read(flow: &mut impl Flow) -> Result<()> {
pub fn new() -> Self {
Self::default()
}

pub fn read(&self, flow: &mut impl Flow) -> Result<()> {
let service = flow.get_service();
let account = flow.get_account();
let secret = get_generic_password(service, account).map_err(Error::ReadSecretError)?;

flow.put_secret(secret.into());
Ok(())
}

pub fn write(flow: &mut impl Flow) -> Result<()> {
pub fn write(&self, flow: &mut impl Flow) -> Result<()> {
let secret = flow.take_secret().ok_or(Error::WriteUndefinedSecretError)?;
let service = flow.get_service();
let account = flow.get_account();
let secret = secret.expose_secret();

set_generic_password(service, account, secret).map_err(Error::WriteSecretError)?;
Ok(())
}
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
#![doc = include_str!("../README.md")]

mod io;
pub mod io;

#[cfg(target_vendor = "apple")]
#[cfg(feature = "apple-native-std")]
#[cfg(any(feature = "apple-native-std"))]
pub mod apple;
#[cfg(target_os = "linux")]
#[cfg(any(
Expand All @@ -16,7 +16,7 @@ pub mod apple;
))]
pub mod secret_service;
#[cfg(target_os = "windows")]
#[cfg(feature = "windows-native-std")]
#[cfg(any(feature = "windows-native-std"))]
pub mod windows;

pub use io::Io;

0 comments on commit c9aa3e6

Please sign in to comment.