{"id":16905148,"url":"https://github.com/hyperbrain/node-jwk","last_synced_at":"2025-10-12T04:06:42.403Z","repository":{"id":65411379,"uuid":"85217907","full_name":"HyperBrain/node-jwk","owner":"HyperBrain","description":"JWK (JSON Web Key) support for Node","archived":false,"fork":false,"pushed_at":"2017-03-16T19:25:25.000Z","size":21,"stargazers_count":4,"open_issues_count":3,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-17T16:30:51.344Z","etag":null,"topics":["convert","jwk","jwkset","jwt","key","njwt","node","node-module","nodejs","pem"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"artistic-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HyperBrain.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-16T16:28:06.000Z","updated_at":"2025-03-20T16:14:02.000Z","dependencies_parsed_at":"2023-01-22T06:55:15.599Z","dependency_job_id":null,"html_url":"https://github.com/HyperBrain/node-jwk","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/HyperBrain/node-jwk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HyperBrain%2Fnode-jwk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HyperBrain%2Fnode-jwk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HyperBrain%2Fnode-jwk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HyperBrain%2Fnode-jwk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HyperBrain","download_url":"https://codeload.github.com/HyperBrain/node-jwk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HyperBrain%2Fnode-jwk/sbom","scorecard":{"id":64068,"data":{"date":"2025-08-11","repo":{"name":"github.com/HyperBrain/node-jwk","commit":"12eb2cb1c93debe9e9f348eec57966392d5e18bc"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/8 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Artistic License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-15T02:15:29.524Z","repository_id":65411379,"created_at":"2025-08-15T02:15:29.524Z","updated_at":"2025-08-15T02:15:29.524Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279010237,"owners_count":26084718,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["convert","jwk","jwkset","jwt","key","njwt","node","node-module","nodejs","pem"],"created_at":"2024-10-13T18:37:23.377Z","updated_at":"2025-10-12T04:06:42.386Z","avatar_url":"https://github.com/HyperBrain.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-jwk\n\nImplementation of RFC-7517 (JSON Web Key) compliant key handling.\n\nThe module can be used to convert keys into buffers or other formats to\nenable the direct use of JWK formatted keys with other node modules like\n[njwt](https://www.npmjs.com/package/njwt) and others.\n\n## Usage\n\nThe module offers the classes `JWK` and `JWKSet` to work with JWK encoded keys\nor key sets.\n\nYou can instantiate either of the objects from a stringified JSON or an object.\n```\nconst njwk = require('node-jwk');\n\nconst myKey = njwk.JWK.fromJSON(myJSONString);\nconst myKeySet = njwk.JWKSet.fromObject(myKeySet);\n```\n\n### Keysets (JWKSet)\n\nKeysets can contain a number of different keys which are unique by their _kid_.\n\n#### JWKSet.findKeyById(kid)\n\nThe JWKSet class offers the `findKeyById` method that will let you grab a key\nby its id and returns it wrapped in a JWK object.\n\n#### JWKSet.findKeysByUse(use)\n\nThere might be cases where you want to use a key designated for encoding/decoding or\nsigning/verification. With `findKeysByUse` you can retrieve an array of all\ncontained keys that match the use given.\n\nBut remember that the use property is specified as OPTIONAL, so is the content of\nit. Be prepared that keys you get from 3rd party could miss it.\n\n#### JWKSet.keys\n\nReturns all keys as an array of JWK objects.\n\n#### JWKSet.fromObject(object) JWKSet.fromJSON(string)\n\nFactory to instantiate JWKSet objects. This method will throw on invalid\nkeysets (the keyset structure or invalid JSON). According to the specification\n(RFC) invalid keys contained in a valid set are ignored.\n\n\n### Keys (JWK)\n\nAll standard JWK properties are exposed by the JWK object. Be aware that per\nspecification all properties but `kty` and `kid` are optional. Here's a list:\n```\n\tkid\n\tkty\n\tuse\n\tkey_ops\n\talg\n```\n\n#### JWK.key\n\nThrough the key property you can access the key algorithm specific functionality.\n\n##### JWK.key.hasPrivateKey\n\nReturns true if the key contains a private key part.\n\n##### JWK.key.toPublicKeyPEM() =\u003e String\n\nGenerates a PEM that contains the public key of the JWK. This can be used\ndirectly as key in OpenSSL or other node modules and works for EC as well as\nRSA keys.\n\n##### JWK.key.toPrivateKeyPEM() =\u003e String\n\nGenerates a PEM that contains the private key of the JWK. This can be used\ndirectly as key in OpenSSL or other node modules and works for EC as well as\nRSA keys.\n\n#### JWK.fromObject(object) JWK.fromJSON(string)\n\nFactory to instantiate JWK objects. This method will throw on invalid\nkeys (the keyset structure or invalid JSON).\nNormally you should use keysets to manage your keys instead of single keys.\n\n\n## Examples\n\n### Creating a signed token with node-jwk and njwt\n\nThe example uses bluebird promises to be able to catch exceptions thrown in the\nkey retrieval and lodash for convenience.\n\n```\nconst time = Math.floor(_.now() / 1000);\n\nconst claims = {\n\tiss: 'itsME',\n\taud: 'myAudience',\n\tiat: time,\n\texp: time + 3600\n};\n\nreturn BbPromise.try(() =\u003e {\n\tconst keySet = nodeJWK.JWKSet.fromObject(myPrivateKeySet);\n\tconst jwk = keySet.findKeyById(myKeyId);\n\n\tif (!jwk) {\n\t\treturn BbPromise.reject(new Error('Huh, my key is not there...'));\n\t}\n\n\tconst keyPEM = jwk.key.toPrivateKeyPEM();\n\tconst jwt = njwt.create(claims, keyPEM, jwk.alg);\n\n\treturn BbPromise.resolve(jwt.compact());\n})\n.catch(err =\u003e {\n\treturn BbPromise.reject(err);\n});\n```\n\n## Supported key types\n\nRSA, EC, oct\n\nAll keys but binary (oct) keys can be converted into PEM format for their\npublic and private keys.\n\n## References\n\n[RFC-7517 JSON Web Key](https://tools.ietf.org/html/rfc7517)\n\n[RFC-7518 JSON Web Algorithms](https://tools.ietf.org/html/rfc7518)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperbrain%2Fnode-jwk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhyperbrain%2Fnode-jwk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperbrain%2Fnode-jwk/lists"}