Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@arcblock/app-agent-storage

Package Overview
Dependencies
Maintainers
2
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arcblock/app-agent-storage

Storage interface for delegated did-auth between application and wallet

  • 0.40.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
increased by100%
Maintainers
2
Weekly downloads
 
Created
Source

@arcblock/app-agent-storage

styled with prettier

Interface for define a storage class that can be used by [@arcblock/did-auth].

Table of Contents

Motivation & Spec

Fields

Possible fields to exist in a did-agent storage record

  • authorizeId: Primary key
  • ownerDid: Owner DID
  • agentDid: Agent DID
  • appDid: Application DID
  • appPk: Application public key
  • appName: Application name
  • appDescription: Application description
  • appLogo: Application logo
  • certificate: Application authorize certificate

APIs

Basic APIs that a did-agent storage should support:

  • create(authorizeId, payload): 创建记录
  • update(authorizeId, updates): 更新记录
  • read(authorizeId):按 authorizeId 查询
  • delete(authorizeId):删除记录
  • listByApp(appDid): 按应用查询
  • listByOwner(ownerDid): 按所有者查询

Install

npm install @arcblock/app-agent-storage
// or
yarn add @arcblock/app-agent-storage

Usage

const StorageInterface = require('@arcblock/app-agent-storage');

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

  create(token, status = 'created') {
    const LoginToken = this.model;
    const item = new LoginToken({ token, status });
    return item.save();
  }

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

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

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

  exist(token, did) {
    return this.model.findOne({ token, did });
  }
};

Contributors

NameWebsite
wangshijunhttps://ocap.arcblock.io

Keywords

FAQs

Package last updated on 10 Nov 2019

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