Closed antho1404 closed 4 years ago
Dependency: https://github.com/mesg-foundation/js-sdk/pull/179
Create @mesg/vault library.
@mesg/vault
Store securely your information
const Vault = require('@mesg/vault') const MemoryStore = require('@mesg/vault/lib/store/memory') const encryptedStore = new MemoryStore() const vault = new Vault(encryptedStore) vault.set('my-key', { foo: 'bar' }, 'my-password') const data = vault.get('my-key', 'my-password')
@mesg/vault can use different stores to store your data.
This store will not persist any data and keep everything in a map in memory.
const MemoryStore = require('@mesg/vault/lib/store/memory') new Vault(new MemoryStore())
This store will persist the values in a json file on disk (only available in node).
const FileStore = require('@mesg/vault/lib/store/file') new Vault(new FileStore('./store.json'))
This store is only available on browser and will persist on the localstorage of your browser.
new Vault(localstorage)
Encryption inspired by @luniehq https://github.com/luniehq/cosmos-keys/blob/develop/src/cosmos-keystore.ts
Dependency: https://github.com/mesg-foundation/js-sdk/pull/179
Create
@mesg/vault
library.Store securely your information
Usage
Store
@mesg/vault can use different stores to store your data.
Memory store
This store will not persist any data and keep everything in a map in memory.
File store
This store will persist the values in a json file on disk (only available in node).
Localstorage
This store is only available on browser and will persist on the localstorage of your browser.