signaller/internal/backends/memory/tokens.go

18 lines
259 B
Go
Raw Normal View History

2019-07-22 14:46:11 +00:00
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)
}