Keystore

Generates a temporary 30mins/1 year JSON database

Store the accessToken from /api/ap in the 1 year to renew credentials.

  • Params:

    • path - The path of the Database

    • year - Should the database expire in a year?

Example code:

const { Keystore } = require('hebece');
// every time you initialize a DB it checks for it's expiration
const tempDb = new Keystore('./keystore.json', true);

tempDb.set('apiap', 'something'); // returns true
const ap = tempDb.get('apiap'); // returns something
const all = tempDb.all();
tempDb.remove('apiap')

Last updated