{"id":23416191,"url":"https://github.com/bluk/min_jwt","last_synced_at":"2025-08-03T14:14:41.774Z","repository":{"id":57639009,"uuid":"218917347","full_name":"bluk/min_jwt","owner":"bluk","description":"A minimal JSON Web Token library that is built on top of RustCrypto and ring.","archived":false,"fork":false,"pushed_at":"2023-10-02T22:07:52.000Z","size":384,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-23T02:44:31.593Z","etag":null,"topics":["authentication","authorization","json-web-signature","json-web-token","jwt","rust"],"latest_commit_sha":null,"homepage":"https://docs.rs/min_jwt/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bluk.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","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,"zenodo":null}},"created_at":"2019-11-01T05:13:01.000Z","updated_at":"2023-05-23T15:22:28.000Z","dependencies_parsed_at":"2023-10-03T03:06:42.316Z","dependency_job_id":null,"html_url":"https://github.com/bluk/min_jwt","commit_stats":{"total_commits":73,"total_committers":2,"mean_commits":36.5,"dds":0.2191780821917808,"last_synced_commit":"4a1c79ff378206566f1ac15baf2dd3836344d176"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/bluk/min_jwt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluk%2Fmin_jwt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluk%2Fmin_jwt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluk%2Fmin_jwt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluk%2Fmin_jwt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bluk","download_url":"https://codeload.github.com/bluk/min_jwt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bluk%2Fmin_jwt/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268554925,"owners_count":24269068,"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-08-03T02:00:12.545Z","response_time":2577,"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":["authentication","authorization","json-web-signature","json-web-token","jwt","rust"],"created_at":"2024-12-22T22:13:59.130Z","updated_at":"2025-08-03T14:14:41.719Z","avatar_url":"https://github.com/bluk.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Minimal JSON Web Token\n\nA minimal JSON Web Token library.\n\nJSON Web Tokens are a method for representing claims between two parties.\n\nThey are used in authentication flows with a third party provider (e.g.\nSign in with...) amongst other scenarios.\n\nThis crate provides functionality to sign and verify the signatures of\nJWTs.\n\n## Documentation\n\n* [Latest API Docs][docs_rs_min_jwt]\n\n## Cryptography Features/Dependencies\n\nThis crate depends on other crates for all cryptographic operations.\nFind a supported crypto crate below which supports the algorithms required.\n\n| Dependent Crate(s)       | Algorithm(s) Supported | Feature(s)\n| ------------------       | ---------------------- | ----------\n| [p256][p256]             | ES256                  | p256\n| [ring][ring]             | ES256, HS256, RS256    | ring\n| [rsa][rsa], [sha2][sha2], [signature][signature] | RS256                  | rsa, sha2, signature\n\nFor instance, if you need `ES256` support, you may choose to use the `p256`\ncrate and/or the `ring` crate.  Suppose you chose the `p256` crate. In your\ncrate, depend on this crate and the relevant dependent crate in your\n`Cargo.toml`:\n\n```toml\n[dependencies]\nmin_jwt = { version = \"0.10.0\", features = [ \"p256\", \"serde\", \"serde_json\"] }\np256 = { version = \"0.13.0\", features = [ \"ecdsa\", \"jwk\", \"pem\"] }\n```\n\nBe sure to enable the relevant features as well.\n\nWhen choosing a cryptography implementation, you may want to consider\ncompatibility with your environment, the ability to import the signing and\nverifying keys in the given formats, and the security properties of the\ncode (e.g. an audited implementation, resistence to timing attacks, etc.).\n\n## Usage\n\nThe [encode_and_sign] and [verify][fn@verify] functions are the primary functions for this crate.\n\nTo use the functions, construct the cryptography crate's key. The\ncryptography crate may provide methods to import a key in PKCS8 PEM, PKCS8\nDER, JSON Web Key (JWK), and other formats.\n\nThen, use the key as either a [sign::Signer] or [verify::Verifier]\nparameter. The key may need to be wrapped in a provided type.\nSee the [sign] or [verify][mod@verify] modules for more documentation and examples.\n\n## Examples\n\n### Sign using ES256 with `p256` crate\n\n```rust\n# #[cfg(feature = \"p256\")]\n# {\nlet header = \"{\\\"alg\\\":\\\"ES256\\\",\\\"typ\\\":\\\"JWT\\\"}\";\nlet claims = \"{\\\"sub\\\":\\\"1234567890\\\",\\\"name\\\":\\\"Jane Doe\\\",\\\"iat\\\":1516239022}\";\nlet jwk = r#\"\n{\n    \"kty\": \"EC\",\n    \"crv\": \"P-256\",\n    \"x\": \"erEk-zqoG1oYBLD3ohuz0tzIlU7XzFG1098HcCOu0Ck\",\n    \"y\": \"lQLKfGS2F6mA97bOvo9AlfyNsn88Mf6Iwa5vmf6UkJw\",\n    \"d\": \"8UmkmK0KO64KCDRZb4RCAHRZ0AfRWBn3Pv6hTv1VR9k\"\n}\n\"#;\n\nlet secret_key = ::p256::SecretKey::from_jwk_str(jwk).unwrap();\nlet signing_key = ::p256::ecdsa::SigningKey::from(secret_key);\n\nlet jwt = min_jwt::encode_and_sign(header.as_bytes(), claims.as_bytes(), \u0026signing_key)?;\n# assert_eq!(\n# \"eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZ\\\n# SI6IkphbmUgRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.t2IAtoWoX5iMaIXJmOELc_LY-B8Y\\\n# xlsgkCsEKso_qvYgg0DR6_Q1pZO6SVeOTLFhgDFku9l_cIoL1A6js5rhjw\",\n# jwt);\n# }\n# Ok::\u003c(), min_jwt::Error\u003e(())\n```\n\n### Verify using RS256 with `rsa`, `sha2`, and `signature` crates\n\n```rust\n# #[cfg(all(feature = \"rsa\", feature = \"sha2\", feature = \"signature\"))]\n# {\n# let jwt = \"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.\\\n# eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkphbmUgRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.\\\n# BV5tgihZQo_CCSJuwSmespFnUPVcE1tZ52td6wYfB6j-YuKanRuHD4hJZPO-fN2GYe492aU4FDF\\\n# VqVqC3cZcv5sZgkZolPgAhXVlQymw___vmvcodWv7xLjZBr4INpzb4FPUkaNhAd1LvF28CXHx0a\\\n# NvoyyOo4i_AR1ZYBk6CbsCrVj7XxdsVmP3VBpXLSFKcit0FrWBs_sP0-g2qQDIKZ5w9HNiv4H3f\\\n# U5NZ_TNKRKIQkwMJ1hvI_JbacIZ9uk2oYZ6LwV_NMeh0EqIwRg1EsH6TcdXhzLRozVa1fbej9hd2\\\n# -AOGxZTba3LQtBAEKbyEATd7N5mqtEsRvcTHzXJmw\";\nuse ::rsa::pkcs8::DecodePublicKey;\n\nlet public_key =\n\"-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyfEiSb2ElqylyAfWkbV0\nJmKwzaYH2JtWi05dELrGpSI+OM2mNmFnpxZVUUx77GWASD+u/EbDpB7TxoL8wW6r\nSFuduTIb63uhqeilkj6VhpPXVLpZg6m8korAXPGaN5BBMTyBAbpWk9e72z5gOGaF\nGI4xOv0v3N0MX2h9uXJvhPTpOdKn6jXEflUFF89OWGEh/3JnyZbX5p8+F8BAuseb\n8gfpqT2Ct6KT5GrNiA7dPwjN7XFvVnvyYgR7+QXTVNRMrcrEUoJbR4DG+QVeyIRh\n0JGqXtm901cviPBRbicIMn2f8qfs15XMSeHWrgel21Cv1wQh3I4xy+soZuZZ2i/p\nzwIDAQAB\n-----END PUBLIC KEY-----\";\n\nlet public_key = ::rsa::RsaPublicKey::from_public_key_pem(public_key).unwrap();\nlet verifying_key = ::rsa::pkcs1v15::VerifyingKey::new_with_prefix(public_key);\n\nlet result = min_jwt::verify(jwt, \u0026verifying_key)?;\n\nlet header = result.decode_header();\nlet claims = result.decode_claims();\n# }\n# Ok::\u003c(), min_jwt::Error\u003e(())\n```\n\n## License\n\nLicensed under either of [Apache License, Version 2.0][LICENSE_APACHE] or [MIT\nLicense][LICENSE_MIT] at your option.\n\n### Contributions\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n\n[docs_rs_min_jwt]: https://docs.rs/min_jwt\n[LICENSE_APACHE]: LICENSE-APACHE\n[LICENSE_MIT]: LICENSE-MIT\n[p256]: https://github.com/RustCrypto/elliptic-curves\n[ring]: https://github.com/briansmith/ring\n[rsa]: https://github.com/RustCrypto/RSA\n[rust_crypto]: https://github.com/RustCrypto\n[sha2]: https://github.com/RustCrypto/hashes\n[signature]: https://github.com/RustCrypto/traits/tree/master/signature","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbluk%2Fmin_jwt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbluk%2Fmin_jwt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbluk%2Fmin_jwt/lists"}