wallet

package
v0.0.0-...-5a265b9 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewKeyPair

func NewKeyPair(private string) (ed25519.PrivateKey, ed25519.PublicKey, error)

func PEMToPrivateKey

func PEMToPrivateKey(raw []byte, pwd []byte) (interface{}, error)

Types

type InvokeResponse

type InvokeResponse struct {
	Event    *fab.TxStatusEvent
	Response []byte
}

type Key

type Key struct {
	PrivKey ed25519.PrivateKey
	PubKey  ed25519.PublicKey
}

Key is a core.Key wrapper for *ecdsa.PublicKey

func NewKey

func NewKey(private string) (*Key, error)

func (*Key) Bytes

func (k *Key) Bytes() (raw []byte, err error)

Bytes converts this key to its byte representation.

func (*Key) Private

func (k *Key) Private() bool

Private returns true if this key is a private key, false otherwise.

func (*Key) PublicKey

func (k *Key) PublicKey() (core.Key, error)

PublicKey returns the corresponding public key part of an asymmetric public/private key pair.

func (*Key) SKI

func (k *Key) SKI() (ski []byte)

SKI returns the subject key identifier of this key.

func (*Key) Symmetric

func (k *Key) Symmetric() bool

Symmetric returns true if this key is a symmetric key, false otherwise.

type Option

type Option func(u *User) error

type User

type User struct {
	ID        string
	PublicKey ed25519.PublicKey
	SecretKey ed25519.PrivateKey
	// contains filtered or unexported fields
}

func NewUser

func NewUser(msp, backendCert, backendKey, connection, id, privateKey string, opts ...Option) (*User, error)

func (*User) AddUser

func (u *User) AddUser() error

func (*User) Addr

func (u *User) Addr() string

func (*User) AddrFromKey

func (u *User) AddrFromKey(key ed25519.PublicKey) string

func (*User) BalanceShouldBe

func (u *User) BalanceShouldBe(expected uint64) error

func (*User) Base58Pk

func (u *User) Base58Pk() string

func (*User) ChangeKeys

func (u *User) ChangeKeys(secretKey ed25519.PrivateKey, publicKey ed25519.PublicKey)

func (*User) Invoke

func (u *User) Invoke(ch, cc, fn string, args ...string) (*InvokeResponse, error)

func (*User) InvokeWithListener

func (u *User) InvokeWithListener(ch, cc, fn string, args ...string) (*InvokeResponse, error)

func (*User) Query

func (u *User) Query(ch, cc, fn string, args ...string) ([]byte, error)

func (*User) QueryWithRetryIfEndorsementMismatch

func (u *User) QueryWithRetryIfEndorsementMismatch(ch, cc, fn string, args ...string) ([]byte, error)

func (*User) SendBatch

func (u *User) SendBatch(ch, cc string, batch *proto.Batch) (*fab.TxStatusEvent, *proto.BatchResponse, error)

func (*User) Sign

func (u *User) Sign(msg []byte) []byte

func (*User) SignedInvoke

func (u *User) SignedInvoke(nonce *int64, ch, cc, fn string, args ...string) (*InvokeResponse, error)

func (*User) SignedInvokeAsync

func (u *User) SignedInvokeAsync(ch, cc, fn string, args ...string) (*InvokeResponse, error)

func (*User) SwapAnswerAndDone

func (u *User) SwapAnswerAndDone(ch, cc, swapId string, swapKey string) error

Jump to

Keyboard shortcuts

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