api

package
v1.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIEndpoint

type APIEndpoint multiaddr.Multiaddr

rpc api endpoint

type CommonAPIAdapter added in v1.2.0

type CommonAPIAdapter struct {
	Internal struct {
		AuthVerify  func(ctx context.Context, token string) ([]permission.Permission, error) `perm:"read"`
		AuthNew     func(ctx context.Context, perms []permission.Permission) ([]byte, error) `perm:"admin"`
		Version     func(context.Context) (common.Version, error)                            `perm:"read"`
		LogList     func(context.Context) ([]string, error)                                  `perm:"write"`
		LogSetLevel func(context.Context, string, string) error                              `perm:"write"`
	}
}

common API permissions constraints

func (*CommonAPIAdapter) AuthNew added in v1.2.0

func (c *CommonAPIAdapter) AuthNew(ctx context.Context, perms []permission.Permission) ([]byte, error)

func (*CommonAPIAdapter) AuthVerify added in v1.2.0

func (c *CommonAPIAdapter) AuthVerify(ctx context.Context, token string) ([]permission.Permission, error)

func (*CommonAPIAdapter) LogList added in v1.2.0

func (c *CommonAPIAdapter) LogList(ctx context.Context) ([]string, error)

func (*CommonAPIAdapter) LogSetLevel added in v1.2.0

func (c *CommonAPIAdapter) LogSetLevel(ctx context.Context, group, level string) error

func (*CommonAPIAdapter) Version added in v1.2.0

func (c *CommonAPIAdapter) Version(ctx context.Context) (common.Version, error)

Version implements API.Version

type FullAPIAdapter added in v1.2.0

full service API permissions constraints

type StrategyAPIAdapter added in v1.2.0

type StrategyAPIAdapter struct {
	Internal struct {
		NewMsgTypeTemplate     func(ctx context.Context, name string, codes []int) error                                                  `perm:"admin" local:"required"`
		NewMethodTemplate      func(ctx context.Context, name string, methods []string) error                                             `perm:"admin" local:"required"`
		NewKeyBindCustom       func(ctx context.Context, name string, address core.Address, codes []int, methods []core.MethodName) error `perm:"admin" local:"required"`
		NewKeyBindFromTemplate func(ctx context.Context, name string, address core.Address, mttName, mtName string) error                 `perm:"admin" local:"required"`
		NewGroup               func(ctx context.Context, name string, keyBindNames []string) error                                        `perm:"admin" local:"required"`
		NewStToken             func(ctx context.Context, groupName string) (token string, err error)                                      `perm:"admin" local:"required"`

		GetMsgTypeTemplate      func(ctx context.Context, name string) (*storage.MsgTypeTemplate, error)    `perm:"admin" local:"required"`
		GetMethodTemplateByName func(ctx context.Context, name string) (*storage.MethodTemplate, error)     `perm:"admin" local:"required"`
		GetKeyBindByName        func(ctx context.Context, name string) (*storage.KeyBind, error)            `perm:"admin" local:"required"`
		GetKeyBinds             func(ctx context.Context, address core.Address) ([]*storage.KeyBind, error) `perm:"admin" local:"required"`
		GetGroupByName          func(ctx context.Context, name string) (*storage.Group, error)              `perm:"admin" local:"required"`
		GetWalletTokensByGroup  func(ctx context.Context, groupName string) ([]string, error)               `perm:"admin" local:"required"`
		GetWalletTokenInfo      func(ctx context.Context, token string) (*storage.GroupAuth, error)         `perm:"admin" local:"required"`

		ListGroups           func(ctx context.Context, fromIndex, toIndex int) ([]*storage.Group, error)           `perm:"admin" local:"required"`
		ListKeyBinds         func(ctx context.Context, fromIndex, toIndex int) ([]*storage.KeyBind, error)         `perm:"admin" local:"required"`
		ListMethodTemplates  func(ctx context.Context, fromIndex, toIndex int) ([]*storage.MethodTemplate, error)  `perm:"admin" local:"required"`
		ListMsgTypeTemplates func(ctx context.Context, fromIndex, toIndex int) ([]*storage.MsgTypeTemplate, error) `perm:"admin" local:"required"`

		AddMsgTypeIntoKeyBind    func(ctx context.Context, name string, codes []int) (*storage.KeyBind, error)      `perm:"admin" local:"required"`
		AddMethodIntoKeyBind     func(ctx context.Context, name string, methods []string) (*storage.KeyBind, error) `perm:"admin" local:"required"`
		RemoveMsgTypeFromKeyBind func(ctx context.Context, name string, codes []int) (*storage.KeyBind, error)      `perm:"admin" local:"required"`
		RemoveMethodFromKeyBind  func(ctx context.Context, name string, methods []string) (*storage.KeyBind, error) `perm:"admin" local:"required"`

		RemoveStToken          func(ctx context.Context, token string) error                                                  `perm:"admin" local:"required"`
		RemoveKeyBind          func(ctx context.Context, name string) error                                                   `perm:"admin" local:"required"`
		RemoveKeyBindByAddress func(ctx context.Context, address core.Address) (int64, error)                                 `perm:"admin" local:"required"`
		RemoveGroup            func(ctx context.Context, name string) error                                                   `perm:"admin" local:"required"`
		RemoveMethodTemplate   func(ctx context.Context, name string) error                                                   `perm:"admin" local:"required"`
		RemoveMsgTypeTemplate  func(ctx context.Context, name string) error                                                   `perm:"admin" local:"required"`
		ScopeWallet            func(ctx context.Context) (*core.AddressScope, error)                                          `perm:"admin" local:"required"`
		ContainWallet          func(ctx context.Context, address core.Address) bool                                           `perm:"admin" local:"required"`
		Verify                 func(ctx context.Context, address core.Address, msgType core.MsgType, msg *core.Message) error `perm:"admin" local:"required"`
	}
}

