LI

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.zip

Installs 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.
173 chars✓ has a “when” trigger
Advanced

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

You give it
License key or application feature request
You get back
License status, feature access, or activation/deactivation confirmation

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

FileLayerPurpose
cortex-keygen/keygen.jsCLI tool (separate)Generate Ed25519 keypair, sign + issue licenses
main/machine-id.jsMain processSHA-256 hardware fingerprint
main/license-validator.jsMain processVerify signature, check expiry, grace period
renderer/index.htmlHTML#license-modal, #trial-banner, license settings tab content
renderer/app.jsRendererstate.license, licenseGate(), activation flow, trial banner render
renderer/styles.cssStylesLicense 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.jsgenerate-keypair and issue commands
  • main/machine-id.js — fingerprint function exported
  • main/license-validator.jsvalidateLicense(), getTrialState(), loadLicenseFile()
  • main/main.js — add license:status, license:activate handlers
  • main/preload.js — expose window.noteflow.license.*
  • renderer/app.jsstate.license init, 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:activate wired to POST /api/v1/activate
  • Background heartbeat (non-blocking, setInterval in main process)
  • license:deactivate wired to POST /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)

  1. Private key never leaves the keygen tool. Never embed it in the app.
  2. license.json is AES-256-GCM encrypted using machineId as the key — never plaintext.
  3. Always verify the Ed25519 signature before trusting any payload field.
  4. Never trust status from renderer state alone for security decisions — re-read from validator in main process.
  5. Atomic write for license.json.tmpfs.renameSync pattern (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

@noble/ed25519

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.

SkillInstallsUpdatedSafetyDifficulty
license-impl (this skill)02moReviewAdvanced
jwt-auth16moCautionAdvanced
maintainx-security-basics11moCautionIntermediate
auth-implementation-patterns14moNo flagsAdvanced

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.

12

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".

11

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.

12

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".

11

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".

00

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.

95185

Search skills

Search the agent skills registry