Socket
Socket
Sign inDemoInstall

@did-connect/storage

Package Overview
Dependencies
Maintainers
1
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@did-connect/storage

Storage interface for did-auth


Version published
Weekly downloads
891
decreased by-41.5%
Maintainers
1
Weekly downloads
 
Created
Source

styled with prettier

Introduction

Defines the interface for DID Connect Session Storage, basic APIs that a session storage includes:

  • async create(session, attrs), create a new session record, persist in storage
  • async read(session), read a session from storage,
  • async update(session, updates), update session record
  • async delete(session), remove a session record

Install

npm install @did-connect/storage
// or
yarn add @did-connect/storage

Usage

const { BaseStorage } = require('@did-connect/storage');
const keystone = require('keystone');

module.exports = class KeystoneStorage extends BaseStorage {
  constructor() {
    this.model = keystone.list('sessions').model;
  }

  create(sessionId, attrs) {
    const LoginToken = this.model;
    const item = new LoginToken({ sessionId, ...attrs });
    return item.save();
  }

  read(sessionId) {
    return this.model.findOne({ sessionId });
  }

  update(sessionId, updates) {
    return this.model.findOneAndUpdate({ sessionId }, updates);
  }

  delete(sessionId) {
    return this.model.remove({ sessionId });
  }
};

Keywords

FAQs

Package last updated on 07 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc