Storage

These classes are very low level and are not well documented.

API

class peerplays.storage.DataDir

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.

clean_data()

Delete files older than 70 days

mkdir_p()

Ensure that the directory in which the data is stored exists

refreshBackup()

Make a new backup

sqlite3_backup(dbfile, backupdir)

Create timestamped database copy

class peerplays.storage.Key

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
class peerplays.storage.MasterPassword(password)

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

deriveChecksum(s)

Derive the checksum

getEncryptedMaster()

Obtain the encrypted masterkey

newMaster()

Generate a new random masterpassword

purge()

Remove the masterpassword from the configuration store

saveEncrytpedMaster()

Store the encrypted master password in the configuration store