Nexmo / nexmo-cli

Nexmo CLI (Command Line Interface)
https://nexmo.com
MIT License
78 stars 52 forks source link

Feature: validate a JWT locally #106

Open nzmark opened 7 years ago

nzmark commented 7 years ago

Background

The CLI currently has a very useful feature to create a JWT using the nexmo jwt:generate command.

It would be similarly useful for developers to be able to validate a JWT that they have created, for instance in these scenarios:

Syntax

The command structure could look like this (with optional parameters in square brackets):

nexmo jwt:validate path/to/public.key path/to/jwt [sub=myname] [application_id=1234-5678]

The validation would check:

tjlytle commented 7 years ago

Probably good to validate + output the decoded header / body. Especially for cases where a call is rejected, and you want to make sure the right subject, applciation_id, etc was passed.

cbetta commented 7 years ago

I love it.

sammachin commented 6 years ago

Another useful feature would be to validate the timestamps and returning human readable timestamps (in GMT) Bonus points for being able to test if a JWT is currently valid eg the iat is in the past and the exp is in the future

sammachin commented 6 years ago

In terms of validating against public keys it would be better to fetch the public key from the API for applications rather than asking the user to specify it, this is a nice way then to check that the user hasn't got their keys mixed up between what they have locally and what nexmo has stored for that app id Just spent about 30mins helping a user with that problem!