@arcblock/did-auth-storage-mongo
v1.7.1
Published
Storage engine that uses mongodb for did-auth
Downloads
57
Readme
Storage engine that uses mongo to store data, implements interfaces defined in
@arcblock/did-auth-storage
.
Table of Contents
Install
npm install @arcblock/did-auth-storage-mongo
// or
yarn add @arcblock/did-auth-storage-mongo
Usage
const MongoStorage = require('@arcblock/did-auth-storage-mongo');
const storage = new MongoStorage({
url: 'mongodb://localhost/forge-web-starter',
collection: 'did_auth_tokens',
});
// Listen on events of the storage
storage.on('create', d => console.log('create', d));
storage.on('update', d => console.log('update', d));
storage.on('destroy', d => console.log('destroy', d));
(async () => {
const token = '123456';
const item = await storage.create(token);
})();
Contributors
| Name | Website | | -------------- | -------------------------- | | wangshijun | https://ocap.arcblock.io |