Skip to content
No description, website, or topics provided.
JavaScript Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
jlinc-did
scripts
test
.eslintrc.js
.gitignore
.gitmodules
.node-version
.npmignore
LICENSE
README.md
config.json.example
package-lock.json
package.json

README.md

Node JLINC

A node client for the JLINC DID Server

Specs:

Specifically: https://did-spec.jlinc.org/#6-operations

Nomenclature

Entity

An entity is a specific DID record with its corresponding keys and secrets. It looks like this:

const entity = {
  did: 'did:jlinc:dnhZF0DuRHgZ0wetY4S7ygsrCQMUzUZoxLxosEmbIYM',
  signingPublicKey: 'dnhZF0DuRgsrCQMUzUZoxLHgZ0wetY4S7yxosEmbIYM',
  signingPrivateKey: 'g2eFkXQO5EeBnTS_FdcbVV_ttiw53sHHENlXCZl5xH5rqwGVWwo9jLG-B61jhLvKCysJAxTNRmjEvGiwSZshgw',
  encryptingPublicKey: 'BK478lOPXtO9J2KsWq_M_opXcVqCiAYd0TWOJcATjX8',
  encryptingPrivateKey: '4LMoOgJQMq2NYWAb7RAkCA0cnMN7QCGZQJROgWmCEdI',
  registrationSecret: '929afc44b7f692ac8fb615467e5eb910325b73d3adb1c504fd46a77edef22235'
};

DID

A DID: did:jlinc:dnhZF0DuRHgZ0wetY4S7ygsrCQMUzUZoxLxosEmbIYM is the unique Decentralized Identifier.

DID Document

A DID Document is a JSON objected sent to and received by the JLINC DID Server. It looks like this

{
  "@context": "https://w3id.org/did/v1",
  "id": "did:jlinc:dnhZF0DuRHgZ0wetY4S7ygsrCQMUzUZoxLxosEmbIYM",
  "created": "2019-01-08T21:12:36.505Z",
  "publicKey": [
    {
      "id": "did:jlinc:dnhZF0DuRHgZ0wetY4S7ygsrCQMUzUZoxLxosEmbIYM#signing",
      "type": "ed25519",
      "owner": "did:jlinc:dnhZF0DuRHgZ0wetY4S7ygsrCQMUzUZoxLxosEmbIYM",
      "publicKeyBase64": "dnhZF0DuRgsrCQMUzUZoxLHgZ0wetY4S7yxosEmbIYM"
    },
    {
      "id": "did:jlinc:dnhZF0DuRHgZ0wetY4S7ygsrCQMUzUZoxLxosEmbIYM#encrypting",
      "type": "curve25519",
      "owner": "did:jlinc:dnhZF0DuRHgZ0wetY4S7ygsrCQMUzUZoxLxosEmbIYM",
      "publicKeyBase64": "BK478lOPXtO9J2KsWq_M_opXcVqCiAYd0TWOJcATjX8"
    },
  ],
}

Expected Usage

const didClient = require('jlinc-did-client');

// point the client to a did server
didClient.didServerUrl = 'http://did.jlinc.test';

async function example(){
  const entity = await didClient.register();
  // Persist all of these values
  entity.did;
  entity.signingPublicKey;
  entity.signingPrivateKey;
  entity.encryptingPublicKey;
  entity.encryptingPrivateKey;
  entity.registrationSecret;

  const didDocument = await didClient.resolve({ did: entity.did });

  // supersede a did
  const entityTwo = await didClient.supersede({ entity });

  // get a history of the DIDs behind this did
  const history = await didClient.history({ did: entityTwo.did });
}
You can’t perform that action at this time.