@windingtree/org.id-resolver 3.0.0-beta.2 → 3.0.0-beta.20

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -1,237 +1,29 @@
1
1
  [![Build Status](https://travis-ci.org/windingtree/org.id-resolver.svg?branch=master)](https://travis-ci.org/windingtree/org.id-resolver)
2
- [![Coverage Status](https://coveralls.io/repos/github/windingtree/org.id-resolver/badge.svg?branch=master)](https://coveralls.io/github/windingtree/org.id-resolver?branch=master&v=2.0)
3
2
 
4
- <a href="https://orgid.tech"><img src="https://github.com/windingtree/branding/raw/master/org.id/svg/org.id-logo.svg" height="50" alt="ORG.ID"></a>
3
+ # ORGiD DID Resolver
5
4
 
6
- ## ORG.ID DID Resolver
5
+ A utility for ORGiD DID resolution according to [Decentralized Identifier Resolution](https://w3c-ccg.github.io/did-resolution/) specification.
7
6
 
8
- ORG.ID DID Resolver is an application for resolving ORG.ID data in [W3C DID](https://w3c.github.io/did-core/) format.
7
+ ## Documentation
9
8
 
10
- ## Usage
9
+ - [ORGiD DID resolver documentation](docs/index.md)
10
+ - [ORGiD SDK documentation](https://windingtree.github.io/org.id-sdk/)
11
11
 
12
- ### Command Line
12
+ ## Setup
13
13
 
14
- ```sh
15
- git clone git@github.com:windingtree/org.id-resolver.git
16
- cd org.id-resolver
17
- npm i
18
- npm link
19
- chmod +x src/cli.js
20
- ```
21
-
22
- ```sh
23
- ./src/cli.js endpoint=<WEB3_PROVIDER> orgid=<ORGID_ADDRESS> did=did:orgid:0x6d98103810d50b3711ea81c187a48245109ba094644ddbc54f8d0c4c
24
- ```
25
-
26
- ### NPM Module
27
-
28
- ```sh
29
- npm i @windingtree/org.id-resolver
30
- ```
31
-
32
- ```javascript
33
- const Web3 = require('web3');
34
- const {
35
- OrgIdResolver,
36
- httpFetchMethod,
37
- linkedInFetchMethod,
38
- twitterFetchMethod,
39
- whoisService
40
- } = require('@windingtree/org.id-resolver');
41
-
42
- const web3 = new Web3('<WEB3_PROVIDER>'); // HTTP(s) or WS(s)
43
- const resolver = new OrgIdResolver({
44
- web3,
45
- orgId: '<ORGID_ADDRESS>', // TODO: #3
46
- authorizedTrustProofsIssuers: [
47
- 'did:orgid:0x52f750...' // These DIDs will be allowed to be used as issuers and verifiers for the Trust proofs issuing in form of Verifiable Credentials
48
- ]
49
- });
50
- resolver.registerSocialFetchMethod(linkedInFetchMethod, {
51
- key: '<LINKEDIN_API_KEY>'
52
- });
53
- resolver.registerSocialFetchMethod(twitterFetchMethod, {
54
- key: '<TWITTER_API_KEY>'
55
- });
56
- resolver.registerFetchMethod(httpFetchMethod);
57
- resolver.registerService(whoisService);
58
-
59
- const result = await resolver.resolve('did:orgid:0x62a7502f4c44d8147b8f7b2a1dbeb8503e8446e77355bb2e4ebf999c7ecc5808');
60
- ```
61
-
62
- ## Algorithm
63
-
64
- 1. Validate DID syntax (must be `did:orgid:bytes32`)
65
- 2. Read organization data from ORG.ID Registry
66
- 3. Fetch and validate [ORG.JSON](https://github.com/windingtree/org.json-schema):
67
- 4. Try to resolve assertions and credentials
68
-
69
- The response of the resolver contains the following information
70
-
71
- ```json
72
- {
73
- // An object that has been resolved from the given DID.
74
- // Can be equal to `null` if JSON file not passed hashes equality check
75
- // or if the file is not passed validation against the ORG.ID schema
76
- "didDocument": {...},
77
-
78
- // Organization identifier
79
- "id": "<organization_id>",
80
-
81
- "organization": {
82
- "orgId": "<organization_id>",
83
- "orgJsonHash": "<organization_json_hash>",
84
- "orgJsonUri": "<organization_json_uri>",
85
- "orgJsonUriBackup1": "<organization_json_uri>",
86
- "orgJsonUriBackup2": "<organization_json_uri>",
87
- "parentOrgId": "<parent_organization_hash_or_zero_hash>",
88
- "owner": "<owner_eth_address>",
89
- "director": "<director_eth_address>",
90
- "isActive": true,// true for `enabled` and false for `disabled`
91
- "isDirectorshipAccepted": true,// director confirmation status
92
- },
93
-
94
- // List of validation results
95
- "checks": [
96
- {
97
- "type": "DID_SYNTAX",
98
- "passed": true,
99
- "errors": [],
100
- "warnings": []
101
- },
102
- {
103
- "type": "ORGID",
104
- "passed": true,
105
- "errors": [],
106
- "warnings": []
107
- },
108
- {
109
- "type": "DID_DOCUMENT",
110
- "passed": true,
111
- "errors": [],
112
- "warnings": []
113
- },
114
- {
115
- "type": "TRUST_ASSERTIONS",
116
- "passed": true
117
- }
118
- ],
119
-
120
- // Verified trust section of the `didDocument`
121
- "trust": {
122
- "assertions": [
123
- {
124
- "type": "dns",
125
- "claim": "test.com",
126
- "proof": "TXT",
127
- "verified": true
128
- },
129
- {
130
- "type": "domain",
131
- "claim": "test2.com",
132
- "proof": "http://test2.com/orgid.txt",
133
- "verified": true,
134
- "whois": {
135
- "domainName": "TEST2.COM",
136
- "registryDomainId": "1234567_DOMAIN_COM-VRSN",
137
- "registrarWhoisServer": "whois.server.net",
138
- "registrarUrl": "http://www.whois.net",
139
- "updatedDate": "2021-03-22T05:01:08Z",
140
- "creationDate": "2011-05-09T18:58:13Z",
141
- "expiryDate": "2024-05-09T18:58:13Z",
142
- "registrar": "Cool Domain",
143
- "registrarIanaId": "345",
144
- "registrarAbuseContactEmail": "abuse@support.server.net",
145
- "registrarAbuseContactPhone": "+33.1234567",
146
- "domainStatus": "clientTransferProhibited",
147
- "nameServer": "NS.SERVER.COM",
148
- "DNSSEC": "unsigned"
149
- }
150
- },
151
- {
152
- "type": "domain",
153
- "claim": "test3.com",
154
- "proof": "http://test3.com/orgid.txt",
155
- "verified": false // Not verified
156
- },
157
- {
158
- "type": "social",
159
- "claim": "twitter.com/jack",
160
- "proof": "https://twitter.com/jack/status/123456789/",
161
- "verified": true
162
- }
163
- ]
164
- },
165
-
166
- // Resolver meta-data like version, date of result and process duration
167
- "resolverMetadata": {
168
- "version": "2.0.0",
169
- "retrieved": "2020-02-21T18:14:13.278Z",
170
- "duration": 979,
171
- "orgIdAddress": "0x2cb8dCf26830B969555E04C2EDe3fc1D1BaD504E"
172
- }
173
- }
174
- ```
175
-
176
- ## Fetching methods
177
-
178
- At least one fetching method is required to the proper working of the resolver.
179
- This library provides a simple fetching method of a file that available via http/https - `httpFetchMethod`.
180
-
181
- To use this method you can get its configuration from the package this way:
182
-
183
- ```javascript
184
- const { OrgIdResolver, httpFetchMethod } = require('@windingtree/org.id-resolver');
185
- const resolver = new OrgIdResolver({...});
186
- resolver.registerFetchMethod(httpFetchMethod);// fetching method should be registered
187
- ```
188
-
189
- Future versions of `DID resolver` library will support more fetching methods like:
190
- IPFS, Swarm and Arweave
191
-
192
- Creation of custom fetching methods is quite simple task. Look at the example of simple fetching method configuration:
193
-
194
- ```javascript
195
- module.exports = {
196
- name: 'unique_method_name',
197
-
198
- // Regexp to match your URI schema
199
- pattern: '^yourpatternrule:',
200
-
201
- fetch: async uri => {
202
- const data = await yourCustomHandler(uri);
203
- return data;
204
- }
205
- };
206
- ```
207
-
208
- ## Development
209
-
210
- ### Test
211
-
212
- ```sh
213
- npm run test
214
- npm run test ./<path_to_test_file>.js
14
+ ```bash
15
+ yarn install
215
16
  ```
216
17
 
217
- ## Test coverage
18
+ ## Build
218
19
 
219
20
  ```bash
220
- npm run coverage
21
+ yarn build
221
22
  ```
222
23
 
223
- ## Lint
24
+ ## Linting & Testing
224
25
 
225
26
  ```bash
226
- npm run lint
227
-
27
+ yarn lint
28
+ yarn test
228
29
  ```
229
-
230
- ## ORG.ID Ecosystem
231
-
232
- - [Winding Tree DAO](https://github.com/windingtree/dao) controls ORG.ID Registry smart contract and some Directories (including their rules)
233
- - [ORG.ID Registry](https://github.com/windingtree/org.id) contains records of all organizations and organizational units
234
- - [ORG.JSON Schema](https://github.com/windingtree/org.json-schema) is a data format for describing organizations
235
- - **ORG.ID Resolver (you are here)**
236
- - [ORG.ID Directories](https://github.com/windingtree/org.id-directories) are curated lists of organizations
237
- - [Arbor](https://arbor.fm) can be used to look up an ORG.ID, and also to create and manage your own ORG.ID
package/dist/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@windingtree/org.id-resolver",
3
- "version": "3.0.0-beta.2",
3
+ "version": "3.0.0-beta.20",
4
4
  "description": "ORGiD DID resolver",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
5
+ "main": "dist/src/index.js",
6
+ "types": "dist/src/index.d.ts",
7
7
  "files": [
8
8
  "dist"
9
9
  ],
@@ -13,7 +13,7 @@
13
13
  "scripts": {
14
14
  "lint": "npx eslint . --ext .ts",
15
15
  "lint:fix": "npx eslint . --ext .ts --fix",
16
- "build": "rm -rf dist && npx tsc -p tsconfig-build.json",
16
+ "build": "rm -rf dist && npx tsc -p tsconfig-build.json && npx ts-node ./scripts/responseSchema.ts > ./dist/responseSchema.json",
17
17
  "test": "npx hardhat test",
18
18
  "test:coverage": "npx nyc --reporter=html --reporter=lcov hardhat test"
19
19
  },
@@ -32,28 +32,28 @@
32
32
  "url": "git+ssh://git@github.com:windingtree/org.id-resolver.git"
33
33
  },
34
34
  "dependencies": {
35
- "@windingtree/org.id": "3.0.0-beta.5",
36
- "@windingtree/org.id-core": "1.0.0-beta.21",
37
- "@windingtree/org.id-auth": "1.0.0-beta.10",
38
- "@windingtree/org.json-schema": "1.0.0-beta.4",
39
- "@windingtree/org.id-utils": "1.0.0-beta.10",
40
- "luxon": "2.0.2",
41
- "ethers": "5.5.1"
35
+ "@windingtree/org.id": "^3.0.0-beta.6",
36
+ "@windingtree/org.id-auth": "^1.0.0-beta.47",
37
+ "@windingtree/org.id-core": "^1.0.0-beta.47",
38
+ "@windingtree/org.id-utils": "^1.0.0-beta.47",
39
+ "@windingtree/org.json-schema": "1.0.2",
40
+ "ethers": "5.5.3",
41
+ "luxon": "2.3.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@windingtree/org.id-test-setup": "1.0.0-beta.21",
45
- "@istanbuljs/nyc-config-typescript": "1.0.1",
46
- "@nomiclabs/hardhat-ethers": "2.0.2",
47
- "@types/luxon": "2.0.5",
48
- "@types/mocha": "9.0.0",
49
- "@types/chai": "4.2.22",
44
+ "@istanbuljs/nyc-config-typescript": "1.0.2",
45
+ "@nomiclabs/hardhat-ethers": "2.0.4",
46
+ "@types/chai": "4.3.0",
50
47
  "@types/chai-as-promised": "7.1.4",
48
+ "@types/luxon": "2.0.9",
49
+ "@types/mocha": "9.0.0",
50
+ "@windingtree/org.id-test-setup": "1.0.0-beta.47",
51
51
  "chai": "4.3.4",
52
52
  "chai-as-promised": "7.1.1",
53
- "eslint": "8.1.0",
54
- "hardhat": "2.6.8",
53
+ "eslint": "8.7.0",
54
+ "hardhat": "2.8.3",
55
55
  "nyc": "15.1.0",
56
56
  "ts-node": "10.4.0",
57
- "typescript": "4.4.4"
57
+ "typescript": "4.5.4"
58
58
  }
59
59
  }