summaryrefslogtreecommitdiff
path: root/src/types.rs
diff options
context:
space:
mode:
authorpennae <github@quasiparticle.net>2022-07-17 14:13:53 +0200
committerpennae <github@quasiparticle.net>2022-07-17 17:26:05 +0200
commit56499a11ad76afce78f2344ebfcb2b1ce1ee437f (patch)
treeb4ed61651499523fae5a6b1dd62498a5e13bb233 /src/types.rs
parent5d7f509f1a98c2d45870e3877b4d7bfa756d2d2a (diff)
downloadminor-skulk-56499a11ad76afce78f2344ebfcb2b1ce1ee437f.tar.gz
minor-skulk-56499a11ad76afce78f2344ebfcb2b1ce1ee437f.tar.xz
minor-skulk-56499a11ad76afce78f2344ebfcb2b1ce1ee437f.zip
use SecretKey for key material in crypto
Diffstat (limited to 'src/types.rs')
-rw-r--r--src/types.rs8
1 files changed, 8 insertions, 0 deletions
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]);