UNPKG

@arcblock/did-auth-storage

Version:
48 lines (40 loc) 1.19 kB
/* eslint-disable no-useless-constructor */ /* eslint-disable no-unused-vars */ const { EventEmitter } = require('events'); /** * Defines the interface of DID-Auth Token Storage * Which is used to persist state during the DID-Auth process in a dApp * * @class AuthStorage * @see @arcblock/did-auth-storage-firebase * @see @arcblock/did-auth-storage-mongo * @see @arcblock/did-auth-storage-keystone * @extends {EventEmitter} */ class AuthStorage extends EventEmitter { /** * Creates an instance of AuthStorage. * * @class * @param {object} options */ constructor(options) { super(options); } create(token, status = 'created') { throw new Error('AuthStorage.create must be implemented in child class'); } read(token) { throw new Error('AuthStorage.read must be implemented in child class'); } update(token, updates) { throw new Error('AuthStorage.update must be implemented in child class'); } delete(token) { throw new Error('AuthStorage.delete must be implemented in child class'); } exist(token, did) { throw new Error('AuthStorage.exist must be implemented in child class'); } } module.exports = AuthStorage;