Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose rsaPublicKeyToPEM util as part of public interface #187

Closed
jthomerson opened this issue Sep 25, 2020 · 2 comments
Closed

Expose rsaPublicKeyToPEM util as part of public interface #187

jthomerson opened this issue Sep 25, 2020 · 2 comments
Labels

Comments

@jthomerson
Copy link

Describe the problem you'd like to have solved

In some cases I need the PEM version of my certificate after retrieving it as a JWK. Your library has a nice utility function (rsaPublicKeyToPEM) for doing this, but it's not available as part of the public API. This led to me needing a separate library (rsa-pem-from-mod-exp) just for this. But that library has the same Buffer deprecation issue that this library had at one point.

I'd prefer to depend on Auth0's implementation of this, and avoid having duplicate code in my library. I was hoping you could expose a public utilities interface, perhaps similar to how node-jose exposes utils.

Describe the ideal solution

import rsaPublicKeyToPEM from 'jwks-rsa/utils';

const pem = rsaPublicKeyToPEM(jwk.n, jwk.e);

Alternatives and current work-arounds

I have to use rsa-pem-from-mod-exp, resulting in duplicate code. I'd prefer to use Auth0's code because I trust Auth0 to be more active in the maintenance of this library since it's a core part of their business.

Additional context

Add any other context or screenshots about the feature request here.

N/A

@davidpatrick
Copy link
Contributor

@jthomerson you can currently import this through require('jwks-rsa/lib/utils'), but just be aware that it's not supported as part of the SDK public api, so you might want to lock down a specific version if you plan to use it this way.

@jthomerson
Copy link
Author

Ah, thanks @davidpatrick. Any chance adding utilities to the public API could be considered?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants