Module autobahn.xbr
¶
- class autobahn.xbr.ActorType[source]¶
XBR Market Actor type.
- CONSUMER = 2¶
Actor is a XBR Consumer.
- NONE = 0¶
Unset
- PROVIDER = 1¶
Actor is a XBR Provider.
- PROVIDER_CONSUMER = 3¶
Actor is both a XBR Provider and XBR Consumer.
- class autobahn.xbr.ChannelType[source]¶
Type of a XBR off-chain channel: paying channel (for provider delegates selling data services) or payment channel (for consumer delegates buying data services).
- NONE = 0¶
Unset
- PAYING = 2¶
Paying channel: from market maker to seller/provider delegate.
- PAYMENT = 1¶
Payment channel: from buyer/consumer delegate to maker maker.
- class autobahn.xbr.EthereumKey(key_or_address: Union[LocalAccount, str, bytes], can_sign: bool, security_module: Optional[ISecurityModule] = None, key_no: Optional[int] = None)[source]¶
Base class to implement
autobahn.wamp.interfaces.IEthereumKey
.- address(binary: bool = False) Union[str, bytes] [source]¶
Implements
autobahn.wamp.interfaces.IEthereumKey.address()
.
- property can_sign: bool¶
Implements
autobahn.wamp.interfaces.IKey.can_sign()
.
- classmethod from_address(address: Union[str, bytes]) EthereumKey [source]¶
Create a public key from an address, which can be used to verify signatures.
- Parameters
address – The Ethereum address (20 octets).
- Returns
New instance of
EthereumKey
- classmethod from_bytes(key: bytes) EthereumKey [source]¶
Create a private key from seed bytes, which can be used to sign and create signatures.
- Parameters
key – The Ethereum private key seed (32 octets).
- Returns
New instance of
EthereumKey
- classmethod from_keyfile(keyfile: str) EthereumKey [source]¶
Create a public or private key from reading the given public or private key file.
Here is an example key file that includes an Ethereum private key
private-key-eth
, which is loaded in this function, and other fields, which are ignored by this function:This is a comment (all lines until the first empty line are comments indeed). creator: oberstet@intel-nuci7 created-at: 2022-07-05T12:29:48.832Z user-id: oberstet@intel-nuci7 public-key-ed25519: 7326d9dc0307681cc6940fde0e60eb31a6e4d642a81e55c434462ce31f95deed public-adr-eth: 0x10848feBdf7f200Ba989CDf7E3eEB3EC03ae7768 private-key-ed25519: f750f42b0430e28a2e272c3cedcae4dcc4a1cf33bc345c35099d3322626ab666 private-key-eth: 4d787714dcb0ae52e1c5d2144648c255d660b9a55eac9deeb80d9f506f501025
- Parameters
keyfile – Path (relative or absolute) to a public or private keys file.
- Returns
New instance of
EthereumKey
- classmethod from_seedphrase(seedphrase: str, index: int = 0) EthereumKey [source]¶
Create a private key from the given BIP-39 mnemonic seed phrase and index, which can be used to sign and create signatures.
- Parameters
seedphrase – The BIP-39 seedphrase (“Mnemonic”) from which to derive the account.
index – The account index in account hierarchy defined by the seedphrase.
- Returns
New instance of
EthereumKey
- property key_no: Optional[int]¶
Implements
autobahn.wamp.interfaces.IKey.key_no()
.
- property key_type: str¶
Implements
autobahn.wamp.interfaces.IKey.key_type()
.
- public_key(binary: bool = False) Union[str, bytes] [source]¶
Implements
autobahn.wamp.interfaces.IKey.public_key()
.
- recover(data: bytes, signature: bytes) bytes [source]¶
Implements
autobahn.wamp.interfaces.IKey.recover()
.
- property security_module: Optional[ISecurityModule]¶
Implements
autobahn.wamp.interfaces.IKey.security_module()
.
- sign(data: bytes) bytes [source]¶
Implements
autobahn.wamp.interfaces.IKey.sign()
.
- class autobahn.xbr.FbsEnum(repository: FbsRepository, schema: FbsSchema, declaration_file: str, name: str, id: int, values: Dict[str, FbsEnumValue], values_by_id: List[FbsEnumValue], is_union: bool, underlying_type: int, attrs: Dict[str, FbsAttribute], docs: str)[source]¶
FlatBuffers enum type.
- class autobahn.xbr.FbsRepository(basemodule: str)[source]¶
- crossbar.interfaces.IInventory
add: FbsRepository[] - load: FbsSchema[]
https://github.com/google/flatbuffers/blob/master/reflection/reflection.fbs
- load(filename: str) Tuple[int, int] [source]¶
Load and add all schemata from Flatbuffers binary schema files (*.bfbs) found in the given directory. Alternatively, a path to a single schema file can be provided.
- Parameters
filename – Filesystem path of a directory or single file from which to load and add Flatbuffers schemata.
- render(jinja2_env, output_dir, output_lang)[source]¶
- Parameters
jinja2_env –
output_dir –
output_lang –
- Returns
- validate(validation_type: str, args: List[Any], kwargs: Dict[str, Any]) Optional[FbsObject] [source]¶
Validate the WAMP application payload provided in positional argument in
args
and in keyword-based arguments inkwargs
against the FlatBuffers table typevalidation_type
from this repository.If the application payload does not validate against the provided type, an
autobahn.wamp.exception.InvalidPayload
is raised.- Parameters
validation_type – Flatbuffers type (fully qualified) against to validate application payload.
args – The application payload WAMP positional arguments.
kwargs – The application payload WAMP keyword-based arguments.
- Returns
The validation type object from this repository (reference in
validation_type
) which has been used for validation.
- validate_obj(validation_type: Optional[str], value: Optional[Any])[source]¶
Validate value against the validation type given.
If the application payload does not validate against the provided type, an
autobahn.wamp.exception.InvalidPayload
is raised.- Parameters
validation_type – Flatbuffers type (fully qualified) against to validate application payload.
value – Value to validate.
- Returns
- class autobahn.xbr.FbsSchema(repository: FbsRepository, file_name: str, file_sha256: str, file_size: int, file_ident: str, file_ext: str, fbs_files: List[Dict[str, str]], root_table: FbsObject, root: Schema, objs: Optional[Dict[str, FbsObject]] = None, objs_by_id: Optional[List[FbsObject]] = None, enums: Optional[Dict[str, FbsEnum]] = None, enums_by_id: Optional[List[FbsEnum]] = None, services: Optional[Dict[str, FbsService]] = None, services_by_id: Optional[List[FbsService]] = None)[source]¶
- Parameters
repository –
file_name –
file_sha256 –
file_size –
file_ident –
file_ext –
fbs_files –
root_table –
root –
objs –
objs_by_id –
enums –
enums_by_id –
services –
services_by_id –
- class autobahn.xbr.FbsType(repository: FbsRepository, schema: FbsSchema, basetype: int, element: int, index: int, objtype: Optional[str] = None, elementtype: Optional[str] = None)[source]¶
Flatbuffers type.
- property elementtype: Optional[str]¶
If basetype == Vector, fully qualified element type name.
- Returns
- property index: int¶
If basetype == Object, index into “objects”. If base_type == Union, UnionType, or integral derived from an enum, index into “enums”. If base_type == Vector && element == Union or UnionType.
- Returns
- class autobahn.xbr.FederatedRealm(name_or_address: str, gateway_config: Optional[Dict[str, Any]] = None)[source]¶
A federated realm is a WAMP application realm with a trust anchor rooted in Ethereum, and which can be shared between multiple parties.
A federated realm is globally identified on an Ethereum chain (e.g. on Mainnet or Rinkeby) by an Ethereum address associated to a federated realm owner by an on-chain record stored in the WAMP Network contract. The federated realm address thus only needs to exist as an identifier of the federated realm-owner record.
Instantiate a federated realm from a federated realm ENS name (which is resolved to an Ethereum address) or Ethereum address.
- Parameters
name_or_address – Ethereum ENS name or address.
gateway_config – If provided, use this Ethereum gateway. If not provided, connect via Infura to Ethereum Mainnet, which requires an environment variable
WEB3_INFURA_PROJECT_ID
with your Infura project ID.
- class autobahn.xbr.IBuyer[source]¶
XBR Buyer interface.
- abstract async start(session)[source]¶
Start buying keys over the provided session.
- Parameters
session – WAMP session that allows to talk to the XBR Market Maker.
- class autobahn.xbr.IMarketMaker[source]¶
XBR Market Maker interface.
- abstract buy(channel_id, channel_seq, buyer_pubkey, datakey_id, amount, balance, signature, details)[source]¶
- Parameters
channel_id –
channel_seq –
buyer_pubkey –
datakey_id –
amount –
balance –
signature –
details –
- Returns
- class autobahn.xbr.KeySeries(api_id, price, interval=None, count=None, on_rotate=None)[source]¶
Data encryption key series with automatic (time-based) key rotation and key offering (to the XBR market maker).
- Parameters
api_id (bytes) – ID of the API for which to generate keys.
price (int) – Price per key in key series.
interval (int) – Interval in seconds after which to auto-rotate key.
count (int) – Number of encryption operations after which to auto-rotate key.
on_rotate (callable) – Optional user callback fired after key was rotated.
- class autobahn.xbr.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] = None, vaction_oid: Optional[UUID] = None, vaction_requested: Optional[datetime64] = None, vaction_verified: Optional[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]¶
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
- Parameters
path –
name –
member_adr –
ethkey –
cskey –
username –
email –
network_url –
network_realm –
member_oid –
vaction_oid –
vaction_requested –
vaction_verified –
data_url –
data_realm –
infura_url –
infura_network –
infura_key –
infura_secret –
- class autobahn.xbr.SecurityModuleMemory(keys: Optional[List[Union[CryptosignKey, EthereumKey]]] = None)[source]¶
A transient, memory-based implementation of
ISecurityModule
.- classmethod from_config(config: str, profile: str = 'default') SecurityModuleMemory [source]¶
Create a new memory-backed security module with keys referred from a profile in the given configuration file.
- Parameters
config – Path (relative or absolute) to an INI configuration file.
profile – Name of the profile within the given INI configuration file.
- Returns
New memory-backed security module instance.
- classmethod from_keyfile(keyfile: str) SecurityModuleMemory [source]¶
Create a new memory-backed security module with keys referred from a profile in the given configuration file.
- Parameters
keyfile – Path (relative or absolute) to a private keys file.
- Returns
New memory-backed security module instance.
- classmethod from_seedphrase(seedphrase: str, num_eth_keys: int = 1, num_cs_keys: int = 1) SecurityModuleMemory [source]¶
Create a new memory-backed security module with
num_eth_keys
keys of typeEthereumKey
, followed bynum_cs_keys
keys of typeCryptosignKey
computed from a (common) BIP44 seedphrase.
- Parameters
seedphrase – BIP44 seedphrase to use.
num_eth_keys – Number of Ethereum keys to derive.
num_cs_keys – Number of Cryptosign keys to derive.
- Returns
New memory-backed security module instance.
- class autobahn.xbr.Seeder(frealm: FederatedRealm, operator: Optional[str] = None, label: Optional[str] = None, country: Optional[str] = None, legal: Optional[str] = None, endpoint: Optional[str] = None, bandwidth_requested: Optional[int] = None, bandwidth_offered: Optional[int] = None)[source]¶
- Parameters
frealm –
operator –
label –
country –
legal –
endpoint –
bandwidth_requested –
bandwidth_offered –
- property country: Optional[str]¶
Operator country (ISO 3166-1 alpha-2), e.g.
"US"
.- Returns
ISO 3166-1 alpha-2 country code.
- create_authextra(client_key: ICryptosignKey, delegate_key: IEthereumKey, bandwidth_requested: int, channel_id: Optional[bytes] = None, channel_binding: Optional[str] = None) Deferred [source]¶
- Parameters
client_key –
delegate_key –
bandwidth_requested –
channel_id –
channel_binding –
- Returns
- property endpoint: Optional[str]¶
Public WAMP endpoint of seeder. Secure WebSocket URL resolving to a public IPv4 or IPv6 listening url accepting incoming WAMP-WebSocket connections, e.g.
wss://service1.example.com/ws
.- Returns
The endpoint URL.
- property frealm: FederatedRealm¶
- Returns
- class autobahn.xbr.SimpleBlockchain(gateway=None)[source]¶
Simple Ethereum blockchain XBR client.
- Parameters
gateway (str) – Optional explicit Ethereum gateway URL to use. If no explicit gateway is specified, let web3 auto-choose.
- async get_balances(account_adr)[source]¶
Return current ETH and XBR balances of account with given address.
- get_contract_adrs()[source]¶
Get XBR smart contract addresses.
- Returns
A dictionary with
"XBRToken"
and"XBRNetwork"
keys and Ethereum contract addresses as values.- Return type
- class autobahn.xbr.SimpleBuyer(market_maker_adr, buyer_key, max_price)[source]¶
Simple XBR buyer component. This component can be used by a XBR buyer delegate to handle the automated buying of data encryption keys from the XBR market maker.
- Parameters
- async balance()[source]¶
Return current balance of payment channel:
amount
: The initial amount with which the payment channel was opened.remaining
: The remaining amount of XBR in the payment channel that can be spent.inflight
: The amount of XBR allocated to buy transactions that are currently processed.
- Returns
Current payment balance.
- Return type
- async close_channel(details=None)[source]¶
Requests to close the currently active payment channel.
- Returns
- async open_channel(buyer_addr, amount, details=None)[source]¶
- Parameters
amount –
details –
- Returns
- Return type
- past_transactions(filter_complete=True, limit=1)[source]¶
- Parameters
filter_complete –
limit –
- Returns
- async start(session, consumer_id)[source]¶
Start buying keys to decrypt XBR data by calling
unwrap()
.- Parameters
session (
autobahn.wamp.protocol.ApplicationSession
) – WAMP session over which to communicate with the XBR market maker.consumer_id (str) – XBR consumer ID.
- Returns
Current remaining balance in payment channel.
- Return type
- class autobahn.xbr.UserConfig(config_path)[source]¶
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.
- Parameters
config_path – The user configuration file path.
- property config_path: List[str]¶
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_password
to get the user password.- Parameters
cb_get_password – Callback called when password is needed.
- Returns
List of profiles loaded.
- 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.
- autobahn.xbr.account_from_seedphrase(seedphrase: str, index: int = 0) Account [source]¶
Create an account from the given BIP-39 mnemonic seed phrase.
- Parameters
seedphrase – The BIP-39 seedphrase from which to derive the account.
index – The account index in account hierarchy defined by the seedphrase.
- Returns
The new Eth account object
- autobahn.xbr.check_seedphrase(seedphrase: str, language: str = 'english')[source]¶
Check a BIP-39 mnemonic seed phrase.
- Parameters
seedphrase – The BIP-39 seedphrase from which to derive the account.
language – The BIP-39 user language to generate the seedphrase for.
- Returns
- autobahn.xbr.create_eip712_authority_certificate(chainId: int, verifyingContract: bytes, validFrom: int, issuer: bytes, subject: bytes, realm: bytes, capabilities: int, meta: str) dict [source]¶
Authority certificate: long-lived, on-chain L2.
- Parameters
chainId –
verifyingContract –
validFrom –
issuer –
subject –
realm –
capabilities –
meta –
- Returns
- autobahn.xbr.create_eip712_delegate_certificate(chainId: int, verifyingContract: bytes, validFrom: int, delegate: bytes, csPubKey: bytes, bootedAt: int, meta: str) dict [source]¶
Delegate certificate: dynamic/one-time, off-chain.
- Parameters
chainId –
verifyingContract –
validFrom –
delegate –
csPubKey –
bootedAt –
meta –
- Returns
- autobahn.xbr.expand_argon2_secret(pkm: bytes, context: bytes, salt: Optional[bytes] = None) bytes [source]¶
Expand
pkm
andcontext
into a key of lengthbytes
using HKDF’s expand function based on HMAC SHA-512). See the HKDF draft RFC and paper for usage notes.- Parameters
pkm –
context –
salt –
- Returns
- autobahn.xbr.generate_seedphrase(strength=128, language='english') str [source]¶
Generate a new BIP-39 mnemonic seed phrase for use in Ethereum (Metamask, etc).
See: * https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki * https://github.com/trezor/python-mnemonic
- Parameters
strength – Strength of seed phrase in bits, one of the following
[128, 160, 192, 224, 256]
, generating seed phrase of 12 - 24 words inlength.- Returns
Newly generated seed phrase (in english).
- autobahn.xbr.is_address(provided: Any) bool [source]¶
Check if the value is a proper Ethereum address.
- Parameters
provided – The value to check.
- Returns
True iff the value is of correct type.
- autobahn.xbr.is_block_number(provided: Any) bool [source]¶
Check if the value is a proper Ethereum block number.
- Parameters
provided – The value to check.
- Returns
True iff the value is of correct type.
- autobahn.xbr.is_bytes16(provided: Any) bool [source]¶
Check if the value is a proper (binary) UUID.
- Parameters
provided – The value to check.
- Returns
True iff the value is of correct type.
- autobahn.xbr.is_chain_id(provided: Any) bool [source]¶
Check if the value is a proper Ethereum chain ID.
- Parameters
provided – The value to check.
- Returns
True iff the value is of correct type.
- autobahn.xbr.is_cs_pubkey(provided: Any) bool [source]¶
Check if the value is a proper WAMP-cryptosign public key.
- Parameters
provided – The value to check.
- Returns
True iff the value is of correct type.
- autobahn.xbr.is_eth_privkey(provided: Any) bool [source]¶
Check if the value is a proper Ethereum private key (seed).
- Parameters
provided – The value to check.
- Returns
True iff the value is of correct type.
- autobahn.xbr.is_signature(provided: Any) bool [source]¶
Check if the value is a proper Ethereum signature.
- Parameters
provided – The value to check.
- Returns
True iff the value is of correct type.
- autobahn.xbr.make_w3(gateway_config=None)[source]¶
Create a Web3 instance configured and ready-to-use gateway to the blockchain.
- Parameters
gateway_config (dict) – Blockchain gateway configuration.
- Returns
Configured Web3 instance.
- Return type
web3.Web3
- autobahn.xbr.parse_certificate_chain(certificates: List[Tuple[Dict[str, Any], str]]) List[Union[EIP712DelegateCertificate, EIP712AuthorityCertificate]] [source]¶
- Parameters
certificates –
- Returns
- autobahn.xbr.pkm_from_argon2_secret(email: str, password: str, context: str, salt: Optional[bytes] = None) bytes [source]¶
- Parameters
email –
password –
context –
salt –
- Returns
- autobahn.xbr.recover_eip712_api_publish(chainId: int, verifyingContract: bytes, member: bytes, published: int, catalogId: bytes, apiId: bytes, schema: str, meta: Optional[str], signature: bytes) bytes [source]¶
Recover the signer address the given EIP712 signature was signed with.
- Returns
The (computed) signer address the signature was signed with.
- Return type
- autobahn.xbr.recover_eip712_authority_certificate(chainId: int, verifyingContract: bytes, validFrom: int, issuer: bytes, subject: bytes, realm: bytes, capabilities: int, meta: str, signature: bytes) bytes [source]¶
Recover the signer address the given EIP712 signature was signed with.
- Parameters
chainId –
verifyingContract –
validFrom –
issuer –
subject –
realm –
capabilities –
meta –
signature –
- Returns
The (computed) signer address the signature was signed with.
- autobahn.xbr.recover_eip712_catalog_create(chainId: int, verifyingContract: bytes, member: bytes, created: int, catalogId: bytes, terms: str, meta: Optional[str], signature: bytes) bytes [source]¶
Recover the signer address the given EIP712 signature was signed with.
- Returns
The (computed) signer address the signature was signed with.
- Return type
- autobahn.xbr.recover_eip712_channel_close(chainId: int, verifyingContract: bytes, closeAt: int, marketId: bytes, channelId: bytes, channelSeq: int, balance: int, isFinal: bool, signature: bytes) bytes [source]¶
Recover the signer address the given EIP712 signature was signed with.
- Returns
The (computed) signer address the signature was signed with.
- Return type
- autobahn.xbr.recover_eip712_channel_open(chainId: int, verifyingContract: bytes, ctype: int, openedAt: int, marketId: bytes, channelId: bytes, actor: bytes, delegate: bytes, marketmaker: bytes, recipient: bytes, amount: int, signature: bytes) bytes [source]¶
Recover the signer address the given EIP712 signature was signed with.
- Returns
The (computed) signer address the signature was signed with.
- Return type
- autobahn.xbr.recover_eip712_consent(chainId: int, verifyingContract: bytes, member: bytes, updated: int, marketId: bytes, delegate: bytes, delegateType: int, apiCatalog: bytes, consent: bool, servicePrefix: str, signature: bytes) bytes [source]¶
Recover the signer address the given EIP712 signature was signed with.
- Returns
The (computed) signer address the signature was signed with.
- Return type
- autobahn.xbr.recover_eip712_delegate_certificate(chainId: int, verifyingContract: bytes, validFrom: int, delegate: bytes, csPubKey: bytes, bootedAt: int, meta: str, signature: bytes) bytes [source]¶
Recover the signer address the given EIP712 signature was signed with.
- Parameters
chainId –
verifyingContract –
validFrom –
delegate –
csPubKey –
bootedAt –
signature –
meta –
- Returns
The (computed) signer address the signature was signed with.
- autobahn.xbr.recover_eip712_market_create(chainId: int, verifyingContract: bytes, member: bytes, created: int, marketId: bytes, coin: bytes, terms: str, meta: str, maker: bytes, providerSecurity: int, consumerSecurity: int, marketFee: int, signature: bytes) bytes [source]¶
Recover the signer address the given EIP712 signature was signed with.
- Returns
The (computed) signer address the signature was signed with.
- Return type
- autobahn.xbr.recover_eip712_market_join(chainId: int, verifyingContract: bytes, member: bytes, joined: int, marketId: bytes, actorType: int, meta: str, signature: bytes) bytes [source]¶
Recover the signer address the given EIP712 signature was signed with.
- Returns
The (computed) signer address the signature was signed with.
- Return type
- autobahn.xbr.recover_eip712_member_login(chainId: int, verifyingContract: bytes, member: bytes, loggedIn: int, timestamp: int, member_email: str, client_pubkey: bytes, signature: bytes) bytes [source]¶
Recover the signer address the given EIP712 signature was signed with.
- Returns
The (computed) signer address the signature was signed with.
- Return type
- autobahn.xbr.recover_eip712_member_register(chainId: int, verifyingContract: bytes, member: bytes, registered: int, eula: str, profile: Optional[str], signature: bytes) bytes [source]¶
Recover the signer address the given EIP712 signature was signed with.
- Returns
The (computed) signer address the signature was signed with.
- Return type
- autobahn.xbr.setProvider(_w3)[source]¶
The XBR library must be initialized (once) first by setting the Web3 provider using this function.
- autobahn.xbr.sign_eip712_api_publish(eth_privkey: bytes, chainId: int, verifyingContract: bytes, member: bytes, published: int, catalogId: bytes, apiId: bytes, schema: str, meta: Optional[str]) bytes [source]¶
- autobahn.xbr.sign_eip712_authority_certificate(eth_privkey: bytes, chainId: int, verifyingContract: bytes, validFrom: int, issuer: bytes, subject: bytes, realm: bytes, capabilities: int, meta: str) bytes [source]¶
Sign the given data using a EIP712 based signature with the provided private key.
- Parameters
eth_privkey –
chainId –
verifyingContract –
validFrom –
issuer –
subject –
realm –
capabilities –
meta –
- Returns
- autobahn.xbr.sign_eip712_catalog_create(eth_privkey: bytes, chainId: int, verifyingContract: bytes, member: bytes, created: int, catalogId: bytes, terms: str, meta: Optional[str]) bytes [source]¶
- autobahn.xbr.sign_eip712_channel_close(eth_privkey: bytes, chainId: int, verifyingContract: bytes, closeAt: int, marketId: bytes, channelId: bytes, channelSeq: int, balance: int, isFinal: bool) bytes [source]¶
- autobahn.xbr.sign_eip712_channel_open(eth_privkey: bytes, chainId: int, verifyingContract: bytes, ctype: int, openedAt: int, marketId: bytes, channelId: bytes, actor: bytes, delegate: bytes, marketmaker: bytes, recipient: bytes, amount: int) bytes [source]¶
- autobahn.xbr.sign_eip712_consent(eth_privkey: bytes, chainId: int, verifyingContract: bytes, member: bytes, updated: int, marketId: bytes, delegate: bytes, delegateType: int, apiCatalog: bytes, consent: bool, servicePrefix: str) bytes [source]¶
- autobahn.xbr.sign_eip712_delegate_certificate(eth_privkey: bytes, chainId: int, verifyingContract: bytes, validFrom: int, delegate: bytes, csPubKey: bytes, bootedAt: int, meta: str) bytes [source]¶
Sign the given data using a EIP712 based signature with the provided private key.
- Parameters
eth_privkey – Signing key.
chainId –
verifyingContract –
validFrom –
delegate –
csPubKey –
bootedAt –
meta –
- Returns
The signature according to EIP712 (32+32+1 raw bytes).
- autobahn.xbr.sign_eip712_market_create(eth_privkey: bytes, chainId: int, verifyingContract: bytes, member: bytes, created: int, marketId: bytes, coin: bytes, terms: str, meta: str, maker: bytes, providerSecurity: int, consumerSecurity: int, marketFee: int) bytes [source]¶
- autobahn.xbr.sign_eip712_market_join(eth_privkey: bytes, chainId: int, verifyingContract: bytes, member: bytes, joined: int, marketId: bytes, actorType: int, meta: str) bytes [source]¶
- autobahn.xbr.sign_eip712_member_login(eth_privkey: bytes, chainId: int, verifyingContract: bytes, member: bytes, loggedIn: int, timestamp: int, member_email: str, client_pubkey: bytes) bytes [source]¶
- autobahn.xbr.sign_eip712_member_register(eth_privkey: bytes, chainId: int, verifyingContract: bytes, member: bytes, registered: int, eula: Optional[str], profile: str) bytes [source]¶
- autobahn.xbr.stretch_argon2_secret(email: str, password: str, salt: Optional[bytes] = None) bytes [source]¶
Compute argon2id based secret from user email and password only. This uses Argon2id for stretching a potentially weak user password/PIN and subsequent HKDF based key extending to derive private key material (PKM) for different usage contexts.
The Argon2 parameters used are the following:
kdf
argon2id-13
time cost
4096
memory cost
512
parallelism
1
See draft-irtf-cfrg-argon2 and argon2-cffi.
- Parameters
email – User email.
password – User password.
salt – Optional salt to use (must be 16 bytes long). If none is given, compute salt from email as
salt = SHA256(email)[:16]
.
- Returns
The computed private key material (256b, 32 octets).
- autobahn.xbr.xbrcatalog = None¶
Contract instance of XBRMarket.
- autobahn.xbr.xbrchannel = None¶
Contract instance of XBRMarket.
- autobahn.xbr.xbrmarket = None¶
Contract instance of XBRMarket.
- autobahn.xbr.xbrnetwork = None¶
Contract instance of XBRNetwork.
- autobahn.xbr.xbrtoken = None¶
Contract instance of XBRToken.