Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to Resolve a DID document #32

Closed
m-yahya opened this issue Aug 27, 2019 · 2 comments
Closed

Failed to Resolve a DID document #32

m-yahya opened this issue Aug 27, 2019 · 2 comments

Comments

@m-yahya
Copy link

m-yahya commented Aug 27, 2019

Description

I'm trying to resolve a DID document using did-resolver and ethr-did-resolver using the instructions described here:
https://github.com/uport-project/ethr-did-resolver#resolving-a-did-document

Sample Code

const Web3 = require('web3');
Web3.providers.HttpProvider.prototype.sendAsync = Web3.providers.HttpProvider.prototype.send
let provider = new Web3.providers.HttpProvider('http://localhost:9545')

const { Resolver } = require('did-resolver')
const { getResolver } = require('ethr-did-resolver')

const EthrDID = require('ethr-did');

let test = async () => {
    const registry = '0x71d2fb13e289fbb9ccae91571ca6637ccb29c727';
    const address = '0x23149630a1a84df75a8dccc3a50c02d0ad146d8e';

    const ethrDid = new EthrDID({ provider, registry, address });

    let did = ethrDid.did;

    const ethrDidResolver = getResolver(provider, registry)
    const didResolver = Resolver(ethrDidResolver)
    console.log(didResolver); // undefined

}

test();

Steps to Reproduce

  1. init npm project
  2. paste the above code into index.js
  3. config the provider
  4. replace the address and registry with your own stuff
  5. install the web3, ethr-did, did-resolver, ethr-did-resolver dependencies
  6. run node index.js

Expected Behaviour

It should resolve the DID Document for give DID.

Actual Behaviour

const didResolver = Resolver(ethrDidResolver) is undefined so the rest of code (didResolver.resolve('did:ethr:0x23149630a1a84df75a8dccc3a50c02d0ad146d8e').then(doc => console.log)) is not executing.

Versions

"did-resolver": "^1.0.0",
"ethjs-provider-http": "^0.1.6",
"ethr-did": "^1.1.0",
"ethr-did-resolver": "^1.0.1",
"web3": "^1.2.1"

@mirceanis
Copy link
Member

I think you are missing a new keyword

const didResolver = Resolver(ethrDidResolver)
// should be
const didResolver = new Resolver(ethrDidResolver)

@m-yahya
Copy link
Author

m-yahya commented Sep 3, 2019

Thank you very much for your support.
It's working.

@m-yahya m-yahya closed this as completed Sep 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants