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.

blockchain = 'steem'
checkBackup()

Backup the SQL database every 7 days

config_defaults = {'client_id': '', 'default_chain': 'steem', 'hot_sign_redirect_uri': None, 'hs_api_url': 'https://hivesigner.com/api/', 'hs_client_id': None, 'hs_oauth_base_url': 'https://hivesigner.com/oauth2/', 'node': ['https://steemd.minnowsupportproject.org', 'https://api.steemit.com', 'https://api.justyy.com', 'https://steem.61bts.com', 'https://steem.bts.tw'], 'oauth_base_url': 'https://api.steemconnect.com/oauth2/', 'order-expiration': 604800, 'password_storage': 'environment', 'rpcpassword': '', 'rpcuser': '', 'sc2_api_url': 'https://api.steemconnect.com/api/', 'sc2_client_id': None}
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 = [{'url': 'https://api.steemit.com', 'version': '0.20.2', 'type': 'appbase-limited', 'owner': 'steemit', 'hive': False, 'score': 50}, {'url': 'https://api.justyy.com', 'version': '0.20.2', 'type': 'appbase', 'owner': 'justyy', 'hive': False, 'score': 20}, {'url': 'wss://steemd.privex.io', 'version': '0.20.2', 'type': 'appbase', 'owner': 'privex', 'hive': False, 'score': -10}, {'url': 'https://steemd.minnowsupportproject.org', 'version': '0.19.12', 'type': 'appbase', 'owner': 'followbtcnews', 'hive': False, 'score': 100}, {'url': 'https://anyx.io', 'version': '0.23.0', 'type': 'appbase', 'owner': 'anyx', 'hive': True, 'score': 80}, {'url': 'http://anyx.io', 'version': '0.23.0', 'type': 'appbase', 'owner': 'anyx', 'hive': True, 'score': 50}, {'url': 'wss://testnet.steem.vc', 'version': '0.19.2', 'type': 'testnet', 'owner': 'almost-digital', 'hive': False, 'score': 20}, {'url': 'ws://testnet.steem.vc', 'version': '0.19.2', 'type': 'testnet', 'owner': 'almost-digital', 'hive': False, 'score': 5}, {'url': 'https://testnet.steem.vc', 'version': '0.19.2', 'type': 'testnet', 'owner': 'almost-digital', 'hive': False, 'score': 10}, {'url': 'http://testnet.steem.vc', 'version': '0.19.2', 'type': 'testnet', 'owner': 'almost-digital', 'hive': False, 'score': 5}, {'url': 'https://api.hivekings.com', 'version': '0.23.0', 'type': 'appbase', 'owner': 'drakos', 'hive': True, 'score': 50}, {'url': 'https://api.hive.blog', 'version': '0.23.0', 'type': 'appbase', 'owner': 'hive', 'hive': True, 'score': 50}, {'url': 'https://api.openhive.network', 'version': '0.23.0', 'type': 'appbase', 'owner': 'gtg', 'hive': True, 'score': 20}, {'url': 'https://techcoderx.com', 'version': '0.23.0', 'type': 'appbase', 'owner': 'techcoderx', 'hive': True, 'score': 10}, {'url': 'https://steem.61bts.com', 'version': '0.22.5', 'type': 'appbase', 'owner': '', 'hive': False, 'score': 10}, {'url': 'https://steem.bts.tw', 'version': '0.22.5', 'type': 'appbase', 'owner': '', 'hive': False, 'score': 10}, {'url': 'https://rpc.esteem.app', 'version': '0.23.0', 'type': 'appbase', 'owner': 'good-karma', 'hive': True, 'score': 10}, {'url': 'https://hived.privex.io', 'version': '0.23.0', 'type': 'appbase', 'owner': 'someguy123', 'hive': True, 'score': 10}]

Default configuration

nodes = ['https://steemd.minnowsupportproject.org', 'https://api.steemit.com', 'https://api.justyy.com', 'https://steem.61bts.com', 'https://steem.bts.tw']
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(backupdir='backups')

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(prefix='STM')

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!

beem.storage.get_default_config_storage()
beem.storage.get_default_key_storage()
beem.storage.get_default_token_storage()