func (*StrategyAPIAdapter) AddMethodIntoKeyBind added in v1.3.0

func (o *StrategyAPIAdapter) AddMethodIntoKeyBind(ctx context.Context, name string, methods []string) (*storage.KeyBind, error)

func (*StrategyAPIAdapter) AddMsgTypeIntoKeyBind added in v1.3.0

func (o *StrategyAPIAdapter) AddMsgTypeIntoKeyBind(ctx context.Context, name string, codes []int) (*storage.KeyBind, error)

func (*StrategyAPIAdapter) ContainWallet added in v1.2.0

func (o *StrategyAPIAdapter) ContainWallet(ctx context.Context, address core.Address) bool

func (*StrategyAPIAdapter) GetGroupByName added in v1.2.0

func (o *StrategyAPIAdapter) GetGroupByName(ctx context.Context, name string) (*storage.Group, error)

func (*StrategyAPIAdapter) GetKeyBindByName added in v1.2.0

func (o *StrategyAPIAdapter) GetKeyBindByName(ctx context.Context, name string) (*storage.KeyBind, error)

func (*StrategyAPIAdapter) GetKeyBinds added in v1.2.0

func (o *StrategyAPIAdapter) GetKeyBinds(ctx context.Context, address core.Address) ([]*storage.KeyBind, error)

func (*StrategyAPIAdapter) GetMethodTemplateByName added in v1.2.0

func (o *StrategyAPIAdapter) GetMethodTemplateByName(ctx context.Context, name string) (*storage.MethodTemplate, error)

func (*StrategyAPIAdapter) GetMsgTypeTemplate added in v1.2.0

func (o *StrategyAPIAdapter) GetMsgTypeTemplate(ctx context.Context, name string) (*storage.MsgTypeTemplate, error)

func (*StrategyAPIAdapter) GetWalletTokenInfo added in v1.2.0

func (o *StrategyAPIAdapter) GetWalletTokenInfo(ctx context.Context, token string) (*storage.GroupAuth, error)

func (*StrategyAPIAdapter) GetWalletTokensByGroup added in v1.2.0

func (o *StrategyAPIAdapter) GetWalletTokensByGroup(ctx context.Context, groupName string) ([]string, error)

func (*StrategyAPIAdapter) ListGroups added in v1.2.0

func (o *StrategyAPIAdapter) ListGroups(ctx context.Context, fromIndex, toIndex int) ([]*storage.Group, error)

func (*StrategyAPIAdapter) ListKeyBinds added in v1.2.0

