From 2fdba37833c5ad7f40a9bdb70e69eab91ce291ca Mon Sep 17 00:00:00 2001 From: Simonas Karuzas Date: Mon, 2 Mar 2020 16:36:10 +0200 Subject: [PATCH] fix: Resolver config --- examples/react-app/package.json | 2 +- examples/react-app/src/setup.ts | 6 +-- examples/react-app/yarn.lock | 54 +++++++++++++++++++++++++-- packages/daf-resolver/src/resolver.ts | 5 ++- 4 files changed, 58 insertions(+), 9 deletions(-) diff --git a/examples/react-app/package.json b/examples/react-app/package.json index 4244cdae8..a26846764 100644 --- a/examples/react-app/package.json +++ b/examples/react-app/package.json @@ -16,7 +16,7 @@ "daf-ethr-did": "../../packages/daf-ethr-did", "daf-libsodium": "../../packages/daf-libsodium", "daf-local-storage": "../../packages/daf-local-storage", - "daf-resolver-universal": "../../packages/daf-resolver-universal", + "daf-resolver": "../../packages/daf-resolver", "daf-trust-graph": "../../packages/daf-trust-graph", "daf-w3c": "../../packages/daf-w3c", "ethr-did": "^1.1.0", diff --git a/examples/react-app/src/setup.ts b/examples/react-app/src/setup.ts index 35b9e209b..9ee997304 100644 --- a/examples/react-app/src/setup.ts +++ b/examples/react-app/src/setup.ts @@ -3,7 +3,7 @@ import * as W3c from 'daf-w3c' import * as TG from 'daf-trust-graph' import * as DBG from 'daf-debug' import * as DidJwt from 'daf-did-jwt' -import { DafUniversalResolver } from 'daf-resolver-universal' +import { DafResolver } from 'daf-resolver' import * as EthrDid from 'daf-ethr-did' import * as DafLocalStorage from 'daf-local-storage' import * as DafLibSodium from 'daf-libsodium' @@ -18,10 +18,10 @@ messageValidator.setNext(new DidJwt.MessageValidator()).setNext(new W3c.MessageV const actionHandler = new DBG.ActionHandler() actionHandler.setNext(new TG.ActionHandler()).setNext(new W3c.ActionHandler()) -const didResolver = new DafUniversalResolver({ url: 'https://uniresolver.io/1.0/identifiers/' }) - const infuraProjectId = '5ffc47f65c4042ce847ef66a3fa70d4c' +const didResolver = new DafResolver({ infuraProjectId }) + const identityProviders: Daf.AbstractIdentityProvider[] = [ new EthrDid.IdentityProvider({ kms: new DafLibSodium.KeyManagementSystem(new DafLocalStorage.KeyStore('localKeys')), diff --git a/examples/react-app/yarn.lock b/examples/react-app/yarn.lock index 4aaf9f4b6..c5eac3f2f 100644 --- a/examples/react-app/yarn.lock +++ b/examples/react-app/yarn.lock @@ -3519,7 +3519,7 @@ daf-did-jwt@../../packages/daf-did-jwt, daf-did-jwt@^2.3.10: did-resolver "^1.1.0" daf-ethr-did@../../packages/daf-ethr-did: - version "2.3.10" + version "2.3.13" dependencies: daf-core "^2.3.10" debug "^4.1.1" @@ -3544,14 +3544,17 @@ daf-local-storage@../../packages/daf-local-storage: daf-core "^2.3.10" debug "^4.1.1" -daf-resolver-universal@../../packages/daf-resolver-universal: +daf-resolver@../../packages/daf-resolver: version "2.0.0" dependencies: - cross-fetch "^3.0.4" debug "^4.1.1" + did-resolver "^1.1.0" + ethr-did-resolver "^1.0.3" + nacl-did "^1.0.0" + web-did-resolver "^1.2.0" daf-trust-graph@../../packages/daf-trust-graph: - version "2.3.10" + version "2.3.14" dependencies: apollo-cache-inmemory "^1.6.3" apollo-client "^2.6.4" @@ -3813,6 +3816,11 @@ did-resolver@0.0.6, did-resolver@^0.0.6: resolved "https://registry.yarnpkg.com/did-resolver/-/did-resolver-0.0.6.tgz#2d4638b8914871c19945fb3243f6f298c1cca9db" integrity sha512-PqxzaoomTbJG3IzEouUGgppu3xrsbGKHS75zS3vS/Hfm56XxLpwIe7yFLokgXUbMWmLa0dczFHOibmebO4wRLA== +did-resolver@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/did-resolver/-/did-resolver-1.0.0.tgz#892bcffe66352b1360c928a23082a731c83ca7c3" + integrity sha512-mgJG0oqlkG7jfRzW0yN9qKawp24M4thGFdfIaZI30SAJXhpkkjqbkRxqMZLJNwqXEM0cqFbXaiFDqnd9Q1UUaw== + did-resolver@^1.0.0, did-resolver@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/did-resolver/-/did-resolver-1.1.0.tgz#27a63b6f2aa8dee3d622cd8b8b47360661e24f1e" @@ -3982,6 +3990,13 @@ ecc-jsbn@~0.1.1: jsbn "~0.1.0" safer-buffer "^2.1.0" +ed2curve-esm@^0.3.0-alpha-1: + version "0.3.0-alpha-1" + resolved "https://registry.yarnpkg.com/ed2curve-esm/-/ed2curve-esm-0.3.0-alpha-1.tgz#67a5722ea97976c3310aeaf0990a2b58ee383aef" + integrity sha512-Ydrqcf0NwKUBT4gL0Nnxp8/O5NG8iatN+/zbEgs/7eMGjgSVbgfE1YfWld2qYnoNIxOQvSWOFy5uBoaL3jCanw== + dependencies: + tweetnacl "^1.0.1" + ee-first@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" @@ -4522,6 +4537,19 @@ ethr-did-resolver@^0.2.0: ethjs-query "^0.3.5" ethr-did-registry "^0.0.3" +ethr-did-resolver@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/ethr-did-resolver/-/ethr-did-resolver-1.0.3.tgz#8a4777c6267afe80a55a16fcee21845ddfd25104" + integrity sha512-9XtaB+4Ozc4W0gWHZ4J2HA+c+M7r0xcktmQI6v3GMjFto7b42Mq9zhh24kAxCqmtkqQhmUDJeqqSOIOwHrNbmQ== + dependencies: + buffer "^5.1.0" + did-resolver "1.0.0" + ethjs-abi "^0.2.1" + ethjs-contract "^0.1.9" + ethjs-provider-http "^0.1.6" + ethjs-query "^0.3.5" + ethr-did-registry "^0.0.3" + ethr-did@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/ethr-did/-/ethr-did-1.1.0.tgz#5e9f304f6b040505b842c3b66912ceb470b72609" @@ -7327,6 +7355,16 @@ mute-stream@0.0.8: resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== +nacl-did@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/nacl-did/-/nacl-did-1.0.1.tgz#94a253430343038c8fee3ff0ecf394b1d34fe4b2" + integrity sha512-eGFtGk8v04QaYYQe0Y+suC0iLarPJh4NC5z/f1+JTQh7nRvA/+5ZT4eh/dtP/JGPtUkh2TdpdeiFtMJ0DEyIKQ== + dependencies: + did-resolver "^1.0.0" + ed2curve-esm "^0.3.0-alpha-1" + tweetnacl "^1.0.1" + tweetnacl-util "^0.15.0" + nan@^2.12.1: version "2.14.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c" @@ -11147,6 +11185,14 @@ wbuf@^1.1.0, wbuf@^1.7.3: dependencies: minimalistic-assert "^1.0.0" +web-did-resolver@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/web-did-resolver/-/web-did-resolver-1.2.0.tgz#bbf5c5531f707afa60fca6b1a1d19721c4a7b750" + integrity sha512-nTZHRVhjZpUazmZdkuV9M5UA8BpkRQRxoVw1UTd+hreLR+q/xeQsYs55eWTOr9jmPG1fePTrgXcoFVfkz1YCbQ== + dependencies: + cross-fetch "^3.0.4" + did-resolver "1.0.0" + webidl-conversions@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" diff --git a/packages/daf-resolver/src/resolver.ts b/packages/daf-resolver/src/resolver.ts index 3c5eaf190..b2b0baad4 100644 --- a/packages/daf-resolver/src/resolver.ts +++ b/packages/daf-resolver/src/resolver.ts @@ -16,7 +16,10 @@ export class DafResolver { constructor(options: Options) { this.didResolver = new Resolver({ ...ethrDidResolver({ - rpcUrl: 'https://mainnet.infura.io/v3/' + options.infuraProjectId, + networks: [ + { name: 'mainnet', rpcUrl: 'https://mainnet.infura.io/v3/' + options.infuraProjectId }, + { name: 'rinkeby', rpcUrl: 'https://rinkeby.infura.io/v3/' + options.infuraProjectId }, + ], }), ...webDidResolver(), nacl: naclDidResolver,