beem.storage

class beem.storage.Configuration

Bases: beem.storage.DataDir

This is the configuration storage that stores key/value pairs in the config table of the SQLite3 database.

checkBackup()

Backup the SQL database every 7 days

config_defaults = {'client_id': '', 'hot_sign_redirect_uri': None, 'node': ['wss://steemd.pevo.science', 'wss://rpc.buildteam.io', 'wss://steemd.privex.io', 'wss://rpc.steemviz.com', 'https://rpc.buildteam.io', 'wss://steemd.minnowsupportproject.org', 'https://api.steemit.com', 'https://api.steem.house', 'https://steemd.minnowsupportproject.org', 'https://rpc.steemviz.com', 'https://gtg.steem.house:8090', 'wss://gtg.steem.house:8090', 'https://steemd.privex.io', 'https://rpc.curiesteem.com', 'https://steemd.pevo.science', 'wss://appbasetest.timcliff.com', 'wss://rpc.steemliberator.com', 'https://appbasetest.timcliff.com', 'https://rpc.steemliberator.com', 'wss://steemd.steemgigs.org', 'https://steemd.steemgigs.org', 'wss://seed.bitcoiner.me', 'https://seed.bitcoiner.me'], 'oauth_base_url': 'https://v2.steemconnect.com/oauth2/', 'order-expiration': 604800, 'password_storage': 'environment', 'rpcpassword': '', 'rpcuser': '', 'sc2_api_url': 'https://v2.steemconnect.com/api/'}
create_table()

Create the new table in the SQLite database

delete(key)

Delete a key from the configuration store

exists_table()

Check if the database table exists

get(key, default=None)

Return the key if exists or a default value

items()
nodelist = [{'type': 'appbase', 'url': 'https://api.steemit.com', 'owner': 'steemit', 'score': 100, 'version': '0.19.4'}, {'type': 'appbase', 'url': 'wss://appbasetest.timcliff.com', 'owner': 'timcliff', 'score': 20, 'version': '0.19.4'}, {'type': 'appbase', 'url': 'https://appbasetest.timcliff.com', 'owner': 'timcliff', 'score': 10, 'version': '0.19.4'}, {'type': 'appbase', 'url': 'https://api.steem.house', 'owner': 'gtg', 'score': 90, 'version': '0.19.4'}, {'type': 'appbase-dev', 'url': 'https://api.steemitdev.com', 'owner': 'steemit', 'score': 100, 'version': '0.19.4'}, {'type': 'appbase-dev', 'url': 'https://api.steemitstage.com', 'owner': 'steemit', 'score': 110, 'version': '0.19.4'}, {'type': 'normal', 'url': 'wss://rpc.steemviz.com', 'owner': 'ausbitbank', 'score': 125, 'version': '0.19.3'}, {'type': 'normal', 'url': 'https://rpc.steemviz.com', 'owner': 'ausbitbank', 'score': 80, 'version': '0.19.3'}, {'type': 'normal', 'url': 'wss://steemd.privex.io', 'owner': 'privex', 'score': 150, 'version': '0.19.3'}, {'type': 'normal', 'url': 'https://steemd.privex.io', 'owner': 'privex', 'score': 50, 'version': '0.19.3'}, {'type': 'normal', 'url': 'wss://rpc.buildteam.io', 'owner': 'themarkymark', 'score': 165, 'version': '0.19.3'}, {'type': 'normal', 'url': 'https://rpc.buildteam.io', 'owner': 'themarkymark', 'score': 120, 'version': '0.19.3'}, {'type': 'normal', 'url': 'wss://gtg.steem.house:8090', 'owner': 'gtg', 'score': 75, 'version': '0.19.3'}, {'type': 'normal', 'url': 'https://gtg.steem.house:8090', 'owner': 'gtg', 'score': 80, 'version': '0.19.3'}, {'type': 'normal', 'url': 'wss://steemd.pevo.science', 'owner': 'pharesim', 'score': 170, 'version': '0.19.3'}, {'type': 'normal', 'url': 'https://steemd.pevo.science', 'owner': 'pharesim', 'score': 30, 'version': '0.19.3'}, {'type': 'normal', 'url': 'wss://rpc.steemliberator.com', 'owner': 'netuoso', 'score': 20, 'version': '0.19.3'}, {'type': 'normal', 'url': 'https://rpc.steemliberator.com', 'owner': 'netuoso', 'score': 10, 'version': '0.19.3'}, {'type': 'normal', 'url': 'wss://seed.bitcoiner.me', 'owner': 'bitcoiner', 'score': 1, 'version': '0.19.3'}, {'type': 'normal', 'url': 'https://seed.bitcoiner.me', 'owner': 'bitcoiner', 'score': 1, 'version': '0.19.3'}, {'type': 'normal', 'url': 'wss://steemd.steemgigs.org', 'owner': 'steemgigs', 'score': 10, 'version': '0.19.3'}, {'type': 'normal', 'url': 'https://steemd.steemgigs.org', 'owner': 'steemgigs', 'score': 10, 'version': '0.19.3'}, {'type': 'normal', 'url': 'wss://steemd.minnowsupportproject.org', 'owner': 'followbtcnews', 'score': 120, 'version': '0.19.3'}, {'type': 'normal', 'url': 'https://steemd.minnowsupportproject.org', 'owner': 'followbtcnews', 'score': 90, 'version': '0.19.3'}, {'type': 'normal', 'url': 'https://rpc.curiesteem.com', 'owner': 'curie', 'score': 50, 'version': '0.19.3'}, {'type': 'testnet', 'url': 'wss://testnet.steem.vc', 'owner': 'almost-digital', 'score': 20, 'version': '0.19.2'}, {'type': 'testnet', 'url': 'ws://testnet.steem.vc', 'owner': 'almost-digital', 'score': 5, 'version': '0.19.2'}, {'type': 'testnet', 'url': 'https://testnet.steem.vc', 'owner': 'almost-digital', 'score': 10, 'version': '0.19.2'}, {'type': 'testnet', 'url': 'http://testnet.steem.vc', 'owner': 'almost-digital', 'score': 5, 'version': '0.19.2'}]

