2.0.5 • Published 3 years ago

jwk-to-pem v2.0.5

Weekly downloads
365,587
License
Apache-2.0
Repository
github
Last release
3 years ago

jwk-to-pem

Build Status Coverage Status

Convert a json web key to a PEM for use by OpenSSL or crytpo.

Install

npm install jwk-to-pem --save

Usage

var jwkToPem = require('jwk-to-pem'),
	jwt = require('jsonwebtoken');

var jwk = { kty: 'EC', crv: 'P-256', x: '...', y: '...' },
	pem = jwkToPem(jwk);

jwt.verify(token, pem);

Support

key typesupport level
RSAall RSA keys
ECP-256, P-384, and P-521 curves

API


jwkToPem(Object jwk[, Object options]) -> String

The first parameter should be an Object representing the jwk, it may be public or private. By default, either of the two will be made into a public PEM. The call will throw if the input jwk is malformed or does not represent a valid key.

Option: private Boolean (false)

You may optionally specify that you would like a private PEM. This can be done by passing true to the private option. The call will throw if the necessary private parameters are not available.

Contributing

  1. Fork the repository. Committing directly against this repository is highly discouraged.

  2. Make your modifications in a branch, updating and writing new unit tests as necessary in the spec directory.

  3. Ensure that all tests pass with npm test

  4. rebase your changes against master. Do not merge.

  5. Submit a pull request to this repository. Wait for tests to run and someone to chime in.

Code Style

This repository is configured with EditorConfig and ESLint rules.

@_projector/handlersarchiveservices-node-jwtmangrove-reviews-jscoginto-auth-middleware@jamliu/cognito-authidentity-auth-server-sdkzapisclericuzzi-javascript-awsaws-lambda-minibig-moduleminibig-js-module@pagsa/custom-authorizerbfs-webauthn@ramble-inc/nest-grpc-authzcustomer-management-serviceardrive-connferring_cmi_apiexplorer-mixins@pyros2097/aws-utils@simplewebauthn-alt/server@onhand/common-framework-awsfred-jwt-setter@omnisearchkit/core@omnisearchkit/servercanary_lambda_commoncanary_lambda_common_btoicmanageratoms-utilsweb-hook-test-lambdaicp-pkg-cognito-validationthing-it-server@everything-registry/sub-chunk-1997@flexiloans/auth@flexiloans/auth_publiclhdlambda-to-expresslambda-typescript-skeletonmonmedx-commonnexuxsecuritywsnode-module-layermultivocalnode-cognito-core-sdkmock-cognitolumi-climangrove-reviewsmangrove-reviews-typescriptmob-oauth2-jwt-validatormulti-type-token-validatormojoauth-sdkn8n-nodes-zurinamaste-benative-cryptonexus-plugin-cognito-authmicroservice-utilitieslpcoauthclientlibnodejs-jwt-validatornucleus-security-factoryn8n-nodes-aws-cognito-jwt-authluralura-devlti-node-library@vapaaradikaali/keycloak-connect@uauth/node@upandgo/verify-cognito-token@trinitiventures/hapi-cognito-auth@tm9657/backend-worker@velas/account-agent@velas/account-client@viconsol/plugin-users-permissions@vizzly/cli@strapi/plugin-users-permissions@stavalfi/docker-registry-client@sutech_jp/platform-base-lib@twilson63/ec-auth@taimos/cdk-serverless-v2@taimos/lambda-toolboxaigx-test-sdk@vulcanobserver/node-auth@yash-kalwani/auth-middleware@webiny/api-plugin-security-cognito@webiny/api-security-auth0@webiny/api-security-cognito-authentication@webiny/api-security-oktaab-auth@wiredkode/wk-node-fhir-server-core@webiny/api-cognito-authenticator@zeytech/cognito-adonisjs@zalastax/nolb-jw@wolfleader101/nextjs-auth0adyen-4.5.0adyen-4.4.1@woneylab/authentication@xeedware/cognito-jwk-cliaws-cognito-expressaws-cognito-graphql-directiveaws-cognito-jwtaws-cognito-jwt-authenticateaws-cognito-jwt-verifieraws-cognito-lambda-authaws-cognito-nextaws-jwt-validator-middleware
2.0.5

3 years ago

2.0.4

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

5 years ago

2.0.0

6 years ago

1.2.6

7 years ago

1.2.5

8 years ago

1.2.4

8 years ago

1.2.3

8 years ago

1.2.2

8 years ago

1.2.1

8 years ago

1.2.0

9 years ago

1.1.4

9 years ago

1.1.3

9 years ago

1.1.2

9 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago