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.

Can NOT verify did:ether JWT token

See original GitHub issue

I try to use Ether-DID library to create new jwt token and after that i can NOT verify it. Here is example code i used.

`const EthrDID = require(‘ethr-did’); const ethrDid = new EthrDID({ provider: web3.currentProvider, address: ‘address’, privateKey: ‘priv-key’ });

var jwt = await ethrDid.signJWT({ claims: { name: ‘Joe Lubin’ } }); //Problem here const { payload, issuer } = ethrDid.verifyJWT(jwt); console.log(payload); // return undefined console.log(issuer); // return undefined`

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:30 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
gdollardcommented, Mar 30, 2020

I was hoping to use a key pair from one of my accounts via my web3 instance but for some reason JWT doesn’t like it.

web3 signatures are different from JWT signatures, even if the same private key is in use so it wouldn’t work with only your web3 provider.

For reference, in pseudocode web3 signatures are computed as signHash(privKey, keccak(message)) while JWT signatures are computed as signHash(privKey, sha256(message))

As a side-note, unfortunately there’s not enough bandwidth now to investigate the issues you are facing, not even to update docs for this library. PRs are still welcome, of course.

@mirceanis thanks for that information, much appreciated.

1reaction
mirceaniscommented, Aug 29, 2019

Just to be clear, the delay is needed somewhere between createSigningDelegate() and verifyJWT because createSigningDelegate() sends a transaction and that block needs to propagate to the node that responds to the calls made by verifyJWT (resolving the DID document).

So, if your flow requires some key delegation for signing but not immediately followed by verification, this delay will not be needed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting JWT validation - Google Cloud
If the flag is not used, the JWT token is intercepted and verified by Cloud Run access control IAM server and not by...
Read more >
Cannot verify JWT token - Stack Overflow
I am using NestJS and its JWT package based on jsonwebtoken. The generated token is always being invalid, and I am getting a...
Read more >
Can't verify JWT token in the backend
Hi there, I have a simple backend for my app and I want to validate whether the request has come from a valid...
Read more >
Validate JSON Web Tokens - Auth0
Tokens should be verified to decrease security risks if the token has been, for example, tampered with, misused, or has expired. JWT validation...
Read more >
Verifying a JSON web token - Amazon Cognito
characters. If your JWT does not conform to this structure, consider it not valid and do not accept it. Step 2: Validate the...
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