Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ElacLicense

Go CI

Production-oriented Go backend for managing and generating license keys for access-control systems.

✨ Features

  • 🗄️ Persistent domain: Stores licenses, vendors, permission presets, and operators in PostgreSQL.
  • 🔐 Authentication: Issues access and refresh JWTs and protects passwords with bcrypt.
  • 🏢 Tenant isolation: Restricts operators to their vendor while allowing administrator-wide access.
  • 📝 Draft workflow: Saves incomplete licenses without generating a production key.
  • 🔑 License generation: Produces encrypted 48-character keys containing limits, expiry, modules, and hardware identity.
  • 🛡️ GOST 28147: Implements the original encryption algorithm and verifies compatibility through test vectors.
  • 🔎 Search API: Supports pagination and filters by key, operator, vendor, dates, serial, modules, and customer fields.
  • 🧩 Hardware decoding: Converts composite serial numbers into database, disk, and processor identifiers.
  • 📴 Operations: Includes schema initialization, administrator bootstrap, graceful shutdown, Docker, and CI.

🔑 Encoded License Data

Version │ Device limit │ User limit │ Checksum │ Hardware serial
Expiry date │ Enabled module flags

The generator validates field sizes and checksum integrity before encrypting the 24-byte payload into a 48-character hexadecimal license key.

🚀 Run

docker compose up --build

For local development, the initial credentials are admin / admin. Override ADMIN_PASSWORD, JWT_SECRET, and LICENSE_KEY in any real environment.

curl -X POST localhost:18080/api/auth/login \
  -H 'Content-Type: application/json' \
  -d '{"username":"admin","password":"admin"}'

Use the returned token as Authorization: Bearer <token>.

🌐 API

  • 🔑 POST /api/auth/login, POST /api/auth/refresh
  • 📄 CRUD: /api/licenses
  • 🏢 CRUD: /api/vendors
  • 👤 CRUD: /api/operators
  • 🧩 CRUD: /api/presets
  • 📚 GET /api/licenses/modules
  • 🖥️ GET /api/licenses/serials/{serial}
  • ❤️ GET /health

🏗️ Project Layout

cmd/elaclicense      application composition and lifecycle
internal/auth        JWT and password security
internal/domain      business entities
internal/httpapi     authenticated HTTP transport
internal/licensekey  GOST and license payload codec
internal/store       PostgreSQL persistence and filtering
compose.yml          local application environment

⚙️ Configuration

Variable Purpose
DATABASE_URL PostgreSQL connection string
JWT_SECRET Token-signing secret
LICENSE_KEY GOST key words used for license encryption
ADMIN_USERNAME Initial administrator name
ADMIN_PASSWORD Initial administrator password
HTTP_ADDR HTTP listen address

🧪 Development

go test ./...
go vet ./...
go run ./cmd/elaclicense

About

PostgreSQL-backed license management API with JWT and GOST 28147 key generation, built in Go

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages