
ORG.ID DID Resolver Library
DID Resolver of the Winding Tree ORG.ID protocol
Initial setup
npm i
Tests
npm run test
npm run test ./<path_to_test_file>.js
Tests coverage
npm run coverage
Linting
npm run lint
Usage
$ npm i @windingtree/org.id-resolver
const Web3 = require('web3');
const { OrgIdResolver, httpFetchMethod } = require('@windingtree/org.id-resolver');
const web3 = new Web3('<WEB3_PROVIDER_URI>');
const resolver = new OrgIdResolver({
web3,
orgId: '<ORGID_INSTANCE_ADDRESS>'
});
resolver.registerFetchMethod(httpFetchMethod);
const result = await resolver.resolve('did:orgid:0x62a7502f4c44d8147b8f7b2a1dbeb8503e8446e77355bb2e4ebf999c7ecc5808');
The result will look like:
{
didDocument: {
'@context': [
'https://www.w3.org/ns/did/v1',
'https://windingtree.com/ns/orgid/v1'
],
id: 'did:orgid:0x62a7502f4c44d8147b8f7b2a1dbeb8503e8446e77355bb2e4ebf999c7ecc5808',
created: '2019-01-01T13:10:02.251Z',
updated: '2019-06-03T13:20:06.398Z',
publicKey: [ [Object], [Object] ],
service: [ [Object] ],
trust: { assertions: [Array], credentials: [Array] },
legalEntity:
{
legalName: 'Acme, Corp.',
alternativeName: 'Acme',
legalIdentifier: 'US12345567',
identifiers: [Array],
legalType: 'GmBH',
registeredAddress: [Object],
locations: [Array],
contacts: [Array]
}
},
errors: [
'Failed assertion trust.assertions[1]: Cannot get the proof',
'Failed assertion trust.assertions[2]: DID not found in the claim',
'Failed assertion trust.assertions[3]: Cannot get the proof'
],
resolverMetadata: {
retrieved: '2020-02-21T18:14:13.278Z',
duration: 979
}
}
Todo
- More tests
- Documentation
- Cache control
- Additional fetching methods like: IPFS, Swarm, Arweave