KeychainDB: Persistent Database in the Keychain
Thought I'd share a quick script I wrote called KeychainDB. It's a wrapper for the keychain which allows you to use the keychain as a persistent (i.e. maintains state across app launches) database.
Each entry in the keychain has three elements: service, username, and password. KeychainDB behaves like a Dictionary, using the username field to store keys and the password field to store values. Service is set to DB_NAME, 'KeychainDB' by default, for all entries to separate KeychainDB entries from legitimate password storage.
Since a KeychainDB behaves like a dict, it's very easy to use and requires no knowledge of database systems. Example usage:
from keychaindb import KeychainDB kdb = KeychainDB() kdb['test'] = 'example' kdb['test'] #=> 'example'
If you kill and reopen Pythonista and execute
kdb['test'], KeychainDB will return
Hope this is helpful and you guys can use it in interesting ways. The script is located here: https://gist.github.com/mattparmett/7948268