Documentation ¶
Index ¶
- func DecodeSig(r io.Reader) (wallet.Sig, error)
- func Hash(msg []byte) []byte
- type Account
- type Address
- func (a *Address) Clone() *Address
- func (a *Address) Cmp(b wallet.Address) int
- func (a *Address) ECDSA() *ecdsa.PublicKey
- func (a *Address) Equal(other wallet.Address) bool
- func (a *Address) MarshalBinary() ([]byte, error)
- func (a *Address) MarshalJSON() ([]byte, error)
- func (a *Address) String() string
- func (a *Address) UnmarshalBinary(data []byte) error
- func (a *Address) UnmarshalJSON(data []byte) error
- type Backend
- type Randomizer
- type Wallet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Account ¶
type Account ecdsa.PrivateKey
Account identifies a Fabric identity by its X509 certificate's private key. The only supported type is *ecdsa.PrivateKey because that's the only type used in Fabric currently.
func NewRandomAccount ¶
NewRandomAccount creates a new Account using the randomness provided by rng. The default curve (P-256) is used.
func (*Account) FabricAddress ¶
FabricAddress returns the public key of this account as this package's Address type.
type Address ¶
Address identifies a Fabric identity by its X509 certificate's public key. The only supported type is *ecdsa.PublicKey because that's the only type used in Fabric currently.
func AddressFromX509Certificate ¶
func AddressFromX509Certificate(cert *x509.Certificate) (*Address, error)
AddressFromX509Certificate extracts the public key from the given certificate.
func NewRandomAddress ¶
NewRandomAddress creates a new Address using the randomness provided by rng. The default curve (P-256) is used.
func (*Address) Cmp ¶
Cmp checks the ordering of two Addresses according to following definition: -1 if (a.X < b.X) || ((a.X == b.X) && (a.Y < b.Y)). 0 if (a.X == b.X) && (a.Y == b.Y). +1 if (a.X > b.X) || ((a.X == b.X) && (a.Y > b.Y)). So the X coordinate takes precedence over the Y coordinate. Pancis if the passed address is of the wrong type or the curves are not the same.
func (*Address) Equal ¶
Equal returns wether the two addresses are equal. The implementation must be equivalent to checking `Address.Cmp(Address) == 0`.
func (*Address) MarshalBinary ¶
MarshalBinary allows to marshal Address in ASN1.
func (*Address) MarshalJSON ¶
func (*Address) UnmarshalBinary ¶
UnmarshalBinary allows to unmarshal Address from ASN1.
func (*Address) UnmarshalJSON ¶
type Backend ¶
type Backend struct{}
Backend provides useful methods for hl fabric.
func (Backend) NewAddress ¶
NewAddress returns a variable of type Address, which can be used for unmarshalling an address from its binary representation.
type Randomizer ¶
type Randomizer struct {
// contains filtered or unexported fields
}
Randomizer wraps a Wallet to derive new random parameters from it.
func NewRandomizer ¶
func NewRandomizer() *Randomizer
NewRandomizer returns a Randomizer containing a fresh, random Wallet.
func (*Randomizer) NewRandomAddress ¶
func (r *Randomizer) NewRandomAddress(rng *rand.Rand) wallet.Address
NewRandomAddress should return a new random address generated from the passed rng.
func (*Randomizer) NewWallet ¶
func (r *Randomizer) NewWallet() test.Wallet
NewWallet returns a fresh, temporary Wallet that doesn't hold any accounts yet.
func (*Randomizer) RandomWallet ¶
func (r *Randomizer) RandomWallet() test.Wallet
RandomWallet returns a fixed random wallet that is part of the randomizer's state.
type Wallet ¶
Wallet contains multiple Account's identifiable by their AddrKey.
func (Wallet) DecrementUsage ¶
DecrementUsage - noop.
func (Wallet) IncrementUsage ¶
IncrementUsage - noop.
func (Wallet) NewRandomAccount ¶
NewRandomAccount generates a new random Account and adds it to the Wallet.