wallet

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package wallet provides the necessary components to use Stellar accounts for Perun payment channels.

Index

Constants

View Source
const SignatureLength = 64

SignatureLength is the length of a signature in bytes.

Variables

View Source
var Backend = backend{}

Functions

func NewRandomAddress

func NewRandomAddress(rng *rand.Rand) wallet.Address

Types

type Account

type Account struct {

	// ParticipantAddress references the ParticipantAddress of the Participant this account belongs to.
	ParticipantAddress keypair.FromAddress
	// contains filtered or unexported fields
}

Account is used for signing channel state.

func NewRandomAccount

func NewRandomAccount(rng *rand.Rand) (*Account, *keypair.Full, error)

NewRandomAccount creates a new account with a random private key. It also creates a random key pair, using its address as the account'privateKey Account.ParticipantAddress.

func NewRandomAccountWithAddress

func NewRandomAccountWithAddress(rng *rand.Rand, addr *keypair.FromAddress) (*Account, error)

NewRandomAccountWithAddress creates a new account with a random private key and the given address as Account.ParticipantAddress.

func (Account) Address

func (a Account) Address() wallet.Address

Address returns the Participant this account belongs to.

func (Account) Participant

func (a Account) Participant() *types.Participant

func (Account) SignData

func (a Account) SignData(data []byte) ([]byte, error)

SignData signs the given data with the account's private key.

type EphemeralWallet

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

func NewEphemeralWallet

func NewEphemeralWallet() *EphemeralWallet

func (*EphemeralWallet) AddAccount

func (e *EphemeralWallet) AddAccount(acc *Account) error

func (*EphemeralWallet) AddNewAccount

func (e *EphemeralWallet) AddNewAccount(rng *rand.Rand) (*Account, *keypair.Full, error)

func (*EphemeralWallet) DecrementUsage

func (e *EphemeralWallet) DecrementUsage(address wallet.Address)

func (*EphemeralWallet) IncrementUsage

func (e *EphemeralWallet) IncrementUsage(address wallet.Address)

func (*EphemeralWallet) LockAll

func (e *EphemeralWallet) LockAll()

func (*EphemeralWallet) Unlock

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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