@did-connect/storage-mongo
v2.2.4
Published
Storage engine that uses mongodb for did-auth
Downloads
21
Readme
Introduction
DID Connect session storage engine that uses mongodb to store data, implements interfaces defined in @did-connect/storage
.
Install
npm install @did-connect/storage-mongo
// or
yarn add @did-connect/storage-mongo
Usage
const { MongoStorage } = require('@did-connect/storage-mongo');
const storage = new MongoStorage({
url: 'mongodb://localhost/did-connect-demo',
collection: 'did-connect-sessions',
});
// 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 sessionId = '123456';
const item = await storage.create(sessionId);
})();