Closed hsnhrn closed 5 years ago
can please you post a gist or a project that is showing the error?
can please you post a gist or a project that is showing the error?
That project is showing a different error. I'm not able to understand what is the intent.
From what I can make of it, it looks like you are trying to add a signing delegate to a contract deployed to a local network at address 0xaa645fc3b17d9ee157f1f934b2cd800e55c172f5
For that to happen, you need to have the local network running and for the registry contract to have already been deployed at that address.
Note that creating a signing delegate for an ethr-did means that a keypair is created locally and then the registry contract is called to add that new key as a delegate.
Please cleanup that project to the bare minimum of what you intend to achieve and have it show the error that is blocking you. Otherwise, I can't help because I don't understand your blocker.
Hi i cleaned the project and added some comments in it.
Yes you are right i am using registry deployed in my own local network.
Creating a signing delegate is working fine and i can see the transaction hash on my local network.
I am only having problem in verifying the JWT after signing it.
Signing the JWT also works fine.
so here is the output i am logging in the console and the error below..
{ kp:
{ address: '0x59f515285081931ebd1fb3ba7a0b9e35e926d84e',
privateKey:
'85407ecdd20a14b1f7d2e345fb93a56366a5cc37a2db07ced33b2eb8015edefb' },
txHash:
'0x673d66c8f2d6e2afc4833eedd09a66b3293e5a31696c2bd56f1f4eafe0a29d69' }
signed JWT:eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NkstUiJ9.eyJpYXQiOjE1NjY5ODc5MDgsImhlbGxvIjoid29ybGQiLCJpc3MiOiJkaWQ6ZXRocjoweDI5RjQwMjQxMDI4N0U4MjBlRjIxRUQ2M2Q0MzFmMGNFMGI4RWIzMTQifQ.fPojiPfl3mvGdH979ivr7PpI6RygST_ZMa6xpDomaO2p97g8atFR6JzlmDNSMnPssgnNZRW1m5oZ4DoNKrl1_gA
undefined
(node:15341) UnhandledPromiseRejectionWarning: Error: Unsupported DID method: 'ethr'
at /home/ubuntu/did_test/node_modules/did-jwt/node_modules/did-resolver/lib/resolver.js:87:31
at step (/home/ubuntu/did_test/node_modules/did-jwt/node_modules/did-resolver/lib/resolver.js:32:23)
at Object.next (/home/ubuntu/did_test/node_modules/did-jwt/node_modules/did-resolver/lib/resolver.js:13:53)
at /home/ubuntu/did_test/node_modules/did-jwt/node_modules/did-resolver/lib/resolver.js:7:71
at new Promise (
ok, I see.
By default, did-jwt
has no resolvers registered. They need to be added.
add ethr-did-resolver version 0.2.0; the latest version is in an incompatible state with the rest of the libraries.
npm install ethr-did-resolver@0.2.0
then, in your index.js add:
import registerResolver from 'ethr-did-resolver'
registerResolver({provider : provider})
NOTE the registry contract may not work correctly with ganache if that is indeed your local network, so you may end up with "Invalid signature for JWT" errors when you try to verify.
Hi @mirceanis , Thanks alot for your help.
I am using this Ethereum Volta network. https://volta-explorer.energyweb.org
And i am having the same error now you mentioned above. "Signature invalid for JWT" Is there any specific reason for that error? Will it be solved at Volta Network end? Should i ask them about it?
Thanks a lot!
I'm not sure yet why this is failing. The ethr-did-registry relies on transaction logs to build a DID document containing the delegate keys. I'm not familiar with the Volta network, but from what I'm seeing in ganache it appears this mechanism is not compatible. It needs a connection to a node that can answer with transaction logs.
Note that if you don't necessarily require key delegation you can use a SimpleSigner
with the private key directly.
I'll close this since the original error was solved. Please open a new issue if you get stuck on something else.
the Signature invalid for JWT
can be fixed by using registerResolver({provider : provider, registry:registryAddress})
Ah, yes. I missed the registry address config. Thank you for pointing it out. Even so, it still doesn't work for me in ganache 2.1.0
@hsnhrn can you please check that with your Volta network configuration?
No, its still the same error
Describe the bug I am trying to verify the the JWT both with ethr-did and did-jwt but it is giving me an error about the Error: Unsupported DID method: 'ethr'.
I created the signer of my private key by
const didJWT = require('did-jwt') const signer = didJWT.SimpleSigner('fa09a3ff0d486be2eb69545c393e2cf47cb53feb44a3550199346bdfa6f53245');
and then created and decoded the JWT succesfully.
But it gaves me an error on verify method
Project link
https://github.com/hsnhrn/did