Secure Store for Objects
npm install @onboardbase/store``bash
npm install @onboardbase/store
#or
yarn add @onboardbase/store
`
js
import Store from '@onboardbase/store';const store = new Store('YOUR_STORE_KEY');
(async () => {
console.log('set data', await store.set({ key: 'hey', value: 'hello' }));
console.log('get data', await store.get({ key: 'hey' }));
console.log(
'get data from locker',
await store.set({ key: 'hey2', value: 'hello-some-locker', lockerKey: 'some-locker' }),
);
console.log('get data from locker', await store.get({ key: 'hey2', lockerKey: 'some-locker' }));
const fs = require('fs');
const { Blob } = require('buffer');
let buffer = fs.readFileSync('./.gitignore');
let blob = new Blob([buffer]);
console.log(
'upload file',
await store.setFile({ key: 'hey-file', fileName: 'gitignore', lockerKey: 'some-locker', file: blob }),
);
console.log('download file', await store.getFile({ key: 'hey-file', lockerKey: 'some-locker' }));
})();
`$3
Set encrypted Key-Value
`ts
import Store from '@onboardbase/store';const store = new Store('SK_M@!ODASMC@_#CSADM'); // your STORE_KEY;
// setObject
store.set({key: 'key', value: 'value'});
// Object
const object = store.setFile({ key: 'key', file: Blob })
`Get Key-Value from Default Locker
`tsstore.get({ key: 'key' });
`Get Value of a Key from a Locker
`tsconst value = store.get({ key: 'key', lockerKey: 'lockey_key' });
`#### Files
Set Files or Blobs
`tsawait store.setFile({ key: 'hey-file', fileName: 'gitignore', file: blob });
// within a locker
await store.setFile({ key: 'hey-file', fileName: 'gitignore', lockerKey: 'some-locker', file: blob })
`
Get Files or Blobs from Default Locker
`tsconst object = await store.getFile({ key: 'hey-file' })
`Get Files or Blobs from a Locker
`ts
const object = await store.getFile({ key: 'hey-file', lockerKey: 'some-locker' })
``