

ORG.ID DID Resolver
ORG.ID DID Resolver is an application for resolving ORG.ID data in W3C DID format.
Usage
Command Line
git clone git@github.com:windingtree/org.id-resolver.git
cd org.id-resolver
npm i
npm link
chmod +x src/cli.js
./src/cli.js endpoint=<WEB3_PROVIDER> orgid=<ORGID_ADDRESS> did=did:orgid:0x6d98103810d50b3711ea81c187a48245109ba094644ddbc54f8d0c4c
NPM Module
npm i @windingtree/org.id-resolver
const Web3 = require('web3');
const {
OrgIdResolver,
httpFetchMethod,
linkedInFetchMethod,
twitterFetchMethod,
whoisService
} = require('@windingtree/org.id-resolver');
const web3 = new Web3('<WEB3_PROVIDER>');
const resolver = new OrgIdResolver({
web3,
orgId: '<ORGID_ADDRESS>',
authorizedTrustProofsIssuers: [
'did:orgid:0x52f750...'
]
});
resolver.registerSocialFetchMethod(linkedInFetchMethod, {
key: '<LINKEDIN_API_KEY>'
});
resolver.registerSocialFetchMethod(twitterFetchMethod, {
key: '<TWITTER_API_KEY>'
});
resolver.registerFetchMethod(httpFetchMethod);
resolver.registerService(whoisService);
const result = await resolver.resolve('did:orgid:0x62a7502f4c44d8147b8f7b2a1dbeb8503e8446e77355bb2e4ebf999c7ecc5808');
Algorithm
- Validate DID syntax (must be
did:orgid:bytes32
) - Read organization data from ORG.ID Registry
- Fetch and validate ORG.JSON:
- Try to resolve assertions and credentials
The response of the resolver contains the following information
{
"didDocument": {...},
"id": "<organization_id>",
"organization": {
"orgId": "<organization_id>",
"orgJsonHash": "<organization_json_hash>",
"orgJsonUri": "<organization_json_uri>",
"orgJsonUriBackup1": "<organization_json_uri>",
"orgJsonUriBackup2": "<organization_json_uri>",
"parentOrgId": "<parent_organization_hash_or_zero_hash>",
"owner": "<owner_eth_address>",
"director": "<director_eth_address>",
"isActive": true,
"isDirectorshipAccepted": true,
},
"checks": [
{
"type": "DID_SYNTAX",
"passed": true,
"errors": [],
"warnings": []
},
{
"type": "ORGID",
"passed": true,
"errors": [],
"warnings": []
},
{
"type": "DID_DOCUMENT",
"passed": true,
"errors": [],
"warnings": []
},
{
"type": "TRUST_ASSERTIONS",
"passed": true
}
],
"trust": {
"assertions": [
{
"type": "dns",
"claim": "test.com",
"proof": "TXT",
"verified": true
},
{
"type": "domain",
"claim": "test2.com",
"proof": "http://test2.com/orgid.txt",
"verified": true,
"whois": {
"domainName": "TEST2.COM",
"registryDomainId": "1234567_DOMAIN_COM-VRSN",
"registrarWhoisServer": "whois.server.net",
"registrarUrl": "http://www.whois.net",
"updatedDate": "2021-03-22T05:01:08Z",
"creationDate": "2011-05-09T18:58:13Z",
"expiryDate": "2024-05-09T18:58:13Z",
"registrar": "Cool Domain",
"registrarIanaId": "345",
"registrarAbuseContactEmail": "abuse@support.server.net",
"registrarAbuseContactPhone": "+33.1234567",
"domainStatus": "clientTransferProhibited",
"nameServer": "NS.SERVER.COM",
"DNSSEC": "unsigned"
}
},
{
"type": "domain",
"claim": "test3.com",
"proof": "http://test3.com/orgid.txt",
"verified": false
},
{
"type": "social",
"claim": "twitter.com/jack",
"proof": "https://twitter.com/jack/status/123456789/",
"verified": true
}
]
},
"resolverMetadata": {
"version": "2.0.0",
"retrieved": "2020-02-21T18:14:13.278Z",
"duration": 979,
"orgIdAddress": "0x2cb8dCf26830B969555E04C2EDe3fc1D1BaD504E"
}
}
Fetching methods
At least one fetching method is required to the proper working of the resolver.
This library provides a simple fetching method of a file that available via http/https - httpFetchMethod
.
To use this method you can get its configuration from the package this way:
const { OrgIdResolver, httpFetchMethod } = require('@windingtree/org.id-resolver');
const resolver = new OrgIdResolver({...});
resolver.registerFetchMethod(httpFetchMethod);
Future versions of DID resolver
library will support more fetching methods like:
IPFS, Swarm and Arweave
Creation of custom fetching methods is quite simple task. Look at the example of simple fetching method configuration:
module.exports = {
name: 'unique_method_name',
pattern: '^yourpatternrule:',
fetch: async uri => {
const data = await yourCustomHandler(uri);
return data;
}
};
Development
Test
npm run test
npm run test ./<path_to_test_file>.js
Test coverage
npm run coverage
Lint
npm run lint
ORG.ID Ecosystem
- Winding Tree DAO controls ORG.ID Registry smart contract and some Directories (including their rules)
- ORG.ID Registry contains records of all organizations and organizational units
- ORG.JSON Schema is a data format for describing organizations
- ORG.ID Resolver (you are here)
- ORG.ID Directories are curated lists of organizations
- Arbor can be used to look up an ORG.ID, and also to create and manage your own ORG.ID