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.

bug: keystore.toJWKS throws on windows

See original GitHub issue

I’m trying to generate a key, i used the code i found in the doc

const { JWKS: { KeyStore } } = require('@panva/jose');
const keystore = new KeyStore();
keystore.generateSync('RSA', 2048, {
  alg: 'RS256',
  use: 'sig',
});
console.log('this is the full private JWKS:\n', keystore.toJWKS(true));

But when i try to start it i get this error

E:\HAS\OpenId\node_modules\@trust\keyto\src\index.js:231
        throw new InvalidOperationError('key is not a valid PEM string')
        ^

Error: key is not a valid PEM string
    at Function.from (E:\HAS\OpenId\node_modules\@trust\keyto\src\index.js:231:15)
    at module.exports.keyObjectToJWK (E:\HAS\OpenId\node_modules\@panva\jose\lib\help\key_utils.js:13:16)
    at RSAKey.get [as e] (E:\HAS\OpenId\node_modules\@panva\jose\lib\jwk\key\base.js:84:23)
    at RSAKey.[THUMBPRINT_MATERIAL] (E:\HAS\OpenId\node_modules\@panva\jose\lib\jwk\key\rsa.js:78:22)
    at RSAKey.get [as kid] (E:\HAS\OpenId\node_modules\@panva\jose\lib\jwk\key\base.js:39:97)
    at Function.entries (<anonymous>)
    at RSAKey.toJWK (E:\HAS2\OpenId\node_modules\@panva\jose\lib\jwk\key\base.js:60:27)
    at keys.map.key (E:\HAS2\OpenId\node_modules\@panva\jose\lib\jwks\keystore.js:95:60)
    at Array.map (<anonymous>)
    at KeyStore.toJWKS (E:\HAS\OpenId\node_modules\@panva\jose\lib\jwks\keystore.js:95:45)

If i understand correctly this is suppose to directly generate a key? I don’t see in the doc the need for another file so maybe i’m not understanding something and i know you are probably very busy atm but if there are things i can do to help let me know :x

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:16 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
DarkSorrowcommented, Mar 19, 2019

ok with your workaround all test pass

E:\HAS\jose>npm run test
> @panva/jose@0.11.1 test E:\HAS\jose
> ava



  1355 tests passed
0reactions
DarkSorrowcommented, Mar 19, 2019

Well thanks for being so reactive, i sent a PR to keyto as well

Read more comments on GitHub >

github_iconTop Results From Across the Web

jose/CHANGELOG.md - UNPKG
412, * keystore filtering by JWK Key thumbprint ... 622, * throw proper error when runtime doesn't support OKP ... toJWK() fixed on...
Read more >
android - Keystore file doesn't exist - Stack Overflow
I had the same error in Windows 10 as well. But sorted it and finally got SHA-1 Key.
Read more >
jose - Bountysource
Will provide screenshots of error. ... Is there a way to have the x5t and x5c produced along with the output of the...
Read more >
node_modules/jose/CHANGELOG.md · master - PLMlab
Features. keystore filtering by JWK Key thumbprint (a9f6f71) ... throw proper error when runtime doesn't support OKP (0a16efb), closes #48 ...
Read more >
@panva/jose: Versions | Openbase
Bug Fixes. keystore.toJWKS(true) does not throw on public keys (81abdfa), closes #42 ... KeyStore are now iterable (e.g. for ... of) (2eae293). Bug...
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