Files
isp-system-service/service/token_source.go
T
txix e9a861b61a
Create and publish a Docker image / build-and-push-image (push) Canceled after 0s
2026-09-25 14:15:10: merge [main:482ec50c7d3bff1587c869331a9e0fe92d110325];
2026-09-25 14:15:11 +03:00

26 lines
473 B
Go

package service
import (
"crypto/rand"
"encoding/hex"
"github.com/txix-open/isp-kit/errors"
)
type TokenSource struct{}
func NewTokenSource() TokenSource {
return TokenSource{}
}
func (s TokenSource) CreateApplicationToken() (string, error) {
cryptoRand := make([]byte, 128) //nolint:mnd
_, err := rand.Read(cryptoRand)
if err != nil {
return "", errors.WithMessage(err, "crypto/rand read")
}
random := hex.EncodeToString(cryptoRand)
return random, nil
}