Documentation ¶
Index ¶
- Variables
- func AesDecryptCBC(data string, key []byte) (crypted []byte, err error)
- func AesDecryptCBCByKey(cstr string) (string, error)
- func AesEncryptCBC(data []byte, key []byte) (string, error)
- func CIDToHash(cidString string) (string, error)
- func CreateAPIKey(ctx context.Context, userID, keyName string, perms []string, buf []byte) ([]byte, string, error)
- func CreateAPIKeySecret(ctx context.Context, userID, keyName string, buf []byte) ([]byte, string, string, error)
- func CreateTenantKey(tenatID, name string) ([]byte, string, string, error)
- func DecodeAPIKeySecrets(buf []byte) (map[string]UserAPIKeySecretInfo, error)
- func DecodeAPIKeys(buf []byte) (map[string]UserAPIKeysInfo, error)
- func EncodeAPIKeySecrets(apiKeys map[string]UserAPIKeySecretInfo) ([]byte, error)
- func EncodeAPIKeys(apiKeys map[string]UserAPIKeysInfo) ([]byte, error)
- func GenTenantKeySecretBlob(apiKey, apiSecret string) ([]byte, error)
- func HashToCID(hashString string) (string, error)
- type Client
- type JWTPayload
- type TenantInfo
- type TenantKeySecretPair
- type UserAPIKeySecretInfo
- type UserAPIKeysInfo
- type UserKeyInfo
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultAreaId = "Asia-China-Guangdong-Shenzhen" SchedulerConfigKeyPrefix = "TITAN::SCHEDULERCFG" )
Functions ¶
func AesDecryptCBC ¶
AesDecryptCBC 解密
func AesDecryptCBCByKey ¶
AesDecryptCBCByKey 通过key解密aes密文
func AesEncryptCBC ¶
AesEncryptCBC 加密后再进行base64编码
func CreateAPIKey ¶
func CreateAPIKey(ctx context.Context, userID, keyName string, perms []string, buf []byte) ([]byte, string, error)
CreateAPIKey 创建API key
func CreateAPIKeySecret ¶
func CreateAPIKeySecret(ctx context.Context, userID, keyName string, buf []byte) ([]byte, string, string, error)
CreateAPIKeySecret 创建api key secret
func CreateTenantKey ¶
CreateTenantKey 生成租户key
func DecodeAPIKeySecrets ¶
func DecodeAPIKeySecrets(buf []byte) (map[string]UserAPIKeySecretInfo, error)
DecodeAPIKeySecrets 解码用户 api key secrets
func DecodeAPIKeys ¶
func DecodeAPIKeys(buf []byte) (map[string]UserAPIKeysInfo, error)
DecodeAPIKeys 解码用户 api keys
func EncodeAPIKeySecrets ¶
func EncodeAPIKeySecrets(apiKeys map[string]UserAPIKeySecretInfo) ([]byte, error)
EncodeAPIKeySecrets 编码用户 api key secrets
func EncodeAPIKeys ¶
func EncodeAPIKeys(apiKeys map[string]UserAPIKeysInfo) ([]byte, error)
EncodeAPIKeys 编码用户 api keys
func GenTenantKeySecretBlob ¶
Types ¶
type JWTPayload ¶
type JWTPayload struct { // role base access controller permission Allow []string ID string // TODO remove NodeID later, any role id replace as ID NodeID string // Extend is json string Extend string // The sub permission of user AccessControlList []userAccessControl }
JWTPayload jwt载体
func AuthVerify ¶
func AuthVerify(token string) (*JWTPayload, error)
AuthVerify verifies a JWT token and returns the permissions associated with it
type TenantInfo ¶
TenantInfo 租户信息
func AesDecryptTenantKey ¶
func AesDecryptTenantKey(cstr string) (*TenantInfo, error)
AesDecryptTenantKey 解密key并获取payload
type TenantKeySecretPair ¶
func LoadTenantKeyPairFromBlob ¶
func LoadTenantKeyPairFromBlob(buf []byte) (*TenantKeySecretPair, error)
type UserAPIKeySecretInfo ¶
UserAPIKeySecretInfo 用户 api key secret信息
type UserAPIKeysInfo ¶
UserAPIKeysInfo 用户 api key 信息
Click to show internal directories.
Click to hide internal directories.