mirror of
https://github.com/signaller-matrix/signaller.git
synced 2024-11-10 04:31:03 +00:00
18 lines
259 B
Go
18 lines
259 B
Go
package memory
|
|
|
|
import (
|
|
"crypto/rand"
|
|
"fmt"
|
|
)
|
|
|
|
// newToken returns new generated token with specified length
|
|
func newToken(size int) string {
|
|
b := make([]byte, size)
|
|
_, err := rand.Read(b)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
return fmt.Sprintf("%x", b)
|
|
}
|