1.7.1 • Published 3 years ago

@arcblock/did-agent-storage-mongo v1.7.1

Weekly downloads
54
License
Apache-2.0
Repository
github
Last release
3 years ago

@arcblock/did-agent-storage-mongo

styled with prettier

Storage engine that uses mongo to store data, implements interfaces defined in @arcblock/did-auth-storage.

Table of Contents

Install

npm install @arcblock/did-agent-storage-mongo
// or
yarn add @arcblock/did-agent-storage-mongo

Usage

const MongoStorage = require('@arcblock/did-agent-storage-mongo');

const storage = new MongoStorage({
  url: 'mongodb://localhost/forge-web-starter',
  collection: 'app-agent-authorizations',
});

(async () => {
  const agent = fromRandom(type);
  const authorizer = fromRandom(type);
  const authorizeId = authorizer.toAddress();

  const authorization = Jwt.sign(authorizeId, authorizer.secretKey, {
    sub: agent.toAddress(),
    ops: {
      profile: ['fullName', 'mobilePhone', 'mailingAddress'],
    },
  });

  const [, content, sig] = authorization.split('.');
  const item = await storage.create(authorizeId, {
    ownerDid: user.toAddress(),
    agentDid: agent.toAddress(),
    appDid: authorizeId,
    appPk: authorizer.publicKey,
    appName: 'ABT Wallet Demo',
    appDescription: 'Demo application to show the potential of ABT Wallet',
    appIcon: 'https://arcblock.oss-cn-beijing.aliyuncs.com/images/wallet-round.png',
    certificateContent: content,
    certificateSignature: sig,
  });
})();

Contributors

NameWebsite
wangshijunhttps://ocap.arcblock.io
1.7.1

3 years ago

1.7.0

3 years ago

1.6.3

4 years ago

1.6.2

4 years ago

1.6.1

4 years ago

1.6.0

4 years ago

1.5.8

4 years ago

1.5.7

4 years ago

1.5.6

5 years ago

1.5.5

5 years ago

1.5.4

5 years ago

1.5.3

5 years ago

1.5.2

5 years ago

1.5.1

5 years ago

1.5.0

5 years ago

1.4.8

5 years ago

1.4.7

5 years ago

1.4.6

5 years ago

1.4.5

5 years ago

1.4.4

5 years ago

1.4.3

5 years ago

1.4.2

5 years ago

1.4.1

5 years ago

1.4.0

5 years ago

1.2.7

5 years ago

1.2.6

5 years ago

1.0.13

6 years ago

1.0.4

6 years ago

1.0.0

6 years ago

0.41.0

6 years ago

0.40.11

6 years ago

0.40.10

6 years ago

0.40.9

6 years ago