signaller/internal/random_provider.go

15 lines
261 B
Go
Raw Normal View History

2019-08-04 16:46:31 +00:00
package internal
2019-07-22 14:46:11 +00:00
import (
"crypto/rand"
"fmt"
)
2019-08-04 16:46:31 +00:00
// RandomString returns new generated token with specified length
func RandomString(size int) string {
2019-07-22 14:46:11 +00:00
b := make([]byte, size)
2019-07-22 17:28:55 +00:00
rand.Read(b) // TODO: check may be can be error
2019-07-22 14:46:11 +00:00
return fmt.Sprintf("%x", b)
}