mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 04:42:15 +00:00
frontend: Generate random secret by default
This commit is contained in:
@@ -2,8 +2,8 @@ use argon2::password_hash::SaltString;
|
||||
use clap::{Parser, ValueEnum};
|
||||
use password_hash::PasswordHasher;
|
||||
use pbkdf2::Params;
|
||||
use rand::{RngCore, rngs::OsRng};
|
||||
use rustical_frontend::FrontendConfig;
|
||||
use rand::rngs::OsRng;
|
||||
use rustical_frontend::{FrontendConfig, generate_frontend_secret};
|
||||
|
||||
use crate::config::{
|
||||
Config, DataStoreConfig, DavPushConfig, HttpConfig, SqliteDataStoreConfig, TracingConfig,
|
||||
@@ -15,14 +15,6 @@ pub mod principals;
|
||||
#[derive(Debug, Parser)]
|
||||
pub struct GenConfigArgs {}
|
||||
|
||||
pub fn generate_frontend_secret() -> [u8; 64] {
|
||||
let mut rng = rand::thread_rng();
|
||||
|
||||
let mut secret = [0u8; 64];
|
||||
rng.fill_bytes(&mut secret);
|
||||
secret
|
||||
}
|
||||
|
||||
pub fn cmd_gen_config(_args: GenConfigArgs) -> anyhow::Result<()> {
|
||||
let config = Config {
|
||||
http: HttpConfig::default(),
|
||||
|
||||
@@ -131,13 +131,10 @@ async fn main() -> Result<()> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::{
|
||||
app::make_app, commands::generate_frontend_secret, config::NextcloudLoginConfig,
|
||||
get_data_stores,
|
||||
};
|
||||
use crate::{app::make_app, config::NextcloudLoginConfig, get_data_stores};
|
||||
use actix_web::{http::StatusCode, test::TestRequest};
|
||||
use rustical_frontend::FrontendConfig;
|
||||
use rustical_frontend::nextcloud_login::NextcloudFlows;
|
||||
use rustical_frontend::{FrontendConfig, generate_frontend_secret};
|
||||
use std::sync::Arc;
|
||||
|
||||
#[tokio::test]
|
||||
|
||||
Reference in New Issue
Block a user