JSPM

@arcblock/did-util

1.25.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 9797
  • Score
    100M100P100Q135459F
  • License Apache-2.0

Helper function to calculate did

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@arcblock/did-util) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    did-util

    styled with prettier docs Gitter

    Helper functions to calculate did

    Table of Contents

    Install

    npm install @arcblock/did-util
    // or
    pnpm install @arcblock/did-util

    Usage

    const { types } = require('@ocap/mcrypto');
    const { Authenticator, Handlers } = require('@arcblock/did-util');
    const { fromSecretKey, WalletType } = require('@ocap/wallet');
    
    const type = WalletType({
      role: types.RoleType.ROLE_APPLICATION,
      pk: types.KeyType.ED25519,
      hash: types.HashType.SHA3,
    });
    
    const wallet = fromSecretKey(process.env.APP_SK, type).toJSON();
    
    module.exports = new Authenticator({
      wallet,
      baseUrl: 'http://wangshijun.natapp1.cc',
      appInfo: {
        chainHost: 'http://did-workshop.arcblock.co:8210/api',
        chainId: 'forge',
        chainToken: 'TBA',
        copyright: 'https://example-application/copyright',
        decimals: 16,
        description: 'Starter projects to develop web application on forge',
        icon: '/images/logo@2x.png',
        name: 'Forge Web Starter',
        path: 'https://arcwallet.io/i/',
        publisher: `did:abt:${wallet.address}`,
        subtitle: 'Starter projects to develop web application on forge',
      },
    });

    Documentation

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

    Contributors

    Name Website
    wangshijun https://github.com/wangshijun