Default configuration

nodes = ['wss://steemd.pevo.science', 'wss://rpc.buildteam.io', 'wss://steemd.privex.io', 'wss://rpc.steemviz.com', 'https://rpc.buildteam.io', 'wss://steemd.minnowsupportproject.org', 'https://api.steemit.com', 'https://api.steem.house', 'https://steemd.minnowsupportproject.org', 'https://rpc.steemviz.com', 'https://gtg.steem.house:8090', 'wss://gtg.steem.house:8090', 'https://steemd.privex.io', 'https://rpc.curiesteem.com', 'https://steemd.pevo.science', 'wss://appbasetest.timcliff.com', 'wss://rpc.steemliberator.com', 'https://appbasetest.timcliff.com', 'https://rpc.steemliberator.com', 'wss://steemd.steemgigs.org', 'https://steemd.steemgigs.org', 'wss://seed.bitcoiner.me', 'https://seed.bitcoiner.me']
class beem.storage.DataDir

Bases: object

This class ensures that the user’s data is stored in its OS preotected user directory:

OSX:

  • ~/Library/Application Support/<AppName>

Windows:

  • C:Documents and Settings<User>Application DataLocal Settings<AppAuthor><AppName>
  • C:Documents and Settings<User>Application Data<AppAuthor><AppName>

Linux:

  • ~/.local/share/<AppName>

Furthermore, it offers an interface to generated backups in the backups/ directory every now and then.

appauthor = 'beem'
appname = 'beem'
clean_data()

Delete files older than 70 days

data_dir = '/home/docs/.local/share/beem'
mkdir_p()

Ensure that the directory in which the data is stored exists

recover_with_latest_backup(backupdir='backups')

Replace database with latest backup

refreshBackup()

Make a new backup

sqlDataBaseFile = '/home/docs/.local/share/beem/beem.sqlite'
sqlite3_backup(backupdir)

Create timestamped database copy

sqlite3_copy(src, dst)

Copy sql file from src to dst

storageDatabase = 'beem.sqlite'
class beem.storage.Key

Bases: beem.storage.DataDir

This is the key storage that stores the public key and the (possibly encrypted) private key in the keys table in the SQLite3 database.

add(wif, pub)
Add a new public/private key pair (correspondence has to be
checked elsewhere!)
Parameters:
  • pub (str) – Public key
  • wif (str) – Private key
create_table()

Create the new table in the SQLite database

delete(pub)

Delete the key identified as pub

Parameters:pub (str) – Public key
exists_table()

Check if the database table exists

getPrivateKeyForPublicKey(pub)
Returns the (possibly encrypted) private key that
corresponds to a public key
Parameters:pub (str) – Public key

The encryption scheme is BIP38

getPublicKeys()

Returns the public keys stored in the database

updateWif(pub, wif)

Change the wif to a pubkey

Parameters:
  • pub (str) – Public key
  • wif (str) – Private key
wipe(sure=False)

Purge the entire wallet. No keys will survive this!

class beem.storage.MasterPassword(password)

Bases: object

The keys are encrypted with a Masterpassword that is stored in the configurationStore. It has a checksum to verify correctness of the password

changePassword(newpassword)

Change the password

config_key = 'encrypted_master_password'

This key identifies the encrypted master password stored in the confiration

decryptEncryptedMaster()

Decrypt the encrypted masterpassword

decrypted_master = ''
deriveChecksum(s)

Derive the checksum

getEncryptedMaster()

Obtain the encrypted masterkey

newMaster()

Generate a new random masterpassword

password = ''
saveEncrytpedMaster()

Store the encrypted master password in the configuration store

static wipe(sure=False)

Remove all keys from configStorage

class beem.storage.Token

Bases: beem.storage.DataDir

This is the token storage that stores the public username and the (possibly encrypted) token in the token table in the SQLite3 database.

add(name, token)
Add a new public/private token pair (correspondence has to be
checked elsewhere!)
Parameters:
  • name (str) – Public name
  • token (str) – Private token
create_table()

Create the new table in the SQLite database

delete(name)

Delete the key identified as name

Parameters:name (str) – Public name
exists_table()

Check if the database table exists

getPublicNames()

Returns the public names stored in the database

getTokenForPublicName(name)
Returns the (possibly encrypted) private token that
corresponds to a public name
Parameters:pub (str) – Public name

The encryption scheme is BIP38

updateToken(name, token)

Change the token to a name

Parameters:
  • name (str) – Public name
  • token (str) – Private token
wipe(sure=False)

Purge the entire wallet. No keys will survive this!