JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 173
  • Score
    100M100P100Q110814F
  • License MIT

node.js module to generate DID and Ed25519 keys to use with Sovrin

Package Exports

  • sovrin-did

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 (sovrin-did) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

node-sovrin-did

build status

node.js module to generate DID and Ed25519 keys to use with Sovrin

Install

$ npm i sovrin-did

Example

var sovrinDID = require("sovrin-did");

var d = sovrinDID.gen();

console.log(d);

output:

{ did: 'S7evWWTSbaXELyE9w53sFr',
  verifyKey: 'EgvhZsLKSsqsbNBfJ2wfR9FFWo9YqkpxpfXeT4ifR1Cq',
  secret:
   { seed: '36a572a7e43956784b517c57b26720a8ef838d114c0619f1d8c7801c37fa4f6a',
     signKey: '4gKLe7Qq2WX249NBfymQySZbAzXboq2emMig6wBR82Bj' } }

API

sovrinDID.gen()

Generates a new did, verification key, signing key, and also gives you the seed used to generate them.

{
    did: "<base58 did>",
    verifyKey: "<base58 publicKey>",

    secret: {
        seed: "<hex encoded 32-byte seed>",
        signKey: "<base58 secretKey>"
    }
}

sovrinDID.fromSeed(seed)

Same as .gen() except you supply the seed. The seed should be a 32-byte Uint8Array (i.e. Buffer).

Example:

var seed = Buffer.from("36a572a7e43956784b517c57b26720a8ef838d114c0619f1d8c7801c37fa4f6a", "hex");

var d = sovrinDID.fromSeed(seed);

console.log(d);

The output is the same as the .gen() example.

License

MIT