A service for generating and verifying JSON Web Encryption (JWE) and JSON Web Tokens (JWT) using RSA encryption. The service is built using Go, Gin, and MongoDB.
API Endpoints
Generate JWE
- URL:
/generate-jwe - Method:
POST - Headers:
X-Claims: Base64 encoded JSON string of claims.
- Response:
200 OK: Returns the generated JWE and keys.400 Bad Request: If theX-Claimsheader is missing or invalid.500 Internal Server Error: If there is an error during processing.
Verify JWE
- URL:
/verify-jwe - Method:
POST - Headers:
X-JWE: The JWE string to be verified.
- Response:
200 OK: Returns the decrypted JWT.400 Bad Request: If theX-JWEheader is missing.500 Internal Server Error: If there is an error during processing.
Example Usage
Generate JWE
curl -X POST http://localhost:8080/generate-jwe \
-H "X-Claims: eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ=="Verify JWE
curl -X POST http://localhost:8080/verify-jwe \
-H "X-JWE: your_jwe_string_here"