wallet

package
v0.0.0-...-7107d2d Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: MIT Imports: 30 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)

NewKeyPair is a constructor for key pair

func PEMToPrivateKey

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

PEMToPrivateKey converts a PEM encoded private key to a PrivateKey

Types

type InvokeResponse

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

InvokeResponse is a response from invoke

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)

NewKey creates a new key from a private key.

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

Option is a user option for invoke

type User

type User struct {
	// ID is a user ID for invoke
	ID string
	// PublicKey is a public key for invoke
	PublicKey ed25519.PublicKey
	// SecretKey is a secret key for invoke
	SecretKey ed25519.PrivateKey
	// contains filtered or unexported fields
}

User is a user for invoke

func NewUser

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

NewUser is a constructor for user

func (*User) AddUser

func (u *User) AddUser() error

AddUser is a method for adding user

func (*User) Addr

func (u *User) Addr() string

Addr is a method for getting address

func (*User) AddrFromKey

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

AddrFromKey is a method for getting address from key

func (*User) BalanceShouldBe

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

BalanceShouldBe is a method for balance should be check

func (*User) Base58Pk

func (u *User) Base58Pk() string

Base58Pk is a base58 public key

func (*User) ChangeKeys

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

ChangeKeys is a method for changing keys

func (*User) Invoke

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

Invoke is a method for invoke

func (*User) InvokeWithListener

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

InvokeWithListener is a method for invoke with listener

func (*User) Query

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

Query is a method for query

func (*User) SendBatch

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

SendBatch is a method for send batch of transactions

func (*User) Sign

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

Sign is a method for signing

func (*User) SignedInvoke

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

SignedInvoke is a method for signed invoke

func (*User) SignedInvokeAsync

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

SignedInvokeAsync is a method for signed invoke async

func (*User) SwapAnswerAndDone

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

SwapAnswerAndDone is a method for swap answer and done

Jump to

Keyboard shortcuts

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