From c713bb8f814517883d9f649843933717d7b2a353 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 16 Oct 2023 01:11:16 +0000 Subject: [PATCH] Format Rust code using rustfmt --- src/keygen.rs | 24 +++++++++++------------- src/types.rs | 2 +- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/keygen.rs b/src/keygen.rs index b4b3d289..70212304 100644 --- a/src/keygen.rs +++ b/src/keygen.rs @@ -67,11 +67,7 @@ pub fn encode_keyfile( .unwrap() } -pub fn decode_keyfile( - keyfile: Vec, - password: &str, -) -> Result { - +pub fn decode_keyfile(keyfile: Vec, password: &str) -> Result { let (username, routers, salt, key_enc, jtw_enc, file_enc) = bincode::deserialize::<(String, Vec, Vec, Vec, Vec, Vec)>(&keyfile) .map_err(|_| "failed to deserialize keyfile")?; @@ -93,26 +89,28 @@ pub fn decode_keyfile( let jwt_nonce = generic_array::GenericArray::from_slice(&jtw_enc[..12]); let file_nonce = generic_array::GenericArray::from_slice(&file_enc[..12]); - let serialized_networking_keypair: Vec = cipher.decrypt(net_nonce, &key_enc[12..]) + let serialized_networking_keypair: Vec = cipher + .decrypt(net_nonce, &key_enc[12..]) .map_err(|_| "failed to decrypt networking keys")?; let networking_keypair = signature::Ed25519KeyPair::from_pkcs8(&serialized_networking_keypair) .map_err(|_| "failed to parse networking keys")?; - let jwt_secret_bytes: Vec = cipher.decrypt(jwt_nonce, &jtw_enc[12..]) + let jwt_secret_bytes: Vec = cipher + .decrypt(jwt_nonce, &jtw_enc[12..]) .map_err(|_| "failed to decrypt jwt secret")?; - let file_key: Vec = cipher.decrypt(file_nonce, &file_enc[12..]) + let file_key: Vec = cipher + .decrypt(file_nonce, &file_enc[12..]) .map_err(|_| "failed to decrypt file key")?; Ok(Keyfile { - username, - routers, - networking_keypair, - jwt_secret_bytes, + username, + routers, + networking_keypair, + jwt_secret_bytes, file_key, }) - } /// # Returns diff --git a/src/types.rs b/src/types.rs index efabcd02..a54b1c1d 100644 --- a/src/types.rs +++ b/src/types.rs @@ -1,10 +1,10 @@ use crate::kernel::component::uq_process::types as wit; +use ring::signature; use serde::{Deserialize, Serialize}; use std::{ collections::{HashMap, HashSet}, sync::Arc, }; -use ring::signature; use thiserror::Error; use tokio::sync::RwLock;