strategy

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2021 License: MIT, Apache-2.0, MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrGenToken            = errors.New("token generation failed")
	ErrIllegalMetaType     = errors.New("this metaType or method is not allowed to pass")
	ErrGenerateTokenFailed = errors.New("generate token failed")
)

Functions

This section is empty.

Types

type ILocalStrategy

type ILocalStrategy interface {
	IStrategyVerify
	IStrategy
}

type IStrategy

type IStrategy interface {
	NewMsgTypeTemplate(ctx context.Context, name string, codes []int) error
	NewMethodTemplate(ctx context.Context, name string, methods []string) error
	NewKeyBindCustom(ctx context.Context, name, address string, codes []int, methods []core.MethodName) error
	NewKeyBindFromTemplate(ctx context.Context, name, address, mttName, mtName string) error
	NewGroup(ctx context.Context, name string, keyBindNames []string) error
	NewWalletToken(ctx context.Context, groupName string) (token string, err error)

	GetMsgTypeTemplate(ctx context.Context, name string) (*storage.MsgTypeTemplate, error)
	GetMethodTemplateByName(ctx context.Context, name string) (*storage.MethodTemplate, error)
	GetKeyBindByName(ctx context.Context, name string) (*storage.KeyBind, error)
	GetKeyBinds(ctx context.Context, address string) ([]*storage.KeyBind, error)
	GetGroupByName(ctx context.Context, name string) (*storage.Group, error)
	GetWalletTokensByGroup(ctx context.Context, groupName string) ([]string, error)
	GetWalletTokenInfo(ctx context.Context, token string) (*storage.GroupAuth, error)

	ListGroups(ctx context.Context, fromIndex, toIndex int) ([]*storage.Group, error)
	ListKeyBinds(ctx context.Context, fromIndex, toIndex int) ([]*storage.KeyBind, error)
	ListMethodTemplates(ctx context.Context, fromIndex, toIndex int) ([]*storage.MethodTemplate, error)
	ListMsgTypeTemplates(ctx context.Context, fromIndex, toIndex int) ([]*storage.MsgTypeTemplate, error)

	PushMsgTypeIntoKeyBind(ctx context.Context, name string, codes []int) (*storage.KeyBind, error)
	PushMethodIntoKeyBind(ctx context.Context, name string, methods []string) (*storage.KeyBind, error)
	PullMsgTypeFromKeyBind(ctx context.Context, name string, codes []int) (*storage.KeyBind, error)
	PullMethodFromKeyBind(ctx context.Context, name string, methods []string) (*storage.KeyBind, error)

	RemoveMsgTypeTemplate(nctx context.Context, ame string) error
	RemoveGroup(ctx context.Context, name string) error
	RemoveMethodTemplate(ctx context.Context, name string) error
	RemoveKeyBind(ctx context.Context, name string) error
	RemoveKeyBindByAddress(ctx context.Context, address string) (int64, error)
	RemoveToken(ctx context.Context, token string) error
}

type IStrategyVerify

type IStrategyVerify interface {
	Verify(ctx context.Context, address core.Address, msgType core.MsgType, msg *core.Message) error
	//@bool: root can do anything
	ScopeWallet(ctx context.Context) (*core.AddressScope, error)
	ContainWallet(ctx context.Context, address core.Address) bool
}

NOTE: for wallet

type StrategyCache

type StrategyCache interface {
	// contains filtered or unexported methods
}

StrategyCache memory based wallet policy cache

type VerifyFunc

type VerifyFunc func(token, address string, enum core.MsgEnum, method core.MethodName) error

Jump to

Keyboard shortcuts

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