Merge pull request #183 from str4d/update-deps-0.5.0

Update dependencies for 0.5.0
This commit is contained in:
Jack Grigg
2024-08-04 02:58:41 +01:00
committed by GitHub
12 changed files with 867 additions and 713 deletions
+59 -11
View File
@@ -1,10 +1,13 @@
name: CI checks name: CI checks
on: [push, pull_request] on:
pull_request:
push:
branches: main
jobs: jobs:
test: test-msrv:
name: Test on ${{ matrix.name }} name: Test MSRV on ${{ matrix.name }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
matrix: matrix:
@@ -35,19 +38,64 @@ jobs:
- name: Verify working directory is clean - name: Verify working directory is clean
run: git diff --exit-code run: git diff --exit-code
codecov: test-latest:
name: Code coverage name: Test latest stable on ${{ matrix.name }}
runs-on: ubuntu-latest runs-on: ${{ matrix.os }}
strategy:
matrix:
name: [linux, windows, macos]
include:
- name: linux
os: ubuntu-latest
build_deps: >
libpcsclite-dev
- name: windows
os: windows-latest
- name: macos
os: macos-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Install build dependencies - name: Install build dependencies
run: sudo apt install libpcsclite-dev run: sudo apt install ${{ matrix.build_deps }}
- name: Install coverage dependencies if: matrix.build_deps != ''
run: cargo install cargo-tarpaulin - uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@stable
id: toolchain
- run: rustup override set ${{steps.toolchain.outputs.name}}
- name: Install test dependencies
run: cargo install rage
- name: Remove lockfile to build with latest dependencies
run: rm Cargo.lock
- name: Run tests
run: cargo test
- name: Verify working directory is clean (excluding lockfile)
run: git diff --exit-code ':!Cargo.lock'
codecov:
name: Code coverage
runs-on: ubuntu-latest
container:
image: xd009642/tarpaulin:develop-nightly
options: --security-opt seccomp=unconfined
steps:
- uses: actions/checkout@v4
- name: Install build dependencies
run: apt update && apt install -y libpcsclite-dev
- name: Generate coverage report - name: Generate coverage report
run: cargo tarpaulin --engine llvm --all-features --release --timeout 600 --out Xml run: >
cargo tarpaulin
--engine llvm
--timeout 180
--out xml
- name: Upload coverage to Codecov - name: Upload coverage to Codecov
uses: codecov/codecov-action@v3.1.5 uses: codecov/codecov-action@v4.5.0
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
doc-links: doc-links:
name: Intra-doc links name: Intra-doc links
+2
View File
@@ -7,6 +7,8 @@ and this project adheres to Rust's notion of
to 0.3.0 are beta releases. to 0.3.0 are beta releases.
## [Unreleased] ## [Unreleased]
### Changed
- MSRV is now 1.67.0.
## [0.4.0] - 2023-04-09 ## [0.4.0] - 2023-04-09
### Changed ### Changed
Generated
+770 -669
View File
File diff suppressed because it is too large Load Diff
+11 -11
View File
@@ -9,7 +9,7 @@ keywords = ["age", "cli", "encryption", "yubikey"]
categories = ["command-line-utilities", "cryptography"] categories = ["command-line-utilities", "cryptography"]
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
edition = "2021" edition = "2021"
rust-version = "1.65" # MSRV rust-version = "1.67" # MSRV
[package.metadata.deb] [package.metadata.deb]
extended-description = """\ extended-description = """\
@@ -22,12 +22,12 @@ assets = [
] ]
[dependencies] [dependencies]
age-core = "0.9" age-core = "0.10"
age-plugin = "0.4" age-plugin = "0.5"
base64 = "0.21" base64 = "0.21"
bech32 = "0.9" bech32 = "0.9"
console = { version = "0.15", default-features = false } console = { version = "0.15", default-features = false }
dialoguer = { version = "0.10", default-features = false, features = ["password"] } dialoguer = { version = "0.11", default-features = false, features = ["password"] }
env_logger = "0.10" env_logger = "0.10"
gumdrop = "0.8" gumdrop = "0.8"
hex = "0.4" hex = "0.4"
@@ -36,23 +36,23 @@ p256 = { version = "0.13", features = ["ecdh"] }
pcsc = "2.4" pcsc = "2.4"
rand = "0.8" rand = "0.8"
sha2 = "0.10" sha2 = "0.10"
which = "4.1" which = "5"
x509 = "0.2" x509 = "0.2"
x509-parser = "0.14" x509-parser = "0.14"
yubikey = { version = "=0.8.0-pre.0", features = ["untested"] } yubikey = { version = "=0.8.0-pre.0", features = ["untested"] }
# Translations # Translations
i18n-embed = { version = "0.13", features = ["desktop-requester", "fluent-system"] } i18n-embed = { version = "0.14", features = ["desktop-requester", "fluent-system"] }
i18n-embed-fl = "0.6" i18n-embed-fl = "0.8"
lazy_static = "1" lazy_static = "1"
rust-embed = "6" rust-embed = "8"
# GnuPG coexistence # GnuPG coexistence
sysinfo = "0.28" sysinfo = "0.29"
[dev-dependencies] [dev-dependencies]
flate2 = "1" flate2 = "1"
man = "0.3" man = "0.3"
tempfile = "3" tempfile = "3"
test-with = "0.9" test-with = "0.11"
which = "4" which = "5"
+1 -1
View File
@@ -8,7 +8,7 @@ which enables files to be encrypted to age identities stored on YubiKeys.
| Environment | CLI command | | Environment | CLI command |
|-------------|-------------| |-------------|-------------|
| Cargo (Rust 1.65+) | `cargo install age-plugin-yubikey` | | Cargo (Rust 1.67+) | `cargo install age-plugin-yubikey` |
| Homebrew (macOS or Linux) | `brew install age-plugin-yubikey` | | Homebrew (macOS or Linux) | `brew install age-plugin-yubikey` |
| Arch Linux | `pacman -S age-plugin-yubikey` | | Arch Linux | `pacman -S age-plugin-yubikey` |
| Debian | [Debian package](https://github.com/str4d/age-plugin-yubikey/releases) | | Debian | [Debian package](https://github.com/str4d/age-plugin-yubikey/releases) |
+1 -1
View File
@@ -6,7 +6,7 @@ use std::io::prelude::*;
const MANPAGES_DIR: &str = "./target/manpages"; const MANPAGES_DIR: &str = "./target/manpages";
fn generate_manpage(page: String, name: &str) { fn generate_manpage(page: String, name: &str) {
let file = File::create(format!("{}/{}.1.gz", MANPAGES_DIR, name)) let file = File::create(format!("{MANPAGES_DIR}/{name}.1.gz"))
.expect("Should be able to open file in target directory"); .expect("Should be able to open file in target directory");
let mut encoder = GzEncoder::new(file, Compression::best()); let mut encoder = GzEncoder::new(file, Compression::best());
encoder encoder
+1
View File
@@ -204,6 +204,7 @@ err-invalid-flag-tui = Flag '{$flag}' cannot be used with the interactive in
err-invalid-pin-policy = Invalid PIN policy '{$policy}' (expected [{$expected}]). err-invalid-pin-policy = Invalid PIN policy '{$policy}' (expected [{$expected}]).
err-invalid-slot = Invalid slot '{$slot}' (expected number between 1 and 20). err-invalid-slot = Invalid slot '{$slot}' (expected number between 1 and 20).
err-invalid-touch-policy = Invalid touch policy '{$policy}' (expected [{$expected}]). err-invalid-touch-policy = Invalid touch policy '{$policy}' (expected [{$expected}]).
err-io-user = Failed to get input from user: {$err}
err-io = Failed to set up {-yubikey}: {$err} err-io = Failed to set up {-yubikey}: {$err}
err-multiple-commands = Only one of {-cmd-generate}, {-cmd-identity}, {-cmd-list}, {-cmd-list-all} can be specified. err-multiple-commands = Only one of {-cmd-generate}, {-cmd-identity}, {-cmd-list}, {-cmd-list-all} can be specified.
err-multiple-yubikeys = Multiple {-yubikeys} are plugged in. Use {-flag-serial} to select a single {-yubikey}. err-multiple-yubikeys = Multiple {-yubikeys} are plugged in. Use {-flag-serial} to select a single {-yubikey}.
+1 -1
View File
@@ -1,3 +1,3 @@
[toolchain] [toolchain]
channel = "1.65.0" channel = "1.67.0"
components = ["clippy", "rustfmt"] components = ["clippy", "rustfmt"]
+8
View File
@@ -15,6 +15,7 @@ macro_rules! wlnfl {
pub enum Error { pub enum Error {
CustomManagementKey, CustomManagementKey,
Dialog(dialoguer::Error),
InvalidFlagCommand(String, String), InvalidFlagCommand(String, String),
InvalidFlagTui(String), InvalidFlagTui(String),
InvalidPinPolicy(String), InvalidPinPolicy(String),
@@ -35,6 +36,12 @@ pub enum Error {
YubiKey(yubikey::Error), YubiKey(yubikey::Error),
} }
impl From<dialoguer::Error> for Error {
fn from(e: dialoguer::Error) -> Self {
Error::Dialog(e)
}
}
impl From<io::Error> for Error { impl From<io::Error> for Error {
fn from(e: io::Error) -> Self { fn from(e: io::Error) -> Self {
Error::Io(e) Error::Io(e)
@@ -65,6 +72,7 @@ impl fmt::Debug for Error {
url = CHANGE_MGMT_KEY_URL url = CHANGE_MGMT_KEY_URL
)?; )?;
} }
Error::Dialog(e) => wlnfl!(f, "err-io-user", err = e.to_string())?,
Error::InvalidFlagCommand(flag, command) => wlnfl!( Error::InvalidFlagCommand(flag, command) => wlnfl!(
f, f,
"err-invalid-flag-command", "err-invalid-flag-command",
+4 -4
View File
@@ -274,10 +274,10 @@ pub(crate) fn disconnect_without_reset(yubikey: YubiKey) {
let _ = yubikey.disconnect(pcsc::Disposition::LeaveCard); let _ = yubikey.disconnect(pcsc::Disposition::LeaveCard);
} }
fn request_pin<E>( fn request_pin<E, E2>(
mut prompt: impl FnMut(Option<String>) -> io::Result<Result<SecretString, E>>, mut prompt: impl FnMut(Option<String>) -> Result<Result<SecretString, E>, E2>,
serial: Serial, serial: Serial,
) -> io::Result<Result<SecretString, E>> { ) -> Result<Result<SecretString, E>, E2> {
let mut prev_error = None; let mut prev_error = None;
loop { loop {
prev_error = Some(match prompt(prev_error)? { prev_error = Some(match prompt(prev_error)? {
@@ -326,7 +326,7 @@ pub(crate) fn manage(yubikey: &mut YubiKey) -> Result<(), Error> {
let pin = request_pin( let pin = request_pin(
|prev_error| { |prev_error| {
if let Some(err) = prev_error { if let Some(err) = prev_error {
eprintln!("{}", err); eprintln!("{err}");
} }
Password::new() Password::new()
.with_prompt(fl!("mgr-choose-new-pin")) .with_prompt(fl!("mgr-choose-new-pin"))
+8 -14
View File
@@ -296,8 +296,8 @@ fn list(flags: PluginFlags, all: bool) -> Result<(), Error> {
flags, flags,
all, all,
|_, recipient, metadata| { |_, recipient, metadata| {
println!("{}", metadata); println!("{metadata}");
println!("{}", recipient); println!("{recipient}");
}, },
) )
} }
@@ -329,8 +329,8 @@ fn main() -> Result<(), Error> {
if let Some(state_machine) = opts.age_plugin { if let Some(state_machine) = opts.age_plugin {
run_state_machine( run_state_machine(
&state_machine, &state_machine,
plugin::RecipientPlugin::default, Some(plugin::RecipientPlugin::default),
plugin::IdentityPlugin::default, Some(plugin::IdentityPlugin::default),
)?; )?;
Ok(()) Ok(())
} else if opts.version { } else if opts.version {
@@ -411,9 +411,9 @@ fn main() -> Result<(), Error> {
.validity() .validity()
.not_before .not_before
.to_rfc2822() .to_rfc2822()
.unwrap_or_else(|e| format!("Invalid date: {}", e)); .unwrap_or_else(|e| format!("Invalid date: {e}"));
format!("{}, created: {}", name, created) format!("{name}, created: {created}")
}) })
}) })
}) })
@@ -631,14 +631,8 @@ fn main() -> Result<(), Error> {
// If `rage` binary is installed, use it in examples. Otherwise default to `age`. // If `rage` binary is installed, use it in examples. Otherwise default to `age`.
let age_binary = which::which("rage").map(|_| "rage").unwrap_or("age"); let age_binary = which::which("rage").map(|_| "rage").unwrap_or("age");
let encrypt_usage = format!( let encrypt_usage = format!("$ cat foo.txt | {age_binary} -r {recipient} -o foo.txt.age");
"$ cat foo.txt | {} -r {} -o foo.txt.age", let decrypt_usage = format!("$ cat foo.txt.age | {age_binary} -d -i {file_name} > foo.txt");
age_binary, recipient
);
let decrypt_usage = format!(
"$ cat foo.txt.age | {} -d -i {} > foo.txt",
age_binary, file_name
);
let identity_usage = format!( let identity_usage = format!(
"$ age-plugin-yubikey -i --serial {} --slot {} > {}", "$ age-plugin-yubikey -i --serial {} --slot {} > {}",
stub.serial, stub.serial,
+1 -1
View File
@@ -177,7 +177,7 @@ impl Metadata {
.validity() .validity()
.not_before .not_before
.to_rfc2822() .to_rfc2822()
.unwrap_or_else(|e| format!("Invalid date: {}", e)), .unwrap_or_else(|e| format!("Invalid date: {e}")),
pin_policy, pin_policy,
touch_policy, touch_policy,
}) })