feat(release): prepare 1.1.0 candidate
This commit is contained in:
parent
5a34f66981
commit
5205dcdfa9
736 changed files with 115667 additions and 12203 deletions
|
|
@ -6,8 +6,6 @@ import {
|
|||
generateLicenseKeyPair,
|
||||
issueSignedLicenseKey,
|
||||
verifySignedLicenseKey,
|
||||
createDefaultTrialPayload,
|
||||
DEFAULT_LICENSE_PUBLIC_KEY,
|
||||
} from '@d3ro/core/utils/crypto-license'
|
||||
import { getLicenseService } from '../../src/main/services/LicenseService'
|
||||
import { useRedHarness } from './harness'
|
||||
|
|
@ -33,13 +31,71 @@ describe('Ed25519 암호화 라이센스 & Reverse Trial 유스케이스', () =>
|
|||
expect(key.startsWith('D3RO-LIC-')).toBe(true)
|
||||
|
||||
// 검증 성공
|
||||
const verification = verifySignedLicenseKey(key, 'test-machine-id-1234', publicKeyPem)
|
||||
const verification = verifySignedLicenseKey(key, 'test-machine-id-1234', publicKeyPem, {
|
||||
environment: 'production',
|
||||
})
|
||||
expect(verification.valid).toBe(true)
|
||||
expect(verification.tier).toBe('pro_plus')
|
||||
expect(verification.reason).toBe('valid')
|
||||
expect(verification.payload?.customerEmail).toBe('alice@enterprise.com')
|
||||
})
|
||||
|
||||
it('운영 환경은 레거시 접두어 키를 명시적 허용 옵션이 있어도 거부한다', () => {
|
||||
const verification = verifySignedLicenseKey(
|
||||
'D3RO-PRO-TEST-KEY1',
|
||||
undefined,
|
||||
undefined,
|
||||
{ allowDevelopmentKeys: true, environment: 'production' },
|
||||
)
|
||||
|
||||
expect(verification.valid).toBe(false)
|
||||
expect(verification.tier).toBe('free')
|
||||
expect(verification.reason).toBe('corrupted_token')
|
||||
})
|
||||
|
||||
it('테스트 환경은 명시적으로 허용한 정확한 개발 fixture만 인정한다', () => {
|
||||
const knownFixture = verifySignedLicenseKey(
|
||||
'D3RO-PRO-TEST-KEY1',
|
||||
undefined,
|
||||
undefined,
|
||||
{ allowDevelopmentKeys: true, environment: 'test' },
|
||||
)
|
||||
const forgedPrefix = verifySignedLicenseKey(
|
||||
'D3RO-PRO-ATTACKER-KEY',
|
||||
undefined,
|
||||
undefined,
|
||||
{ allowDevelopmentKeys: true, environment: 'test' },
|
||||
)
|
||||
|
||||
expect(knownFixture.valid).toBe(true)
|
||||
expect(knownFixture.tier).toBe('pro')
|
||||
expect(knownFixture.reason).toBe('dev_key')
|
||||
expect(forgedPrefix.valid).toBe(false)
|
||||
expect(forgedPrefix.tier).toBe('free')
|
||||
})
|
||||
|
||||
it('운영 공개키가 없으면 서명 형식이 맞아도 fail-closed 한다', () => {
|
||||
const { privateKeyPem } = generateLicenseKeyPair()
|
||||
const key = issueSignedLicenseKey(
|
||||
{
|
||||
licenseId: 'lic-no-production-key',
|
||||
tier: 'enterprise',
|
||||
customerEmail: 'release@example.test',
|
||||
issuedAt: Date.now(),
|
||||
expiresAt: null,
|
||||
machineId: null,
|
||||
},
|
||||
privateKeyPem,
|
||||
)
|
||||
|
||||
const verification = verifySignedLicenseKey(key, undefined, undefined, {
|
||||
environment: 'production',
|
||||
})
|
||||
expect(verification.valid).toBe(false)
|
||||
expect(verification.reason).toBe('invalid_signature')
|
||||
expect(verification.message).toContain('not configured')
|
||||
})
|
||||
|
||||
it('머신 ID가 일치하지 않으면 machine_mismatch 로 실패한다', () => {
|
||||
const { publicKeyPem, privateKeyPem } = generateLicenseKeyPair()
|
||||
const payload = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue