account_access

package
v1.4.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMsgAccessKeyInvalidPartCountOrPrefix = errors.New("invalid part count or prefix")
	ErrMsgAccessKeyBase64Decode             = errors.New("base64 decode")
	ErrMsgAccessKeyInvalidPartCount         = errors.New("invalid part count of contents")
	ErrMsgAccessKeyInvalidAccountID         = errors.New("invalid account id")
	ErrMsgAccessKeyInvalidTimestamp         = errors.New("invalid timestamp")
)

Functions

func DeleteByName

func DeleteByName(ctx context.Context, name string) error

func GenAccessKey

func GenAccessKey(id types.SFID) (rand, key string, ts time.Time)

GenAccessKey key contains token owner, random string and generate time

func ParseAccessKey

func ParseAccessKey(key string) (id types.SFID, rand string, ts time.Time, err error)

ParseAccessKey parse access key

func Validate

func Validate(ctx context.Context, key string) (interface{}, error, bool)

Types

type CreateReq

type CreateReq struct {
	// Name access token name
	Name string `json:"name"`
	// ExpirationDays access token valid in ExpirationDays, if 0 means token will not be expired.
	ExpirationDays int `json:"expirationDays,omitempty"`
	// Description access token description
	Desc string `json:"desc"`
	// contains filtered or unexported fields
}

type CreateRsp

type CreateRsp struct {
	Name      string           `json:"name"`
	AccessKey string           `json:"accessKey"`
	ExpiredAt *types.Timestamp `json:"expiredAt,omitempty"`
	Desc      string           `json:"desc,omitempty"`
}

func Create

func Create(ctx context.Context, r *CreateReq) (*CreateRsp, error)

Jump to

Keyboard shortcuts

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