package common

import (
	"git.apinb.com/bsm-sdk/core/crypto/token"
	"git.apinb.com/bsm-sdk/core/env"
)

// GenerateTokenAes .
func GenerateTokenAes(id uint, identity, client, role string, extend map[string]string) (string, error) {
	token, err := token.New(env.Runtime.JwtSecretKey).GenerateJwt(id, identity, client, role, nil, extend)
	if err != nil {
		return "", err
	}
	return token, nil
}

func VerifyMapKeys(m map[string]string, keys []string) bool {
	for _, key := range keys {
		if _, ok := m[key]; !ok {
			return false
		}
	}
	return true
}
