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

3id-test-helper

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

3id-test-helper

Generate 3IDs and signers for testing

  • 1.0.5
  • latest
  • Source
  • npm
  • Socket score

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

3id Test Helper

A library to generate DIDs and sign Json Web Tokens (JWTs). This library is meant for running tests so that you do not need to log in to your wallet, connect to 3box and then sign JWTs.

Install

Using npm:

$ npm install 3id-test-helper

API

Create the class

const DidHelper = require('3id-test-helper')
const IPFS = require('ipfs')

const ipfs = await IPFS.create()
const testHelper = new DidHelper(ipfs)

Generate DIDs

const accounts = await testHelper.generateAccounts()

When you generate accounts, you create random Ethereum private keys which are used to generate your DIDs.

You can get those private keys and hardcode them in your tests so you can reuse the same DIDs.

const privateKeys = testHelper.getPrivateKeys()
const reusedDIDs = testHelper.generateAccounts(privateKeys)

Signing Json Web Tokens (JWTs)

Important: The did you pass in must have been generated by the class. When the class generates the DIDs, it creates a signer for JWTs.

const jwt = await testHelper.createJWTFromDID(did, payload)

FAQs

Package last updated on 17 Sep 2020

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