func GenerateToken(config jwtverify.VerifierConfig, user string, ttlSeconds int64) (string, error) {
	if config.HMACSecretKey == "" {
		return "", fmt.Errorf("no HMAC secret key set")
	}
	signer, _ := jwt.NewSignerHS(jwt.HS256, []byte(config.HMACSecretKey))
	builder := jwt.NewBuilder(signer)
	token, err := builder.Build(jwt.StandardClaims{
		Subject:   user,
		ExpiresAt: jwt.NewNumericDate(time.Now().Add(time.Duration(ttlSeconds) * time.Second)),
	})
	if err != nil {
		return "", err
	}
	return token.String(), nil
}
GenerateToken generates sample JWT for user.
package cli
import (
	"encoding/json"
	"fmt"
	"time"
	"github.com/centrifugal/centrifugo/v3/internal/jwtverify"
	"github.com/centrifugal/centrifugo/v3/internal/rule"
	"github.com/cristalhq/jwt/v3"
)