API: CRUD function that connects to an Employee database. PHP: web ui to decrypt encrypted JSON output from API and display said data in plaintext form.
Made using Rust and using Axum as web app framework.
Features: JWT authentication (secret key stored at Environment Variables) and API rate limiting. SODIUM encryption and decryption of JSON output from API.
- Encryption key is currently generated by API once on server startup. The key will change on every server resets.
- Decryption is currently performed by API, under /decrypt endpoint. Will remove and change to upcoming PHP layer
To be implemented:
- Change token reference from windows environmental variables to local file (for more security)
- Removal of /decrypt from API, and then implement it on PHP layer.
To run the API, these Pre-requisites are needed:
- XAMPP software with MySQL and database initialized. Database should run before launching the API Database can be generated from included employee.sql file.
- Rust installed.
- JWT secret key (64 Bytes, generate from: https://jwtsecret.com/generate). (Then, set to your OS' Environment Variables setting under JWT_SECRET.) <- to be changed
- JWT web token: PAYLOAD:DATA format { "sub": "your_username", // Set with any username you want "exp": 1742803200 // set to at least 1 hour or more from current time. Use https://www.unixtimestamp.com/index.php for unix time stamp format) } VERIFY SIGNATURE:
- Paste the generated secret key to obtain the encoded JWT token.
Once downloaded, open terminal/cmd, navigate to directory containing the files, and then run 'cargo build' Then, run 'cargo run' to launch the server.