From aae1f386456a605c12263e2ba5f09dc36bb180b3 Mon Sep 17 00:00:00 2001 From: Keuin Date: Sun, 27 Mar 2022 17:40:18 +0800 Subject: Finally, it works. Further cleanup work is needed. --- src/token.rs | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 src/token.rs (limited to 'src/token.rs') 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 -- cgit v1.2.3