From 56499a11ad76afce78f2344ebfcb2b1ce1ee437f Mon Sep 17 00:00:00 2001 From: pennae Date: Sun, 17 Jul 2022 14:13:53 +0200 Subject: use SecretKey for key material in crypto --- src/types.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/types.rs') diff --git a/src/types.rs b/src/types.rs index aca74cf..342deab 100644 --- a/src/types.rs +++ b/src/types.rs @@ -226,6 +226,14 @@ impl OauthAuthorizationID { } } +impl SecretKey { + pub fn generate() -> Self { + let mut result = Self([0; 32]); + OsRng.fill_bytes(&mut result.0); + result + } +} + #[derive(Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(try_from = "String", into = "String")] pub(crate) struct OauthToken([u8; 32]); -- cgit v1.2.3