@arcblock/did-ext
TypeScript icon, indicating that this package has built-in type declarations

1.18.120 • Public • Published

DID

styled with prettier docs Gitter

Extensions to work with ArcBlock DID

Usage

yarn add @arcblock/did-ext
const { WalletType } = require('@ocap/wallet');
const { fromAppDid } = require('@arcblock/did-ext');

const type = WalletType({ role: types.RoleType.ROLE_ACCOUNT });
const rootSk = '0x07abfceff5cdfb0cd164d2da98099c15b7223fc5a1b8c02c2cf1f74670c72aac27e1d28ed47cf4f2c4330a6e6e1dc0724721e80fa56177fdba926937a253fe7e'; // prettier-ignore
let wallet = fromAppDid('', rootSk, type);
console.log(wallet.toJSON());
wallet = fromAppDid('zNKdqQxDUVz2YkfArfqc1CzjbX2QSNnMk1iW', rootSk, type);
console.log(wallet.toJSON());

Will output:

{
  type: {
    role: 'ROLE_ACCOUNT',
    pk: 'ED25519',
    hash: 'SHA3',
    address: 'BASE58'
  },
  sk: '0x2e47d7b4c367c04cd594feac2c2bbe3eefe02723c3be2b682aabef1ec0c2902e9f16f990b2df33928c22b5b49a73eaa0ee52e40735eddd98e16e3c4538546546',
  pk: '0x9f16f990b2df33928c22b5b49a73eaa0ee52e40735eddd98e16e3c4538546546',
  address: 'z1Zhi9h6do1EUNkM63CEXHonyHx47WQKtxB'
}
{
  type: {
    role: 'ROLE_ACCOUNT',
    pk: 'ED25519',
    hash: 'SHA3',
    address: 'BASE58'
  },
  sk: '0x00b16a229aae56a4bc9e4cb2fdf3bfafcb1c81cca57120db9593e8711a9f859a3a0d2a698006ac0f2f62341a1ddb53404adb4e4b17d1a843af9791991fa4c302',
  pk: '0x3a0d2a698006ac0f2f62341a1ddb53404adb4e4b17d1a843af9791991fa4c302',
  address: 'z1m7dNPVzpgMwRSXDtKywWK6tp5mbK57bN5'
}

Documentation

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

Readme

Keywords

Package Sidebar

Install

npm i @arcblock/did-ext

Weekly Downloads

1,261

Version

1.18.120

License

Apache-2.0

Unpacked Size

6.27 kB

Total Files

5

Last publish

Collaborators

  • wangshijun
  • polunzh
  • mave99a
  • gxw