Skip to content
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

Support OpenBSD #156

Merged
merged 1 commit into from
Dec 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ readme = "README.md"

[features]
default = ["platform-all"]
platform-all = ["platform-linux", "platform-freebsd", "platform-macos", "platform-ios", "platform-windows"]
platform-all = ["platform-linux", "platform-freebsd", "platform-openbsd", "platform-macos", "platform-ios", "platform-windows"]
platform-linux = ["linux-secret-service", "linux-keyutils"]
platform-freebsd = ["linux-secret-service"]
platform-openbsd = ["linux-secret-service"]
platform-macos = ["security-framework"]
platform-ios = ["security-framework"]
platform-windows = ["winapi", "byteorder"]
Expand Down Expand Up @@ -44,6 +45,9 @@ linux-keyutils = { version = "0.2", features = ["std"], optional = true }
[target.'cfg(target_os = "freebsd")'.dependencies]
secret-service = { version = "3", optional = true }

[target.'cfg(target_os = "openbsd")'.dependencies]
secret-service = { version = "3", optional = true }

[target.'cfg(target_os = "windows")'.dependencies]
byteorder = { version = "1.2", optional = true }
winapi = { version = "0.3", features = ["wincred", "winerror", "errhandlingapi", "minwindef"], optional = true }
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ Linux (secret-service and kernel keyutils),
iOS (keychain), macOS (keychain), and
Windows (credential manager).

It also builds on FreeBSD (secret-service),
It also builds on FreeBSD and OpenBSD (secret-service),
and probably works there,
but since neither the maintainers nor GitHub do
building and testing on FreeBSD, we can't be sure.
building and testing on BSDs, we can't be sure.

The default features of this crate are set up
to build all the available platform support.
Expand Down Expand Up @@ -117,7 +117,7 @@ PLEASE NOTE: As of version 2.2, turning off the default
feature set will turn off platform support on *all* platforms,
not just on Linux (as was the case before). While this
behavior is a breaking change on Mac, Windows,
and FreeBSD, the behavior on those platforms before was
FreeBSD and OpenBSD, the behavior on those platforms before was
unintended and undefined (suppressing default features did nothing),
so this is considered a bug fix rather than
a semver-breaking change that requires a major version bump.
Expand Down
10 changes: 10 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ A top-level introduction to the library's usage, as well as a small code sample,
may be found in [the library's entry on crates.io](https://crates.io/crates/keyring).
Currently supported platforms are
Linux,
FreeBSD,
OpenBSD,
Windows,
macOS, and iOS.

Expand Down Expand Up @@ -147,6 +149,13 @@ use crate::secret_service as default;
#[cfg(all(target_os = "freebsd", not(feature = "secret-service")))]
use mock as default;

#[cfg(all(target_os = "openbsd", feature = "secret-service"))]
pub mod secret_service;
#[cfg(all(target_os = "openbsd", feature = "secret-service"))]
use crate::secret_service as default;
#[cfg(all(target_os = "openbsd", not(feature = "secret-service")))]
use mock as default;

#[cfg(all(target_os = "macos", feature = "platform-macos"))]
pub mod macos;
#[cfg(all(target_os = "macos", feature = "platform-macos"))]
Expand All @@ -171,6 +180,7 @@ use mock as default;
#[cfg(not(any(
target_os = "linux",
target_os = "freebsd",
target_os = "openbsd",
target_os = "macos",
target_os = "ios",
target_os = "windows",
Expand Down