Skip to content

Commit fcc7bb0

Browse files
Merge pull request #179 from brotskydotcom/master
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).
2 parents dc256b1 + 06dd220 commit fcc7bb0

File tree

10 files changed

+319
-269
lines changed

10 files changed

+319
-269
lines changed

.github/workflows/build.yaml

-46
This file was deleted.

.github/workflows/ci.yaml

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: CI
2+
3+
on: [ workflow_dispatch, push, pull_request ]
4+
5+
jobs:
6+
ci_native:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
matrix:
10+
os: [ ubuntu-latest, macos-latest, windows-latest ]
11+
12+
steps:
13+
- name: Fetch head
14+
uses: actions/checkout@v4
15+
16+
- name: Install rust stable
17+
uses: actions-rust-lang/setup-rust-toolchain@v1
18+
with:
19+
toolchain: stable
20+
components: rustfmt, clippy
21+
22+
- name: Format check
23+
run: cargo fmt --all -- --check
24+
25+
- name: Clippy check
26+
run: cargo clippy -- -D warnings
27+
28+
- name: Build and Test
29+
run: cargo test --features=apple-native,windows-native,linux-native --verbose
30+
31+
- name: Build the CLI release
32+
run: cargo build --release --features=apple-native,windows-native,linux-native --example cli
33+
34+
ci_secret_service:
35+
runs-on: ubuntu-latest
36+
strategy:
37+
matrix:
38+
features:
39+
- "linux-keyutils"
40+
- "sync-secret-service"
41+
- "sync-secret-service,crypto-rust"
42+
- "sync-secret-service,crypto-openssl"
43+
- "async-secret-service,tokio,crypto-rust"
44+
- "async-secret-service,async-io,crypto-rust"
45+
- "async-secret-service,tokio,crypto-openssl"
46+
- "async-secret-service,async-io,crypto-openssl"
47+
48+
steps:
49+
- name: Install CI dependencies
50+
run: |
51+
sudo apt update -y
52+
sudo apt install -y libdbus-1-dev libssl-dev gnome-keyring
53+
54+
- name: Fetch head
55+
uses: actions/checkout@v4
56+
57+
- name: Install rust stable
58+
uses: actions-rust-lang/setup-rust-toolchain@v1
59+
with:
60+
toolchain: stable
61+
62+
- name: Cache dependencies
63+
uses: actions/cache@v4
64+
with:
65+
path: |
66+
~/.cargo/registry
67+
~/.cargo/git
68+
target
69+
key: $test-cache-${{ steps.toolchain.outputs.rustc_hash }}-${{ hashFiles('**/Cargo.lock') }}
70+
71+
- name: Start gnome-keyring
72+
# run gnome-keyring with 'foobar' as password for the login keyring
73+
# this will create a new login keyring and unlock it
74+
# the login password doesn't matter, but the keyring must be unlocked for the tests to work
75+
run: gnome-keyring-daemon --components=secrets --daemonize --unlock <<< 'foobar'
76+
77+
- name: Run tests
78+
# run tests single-threaded to avoid dbus race conditions
79+
run: cargo test --features=${{ matrix.feature }} -- --test-threads=1

.github/workflows/publish.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ${{ matrix.os }}
1212
strategy:
1313
matrix:
14-
os: [macos-latest, ubuntu-latest, windows-latest]
14+
os: [ macos-latest, ubuntu-latest, windows-latest ]
1515
include:
1616
- os: windows-latest
1717
executable_name: examples/cli.exe
@@ -27,13 +27,13 @@ jobs:
2727
- name: Fetch head
2828
uses: actions/checkout@v4
2929

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

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

3838
- name: Post cli executable
3939
uses: svenstaro/upload-release-action@v2

Cargo.toml

+23-22
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,27 @@ keywords = ["password", "credential", "keychain", "keyring", "cross-platform"]
66
license = "MIT OR Apache-2.0"
77
name = "keyring"
88
repository = "https://github.com/hwchen/keyring-rs.git"
9-
version = "2.3.3"
10-
rust-version = "1.68"
9+
version = "3.0.0-rc.1"
10+
rust-version = "1.70"
1111
edition = "2021"
1212
exclude = [".github/"]
1313
readme = "README.md"
1414

1515
[features]
16-
default = ["platform-all"]
17-
platform-all = ["platform-linux", "platform-freebsd", "platform-openbsd", "platform-macos", "platform-ios", "platform-windows"]
18-
platform-linux = ["linux-secret-service", "linux-keyutils"]
19-
platform-freebsd = ["linux-secret-service"]
20-
platform-openbsd = ["linux-secret-service"]
21-
platform-macos = ["security-framework"]
22-
platform-ios = ["security-framework"]
23-
platform-windows = ["windows-sys", "byteorder"]
24-
linux-secret-service = ["linux-secret-service-rt-async-io-crypto-rust"]
25-
linux-secret-service-rt-async-io-crypto-rust = ["secret-service/rt-async-io-crypto-rust"]
26-
linux-secret-service-rt-tokio-crypto-rust = ["secret-service/rt-tokio-crypto-rust"]
27-
linux-secret-service-rt-async-io-crypto-openssl = ["secret-service/rt-async-io-crypto-openssl"]
28-
linux-secret-service-rt-tokio-crypto-openssl = ["secret-service/rt-tokio-crypto-openssl"]
29-
linux-no-secret-service = ["linux-default-keyutils"]
30-
linux-default-keyutils = ["linux-keyutils"]
31-
windows-test-threading = []
16+
linux-native = ["dep:linux-keyutils"]
17+
apple-native = ["dep:security-framework"]
18+
windows-native = ["dep:windows-sys", "dep:byteorder"]
19+
20+
sync-secret-service = ["dep:dbus-secret-service"]
21+
async-secret-service = ["dep:secret-service", "dep:zbus"]
22+
crypto-rust = ["dbus-secret-service?/crypto-rust", "secret-service?/crypto-rust"]
23+
crypto-openssl = ["dbus-secret-service?/crypto-openssl", "secret-service?/crypto-openssl"]
24+
tokio = ["zbus?/tokio"]
25+
async-io = ["zbus?/async-io"]
26+
vendored = ["dbus-secret-service?/vendored", "openssl?/vendored"]
3227

3328
[dependencies]
34-
lazy_static = "1"
29+
openssl = { version = "0.10.55", optional = true }
3530

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

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

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

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

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

0 commit comments

Comments
 (0)