This repository contains 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, which you can find here. The current goal is to produce a beta implementation by March 2023. This won't include all interfaces described in the DWN spec, but will be enough to begin building applications.
This project is used as a dependency by several other projects.
Proposals and issues for the specification itself should be submitted as pull requests to the spec repo.
npm install @tbd54566975/dwn-sdk-js
import { Dwn, DataStream, DidKeyResolver, Jws, RecordsWrite, RecordsQuery } from '@tbd54566975/dwn-sdk-js';
export const dwn = await Dwn.create();
...
const didKey = await DidKeyResolver.generate(); // generate a did:key DID
const signatureMaterial = Jws.createSignatureInput(didKey);
const data = randomBytes(32); // in node.js
// or in web
// const data = new Uint8Array(32);
// window.crypto.getRandomValues(data);
const query = await RecordsWrite.create({
data,
dataFormat : 'application/json',
published : true,
protocol : 'yeeter',
schema : 'yeeter/post',
authorizationSignatureInput : signatureMaterial
});
const dataStream = DataStream.fromBytes(data);
const result = await dwn.processMessage(didState.did, query.toJSON(), dataStream);
With a web wallet installed:
const result = await window.web5.dwn.processMessage({
method : 'RecordsQuery',
message : {
filter: {
schema: 'http://some-schema-registry.org/todo'
},
dateSort: 'createdAscending'
}
});
Resource | Description |
---|---|
CODEOWNERS | Outlines the project lead(s) |
CODE_OF_CONDUCT.md | Expected behavior for project contributors, promoting a welcoming environment |
CONTRIBUTING.md | Developer guide to build, test, run, access CI, chat, discuss, file issues |
GOVERNANCE.md | Project governance |
LICENSE | Apache License, Version 2.0 |