storage

package
v0.0.0-...-8066787 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2024 License: Apache-2.0, MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultAreaId            = "Asia-China-Guangdong-Shenzhen"
	SchedulerConfigKeyPrefix = "TITAN::SCHEDULERCFG"
)

Functions

func AesDecryptCBC

func AesDecryptCBC(data string, key []byte) (crypted []byte, err error)

AesDecryptCBC 解密

func AesDecryptCBCByKey

func AesDecryptCBCByKey(cstr string) (string, error)

AesDecryptCBCByKey 通过key解密aes密文

func AesEncryptCBC

func AesEncryptCBC(data []byte, key []byte) (string, error)

AesEncryptCBC 加密后再进行base64编码

func CIDToHash

func CIDToHash(cidString string) (string, error)

CIDToHash converts a CID string to its corresponding hash string.

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

func CreateTenantKey(tenatID, name string) ([]byte, string, string, error)

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

func GenTenantKeySecretBlob(apiKey, apiSecret string) ([]byte, error)

func HashToCID

func HashToCID(hashString string) (string, error)

HashToCID [不建议继续使用] converts a hash string to its corresponding CID string.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client 客户端

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

type TenantInfo struct {
	TenantID string
	Name     string
	Salt     string
}

TenantInfo 租户信息

func AesDecryptTenantKey

func AesDecryptTenantKey(cstr string) (*TenantInfo, error)

AesDecryptTenantKey 解密key并获取payload

type TenantKeySecretPair

type TenantKeySecretPair struct {
	ApiKey      string
	ApiSecret   string
	CreatedTime time.Time
}

func LoadTenantKeyPairFromBlob

func LoadTenantKeyPairFromBlob(buf []byte) (*TenantKeySecretPair, error)

type UserAPIKeySecretInfo

type UserAPIKeySecretInfo struct {
	APIKey      string
	APISecret   string
	CreatedTime time.Time
}

UserAPIKeySecretInfo 用户 api key secret信息

type UserAPIKeysInfo

type UserAPIKeysInfo struct {
	CreatedTime time.Time
	APIKey      string
}

UserAPIKeysInfo 用户 api key 信息

type UserKeyInfo

type UserKeyInfo struct {
	UID  string
	Salt string
}

UserKeyInfo 用户key信息

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL