The License Service provides an interface for managing licenses in an application. It generates and verifies license keys associated with devices based on a master key and additional metadata, using HMAC-based encryption for security.
-
Express.js: Fast, unopinionated, minimalist web framework for Node.js
-
ESLint: Linting JavaScript code for consistency and avoiding errors
-
Prettier: Code formatter for maintaining code style
-
dotenv: Loads environment variables from a
.envfile -
Morgan: HTTP request logger middleware for Node.js
-
Helmet: Helps secure Express apps by setting various HTTP headers
-
CORS: Cross-Origin Resource Sharing middleware
-
JWT: Authentication Method with Json Web Token
-
MongoDB: Database MongoDB for storing data
-
Docker: Docker for containerized
-
Master Key Generation: Generates a master key with a specified lifetime and associated metadata.
-
License Key Generation: Generates device-specific license keys tied to a master key with expiration dates and device quotas.
-
License Verification: Verifies the validity of a license key based on provided inputs.
- Clone the repository:
git clone git@github.com:aldo235/license-service-nodejs.git cd license-service-nodejs - Install dependencies:
npm install # or yarn install - Set up environment variables:
- Create a .env file in the root of the project.
- Add the following variables:
PORT= BASIC_AUTH_USERNAME= BASIC_AUTH_PASSWORD= JWT_SECRET= JWT_ISSUER= MONGODB_URL= LICENSE_SECRET=
- Run the application:
# DEV npm run start dev yarn start dev #PROD npm run start yarn start
- Build Docker:
docker build -t licenseservice:latest . - Set up environment variables:
- Create a .env file in the root of the project.
- Add the following variables:
PORT= BASIC_AUTH_USERNAME= BASIC_AUTH_PASSWORD= JWT_SECRET= JWT_ISSUER= LICENSE_SECRET=
- Run Docker:
docker run --env-file __LOCATION_ENV__ --name licenseservice -d --publish 8080:8080 licenseservice:latest ``