package keyspacepoolconfig

import (
	"crypto/sha1"
	"io"
	"strconv"
	"time"

	"github.com/btcsuite/btcutil/base58"
	"github.com/tidbcloud/aws-shared-provider/pkg/utils"
)

func genKeyspaceToken(ns, kubernetes string) string {
	h := sha1.New()
	_, _ = io.WriteString(h, strconv.FormatInt(time.Now().UnixNano(), 10)+ns+kubernetes)
	return base58.Encode(h.Sum(nil))[:utils.GatewayTokenLen]
}
