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

@arcblock/did

Package Overview
Dependencies
Maintainers
0
Versions
544
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arcblock/did

Javascript lib to work with ArcBlock DID

  • 1.18.153
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6.9K
decreased by-24.36%
Maintainers
0
Weekly downloads
 
Created
Source

DID

styled with prettier docs Gitter

Javascript library to manipulate ArcBlock DID: https://github.com/ArcBlock/abt-did-spec

Usage

yarn add @ocap/mcrypto @arcblock/did
const Mcrypto = require('@ocap/mcrypto');
const { fromSecretKey, fromPublicKey, fromAppDID } = require('@arcblock/did');

const { types } = Mcrypto;
const keyPair = Mcrypto.Signer.Ed25519.genKeyPair();

// Gen DID from secretKey
const address = fromSecretKey(keyPair.secretKey, {
  role: types.RoleType.ROLE_APPLICATION,
  pk: types.KeyType.ED25519,
  hash: types.HashType.SHA3,
});
console.log(`abt:did:${address}`);

// Gen DID from publicKey
const address = fromPublicKey(keyPair.publicKey, {
  role: types.RoleType.ROLE_APPLICATION,
  pk: types.KeyType.ED25519,
  hash: types.HashType.SHA3,
});
console.log(`abt:did:${address}`);

// Gen DID from appId
const seed =
  '0xa0c42a9c3ac6abf2ba6a9946ae83af18f51bf1c9fa7dacc4c92513cc4dd015834341c775dcd4c0fac73547c5662d81a9e9361a0aac604a73a321bd9103bce8af';
const appDID = 'zNKtCNqYWLYWYW3gWRA1vnRykfCBZYHZvzKr';
const userDID = fromAppDID(appDID, keyPair.publicKey, {
  role: types.RoleType.ROLE_APPLICATION,
  pk: types.KeyType.ED25519,
  hash: types.HashType.SHA3,
});
console.log(`abt:did:${userDID}`);

Documentation

For full documentation, checkout https://asset-chain.netlify.com

Keywords

FAQs

Package last updated on 03 Dec 2024

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