Module Contents¶
Classes¶
Simple XBR buyer component. This component can be used by a XBR buyer delegate to |
- class autobahn.xbr._buyer.Transaction(channel, delegate, pubkey, key_id, channel_seq, amount, balance, signature)[source]¶
Bases:
object
- class autobahn.xbr._buyer.SimpleBuyer(market_maker_adr, buyer_key, max_price)[source]¶
Bases:
object
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.
- log¶
- 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
- 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 open_channel(buyer_addr, amount, details=None)[source]¶
- Parameters
amount –
details –
- Returns
- Return type
- async close_channel(details=None)[source]¶
Requests to close the currently active payment channel.
- Returns
- async unwrap(key_id, serializer, ciphertext)[source]¶
Decrypt XBR data. This functions will potentially make the buyer call the XBR market maker to buy data encryption keys from the XBR provider.
- _save_transaction_phase1(channel_oid, delegate_adr, buyer_pubkey, key_id, channel_seq, amount, balance, signature)[source]¶
- Parameters
channel_oid –
delegate_adr –
buyer_pubkey –
key_id –
channel_seq –
amount –
balance –
signature –
- Returns
- _save_transaction_phase2(channel_oid, delegate_adr, buyer_pubkey, key_id, channel_seq, amount, balance, signature)[source]¶
- Parameters
channel_oid –
delegate_adr –
buyer_pubkey –
key_id –
channel_seq –
amount –
balance –
signature –
- Returns