This repository provides a ready-to-use Java Spring Boot utility to help integrators fast-track their integration with NHCX. It enables secure encryption and decryption of request payloads for seamless data exchange between participants.
- Pre-built utility for encryption and decryption of NHCX request payloads.
- Configurable and ready to use with minimal setup.
- Exposes two REST endpoints:
- Encrypt API: Encrypts request payloads before sending.
- Decrypt API: Decrypts received encrypted data.
- Can be run locally or deployed as a microservice in production environments.
- Java 17 or later
- Maven
- Spring Boot Framework
Endpoint: POST /api/encrypt
Request Body:
{
"resourceType": "CoverageEligibilityRequest",
"sender": "1000003548@hcx",
"receiver": "1000003538@hcx",
"payload": "<Optional custom payload as JSON string>",
"apiCallId": "<Optional API call ID>",
"workflowId": "<Optional workflow ID>",
"requestId": "<Optional request ID>",
"correlationId": "<Optional correlation ID>",
"status": "<Optional status>"
}Response:
{
"encryptedPayload": "<JWE Token>",
"correlationID": "<Correlation ID>",
"headers": {
"x-hcx-sender_code": "<Sender Code>",
"x-hcx-recipient_code": "<Recipient Code>",
"x-hcx-timestamp": "<ISO-8601 Timestamp>",
"x-hcx-correlation_id": "<Correlation ID>"
},
"timestamp": "<ISO-8601 Timestamp>",
"senderCode": "<Sender Code>",
"recipientCode": "<Recipient Code>"
}Endpoint: POST /api/decrypt
Request Body:
{
"encryptedText": "<JWE Token>"
}Response:
{
"body": "<Decrypted payload as JSON string>",
"header": {
"x-hcx-recipient_code": "<Recipient Code>",
"x-hcx-correlation_id": "<Correlation ID>"
}
}To run this utility, update the configuration files as follows:
- **Modify **
application.propertiesto set required environment variables. - Update FHIR bundle files in the repository as per your integration needs.
- Add your private key in the
resourcesfolder for decryption.
- Clone this repository:
git clone <repository-url>
- Navigate to the project directory:
cd nhcx-encryption-utility - Build the project using Maven:
mvn clean install
- Run the application:
mvn spring-boot:run
This utility can be deployed as a standalone service or integrated into an existing microservices architecture.
Feel free to contribute to this repository by raising issues or submitting pull requests.
This project is licensed under the MIT License.
For any queries or support, please raise an issue on the repository.