autobahn.xbr._config


Module Contents

Classes

Profile

User profile, stored as named section in ${HOME}/.xbrnetwork/config.ini:

UserConfig

Local user configuration file. The data is either a plain text (unencrypted)

WampUrl

WAMP transport URL validator.

EthereumAddress

Ethereum address validator.

PrivateKey

Private key (32 bytes in HEX) validator.

Functions

style_error(text)

style_ok(text)

prompt_for_wamp_url(msg[, default])

Prompt user for WAMP transport URL (eg "wss://planet.xbr.network/ws").

prompt_for_ethereum_address(msg)

Prompt user for an Ethereum (public) address.

prompt_for_key(msg, key_len[, default])

Prompt user for a binary key of given length (in HEX).

load_or_create_profile([dotdir, profile, default_url, ...])

Attributes

_HAS_COLOR_TERM

term

_DEFAULT_CFC_URL

_DEFAULT_CONFIG

autobahn.xbr._config._HAS_COLOR_TERM = False
autobahn.xbr._config.term
class autobahn.xbr._config.Profile(path: Optional[str] = None, name: Optional[str] = None, member_adr: Optional[str] = None, ethkey: Optional[bytes] = None, cskey: Optional[bytes] = None, username: Optional[str] = None, email: Optional[str] = None, network_url: Optional[str] = None, network_realm: Optional[str] = None, member_oid: Optional[uuid.UUID] = None, vaction_oid: Optional[uuid.UUID] = None, vaction_requested: Optional[numpy.datetime64] = None, vaction_verified: Optional[numpy.datetime64] = None, data_url: Optional[str] = None, data_realm: Optional[str] = None, infura_url: Optional[str] = None, infura_network: Optional[str] = None, infura_key: Optional[str] = None, infura_secret: Optional[str] = None)[source]

Bases: object

User profile, stored as named section in ${HOME}/.xbrnetwork/config.ini:

[default]
# username used with this profile
username=joedoe

# user email used with the profile (e.g. for verification emails)
email=joe.doe@example.com

# XBR network node used as a directory server and gateway to XBR smart contracts
network_url=ws://localhost:8090/ws

# WAMP realm on network node, usually "xbrnetwork"
network_realm=xbrnetwork

# user private WAMP-cryptosign key (for client authentication)
cskey=0xb18bbe88ca0e189689e99f87b19addfb179d46aab3d59ec5d93a15286b949eb6

# user private Ethereum key (for signing transactions and e2e data encryption)
ethkey=0xfbada363e724d4db2faa2eeaa7d7aca37637b1076dd8cf6fefde13983abaa2ef
marshal()[source]
static parse(path, name, items)[source]
class autobahn.xbr._config.UserConfig(config_path)[source]

Bases: object

Local user configuration file. The data is either a plain text (unencrypted) .ini file, or such a file encrypted with XSalsa20-Poly1305, and with a binary file header of 48 octets.

property config_path: List[str]

Return the path to the user configuration file exposed by this object.,

Returns

Local filesystem path.

property profiles: Dict[str, object]

Access to a map of user profiles in this user configuration.

Returns

Map of user profiles.

save(password: Optional[str] = None)[source]

Save this user configuration to the underlying configuration file. The user configuration file can be encrypted using Argon2id when a password is given.

Parameters

password – The optional Argon2id password.

Returns

Number of octets written to the user configuration file.

load(cb_get_password=None) List[str][source]

Load this object from the underlying user configuration file. When the file is encrypted, call back into cb_get_password to get the user password.

Parameters

cb_get_password – Callback called when password is needed.

Returns

List of profiles loaded.

autobahn.xbr._config._DEFAULT_CFC_URL
autobahn.xbr._config.style_error(text)[source]
autobahn.xbr._config.style_ok(text)[source]
class autobahn.xbr._config.WampUrl[source]

Bases: click.ParamType

WAMP transport URL validator.

name = WAMP transport URL
convert(value, param, ctx)[source]

Convert the value to the correct type. This is not called if the value is None (the missing value).

This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types.

The param and ctx arguments may be None in certain situations, such as when converting prompt input.

If the value cannot be converted, call fail() with a descriptive message.

Parameters
  • value – The value to convert.

  • param – The parameter that is using this type to convert its value. May be None.

  • ctx – The current context that arrived at this value. May be None.

autobahn.xbr._config.prompt_for_wamp_url(msg, default=None)[source]

Prompt user for WAMP transport URL (eg “wss://planet.xbr.network/ws”).

class autobahn.xbr._config.EthereumAddress[source]

Bases: click.ParamType

Ethereum address validator.

name = Ethereum address
convert(value, param, ctx)[source]

Convert the value to the correct type. This is not called if the value is None (the missing value).

This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types.

The param and ctx arguments may be None in certain situations, such as when converting prompt input.

If the value cannot be converted, call fail() with a descriptive message.

Parameters
  • value – The value to convert.

  • param – The parameter that is using this type to convert its value. May be None.

  • ctx – The current context that arrived at this value. May be None.

autobahn.xbr._config.prompt_for_ethereum_address(msg)[source]

Prompt user for an Ethereum (public) address.

class autobahn.xbr._config.PrivateKey(key_len)[source]

Bases: click.ParamType

Private key (32 bytes in HEX) validator.

name = Private key
convert(value, param, ctx)[source]

Convert the value to the correct type. This is not called if the value is None (the missing value).

This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types.

The param and ctx arguments may be None in certain situations, such as when converting prompt input.

If the value cannot be converted, call fail() with a descriptive message.

Parameters
  • value – The value to convert.

  • param – The parameter that is using this type to convert its value. May be None.

  • ctx – The current context that arrived at this value. May be None.

autobahn.xbr._config.prompt_for_key(msg, key_len, default=None)[source]

Prompt user for a binary key of given length (in HEX).

autobahn.xbr._config._DEFAULT_CONFIG = Multiline-String
Show Value
 1[default]
 2# username used with this profile
 3username={username}
 4
 5# user email used with the profile (e.g. for verification emails)
 6email={email}
 7
 8# XBR network node used as a directory server and gateway to XBR smart contracts
 9network_url={network_url}
10
11# WAMP realm on network node, usually "xbrnetwork"
12network_realm={network_realm}
13
14# user private WAMP-cryptosign key (for client authentication)
15cskey={cskey}
16
17# user private Ethereum key (for signing transactions and e2e data encryption)
18ethkey={ethkey}
autobahn.xbr._config.load_or_create_profile(dotdir=None, profile=None, default_url=None, default_realm=None, default_email=None, default_username=None)[source]