🔒️ more secure token generation

This commit is contained in:
naiba committed 2022-12-16 23:34:14 +08:00
1 parent 5a291cbc18
commit 15f4816e1f
10 files changed
+65 -58

No files matched your search

+11
View File
@@ -39,3 +39,14 @@ func TestNotification(t *testing.T) {
assert.Equal(t, IPDesensitize(c.input), c.output)
}
}
func TestGenerGenerateRandomString(t *testing.T) {
generatedString := make(map[string]bool)
for i := 0; i < 100; i++ {
str, err := GenerateRandomString(32)
assert.Nil(t, err)
assert.Equal(t, len(str), 32)
assert.False(t, generatedString[str])
generatedString[str] = true
}
}