mirror of
https://github.com/openziti/zrok.git
synced 2024-12-23 07:09:12 +01:00
16 lines
313 B
Go
16 lines
313 B
Go
|
package controller
|
||
|
|
||
|
import (
|
||
|
"crypto/rand"
|
||
|
"encoding/hex"
|
||
|
"github.com/pkg/errors"
|
||
|
)
|
||
|
|
||
|
func generateApiToken() (string, error) {
|
||
|
bytes := make([]byte, 64)
|
||
|
if _, err := rand.Read(bytes); err != nil {
|
||
|
return "", errors.Wrap(err, "error generating random api token")
|
||
|
}
|
||
|
return hex.EncodeToString(bytes), nil
|
||
|
}
|