session

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package session implements a session to which a user can attach his or her credentials. He or she can then use the session to open, use, and settle state channels.

Each session runs an instance of state channel network client and is owned by the user of the session. Data within a session is continuously persisted in runtime, allowing the user to close and restore the same session later.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg Config) (*session, error)

New initializes a SessionAPI instance for the given configuration and returns an instance of it. All methods on it are safe for concurrent use.

func NewUnlockedUser

func NewUnlockedUser(wb perun.WalletBackend, cfg UserConfig) (perun.User, error)

NewUnlockedUser initializes a user and unlocks all the accounts, those corresponding to on-chain address, off-chain address and all participant addresses.

Types

type Config

type Config struct {
	User UserConfig

	ContactsType       string        // Type of contacts provider.
	ContactsURL        string        // URL for accessing the contacts provider.
	ChainURL           string        // URL of the blockchain node.
	Asset, Adjudicator string        // Address of the Asset and Adjudicator contracts.
	ChainConnTimeout   time.Duration // Timeout for connecting to blockchain node.
	OnChainTxTimeout   time.Duration // Timeout to wait for confirmation of on-chain tx.
	ResponseTimeout    time.Duration // Timeout to wait for a response from the peer / user.

	DatabaseDir string // Path to directory containing persistence database.
	// Timeout for re-establishing all open channels (if any) that was persisted during the
	// previous running instance of the node.
	PeerReconnTimeout time.Duration
}

Config defines the parameters required to configure a session.

func ParseConfig

func ParseConfig(configFile string) (Config, error)

ParseConfig parses the session configuration from a file.

type UserConfig

type UserConfig struct {
	Alias string

	OnChainAddr   string
	OnChainWallet WalletConfig

	PartAddrs      []string
	OffChainAddr   string
	OffChainWallet WalletConfig

	CommAddr string
	CommType string
}

UserConfig defines the parameters required to configure a user. Address strings should be parsed using the wallet backend.

type WalletConfig

type WalletConfig struct {
	KeystorePath string
	Password     string
}

WalletConfig defines the parameters required to configure a wallet.

Directories

Path Synopsis
Package sessiontest implements test helpers for functionalities defined in session.
Package sessiontest implements test helpers for functionalities defined in session.

Jump to

Keyboard shortcuts

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