From c1b50bd36a46eea704bcbeb9799c21443db504df Mon Sep 17 00:00:00 2001 From: shockrah Date: Thu, 6 Aug 2020 16:31:18 -0700 Subject: [PATCH] adding helper function to aid in creation of members as opt `create owner` requires --- server/src/auth.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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) +}