xbr._seller¶
Classes¶
Data encryption key series with automatic (time-based) key rotation |
|
Module Contents¶
- class KeySeries(api_id, price, interval=None, count=None, on_rotate=None)[source]¶
Bases:
objectData encryption key series with automatic (time-based) key rotation and key offering (to the XBR market maker).
- encrypt_key(key_id, buyer_pubkey)[source]¶
Encrypt a (previously used) XBR data encryption key with a buyer public key.
- class SimpleSeller(market_maker_adr, seller_key, provider_id=None)[source]¶
Bases:
object- add(api_id, prefix, price, interval=None, count=None, categories=None)[source]¶
Add a new (rotating) private encryption key for encrypting data on the given API.
- Parameters:
api_id (bytes) – API for which to create a new series of rotating encryption keys.
price (int) – Price in XBR token per key.
interval (int) – Interval (in seconds) after which to auto-rotate the encryption key.
count (int) – Number of encryption operations after which to auto-rotate the encryption key.
- async balance()[source]¶
Return current (off-chain) balance of paying channel:
amount: The initial amount with which the paying channel was opened.remaining: The remaining amount of XBR in the paying channel that can be earned.inflight: The amount of XBR allocated to sell transactions that are currently processed.
- Returns:
Current paying balance.
- Return type:
- close_channel(market_maker_adr, channel_oid, channel_seq, channel_balance, channel_is_final, marketmaker_signature, details=None)[source]¶
Called by a XBR Market Maker to close a paying channel.
- property public_key[source]¶
This seller delegate public Ethereum key.
- Returns:
Ethereum public key of this seller delegate.
- Return type:
- sell(market_maker_adr, buyer_pubkey, key_id, channel_oid, channel_seq, amount, balance, signature, details=None)[source]¶
Called by a XBR Market Maker to buy a data encyption key. The XBR Market Maker here is acting for (triggered by) the XBR buyer delegate.
- Parameters:
market_maker_adr (bytes of length 20) – The market maker Ethereum address. The technical buyer is usually the XBR market maker (== the XBR delegate of the XBR market operator).
buyer_pubkey (bytes of length 32) – The buyer delegate Ed25519 public key.
key_id (bytes of length 16) – The UUID of the data encryption key to buy.
channel_oid (bytes of length 16) – The on-chain channel contract address.
channel_seq (int) – Paying channel sequence off-chain transaction number.
amount (bytes) – The amount paid by the XBR Buyer via the XBR Market Maker.
balance (bytes) – Balance remaining in the payment channel (from the market maker to the seller) after successfully buying the key.
signature (bytes of length 65) – Signature over the supplied buying information, using the Ethereum private key of the market maker (which is the delegate of the marker operator).
details (
autobahn.wamp.types.CallDetails) – Caller details. The call will come from the XBR Market Maker.
- Returns:
The data encryption key, itself encrypted to the public key of the original buyer.
- Return type:
- async start(session)[source]¶
Start rotating keys and placing key offers with the XBR market maker.
- Parameters:
session (
autobahn.wamp.protocol.ApplicationSession) – WAMP session over which to communicate with the XBR market maker.