Skip to content

Commit

Permalink
Merge pull request #179 from brotskydotcom/master
Browse files Browse the repository at this point in the history
Ready the release of v3.

The main feature of this release is that it allows using the keyring with the secret service _without_ an async runtime.

It also fixes a number of outstanding issues raised by various contributors:

1. Integrates the latest release of the secret service (fixes #175).
2. Replaces older macro crates with newer Rust std library features (fixes #178).
  • Loading branch information
brotskydotcom authored Jul 6, 2024
2 parents dc256b1 + 06dd220 commit fcc7bb0
Show file tree
Hide file tree
Showing 10 changed files with 319 additions and 269 deletions.
46 changes: 0 additions & 46 deletions .github/workflows/build.yaml

This file was deleted.

79 changes: 79 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: CI

on: [ workflow_dispatch, push, pull_request ]

jobs:
ci_native:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]

steps:
- name: Fetch head
uses: actions/checkout@v4

- name: Install rust stable
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy

- name: Format check
run: cargo fmt --all -- --check

- name: Clippy check
run: cargo clippy -- -D warnings

- name: Build and Test
run: cargo test --features=apple-native,windows-native,linux-native --verbose

- name: Build the CLI release
run: cargo build --release --features=apple-native,windows-native,linux-native --example cli

ci_secret_service:
runs-on: ubuntu-latest
strategy:
matrix:
features:
- "linux-keyutils"
- "sync-secret-service"
- "sync-secret-service,crypto-rust"
- "sync-secret-service,crypto-openssl"
- "async-secret-service,tokio,crypto-rust"
- "async-secret-service,async-io,crypto-rust"
- "async-secret-service,tokio,crypto-openssl"
- "async-secret-service,async-io,crypto-openssl"

steps:
- name: Install CI dependencies
run: |
sudo apt update -y
sudo apt install -y libdbus-1-dev libssl-dev gnome-keyring
- name: Fetch head
uses: actions/checkout@v4

- name: Install rust stable
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable

- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: $test-cache-${{ steps.toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }}

- name: Start gnome-keyring
# run gnome-keyring with 'foobar' as password for the login keyring
# this will create a new login keyring and unlock it
# the login password doesn't matter, but the keyring must be unlocked for the tests to work
run: gnome-keyring-daemon --components=secrets --daemonize --unlock <<< 'foobar'

- name: Run tests
# run tests single-threaded to avoid dbus race conditions
run: cargo test --features=${{ matrix.feature }} -- --test-threads=1
12 changes: 6 additions & 6 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
os: [ macos-latest, ubuntu-latest, windows-latest ]
include:
- os: windows-latest
executable_name: examples/cli.exe
Expand All @@ -27,13 +27,13 @@ jobs:
- name: Fetch head
uses: actions/checkout@v4

- name: Install Rust Toolchain (stable)
uses: dtolnay/rust-toolchain@stable
- name: Install rust stable
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt, clippy
toolchain: stable

- name: Build (release, locked)
run: cargo build --release --example cli
- name: Build
run: cargo build --release --features=apple-native,windows-native,linux-native --example cli

- name: Post cli executable
uses: svenstaro/upload-release-action@v2
Expand Down
45 changes: 23 additions & 22 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,27 @@ keywords = ["password", "credential", "keychain", "keyring", "cross-platform"]
license = "MIT OR Apache-2.0"
name = "keyring"
repository = "https://github.com/hwchen/keyring-rs.git"
version = "2.3.3"
rust-version = "1.68"
version = "3.0.0-rc.1"
rust-version = "1.70"
edition = "2021"
exclude = [".github/"]
readme = "README.md"

[features]
default = ["platform-all"]
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 = ["windows-sys", "byteorder"]
linux-secret-service = ["linux-secret-service-rt-async-io-crypto-rust"]
linux-secret-service-rt-async-io-crypto-rust = ["secret-service/rt-async-io-crypto-rust"]
linux-secret-service-rt-tokio-crypto-rust = ["secret-service/rt-tokio-crypto-rust"]
linux-secret-service-rt-async-io-crypto-openssl = ["secret-service/rt-async-io-crypto-openssl"]
linux-secret-service-rt-tokio-crypto-openssl = ["secret-service/rt-tokio-crypto-openssl"]
linux-no-secret-service = ["linux-default-keyutils"]
linux-default-keyutils = ["linux-keyutils"]
windows-test-threading = []
linux-native = ["dep:linux-keyutils"]
apple-native = ["dep:security-framework"]
windows-native = ["dep:windows-sys", "dep:byteorder"]

sync-secret-service = ["dep:dbus-secret-service"]
async-secret-service = ["dep:secret-service", "dep:zbus"]
crypto-rust = ["dbus-secret-service?/crypto-rust", "secret-service?/crypto-rust"]
crypto-openssl = ["dbus-secret-service?/crypto-openssl", "secret-service?/crypto-openssl"]
tokio = ["zbus?/tokio"]
async-io = ["zbus?/async-io"]
vendored = ["dbus-secret-service?/vendored", "openssl?/vendored"]

[dependencies]
lazy_static = "1"
openssl = { version = "0.10.55", optional = true }

[target.'cfg(target_os = "macos")'.dependencies]
security-framework = { version = "2.6", optional = true }
Expand All @@ -40,14 +35,20 @@ security-framework = { version = "2.6", optional = true }
security-framework = { version = "2.6", optional = true }

[target.'cfg(target_os = "linux")'.dependencies]
secret-service = { version = "3", optional = true }
secret-service = { version = "4", optional = true }
zbus = { version = "4", optional = true }
linux-keyutils = { version = "0.2", features = ["std"], optional = true }
dbus-secret-service = { version = "4.0.0-rc.2", optional = true }

[target.'cfg(target_os = "freebsd")'.dependencies]
secret-service = { version = "3", optional = true }
secret-service = { version = "4", optional = true }
zbus = { version = "4", optional = true }
dbus-secret-service = { version = "4.0.0-rc.1", optional = true }

[target.'cfg(target_os = "openbsd")'.dependencies]
secret-service = { version = "3", optional = true }
secret-service = { version = "4", optional = true }
zbus = { version = "4", optional = true }
dbus-secret-service = { version = "4.0.0-rc.1", optional = true }

[target.'cfg(target_os = "windows")'.dependencies]
byteorder = { version = "1.2", optional = true }
Expand Down
Loading

0 comments on commit fcc7bb0

Please sign in to comment.