xbr._config¶
Attributes¶
Classes¶
Ethereum address validator. |
|
Private key (32 bytes in HEX) validator. |
|
User profile, stored as named section in |
|
Local user configuration file. The data is either a plain text (unencrypted) |
|
WAMP transport URL validator. |
Functions¶
|
|
Prompt user for an Ethereum (public) address. |
|
|
Prompt user for a binary key of given length (in HEX). |
|
Prompt user for WAMP transport URL (eg "wss://planet.xbr.network/ws"). |
|
|
|
Module Contents¶
- class EthereumAddress[source]¶
Bases:
click.ParamTypeEthereum address validator.
- 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
paramandctxarguments may beNonein 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.
- class PrivateKey(key_len)[source]¶
Bases:
click.ParamTypePrivate key (32 bytes in HEX) validator.
- 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
paramandctxarguments may beNonein 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.
- class Profile(path: str | None = None, name: str | None = None, member_adr: str | None = None, ethkey: bytes | None = None, cskey: bytes | None = None, username: str | None = None, email: str | None = None, network_url: str | None = None, network_realm: str | None = None, member_oid: uuid.UUID | None = None, vaction_oid: uuid.UUID | None = None, vaction_requested: numpy.datetime64 | None = None, vaction_verified: numpy.datetime64 | None = None, data_url: str | None = None, data_realm: str | None = None, infura_url: str | None = None, infura_network: str | None = None, infura_key: str | None = None, infura_secret: str | None = None)[source]¶
Bases:
objectUser 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
- class UserConfig(config_path)[source]¶
Bases:
objectLocal 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][source]¶
Return the path to the user configuration file exposed by this object.,
- Returns:
Local filesystem path.
- 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_passwordto get the user password.- Parameters:
cb_get_password – Callback called when password is needed.
- Returns:
List of profiles loaded.
- property profiles: Dict[str, object][source]¶
Access to a map of user profiles in this user configuration.
- Returns:
Map of user profiles.
- save(password: str | None = None)[source]¶
Save this user configuration to the underlying configuration file. The user configuration file can be encrypted using Argon2id when a
passwordis given.- Parameters:
password – The optional Argon2id password.
- Returns:
Number of octets written to the user configuration file.
- class WampUrl[source]¶
Bases:
click.ParamTypeWAMP transport URL validator.
- 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
paramandctxarguments may beNonein 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.
- _DEFAULT_CONFIG = Multiline-String[source]¶
Show Value
"""[default] # username used with this profile username={username} # user email used with the profile (e.g. for verification emails) email={email} # XBR network node used as a directory server and gateway to XBR smart contracts network_url={network_url} # WAMP realm on network node, usually "xbrnetwork" network_realm={network_realm} # user private WAMP-cryptosign key (for client authentication) cskey={cskey} # user private Ethereum key (for signing transactions and e2e data encryption) ethkey={ethkey} """
- load_or_create_profile(dotdir=None, profile=None, default_url=None, default_realm=None, default_email=None, default_username=None)[source]¶
- prompt_for_key(msg, key_len, default=None)[source]¶
Prompt user for a binary key of given length (in HEX).