func (o *StrategyAPIAdapter) ListKeyBinds(ctx context.Context, fromIndex, toIndex int) ([]*storage.KeyBind, error)

func (*StrategyAPIAdapter) ListMethodTemplates added in v1.2.0

func (o *StrategyAPIAdapter) ListMethodTemplates(ctx context.Context, fromIndex, toIndex int) ([]*storage.MethodTemplate, error)

func (*StrategyAPIAdapter) ListMsgTypeTemplates added in v1.2.0

func (o *StrategyAPIAdapter) ListMsgTypeTemplates(ctx context.Context, fromIndex, toIndex int) ([]*storage.MsgTypeTemplate, error)

func (*StrategyAPIAdapter) NewGroup added in v1.2.0

func (o *StrategyAPIAdapter) NewGroup(ctx context.Context, name string, keyBindNames []string) error

func (*StrategyAPIAdapter) NewKeyBindCustom added in v1.2.0

func (o *StrategyAPIAdapter) NewKeyBindCustom(ctx context.Context, name string, address core.Address, codes []int, methods []core.MethodName) error

func (*StrategyAPIAdapter) NewKeyBindFromTemplate added in v1.2.0

func (o *StrategyAPIAdapter) NewKeyBindFromTemplate(ctx context.Context, name string, address core.Address, mttName, mtName string) error

func (*StrategyAPIAdapter) NewMethodTemplate added in v1.2.0

func (o *StrategyAPIAdapter) NewMethodTemplate(ctx context.Context, name string, methods []string) error

func (*StrategyAPIAdapter) NewMsgTypeTemplate added in v1.2.0

func (o *StrategyAPIAdapter) NewMsgTypeTemplate(ctx context.Context, name string, codes []int) error

func (*StrategyAPIAdapter) NewStToken added in v1.3.0

func (o *StrategyAPIAdapter) NewStToken(ctx context.Context, groupName string) (token string, err error)

func (*StrategyAPIAdapter) RemoveGroup added in v1.2.0

func (o *StrategyAPIAdapter) RemoveGroup(ctx context.Context, name string) error

func (*StrategyAPIAdapter) RemoveKeyBind added in v1.2.0

func (o *StrategyAPIAdapter) RemoveKeyBind(ctx context.Context, name string) error

func (*StrategyAPIAdapter) RemoveKeyBindByAddress added in v1.2.0

func (o *StrategyAPIAdapter) RemoveKeyBindByAddress(ctx context.Context, address core.Address) (int64, error)

func (*StrategyAPIAdapter) RemoveMethodFromKeyBind added in v1.3.0

func (o *StrategyAPIAdapter) RemoveMethodFromKeyBind(ctx context.Context, name string, methods []string) (*storage.KeyBind, error)

func (*StrategyAPIAdapter) RemoveMethodTemplate added in v1.2.0

func (o *StrategyAPIAdapter) RemoveMethodTemplate(ctx context.Context, name string) error

func (*StrategyAPIAdapter) RemoveMsgTypeFromKeyBind added in v1.3.0

func (o *StrategyAPIAdapter) RemoveMsgTypeFromKeyBind(ctx context.Context, name string, codes []int) (*storage.KeyBind, error)

func (*StrategyAPIAdapter) RemoveMsgTypeTemplate added in v1.2.0

func (o *StrategyAPIAdapter) RemoveMsgTypeTemplate(ctx context.Context, name string) error

func (*StrategyAPIAdapter) RemoveStToken added in v1.3.0

func (o *StrategyAPIAdapter) RemoveStToken(ctx context.Context, token string) error

func (*StrategyAPIAdapter) ScopeWallet added in v1.2.0

func (o *StrategyAPIAdapter) ScopeWallet(ctx context.Context) (*core.AddressScope, error)

func (*StrategyAPIAdapter) Verify added in v1.2.0

func (o *StrategyAPIAdapter) Verify(ctx context.Context, address core.Address, msgType core.MsgType, msg *core.Message) error

type WalletAPIAdapter added in v1.2.0

