{"id":16472503,"url":"https://github.com/nhynes/jwk-rs","last_synced_at":"2025-04-10T03:52:50.987Z","repository":{"id":41892847,"uuid":"279129051","full_name":"nhynes/jwk-rs","owner":"nhynes","description":"Rust JSON Web Keys 🦀🕸🔑","archived":false,"fork":false,"pushed_at":"2023-12-17T20:47:35.000Z","size":62,"stargazers_count":35,"open_issues_count":10,"forks_count":19,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-10T03:52:43.415Z","etag":null,"topics":["jwk","jwt","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nhynes.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-12T18:57:24.000Z","updated_at":"2025-03-21T00:47:53.000Z","dependencies_parsed_at":"2024-06-21T07:27:26.437Z","dependency_job_id":"14d16be6-c85a-4a01-8995-a231c410070d","html_url":"https://github.com/nhynes/jwk-rs","commit_stats":{"total_commits":25,"total_committers":4,"mean_commits":6.25,"dds":0.28,"last_synced_commit":"da12dc40870cb604e3e6ec8a0e6eeb8c6ef2f0e8"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nhynes%2Fjwk-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nhynes%2Fjwk-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nhynes%2Fjwk-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nhynes%2Fjwk-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nhynes","download_url":"https://codeload.github.com/nhynes/jwk-rs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248154998,"owners_count":21056542,"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","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":["jwk","jwt","rust"],"created_at":"2024-10-11T12:17:23.583Z","updated_at":"2025-04-10T03:52:50.963Z","avatar_url":"https://github.com/nhynes.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jsonwebkey\n\n[![crates.io](https://img.shields.io/crates/v/jsonwebkey.svg?color=fc8d62\u0026logo=rust)](https://crates.io/crates/jsonwebkey)\n[![docs.rs](https://img.shields.io/badge/docs.rs-jsonwebkey-66c2a5?labelColor=555555\u0026logoColor=white\u0026logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDUxMiA1MTIiPjxwYXRoIGZpbGw9IiNmNWY1ZjUiIGQ9Ik00ODguNiAyNTAuMkwzOTIgMjE0VjEwNS41YzAtMTUtOS4zLTI4LjQtMjMuNC0zMy43bC0xMDAtMzcuNWMtOC4xLTMuMS0xNy4xLTMuMS0yNS4zIDBsLTEwMCAzNy41Yy0xNC4xIDUuMy0yMy40IDE4LjctMjMuNCAzMy43VjIxNGwtOTYuNiAzNi4yQzkuMyAyNTUuNSAwIDI2OC45IDAgMjgzLjlWMzk0YzAgMTMuNiA3LjcgMjYuMSAxOS45IDMyLjJsMTAwIDUwYzEwLjEgNS4xIDIyLjEgNS4xIDMyLjIgMGwxMDMuOS01MiAxMDMuOSA1MmMxMC4xIDUuMSAyMi4xIDUuMSAzMi4yIDBsMTAwLTUwYzEyLjItNi4xIDE5LjktMTguNiAxOS45LTMyLjJWMjgzLjljMC0xNS05LjMtMjguNC0yMy40LTMzLjd6TTM1OCAyMTQuOGwtODUgMzEuOXYtNjguMmw4NS0zN3Y3My4zek0xNTQgMTA0LjFsMTAyLTM4LjIgMTAyIDM4LjJ2LjZsLTEwMiA0MS40LTEwMi00MS40di0uNnptODQgMjkxLjFsLTg1IDQyLjV2LTc5LjFsODUtMzguOHY3NS40em0wLTExMmwtMTAyIDQxLjQtMTAyLTQxLjR2LS42bDEwMi0zOC4yIDEwMiAzOC4ydi42em0yNDAgMTEybC04NSA0Mi41di03OS4xbDg1LTM4Ljh2NzUuNHptMC0xMTJsLTEwMiA0MS40LTEwMi00MS40di0uNmwxMDItMzguMiAxMDIgMzguMnYuNnoiPjwvcGF0aD48L3N2Zz4K)](https://docs.rs/jsonwebkey)\n[![codecov](https://codecov.io/gh/nhynes/jwk-rs/branch/master/graph/badge.svg)](https://codecov.io/gh/nhynes/jwk-rs)\n\n*[JSON Web Key (JWK)](https://tools.ietf.org/html/rfc7517#section-4.3) (de)serialization, generation, and conversion.*\n\n**Goals**\n\ntl;dr: get keys into a format that can be used by other crates; be as safe as possible while doing so.\n\n- Serialization and deserialization of _Required_ and _Recommended_ key types (HS256, RS256, ES256)\n- Conversion to PEM for interop with existing JWT libraries (e.g., [jsonwebtoken](https://crates.io/crates/jsonwebtoken))\n- Key generation (particularly useful for testing)\n\n**Non-goals**\n\n- be a fully-featured JOSE framework\n\n## Examples\n\n### Deserializing from JSON\n\n```rust\nextern crate jsonwebkey as jwk;\n// Generated using https://mkjwk.org/.\nlet jwt_str = r#\"{\n   \"kty\": \"oct\",\n   \"use\": \"sig\",\n   \"kid\": \"my signing key\",\n   \"k\": \"Wpj30SfkzM_m0Sa_B2NqNw\",\n   \"alg\": \"HS256\"\n}\"#;\nlet the_jwk: jwk::JsonWebKey = jwt_str.parse().unwrap();\nprintln!(\"{:#?}\", the_jwk); // looks like `jwt_str` but with reordered fields.\n```\n\n### Using with other crates\n\n```rust\n#[cfg(all(feature = \"generate\", feature = \"jwt-convert\"))] {\nextern crate jsonwebtoken as jwt;\nextern crate jsonwebkey as jwk;\n\n#[derive(serde::Serialize, serde::Deserialize)]\nstruct TokenClaims {\n   exp: usize\n}\n\nlet mut my_jwk = jwk::JsonWebKey::new(jwk::Key::generate_p256());\nmy_jwk.set_algorithm(jwk::Algorithm::ES256);\n\nlet alg: jwt::Algorithm = my_jwk.algorithm.unwrap().into();\nlet token = jwt::encode(\n    \u0026jwt::Header::new(alg),\n    \u0026TokenClaims { exp: 1492 },\n    \u0026my_jwk.key.to_encoding_key(),\n).unwrap();\n\nlet mut validation = jwt::Validation::new(alg);\nvalidation.validate_exp = false;\njwt::decode::\u003cTokenClaims\u003e(\u0026token, \u0026my_jwk.key.to_decoding_key(), \u0026validation).unwrap();\n}\n```\n\n## Features\n\n* `pkcs-convert` - enables `Key::{to_der, to_pem}`.\n                   This pulls in the [yasna](https://crates.io/crates/yasna) crate.\n* `generate` - enables `Key::{generate_p256, generate_symmetric}`.\n               This pulls in the [p256](https://crates.io/crates/p256) and [rand](https://crates.io/crates/rand) crates.\n* `jwt-convert` - enables conversions to types in the\n                  [jsonwebtoken](https://crates.io/crates/jsonwebtoken) crate.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnhynes%2Fjwk-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnhynes%2Fjwk-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnhynes%2Fjwk-rs/lists"}