{"id":15138215,"url":"https://github.com/tyleradammartinez/jwks-server","last_synced_at":"2026-02-10T20:31:28.643Z","repository":{"id":221786500,"uuid":"754388448","full_name":"TylerAdamMartinez/JWKS-server","owner":"TylerAdamMartinez","description":"Project 1 (JWKS Server) for UNT's CSCE 3550","archived":false,"fork":false,"pushed_at":"2024-04-04T00:22:10.000Z","size":1309,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-06T06:44:40.392Z","etag":null,"topics":["bcrypt","jwk","jwks","jwt","rocket","rust"],"latest_commit_sha":null,"homepage":"https://tyleradammartinez.github.io/JWKS-server/jwks_server/index.html","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TylerAdamMartinez.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-02-08T00:06:26.000Z","updated_at":"2024-03-24T05:10:51.000Z","dependencies_parsed_at":"2024-02-10T04:29:00.551Z","dependency_job_id":"938e9e05-9708-4a18-91d8-db05fe3030a3","html_url":"https://github.com/TylerAdamMartinez/JWKS-server","commit_stats":null,"previous_names":["tyleradammartinez/jwks-server"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TylerAdamMartinez/JWKS-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TylerAdamMartinez%2FJWKS-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TylerAdamMartinez%2FJWKS-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TylerAdamMartinez%2FJWKS-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TylerAdamMartinez%2FJWKS-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TylerAdamMartinez","download_url":"https://codeload.github.com/TylerAdamMartinez/JWKS-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TylerAdamMartinez%2FJWKS-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272186796,"owners_count":24888445,"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-26T02:00:07.904Z","response_time":60,"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":["bcrypt","jwk","jwks","jwt","rocket","rust"],"created_at":"2024-09-26T07:21:12.278Z","updated_at":"2026-02-10T20:31:28.609Z","avatar_url":"https://github.com/TylerAdamMartinez.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JWKS Server\n\n**PLEASE CHECKOUT THE DOC SITE [HERE](https://tyleradammartinez.github.io/JWKS-server/jwks_server/index.html)!!**\n\n## Overview\n\nThis project implements a simple web server that generates RSA key pairs and \nprovides JWTs (JSON Web Tokens) through a RESTful API. It includes a JWKS \n(JSON Web Key Set) endpoint for serving public keys and an authentication \nendpoint for issuing JWTs. \n\n## Screenshots\n1. Terminal output of running rocket dev server  \n![Terminal output of running rocket dev server](https://github.com/TylerAdamMartinez/JWKS-server/assets/57375362/ba03f07d-8e70-41de-bae6-4f12665da238)\n2. Postman output of /auth endpoint  \n![Postman output of /auth endpoint](https://github.com/TylerAdamMartinez/JWKS-server/assets/57375362/a3858bec-b3db-4ad8-b3c4-49062ac2d25d)\n3. [jwt.io](https://www.jwt.io) website decoding of jwt produced by /auth endpoint  \n![jwt.io website decoding of jwt produced by /auth endpoint](https://github.com/TylerAdamMartinez/JWKS-server/assets/57375362/90408224-bd62-449d-930f-02e64cda7a19)\n4. Postman output of /.well-known/jwks.json endpoint  \n![Postman output of /.well-known/jwks.json endpoint](https://github.com/TylerAdamMartinez/JWKS-server/assets/57375362/7f20cc53-08a2-4763-bc4e-e37c2f2e8fd8)\n5. Postman output of / endpoint  \n![Postman output of / endpoint](https://github.com/TylerAdamMartinez/JWKS-server/assets/57375362/61cb0477-6cb1-4fe2-9467-efc78b9c93ab)\n6. Termianl output of rocket logs  \n![Termianl output of rocket logs](https://github.com/TylerAdamMartinez/JWKS-server/assets/57375362/23b4d2a1-5c4f-4c62-83ea-967142c5de62)\n7. Project2 requirements table\n![Project2 requirements table](https://github.com/TylerAdamMartinez/JWKS-server/assets/57375362/d1b85111-158b-4af5-9350-50f2b9c40cc1)\n8. Test Converage\n![Test Converage](https://github.com/TylerAdamMartinez/JWKS-server/assets/57375362/80bfb4a1-2019-4270-aecc-bfda5e964f0b)\n\n\n## Setup and Running Instructions\nBefore running the JWKS Server, ensure you have completed the following setup steps:\n\n### Prerequisites\nInstall Rust and Cargo: Make sure Rust and Cargo are installed on your system. You can download them from [rust-lang.org](https://www.rust-lang.org).  \n\nInstall SQLx CLI: The SQLx CLI tool is used for handling database migrations. Install it by running:  \n```bash\ncargo install sqlx-cli --no-default-features --features native-tls,sqlite\n```\nThis command installs the SQLx CLI with SQLite support.  \n\n### Database Setup\n1. **Environment Variables**: Copy the .env.example file to .env to use as your environment configuration.\n```bash\ncp .env.example .env\n```\nMake sure to adjust any variables in .env as needed, particularly DATABASE_URL to match your database setup.  \n\n2. **Create SQLite Database**: Based on your DATABASE_URL from the .env file, ensure the database exists. For SQLite, the database file specified in DATABASE_URL will be automatically created by SQLx if it doesn't exist, but you can also manually create it if necessary.\n\n3. **Run Migrations**: With the SQLx CLI tool installed and your environment configured, run the following command to apply database migrations:\n```bash\nsqlx migrate run\n```\nThis command sets up the necessary database schema for the JWKS Server.  \n### Running the Server\nAfter setting up the environment and database, start the server by navigating to the project root and running:  \n```bash\ncargo run\n```\nThe server will start and be accessible on http://localhost:8080, ready to handle requests to its endpoints.  \n\n## Requirements\n\n- **Key Generation**\n  - Implement RSA key pair generation.\n  - Associate a Key ID (kid) and expiry timestamp with each key.\n\n- **Web Server**\n  - Serve HTTP on port 8080.\n  - Implement a RESTful JWKS endpoint to serve the public keys in JWKS format, \n  only including keys that have not expired.\n  - Implement an `/auth` endpoint to return an unexpired, signed JWT on a POST \n  request. If the \"expired\" query parameter is present, issue a JWT signed with an expired key pair.\n\n- **Documentation**\n  - Organize and comment the code where needed.\n  - Adhere to the linting standards of the used language/framework.\n\n- **Tests**\n  - Include a test suite with coverage over 80%.\n\n- **Blackbox Testing**\n  - Ensure compatibility with an external test client for POST requests to `/auth`.\n\n## Project Structure\n```\nJWKS-server/\n├── Cargo.lock\n├── Cargo.toml\n├── Rocket.toml\n├── .gitignore\n├── .env.example\n├── .env\n├── src/\n│ ├── crypto/\n│ │ ├── error.rs\n│ │ ├── jwk.rs\n│ │ ├── jwks.rs\n│ │ ├── jwt.rs\n│ │ ├── key_pair.rs\n│ │ └── mod.rs\n│ ├── routes/\n│ │ └── mod.rs\n│ └── main.rs\n└── target/\n```\n\n## Endpoints\n\nThe server provides the following endpoints:\n\n### GET `/`\n\nA simple endpoint that returns a greeting message, demonstrating a basic HTTP GET request.\n\nResponse:  \n```bash\nHowdy!\n```\n\n### GET `/.well-known/jwks.json`\n\nServes the public keys used by the server in JWKS (JSON Web Key Set) format. \nThis endpoint ensures that only keys that have not expired are included, enabling \nclients to verify the authenticity of JWTs issued by this server.\n\nResponse:  \n```json\n{\n  \"keys\": [\n    // Public keys in JWKS format\n  ]\n}\n```\n\n### POST `/auth?expired=[true|false]`\n\nIssues a JWT (JSON Web Token) for authenticated users. \nThis endpoint allows clients to request an expired JWT for \ntesting purposes by setting the expired query parameter to true.\n\nrequest (Content-Type: application/json):  \n```json\n{\n  \"username\": \"user\",\n  \"password\": \"pass\"\n}\n```\n\nResponse:  \nA JWT in text format.\n\n## Testing\n\n- Run `cargo test` to execute the test suite.\n- Ensure blackbox testing compatibility with the provided external test client.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyleradammartinez%2Fjwks-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftyleradammartinez%2Fjwks-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftyleradammartinez%2Fjwks-server/lists"}