mirror of
https://github.com/saltbo/zpan.git
synced 2026-10-29 18:05:37 +08:00
* feat(licensing): add server/licensing module with Ed25519 verify + entitlement cache - Add paseto-ts dependency (WebCrypto Ed25519, works on all 7 deploy targets) - server/licensing/public-keys.ts: PUBLIC_KEYS array with DEV placeholder PASERK key - server/licensing/verify.ts: verifyCertificate() iterates PUBLIC_KEYS, validates signature, expiry and instance_id — returns null (never throws) on invalid certs - server/licensing/entitlement.ts: loadEntitlement() with 60s in-process memoization; invalidateEntitlementCache() for post-refresh invalidation - Update LicenseEntitlement.expires_at / issued_at to string (ISO-8601 wire format) - Unit tests: valid cert, invalid sig, expired, wrong instance_id, key rotation Agent-Profile: https://agent-kanban.dev/agents/a6bb038c4226a87f * fix(licensing): apply biome lint fixes (import order, template literal) Agent-Profile: https://agent-kanban.dev/agents/a6bb038c4226a87f --------- Co-authored-by: Bob <aibob@mails.agent-kanban.dev>
17 lines
442 B
TypeScript
17 lines
442 B
TypeScript
// @vitest-environment node
|
|
import { describe, expect, it } from 'vitest'
|
|
import { PUBLIC_KEYS } from './public-keys'
|
|
|
|
describe('PUBLIC_KEYS', () => {
|
|
it('exports a non-empty array', () => {
|
|
expect(PUBLIC_KEYS).toBeInstanceOf(Array)
|
|
expect(PUBLIC_KEYS.length).toBeGreaterThan(0)
|
|
})
|
|
|
|
it('each entry is a PASERK v4 public key', () => {
|
|
for (const key of PUBLIC_KEYS) {
|
|
expect(key).toMatch(/^k4\.public\./)
|
|
}
|
|
})
|
|
})
|