summaryrefslogtreecommitdiff
path: root/src/token.rs
diff options
context:
space:
mode:
authorKeuin <[email protected]>2022-03-27 17:40:18 +0800
committerKeuin <[email protected]>2022-03-27 17:40:18 +0800
commitaae1f386456a605c12263e2ba5f09dc36bb180b3 (patch)
treed125ec6c6ecc0e53389713578374b1f510e65416 /src/token.rs
Finally, it works.
Further cleanup work is needed.
Diffstat (limited to 'src/token.rs')
-rw-r--r--src/token.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/token.rs b/src/token.rs
new file mode 100644
index 0000000..3de71ce
--- /dev/null
+++ b/src/token.rs
@@ -0,0 +1,6 @@
+pub fn generate() -> String {
+ let mut rng = urandom::csprng();
+ let mut bytes = [0u8; 32];
+ rng.fill_bytes(&mut bytes);
+ bs58::encode(bytes).into_string()
+} \ No newline at end of file