remotewallet

package
v1.1.3-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2021 License: Apache-2.0, MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func ConvertLocalKeyInfo

func ConvertLocalKeyInfo(key *wallet.KeyInfo) *crypto.KeyInfo

func ConvertRemoteKeyInfo

func ConvertRemoteKeyInfo(key *crypto.KeyInfo) *wallet.KeyInfo

func GetKeyType

func GetKeyType(p address.Protocol) wallet.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, wallet.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 wallet.MsgMeta) (*wallet.Signature, error)
	WalletExport(ctx context.Context, addr address.Address) (*wallet.KeyInfo, error)
	WalletImport(context.Context, *wallet.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 wallet.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 wallet.MsgMeta) (*wallet.Signature, error) `perm:"sign"`
		WalletExport func(ctx context.Context, addr address.Address) (*wallet.KeyInfo, error)                                         `perm:"admin"`
		WalletImport func(ctx context.Context, ki *wallet.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) (*wallet.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 *wallet.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 wallet.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 wallet.MsgMeta) (*wallet.Signature, error)

Jump to

Keyboard shortcuts

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