wallet

package
v0.0.0-...-7bd1b19 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EndpointSignData                    = "/sign"
	EndpointSignChannelState            = "/signChannelState"
	EndpointVerifyDataSignature         = "/verify"
	EndpointVerifyChannelStateSignature = "/verifyChannelState"
	EndpointKeyAvailable                = "/keyAvailable"
	EndpointCalculateChannelID          = "/calculateChannelID"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type PerunCardanoWallet

type PerunCardanoWallet struct {
	// contains filtered or unexported fields
}

PerunCardanoWallet is a basic implementation Remote implementation that calls perun-cardano-wallet via http.

func NewPerunCardanoWallet

func NewPerunCardanoWallet(addr string) *PerunCardanoWallet

NewPerunCardanoWallet returns a new PerunCardanoWallet with the given server address.

func (*PerunCardanoWallet) CallEndpoint

func (r *PerunCardanoWallet) CallEndpoint(endpoint string, body interface{}, result interface{}) error

CallEndpoint calls the given endpoint on the remote wallet and decodes the json response into the given result. `result` must be a pointer.

type Remote

type Remote interface {
	// CallEndpoint calls the given endpoint with the given body, writing the result to the given result.
	CallEndpoint(endpoint string, body interface{}, result interface{}) error
}

Remote is an interface, which instances are used to communicate with the perun-cardano-wallet server.

type RemoteAccount

type RemoteAccount struct {
	AccountAddress address.Address
	// contains filtered or unexported fields
}

RemoteAccount represents a cardano account. The secrets are stored on the associated remote walletServer.

func MakeRemoteAccount

func MakeRemoteAccount(addr address.Address, r Remote, id string) RemoteAccount

MakeRemoteAccount returns a new RemoteAccount instance.

func (RemoteAccount) Address

func (a RemoteAccount) Address() wallet.Address

Address returns the Address associated with this account.

func (RemoteAccount) GetCardanoWalletID

func (a RemoteAccount) GetCardanoWalletID() string

func (RemoteAccount) SignChannelState

func (a RemoteAccount) SignChannelState(channelState types.ChannelState) (wallet.Sig, error)

SignChannelState signs the given channel state with this account.

func (RemoteAccount) SignData

func (a RemoteAccount) SignData(data []byte) (wallet.Sig, error)

SignData signs arbitrary data with this account.

type RemoteBackend

type RemoteBackend struct {
	// contains filtered or unexported fields
}

RemoteBackend is a wallet.Backend implementation with a remote server for signing data and verifying signatures.

func MakeRemoteBackend

func MakeRemoteBackend(remote Remote) RemoteBackend

MakeRemoteBackend returns a new RemoteBackend struct.

func (RemoteBackend) CalculateChannelID

func (b RemoteBackend) CalculateChannelID(parameters types.ChannelParameters) (channel.ID, error)

CalculateChannelID returns the channelId for the given parameters as calculated by the remote instance.

func (RemoteBackend) DecodeSig

func (b RemoteBackend) DecodeSig(reader io.Reader) (wallet.Sig, error)

DecodeSig reads SignatureLength bytes from the given reader and returns the read signature.

func (RemoteBackend) NewAddress

func (b RemoteBackend) NewAddress() wallet.Address

NewAddress returns a pointer to a new, empty address.

func (RemoteBackend) ToChannelStateSigningAccount

func (b RemoteBackend) ToChannelStateSigningAccount(account wallet.Account) (types.ChannelStateSigningAccount, error)

func (RemoteBackend) VerifyChannelStateSignature

func (b RemoteBackend) VerifyChannelStateSignature(state types.ChannelState, sig wallet.Sig, a wallet.Address) (bool, error)

VerifyChannelStateSignature returns true, iff the given signature is valid for the given ChannelState under the public key associated with the given address.

func (RemoteBackend) VerifySignature

func (b RemoteBackend) VerifySignature(msg []byte, sig wallet.Sig, a wallet.Address) (bool, error)

VerifySignature returns true, iff the given signature is valid for the given message under the public key associated with the given address.

type RemoteWallet

type RemoteWallet struct {
	// contains filtered or unexported fields
}

RemoteWallet is a cardano signing wallet using a remote wallet server. Note: If we decide to stick with a remote signing wallet, we will have to harden the wallet server!

func NewRemoteWallet

func NewRemoteWallet(remote Remote, id string) *RemoteWallet

NewRemoteWallet returns a pointer to a new RemoteWallet struct associated with the given Remote wallet server.

func (*RemoteWallet) DecrementUsage

func (w *RemoteWallet) DecrementUsage(address wallet.Address)

DecrementUsage is unimplemented due to the remote nature of this wallet.

func (*RemoteWallet) IncrementUsage

func (w *RemoteWallet) IncrementUsage(address wallet.Address)

IncrementUsage is unimplemented due to the remote nature of this wallet.

func (*RemoteWallet) LockAll

func (w *RemoteWallet) LockAll()

LockAll is unimplemented due to the remote nature of this wallet.

func (*RemoteWallet) Unlock

func (w *RemoteWallet) Unlock(addr wallet.Address) (wallet.Account, error)

Unlock returns the account of the given address, iff the wallet server associated with this RemoteWallet has that account.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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