type WalletAPIAdapter struct {
	Internal struct {
		WalletNew    func(ctx context.Context, kt core.KeyType) (core.Address, error)                                          `perm:"admin"`
		WalletHas    func(ctx context.Context, address core.Address) (bool, error)                                             `perm:"read"`
		WalletList   func(ctx context.Context) ([]core.Address, error)                                                         `perm:"read"`
		WalletSign   func(ctx context.Context, signer core.Address, toSign []byte, meta core.MsgMeta) (*core.Signature, error) `perm:"sign"`
		WalletExport func(ctx context.Context, addr core.Address) (*core.KeyInfo, error)                                       `perm:"admin"`
		WalletImport func(ctx context.Context, ki *core.KeyInfo) (core.Address, error)                                         `perm:"admin"`
		WalletDelete func(ctx context.Context, addr core.Address) error                                                        `perm:"admin"`
	}
}

wallet API permissions constraints

func (*WalletAPIAdapter) WalletDelete added in v1.2.0

func (c *WalletAPIAdapter) WalletDelete(ctx context.Context, addr core.Address) error

func (*WalletAPIAdapter) WalletExport added in v1.2.0

func (c *WalletAPIAdapter) WalletExport(ctx context.Context, a core.Address) (*core.KeyInfo, error)

func (*WalletAPIAdapter) WalletHas added in v1.2.0

func (c *WalletAPIAdapter) WalletHas(ctx context.Context, addr core.Address) (bool, error)

func (*WalletAPIAdapter) WalletImport added in v1.2.0

func (c *WalletAPIAdapter) WalletImport(ctx context.Context, ki *core.KeyInfo) (core.Address, error)

func (*WalletAPIAdapter) WalletList added in v1.2.0

func (c *WalletAPIAdapter) WalletList(ctx context.Context) ([]core.Address, error)

func (*WalletAPIAdapter) WalletNew added in v1.2.0

func (c *WalletAPIAdapter) WalletNew(ctx context.Context, keyType core.KeyType) (core.Address, error)

func (*WalletAPIAdapter) WalletSign added in v1.2.0

func (c *WalletAPIAdapter) WalletSign(ctx context.Context, signer core.Address, toSign []byte, meta core.MsgMeta) (*core.Signature, error)

type WalletEventAPIAdapter added in v1.2.0

type WalletEventAPIAdapter struct {
	Internal struct {
		AddSupportAccount func(ctx context.Context, supportAccount string) error      `perm:"admin"`
		AddNewAddress     func(ctx context.Context, newAddrs []address.Address) error `perm:"admin"`
	}
}

func (WalletEventAPIAdapter) AddNewAddress added in v1.2.0

func (w WalletEventAPIAdapter) AddNewAddress(ctx context.Context, newAddrs []address.Address) error

func (WalletEventAPIAdapter) AddSupportAccount added in v1.2.0

func (w WalletEventAPIAdapter) AddSupportAccount(ctx context.Context, supportAccount string) error

type WalletLockAPIAdapter added in v1.2.0

type WalletLockAPIAdapter struct {
	Internal struct {
		SetPassword    func(ctx context.Context, password string) error `perm:"admin" local:"required"`
		Unlock         func(ctx context.Context, password string) error `perm:"admin" local:"required"`
		Lock           func(ctx context.Context, password string) error `perm:"admin" local:"required"`
		VerifyPassword func(ctx context.Context, password string) error `perm:"admin" local:"required"`
		LockState      func(ctx context.Context) bool                   `perm:"admin"`
	}
}

func (*WalletLockAPIAdapter) Lock added in v1.2.0

func (c *WalletLockAPIAdapter) Lock(ctx context.Context, password string) error

func (*WalletLockAPIAdapter) LockState added in v1.2.0

func (c *WalletLockAPIAdapter) LockState(ctx context.Context) bool

func (*WalletLockAPIAdapter) SetPassword added in v1.2.0

func (c *WalletLockAPIAdapter) SetPassword(ctx context.Context, password string) error

func (*WalletLockAPIAdapter) Unlock added in v1.2.0

func (c *WalletLockAPIAdapter) Unlock(ctx context.Context, password string) error

func (*WalletLockAPIAdapter) VerifyPassword added in v1.2.1

func (c *WalletLockAPIAdapter) VerifyPassword(ctx context.Context, password string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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