invalid key input
See original GitHub issueDescribe the bug
I just try to reproduce the example of documentation JSON Web Tokens (JWT)Signing
It returns TypeError: invalid key input
To Reproduce
Code to reproduce the behaviour:
const secret = 'bGoa+V7g/yqDXvKRqq+JTFn4uQZbPiQJo4pf9RzJ'
const accessToken = await new SignJWT({ 'urn:example:claim': true })
.setProtectedHeader({ alg: 'ES256' })
.setIssuedAt()
.setIssuer('urn:example:issuer')
.setAudience('urn:example:audience')
.setExpirationTime('2h')
.sign(secret)
Expected behaviour Create a simple JWT for authentification.
Environment:
jose
version: 3.12.3- affected runtime is: Node.js 14.17.0,
- [ X ] the bug is happening on latest
jose
too. - [ X ] i have searched
invalid key input
the issues tracker on github for similar issues and couldn’t find anything related.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Detecting Invalid Key Conditions (INVALID KEY Phrase) - IBM
The imperative statement identified by the INVALID KEY phrase will be given control in the event that an input-output error occurs because of...
Read more >Where is the invalid key in my inputs.conf? - Splunk Community
Solved: Receiving: Invalid key in stanza [monitor://D:\\radiantone\\vds\\vds_server\\logs] in , line 6: whitelist1 (value: vds_server.
Read more >DFC130 Invalid key in input file - Micro Focus
The key information specified for the input file is incompatible with the keys in the file. Resolution: Ensure that the key information read...
Read more >How to Accept [ENTER] key as an invalid input and send out ...
Purpose is to send out error message and that no input is given and [ENTER] key is not valid input and only accept...
Read more >invalid public key input:', <solana.account.Account ... - GitHub
BUY, order_type=OrderType.LIMIT, limit_price=0.5, max_quantity=abs(1), opts=TxOpts(skip_preflight=True) ) The following error occurs: ValueError ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@jvanalst please update/remove those samples before anyone copy/pastes readFileSync to their code… you know that’s gonna happen.
To be honest, I also found these new crypto libraries confusing. While I agree that people should read the documentation, if you’ve never seen SubtleCrypto or crypto.createPublicKey before clicking into one of the links isn’t super helpful (especially for SubtleCrypto with all it’s numerous options that aren’t particularly well explained because you need to have a detailed knowledge of cryptography first).
It also doesn’t help the jsonwebtoken (the JWT library I’m trying to migrate from) just accepts a string with proper headers, so all you need to do is read your public key file into memory and away you go.
It would definitely be helpful to add a few more concrete examples somewhere… actually… maybe that’s exactly what we need? A migration guide from jsonwebtoken to jose?
vs.
mykey.pub: