license-impl
Guides the implementation of license validation and key generation logic for Cortex Notes.
Install
mkdir -p .claude/skills/license-impl && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/14575" && unzip -o skill.zip -d .claude/skills/license-impl && rm skill.zipInstalls to .claude/skills/license-impl
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Use when implementing any part of the Cortex Notes license/KeyGen system. Loads full plan context, phase checklist, and implementation rules specific to the license feature.Key capabilities
- →Generate Ed25519 keypairs for licenses
- →Verify license signatures and check expiry
- →Implement feature gating based on license status
- →Handle online license activation and deactivation
- →Encrypt license data using machine ID
- →Manage trial state and note caps
How it works
This skill outlines the implementation of a license/KeyGen system, including generating keypairs, validating license signatures, and managing trial states. It defines IPC channels for license status and activation, and specifies security rules for data encryption and signature verification.
Inputs & outputs
When to use license-impl
- →Implementing license validation
- →Adding trial banners
- →Configuring feature locks
About this skill
License Implementation Skill
Always read docs/LICENSE_PLAN.md before writing any code. It is the authoritative source for schemas, IPC contracts, phase scope, and security decisions.
Quick Reference
New files for this feature
| File | Layer | Purpose |
|---|---|---|
cortex-keygen/keygen.js | CLI tool (separate) | Generate Ed25519 keypair, sign + issue licenses |
main/machine-id.js | Main process | SHA-256 hardware fingerprint |
main/license-validator.js | Main process | Verify signature, check expiry, grace period |
renderer/index.html | HTML | #license-modal, #trial-banner, license settings tab content |
renderer/app.js | Renderer | state.license, licenseGate(), activation flow, trial banner render |
renderer/styles.css | Styles | License modal, trial banner, feature-lock overlay |
IPC channels to add in main/main.js and main/preload.js
'license:status' // → { status, tier, daysLeft, features, customerName, expiresAt }
'license:activate' // payload: { key } → { success, data: licenseState }
'license:deactivate' // → { success }
'license:openPortal' // → opens shell.openExternal to purchase URL
state.license shape (init in state object)
license: {
status: 'trial', // 'trial'|'licensed'|'expired'|'invalid'|'grace'
tier: 'trial', // 'trial'|'personal'|'pro'|'team'
daysLeft: 14,
features: [], // ['ai','backup','encryption','unlimited']
customerName: '',
expiresAt: null,
licenseId: null,
}
Feature gate pattern
function licenseGate(feature) {
return state.license.features.includes(feature);
}
// Usage: if (!licenseGate('ai')) { showUpgradePrompt('ai'); return; }
Dependency
npm install @noble/ed25519
@noble/ed25519 — audited pure-JS Ed25519 implementation. Works in Node (main process) and browser (renderer for client-side pre-validation). No native bindings needed.
Phase Checklist
Phase 1 — Offline skeleton
-
cortex-keygen/keygen.js—generate-keypairandissuecommands -
main/machine-id.js— fingerprint function exported -
main/license-validator.js—validateLicense(),getTrialState(),loadLicenseFile() -
main/main.js— addlicense:status,license:activatehandlers -
main/preload.js— exposewindow.noteflow.license.* -
renderer/app.js—state.licenseinit, load on startup,openActivationModal() -
renderer/index.html—#license-modal,#trial-banner -
renderer/styles.css— modal + banner styles - Settings tab: License section
Phase 2 — Feature gating
-
licenseGate(feature)in renderer - AI Chat gated behind
ai - Backup gated behind
backup - Encryption (note lock) gated behind
encryption - 50-note cap on Trial (gate
unlimited) - Feature-lock overlay component
Phase 3 — Online activation
- Activation server deployed (Cloudflare Workers / Vercel)
-
license:activatewired toPOST /api/v1/activate - Background heartbeat (non-blocking,
setIntervalin main process) -
license:deactivatewired toPOST /api/v1/deactivate - Grace period countdown written to
license.json
Phase 4 — Polish
- Key input auto-format (dashes + uppercase)
- Windows URI handler
cortex://activate?key=... - In-app purchase link
- Deep-link handler in
main/main.js
Security Rules (Non-Negotiable)
- Private key never leaves the keygen tool. Never embed it in the app.
license.jsonis AES-256-GCM encrypted usingmachineIdas the key — never plaintext.- Always verify the Ed25519 signature before trusting any payload field.
- Never trust
statusfrom renderer state alone for security decisions — re-read from validator in main process. - Atomic write for
license.json—.tmp→fs.renameSyncpattern (same as all other data files).
Key Format
CORTEX-A1B2C-D3E4F-G5H6I-J7K8L
Decodes to: base64url(payload_json) + '.' + base64url(ed25519_signature)
Payload required fields: id, product, version, type, seats, issued_at, features[], customer.email
Machine Fingerprint
// main/machine-id.js
const inputs = [
os.hostname(),
os.cpus()[0]?.model ?? '',
firstNonLoopbackMAC(), // os.networkInterfaces()
process.env.USERPROFILE ?? process.env.HOME ?? '',
].join('|');
return crypto.createHash('sha256').update(inputs).digest('hex');
Hamming-distance tolerance of 1 character handles minor hardware changes (RAM upgrade, NIC change) without requiring re-activation.
Trial State
Stored in settings.json under trial key (backward-compatible addition):
{
"trial": {
"startedAt": "ISO8601",
"notesCreated": 0
}
}
Trial expires 14 days after startedAt. Note cap is 50 (notesCreated >= 50 blocks new note creation with upgrade prompt).
When not to use it
- →When implementing features unrelated to the Cortex Notes license/KeyGen system
- →When the application does not require license validation
- →When the application does not use Ed25519 for license signing
Prerequisites
Limitations
- →Specific to the Cortex Notes license/KeyGen system
- →Requires adherence to defined security rules
- →Relies on Ed25519 for signature verification
How it compares
This workflow provides a detailed, security-focused implementation plan for a specific license system, including cryptographic verification and machine fingerprinting, which is more reliable than simple license key checks.
Compared to similar skills
license-impl side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| license-impl (this skill) | 0 | 2mo | Review | Advanced |
| jwt-auth | 1 | 6mo | Caution | Advanced |
| maintainx-security-basics | 1 | 1mo | Caution | Intermediate |
| auth-implementation-patterns | 1 | 4mo | No flags | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
jwt-auth
dadbodgeoff
Implement secure JWT authentication with refresh token rotation, secure storage, and automatic renewal. Use when building authentication for SPAs, mobile apps, or APIs that need stateless auth with refresh capabilities.
maintainx-security-basics
jeremylongshore
Configure MaintainX API security, credential management, and access control. Use when securing API keys, implementing access controls, or hardening your MaintainX integration. Trigger with phrases like "maintainx security", "maintainx api key security", "secure maintainx", "maintainx credentials", "maintainx access control".
auth-implementation-patterns
sickn33
Master authentication and authorization patterns including JWT, OAuth2, session management, and RBAC to build secure, scalable access control systems. Use when implementing auth systems, securing APIs, or debugging security issues.
maintainx-enterprise-rbac
jeremylongshore
Configure enterprise role-based access control for MaintainX integrations. Use when implementing SSO, managing organization-level permissions, or setting up enterprise access controls with MaintainX. Trigger with phrases like "maintainx rbac", "maintainx sso", "maintainx enterprise", "maintainx permissions", "maintainx roles".
openevidence-security-basics
jeremylongshore
Apply OpenEvidence security best practices for HIPAA compliance and PHI protection. Use when securing API keys, implementing PHI handling, or auditing OpenEvidence security configuration. Trigger with phrases like "openevidence security", "openevidence hipaa", "openevidence phi", "secure openevidence", "openevidence compliance".
supabase-developer
daffy0208
Build full-stack applications with Supabase (PostgreSQL, Auth, Storage, Real-time, Edge Functions). Use when implementing authentication, database design with RLS, file storage, real-time features, or serverless functions.