fix: warnings

This commit is contained in:
shimun 2022-12-24 20:57:16 +01:00
parent 0f6e2e0d40
commit ccd7484979
Signed by: shimun
GPG Key ID: E0420647856EA39E

View File

@ -4,7 +4,7 @@ use std::collections::HashMap;
use std::net::SocketAddr;
use std::path::{self, PathBuf};
use std::sync::Arc;
use std::time::{Duration, SystemTime};
use std::time::SystemTime;
use anyhow::Context;
use axum::body;
@ -18,8 +18,7 @@ use jwt_compact::alg::{Hs256, Hs256Key};
use jwt_compact::{AlgorithmExt, Token, UntrustedToken};
use rand::{thread_rng, Rng};
use serde::{Deserialize, Serialize};
use ssh_key::private::Ed25519Keypair;
use ssh_key::{certificate, Certificate, PrivateKey, PublicKey};
use ssh_key::{Certificate, PublicKey};
use tokio::sync::Mutex;
use tower::ServiceBuilder;
use tower_http::{trace::TraceLayer, ServiceBuilderExt};
@ -198,6 +197,7 @@ async fn fallback_404() -> ApiResult<()> {
Err(ApiError::CertificateNotFound)
}
#[cfg(feature = "index")]
async fn list_certs(
_: CertList,
State(ApiState { certs, .. }): State<ApiState>,
@ -233,7 +233,7 @@ async fn get_certs_identifier(
..
}): State<ApiState>,
) -> ApiResult<String> {
use jwt_compact::{AlgorithmExt, Claims, Header, TimeOptions};
use jwt_compact::{Claims, Header, TimeOptions};
if client_auth {
let claims = Claims::new(AuthClaims { identifier })
@ -375,12 +375,14 @@ async fn put_cert_update(
let identity = cert.key_id();
info!(%identity, ?principals, "updating certificate");
certs.lock().await.insert(cert.key_id().to_string(), cert);
Ok(format!("{} -> {}", prev_serial, serial))
Ok(format!("{prev_serial} -> {serial}"))
}
#[cfg(test)]
mod tests {
use ssh_key::{certificate, private::Ed25519Keypair, PrivateKey};
use std::env::temp_dir;
use std::time::Duration;
use super::*;
@ -433,7 +435,7 @@ mod tests {
cert_dir: dbg!(temp_dir()),
validation_args: Default::default(),
client_auth: false,
jwt_key: Hs256Key::new(&[0u8; 16]),
jwt_key: Hs256Key::new([0u8; 16]),
}
}