remotewallet

package
v1.15.2 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0, MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServiceToken        = "Authorization"
	WalletStrategyToken = "StrategyToken"
)

Variables

This section is empty.

Functions

func ConvertLocalKeyInfo

func ConvertLocalKeyInfo(keyInfo *types.KeyInfo) *key.KeyInfo

func ConvertRemoteKeyInfo

func ConvertRemoteKeyInfo(key *key.KeyInfo) *types.KeyInfo

func GetKeyType

func GetKeyType(p address.Protocol) types.KeyType

func SetupRemoteWallet

func SetupRemoteWallet(info string) (wallet.WalletIntersection, error)

Types

type APIInfo added in v0.9.7

type APIInfo struct {
	Addr          string
	Token         []byte
	StrategyToken []byte
}

APIInfo parse URL string to

func ParseAPIInfo added in v0.9.7

func ParseAPIInfo(s string) (*APIInfo, error)

func (APIInfo) AuthHeader added in v0.9.7

func (a APIInfo) AuthHeader() http.Header

func (APIInfo) DialArgs added in v0.9.7

func (a APIInfo) DialArgs() (string, error)

type IWallet added in v0.9.7

type IWallet interface {
	WalletNew(context.Context, types.KeyType) (address.Address, error)
	WalletHas(ctx context.Context, address address.Address) (bool, error)
	WalletList(ctx context.Context) ([]address.Address, error)
	WalletSign(ctx context.Context, signer address.Address, toSign []byte, meta types.MsgMeta) (*crypto.Signature, error)
	WalletExport(ctx context.Context, addr address.Address) (*types.KeyInfo, error)
	WalletImport(context.Context, *types.KeyInfo) (address.Address, error)
	WalletDelete(context.Context, address.Address) error
}

func NewWalletRPC added in v0.9.7

func NewWalletRPC(ctx context.Context, addr string, requestHeader http.Header) (IWallet, jsonrpc.ClientCloser, error)

NewWalletRPC RPCClient returns an RPC client connected to a node @addr reference ./httpparse/ParseApiInfo() @requestHeader reference ./httpparse/ParseApiInfo()

type WalletAPIAdapter added in v0.9.7

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

wallet API permissions constraints

func (*WalletAPIAdapter) WalletDelete added in v0.9.7

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

func (*WalletAPIAdapter) WalletExport added in v0.9.7

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

func (*WalletAPIAdapter) WalletHas added in v0.9.7

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

func (*WalletAPIAdapter) WalletImport added in v0.9.7

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

func (*WalletAPIAdapter) WalletList added in v0.9.7

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

func (*WalletAPIAdapter) WalletNew added in v0.9.7

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

func (*WalletAPIAdapter) WalletSign added in v0.9.7

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

Jump to

Keyboard shortcuts

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