0.1.1 • Published 4 months ago

@abaxx/id v0.1.1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
4 months ago

@abaxx/id

Code Coverage Statements Branches Functions Lines

Introduction

This repository contains ID++ v1 backwards compatibilty and a reference implementation of Decentralized Web Node (DWN) as per the specification. This specification is in a draft state and very much so a WIP. For the foreseeable future, a lot of the work on DWN will be split across this repo and the repo that houses the specification.

Proposals and issues for the specification itself should be submitted as pull requests.

Documentation

  • ID Dwn Protocol
  • ID Dwn Guide
  • ID Dwn Whitepaper
  • ID SDK Docs

Installation

npm install @abaxx/id

Tests

To disable all tests

export TESTSOFF=true

Usage

import { 
  Dwn,
  DataStream,
  DidKeyResolver,
  Jws,
  RecordsWrite,
  MessageStoreLevel,
  DataStoreLevel,
  EventLogLevel
} from '@abaxx/id';

const messageStore = new MessageStoreLevel();
const dataStore = new DataStoreLevel();
const eventLog = new EventLogLevel();

// Create instances
const dwn = await Dwn.create({ messageStore, dataStore, eventLog });

// generate a did:key DID
const didKey = await DidKeyResolver.generate();

const signature = Jws.createSigner(didKey);

// Create some data to be stored.
const encoder = new TextEncoder();
const data = encoder.encode('Hello, World!');

const recordsWrite = await RecordsWrite.create({
  data,
  dataFormat                  : 'application/json',
  published                   : true,
  protocol                    : 'authentication',
  schema                      : 'authentication/get',
  signer                      : Jws.createSigner(didKey)
});

const dataStream = DataStream.fromBytes(data);
const result = await dwn.processMessage(didKey.did, recordsWrite.message, dataStream);

console.log('result', result.status);

// Close the DWN
await dwn.close()

Note: built for node and browser environments

Architecture

The diagram is a conceptual view, the actual component abstraction and names in the source code file may differ.

Project Resources

ResourceDescription
CODEOWNERSOutlines the project lead(s)
CODE_OF_CONDUCT.mdExpected behavior for project contributors, promoting a welcoming environment
CONTRIBUTING.mdDeveloper guide to build, test, run, access CI, chat, discuss, file issues
GOVERNANCE.mdProject governance
LICENSEApache License, Version 2.0