forked from mtusi2026/mtusi2026lab4
feat: база из лабораторной 3 перенесена в лабу 4
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package ident
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"encoding/hex"
|
||||
)
|
||||
|
||||
const tokenBytes = 32
|
||||
|
||||
func GenerateToken() string {
|
||||
buf := make([]byte, tokenBytes)
|
||||
if _, err := rand.Read(buf); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return hex.EncodeToString(buf)
|
||||
}
|
||||
Reference in New Issue
Block a user