npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

discipl-core

v0.3.3

Published

Discipl Core API

Downloads

23

Readme

Discipl Core API

For the WHY and HOW of Discipl Core: see http://discipl.org and presentation in the docs folder (as presented on a first open source ecosystem meetup).

Below you can find the description of the common interface implemented by discipl core connectors:

  • local : simply stores claims (and attestations) locally in an array tied to a DID. Note that this is currently not encrypted.
  • iota : stores claims (and attestations) in public IOTA MAM channels (on the distributed IOTA tangle) that are tied to a DID

The following connectors will be added in near future:

  • irma
  • blockchain
  • ethereum
  • trustchain : see tribler.org
  • leopardledger
  • forus

Other connectors may be included in near future:

  • rchain
  • sovrin
  • secure scuttlebutt
  • ...

Note this library is in early development. Do not use in production.

Installation

yarn install

Basic Usage

this package will export the connectors that export a similair interface as explained in the API (below)

npm install discipl-core

then in Node:

const discipl = require('discipl-core')
const Mam = require('mam.client.js/lib/mam.node.js')
const iotaConnector = new discipl.connectors.iota(Mam, new IOTA({ provider: 'http://node.discipl.org:14265' }))
var mamState = discipl.initState(iotaConnector, seed)
const attestorDid = await discipl.getDid(iotaConnector, mamState)
console.log("Attestor DID: " + attestorDid);
var { mamState, message, attachResult } = await discipl.claim(iotaConnector, mamState, {'msg':'Hello World!'});
...

see examples folder for more example code

API

Note: every API call takes a Discipl Connector as first parameter. This is not repeated for every method description below:

initState

IOTA only: initialises the MAM state in the iota binding. returns the mamState object. Note that the Discipl IOTA connector also provides a (de)serialize method for the mamState object. The initData should be the IOTA wallet seed (a private key) to which the MAM channel will be bound. Note that this seed stays local.

initState(initData)

getDid

Retrieves the DID (did.discipl...) tied to the given private key in the current store

getDid(conn, pkey)

claim

Stores the given (JSON-LD) claim into the store using an account tied to the subject (an id) in the given linked data triples which has to be tied to the given private key. All triples should be about the same subject. NB in case of IOTA the pkey is the seed used by the subject. returns a reference to the claim (an universlly unique id). Note the method attaches the claim to the tangle causing PoW to be done.

function claim(conn, obj, pkey)

attest

Stores an attestation of the given (JSON-LD) claim into the store using a given attestor did with corresponding private key (of the attestor) the claim is not stored itself but only a keyed hash of it for which the given hashkey is used. The keys are not stored anywhere. A reference to the stored attestation is returned

function attest(conn, obj, pkey, hashkey)

attestByReference

Stores an attestation of the claim a given claim reference refers to into the store using a given attestor did with corresponding private key (of the attestor) the referred claim is not stored itself but only a claim containing the reference. A reference to the stored attestation is returned

function attestByReference(conn, obj, reference)

exportLD

Returns a json object containing all messages in the channel of the given did. references to claims in other channels are followed recursively

function exportLD(conn, did)

verify

evaluates whether the store contains an attestation at the address ref of the given (JSON-LD) claim object attested by (one of) the given attestor(s) using the given hashkey note currently only capable of receiving one attestor did.

function verify(conn, ref, attestor_did, obj, hashkey)

revoke

Not Yet Implemented: revokes a particular claim. Verification of a revoked claim or attestation of a claim will result in false.

function revoke(conn, ref, pkey)

getByReference

the only getter for now is one that requires a direct reference

function getByReference(conn, ref, did)