Skip to content

Commit

Permalink
add Keyring std enum for convenience
Browse files Browse the repository at this point in the history
  • Loading branch information
soywod committed Dec 18, 2024
1 parent 3cbd7e6 commit 04bb004
Show file tree
Hide file tree
Showing 16 changed files with 605 additions and 547 deletions.
106 changes: 35 additions & 71 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,84 +4,48 @@ on:
push:

jobs:
examples:
runs-on: ${{ matrix.os }}
secret-service-std:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
include:
# Secret Service + D-Bus + std (blocking)

- os: ubuntu-24.04
features: secret-service-dbus-std,secret-service-openssl-std
example: secret-service-dbus-openssl-std
- os: ubuntu-24.04
features: secret-service-dbus-std,secret-service-rust-crypto-std
example: secret-service-dbus-rust-crypto-std

# Secret Service + D-Bus + tokio

- os: ubuntu-24.04
features: secret-service-dbus-tokio,secret-service-openssl-std
example: secret-service-dbus-openssl-tokio
- os: ubuntu-24.04
features: secret-service-dbus-tokio,secret-service-rust-crypto-std
example: secret-service-dbus-rust-crypto-tokio

# Secret Service + Z-Bus + std (blocking)

- os: ubuntu-24.04
features: secret-service-zbus-std,secret-service-openssl-std
example: secret-service-zbus-openssl-std
- os: ubuntu-24.04
features: secret-service-zbus-std,secret-service-rust-crypto-std
example: secret-service-zbus-rust-crypto-std

# Secret Service + Z-Bus + async-std

- os: ubuntu-24.04
features: secret-service-zbus-async-std,secret-service-openssl-std
example: secret-service-zbus-openssl-async-std
- os: ubuntu-24.04
features: secret-service-zbus-async-std,secret-service-rust-crypto-std
example: secret-service-zbus-rust-crypto-async-std

# Secret Service + Z-Bus + tokio

- os: ubuntu-24.04
features: secret-service-zbus-tokio,secret-service-openssl-std
example: secret-service-zbus-openssl-tokio
- os: ubuntu-24.04
features: secret-service-zbus-tokio,secret-service-rust-crypto-std
example: secret-service-zbus-rust-crypto-tokio

# MacOS/iOS Keychain

- os: macos-13
features: apple-native-std
example: apple-native-std
- os: macos-14
features: apple-native-std
example: apple-native-std
- os: macos-15
features: apple-native-std
example: apple-native-std
- os: macos-13
features: apple-native-std
example: apple-native-std

# Windows Credentials

- os: windows-latest
features: windows-native-std
example: windows-native-std
keyring: [dbus, zbus]
crypto: [openssl, rust-crypto]
encryption: [plain, dh]
env:
KEY: ubuntu-24.04-ss-${{ matrix.keyring }}-${{ matrix.crypto }}-${{ matrix.encryption }}-std
KEYRING_PROVIDER: ${{ matrix.keyring }}-secret-service
SS_CRYPTO_PROVIDER: ${{ matrix.crypto }}
SS_CRYPTO_ALGORITHM: ${{ matrix.encryption }}
steps:
- uses: actions/checkout@v4
- uses: awalsh128/cache-apt-pkgs-action@latest
if: matrix.os == 'ubuntu-24.04'
with:
packages: libdbus-1-dev libssl-dev gnome-keyring
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: gnome-keyring-daemon --components=secrets --daemonize --unlock <<< 'password'
if: matrix.os == 'ubuntu-24.04'
- run: cargo run --features ${{ matrix.features }} --example ${{ matrix.example }}
- run: cargo run --features secret-service-${{ matrix.keyring }}-std,secret-service-${{ matrix.crypto }}-std --example std

apple-keychain-std:
runs-on: ${{ matrix.macos }}
strategy:
fail-fast: false
matrix:
macos: [macos-13, macos-14, macos-15]
env:
KEY: ${{ matrix.macos }}-std
KEYRING_PROVIDER: apple-keychain
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo run --features apple-keychain-std --example std

windows-credentials-std:
runs-on: windows-latest
env:
KEY: windows-latest-std
KEYRING_PROVIDER: windows-credentials
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo run --features windows-credentials-std --example std
32 changes: 13 additions & 19 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ name = "keyring"
[features]
default = []
full = [
"apple-native-std",
"windows-native-std",
"apple-keychain-std",
"windows-credentials-std",

"secret-service-dbus-std",
"secret-service-dbus-tokio",
Expand Down Expand Up @@ -61,13 +61,13 @@ secret-service-rust-crypto-std = ["dep:aes", "dep:block-padding", "dep:cbc", "de

## MacOS/iOS Keychain
#
apple-native = []
apple-native-std = ["dep:security-framework", "apple-native"]
apple-keychain = []
apple-keychain-std = ["dep:security-framework", "apple-keychain"]

## Windows Credentials
#
windows-native = []
windows-native-std = ["dep:byteorder", "dep:windows-sys", "windows-native"]
windows-credentials = []
windows-credentials-std = ["dep:byteorder", "dep:windows-sys", "windows-credentials"]

## Vendored
#
Expand All @@ -81,15 +81,10 @@ tokio = { version = "1", features = ["full"] }
dbus-codegen = { version = "0.12", default-features = false, optional = true }

[dependencies]
secrecy = "0.10"
serde = { version = "1", optional = true }
thiserror = "2"
tracing = "0.1"

[target.'cfg(target_os = "linux")'.dependencies]
aes = { version = "0.8", optional = true }
async-std = { version = "1", optional = true }
block-padding = { version = "0.3", features = ["std"], optional = true }
byteorder = { version = "1.2", optional = true }
cbc = { version = "0.1", features = ["block-padding", "alloc"], optional = true }
dbus = { version = "0.9", optional = true }
dbus-tokio = { version = "0.7", optional = true }
Expand All @@ -98,13 +93,12 @@ num = { version = "0.4", optional = true }
once_cell = { version = "1", optional = true }
openssl = { version = "0.10", optional = true }
rand = { version = "0.8", optional = true }
secrecy = "0.10"
security-framework = { version = "3", default-features = false, optional = true }
serde = { version = "1", optional = true }
sha2 = { version = "0.10", optional = true }
thiserror = "2"
tokio = { version = "1", features = ["rt"], optional = true }
zbus = { version = "5", default-features = false, features = ["async-io"], optional = true }

[target.'cfg(target_vendor = "apple")'.dependencies]
security-framework = { version = "3", default-features = false, optional = true }

[target.'cfg(target_os = "windows")'.dependencies]
byteorder = { version = "1.2", optional = true }
tracing = "0.1"
windows-sys = { version = "0.59", features = ["Win32_Foundation", "Win32_Security_Credentials"], optional = true }
zbus = { version = "5", default-features = false, features = ["async-io"], optional = true }
61 changes: 0 additions & 61 deletions examples/apple-native-std.rs

This file was deleted.

80 changes: 0 additions & 80 deletions examples/secret-service-dbus-openssl-std.rs

This file was deleted.

Loading

0 comments on commit 04bb004

Please sign in to comment.