Documentation ¶
Index ¶
- Variables
- func AddChannelStateSignature(address address.Address, sig gpwallet.Sig, channelState types.ChannelState)
- func AddDataSignature(address address.Address, sig gpwallet.Sig, msg []byte)
- func GetRandomByteSlice(minLength int, maxLength int, rng *rand.Rand) []byte
- func MakeRandomAddress(rng *rand.Rand) address.Address
- func MakeRandomSignature(rng *rand.Rand) gpwallet.Sig
- func MakeRemoteAccount(address address.Address, remote wallet.Remote) wallet.RemoteAccount
- func MakeTooFewAddressBytes(rng *rand.Rand) []byte
- func MakeTooFewPubKeyBytes(rng *rand.Rand) []byte
- func MakeTooLongSignature(rng *rand.Rand) gpwallet.Sig
- func MakeTooManyAddressBytes(rng *rand.Rand) []byte
- func MakeTooManyPubKeyBytes(rng *rand.Rand) []byte
- func MakeTooShortSignature(rng *rand.Rand) gpwallet.Sig
- func NewRemoteWallet(remote wallet.Remote) *wallet.RemoteWallet
- func VerifyChannelStateSig(sig ChannelStateSignature) bool
- func VerifyDataSig(sig DataSignature) bool
- type ChannelStateSignature
- type DataSignature
- type GenericRemote
- type MockRemote
- type OtherAddressImpl
Constants ¶
This section is empty.
Variables ¶
var ChannelIDOracle = &channelIDOracle{ parameters: []types.ChannelParameters{}, ids: []types.ID{}, }
var ValidSignatures = &validSignatures{ validDataSignatures: []DataSignature{}, validChannelStateSignatures: []ChannelStateSignature{}, }
Functions ¶
func AddDataSignature ¶
func GetRandomByteSlice ¶
GetRandomByteSlice returns a byte slice of a random length in [minLength, maxLength] filled with random values.
func MakeRemoteAccount ¶
func MakeTooFewAddressBytes ¶
func MakeTooFewPubKeyBytes ¶
func MakeTooManyAddressBytes ¶
func MakeTooManyPubKeyBytes ¶
func NewRemoteWallet ¶
func NewRemoteWallet(remote wallet.Remote) *wallet.RemoteWallet
func VerifyChannelStateSig ¶
func VerifyChannelStateSig(sig ChannelStateSignature) bool
func VerifyDataSig ¶
func VerifyDataSig(sig DataSignature) bool
Types ¶
type ChannelStateSignature ¶
type ChannelStateSignature struct { Address address.Address Signature gpwallet.Sig ChannelState types.ChannelState }
func (ChannelStateSignature) Equal ¶
func (d ChannelStateSignature) Equal(other ChannelStateSignature) bool
type DataSignature ¶
func (DataSignature) Equal ¶
func (d DataSignature) Equal(other DataSignature) bool
type GenericRemote ¶
type GenericRemote struct { AvailableAddresses []address.Address // contains filtered or unexported fields }
GenericRemote is a mock remote that suits the generic go-perun wallet tests. Signatures are generated randomly and all valid signature t-tuples are collected globally in ValidSignatures. This means that GenericRemote verifies a signature as valid, iff it has been signed by ANY Generic remote before. GenericRemote uses the ChannelIDOracle to come up with a random channel id that is then fixed to that ChannelParameters.
func NewGenericRemote ¶
func NewGenericRemote(availableAddresses []address.Address, rng *rand.Rand) *GenericRemote
NewGenericRemote returns a new generic remote instance. Every GenericRemote instance needs to receive an exclusive rand.Rand instance for concurrent safety!
func (*GenericRemote) CallEndpoint ¶
func (g *GenericRemote) CallEndpoint(endpoint string, request interface{}, response interface{}) error
func (*GenericRemote) SetCallEndpoint ¶
func (g *GenericRemote) SetCallEndpoint(f func(string, interface{}, interface{}) error)
type MockRemote ¶
type MockRemote struct { MockAddress address.Address MockPubKeyBytes [address.PubKeyLength]byte MockPubKeyHashBytes [address.PubKeyHashLength]byte UnavailableAddress address.Address // InvalidPubKeyBytes is invalid because it is not exactly wallet.PubKeyLength bytes long. InvalidPubKeyBytes []byte MockSignature []byte MockSignatureString string // OtherSignature is a correctly encoded signature that is not valid for any (message, public key) pair. OtherSignature []byte OtherSignatureString string // InvalidSignatureLonger is a signature that has a length longer than wallet.SignatureLength. InvalidSignatureLonger []byte // InvalidSignatureShorter is a signature that has a length shorter than wallet.SignatureLength. InvalidSignatureShorter []byte MockMessage []byte MockMessageString string MockChannelState types.ChannelState // contains filtered or unexported fields }
MockRemote should only be instantiated using NewMockRemote. The default implementation has one valid signature tuple: (MockMessage, MockSignature, MockAddress).
func NewMockRemote ¶
func NewMockRemote(rng *rand.Rand) *MockRemote
func (*MockRemote) CallEndpoint ¶
func (m *MockRemote) CallEndpoint(endpoint string, request interface{}, response interface{}) error
func (*MockRemote) SetCallEndpoint ¶
func (m *MockRemote) SetCallEndpoint(f func(string, interface{}, interface{}) error)
type OtherAddressImpl ¶
type OtherAddressImpl struct {
// contains filtered or unexported fields
}
func NewOtherAddressImpl ¶
func NewOtherAddressImpl(t *testing.T) *OtherAddressImpl
func (*OtherAddressImpl) MarshalBinary ¶
func (n *OtherAddressImpl) MarshalBinary() (data []byte, err error)
func (*OtherAddressImpl) String ¶
func (n *OtherAddressImpl) String() string
func (*OtherAddressImpl) UnmarshalBinary ¶
func (n *OtherAddressImpl) UnmarshalBinary(data []byte) error