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
|
|
@ -3,11 +3,7 @@
|
|||
|
||||
import { randomUUID } from 'node:crypto'
|
||||
import { NextRequest, NextResponse } from 'next/server'
|
||||
import {
|
||||
issueSignedLicenseKey,
|
||||
DEFAULT_LICENSE_PRIVATE_KEY,
|
||||
type SignedLicensePayload
|
||||
} from '@d3ro/core/utils/crypto-license'
|
||||
import { issueSignedLicenseKey, type SignedLicensePayload } from '@d3ro/core/utils/crypto-license'
|
||||
import type { LicenseTier } from '@d3ro/core/types'
|
||||
import { AdminBackendError, fetchAdminBackend, requireVerifiedBackendSession } from '@/lib/backend-session'
|
||||
|
||||
|
|
@ -27,20 +23,11 @@ const MAX_DEVICES: Record<LicenseTier, number> = {
|
|||
enterprise: 999
|
||||
}
|
||||
|
||||
interface SigningKey {
|
||||
privateKeyPem: string
|
||||
usedDefaultKey: boolean
|
||||
}
|
||||
|
||||
// 저장소에 포함된 기본 키쌍은 공개된 것이므로 위조 방어력이 없다. 운영 발급은
|
||||
// ADMIN_LICENSE_PRIVATE_KEY(전용 키 로테이션)로만 하고, 기본 키 사용은 명시적 opt-in.
|
||||
function resolveSigningKey(): SigningKey | null {
|
||||
// 공개된 개발 키로의 fallback은 없다. 모든 환경에서 명시적인 전용 서명키가 필요하다.
|
||||
function resolveSigningKey(): string | null {
|
||||
const configured = process.env.ADMIN_LICENSE_PRIVATE_KEY?.trim()
|
||||
if (configured) {
|
||||
return { privateKeyPem: configured.replace(/\\n/g, '\n'), usedDefaultKey: false }
|
||||
}
|
||||
if (process.env.ADMIN_LICENSE_ALLOW_DEFAULT_KEY === 'true') {
|
||||
return { privateKeyPem: DEFAULT_LICENSE_PRIVATE_KEY, usedDefaultKey: true }
|
||||
return configured.replace(/\\n/g, '\n')
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
|
@ -119,7 +106,7 @@ export async function POST(request: NextRequest): Promise<NextResponse> {
|
|||
|
||||
let licenseKey: string
|
||||
try {
|
||||
licenseKey = issueSignedLicenseKey(payload, signingKey.privateKeyPem)
|
||||
licenseKey = issueSignedLicenseKey(payload, signingKey)
|
||||
} catch {
|
||||
return NextResponse.json({ error: 'license_signing_failed' }, { status: 500 })
|
||||
}
|
||||
|
|
@ -151,7 +138,6 @@ export async function POST(request: NextRequest): Promise<NextResponse> {
|
|||
licenseKey,
|
||||
licenseId: payload.licenseId,
|
||||
expiresAt: payload.expiresAt,
|
||||
usedDefaultKey: signingKey.usedDefaultKey,
|
||||
auditRecorded
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue