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