diff --git a/server/src/auth.rs b/server/src/auth.rs index 26af473..8865fe9 100644 --- a/server/src/auth.rs +++ b/server/src/auth.rs @@ -57,3 +57,15 @@ pub async fn wall_entry(path: &str, pool: &Pool, params: &mut serde_json::Value) } } } + +pub fn generate_secret() -> String { + /* + * Generates a url-safe-plaintext secret for our db + * */ + use getrandom::getrandom; + use base64::{encode_config, URL_SAFE}; + + let mut buf: Vec = vec![0;64]; + getrandom(&mut buf); + encode_config(buf,URL_SAFE) +}