ssb-keyring
Version:
A persistence store for encryption keys for scuttlebutt. It's purpose is to make easy to answer box2 encryption/ decryption questions.
17 lines (13 loc) • 364 B
JavaScript
const mkdirp = require('mkdirp')
const Level = require('level')
const charwise = require('charwise')
const infoEncoding = require('./info-encoding')
module.exports = function db (path) {
if (typeof window === 'undefined') { // not in a browser
mkdirp.sync(path)
}
return Level(path, {
keyEncoding: charwise,
valueEncoding: infoEncoding
})
}