question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to instantiate EthrDID

See original GitHub issue

I’m trying to instantiate EthrDID in the following way:

const providerConfig = { rpcUrl: 'https://rinkeby.infura.io/ethr-did' }
const issuer: Issuer = new EthrDID({
  identifier: identity.did, // my did
  privateKey: identity.privateKey, // my private key
  providerConfig  
})

I get this error:

error TS2351: This expression is not constructable.
Type 'typeof import("/app/node_modules/ethr-did/lib/index")' has no construct signatures.

I’m using “ethr-did”: “^2.1.4” on package.json

Maybe I’m misconfiguring the providerConfig parameter? Thanks and best regards

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mirceaniscommented, Jun 3, 2021

I think I see what’s happening now, after you shared your project. the import statement should be import { EthrDID } from "ethr-did"; instead of import EthrDID from "ethr-did";

You seem to have stumbled upon a bug in the docs that are somewhat outdated now.

Here’s a sample, based on your project, that works with ts-node:

import { EthrDID } from "ethr-did";
import { Issuer } from "did-jwt-vc";

const issuer: Issuer = new EthrDID({
  identifier: "did:ethr:0xb9c5714089478a327f09197987f16f9e5d936e8a",
  rpcUrl: "https://rinkeby.infura.io/v3/8a581af7416b4e7681d1f871b6945281",
  chainNameOrId: "rinkeby",
}) as Issuer;

console.log(issuer);
0reactions
uport-automation-botcommented, Nov 10, 2021

🎉 This issue has been resolved in version 2.1.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can NOT verify did:ether JWT token #22 - GitHub
I try to use Ether-DID library to create new jwt token and after that i can NOT verify it. Here is example code...
Read more >
verifyJWT not working in Ethr-did nodejs? - Stack Overflow
I am trying to generate and register a DID using ethr-did library. I have created a did by const ethrDid = new EthrDID({provider,...
Read more >
uport-project/Lobby - Gitter
I could solve it using a custom registry address. _. Sign in to start talking · Chat via Matrix.
Read more >
ethr-did - npm
Start using ethr-did in your project by running `npm i ethr-did`. There are 34 other projects in the npm registry using ethr-did.
Read more >
Decentralized Identifiers (DIDs) v1.0 - W3C
Since a key can't control itself, and the key controller cannot be inferred from the DID document, it is necessary to explicitly express...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found