import { ILicense } from '../type'; export const validateLicense = ( licenseInfo: ILicense, featureCodes: string[], ): boolean => { if (!licenseInfo.isValid) return false; // check time - format ISO if (licenseInfo.expireAt) { const expireAt = new Date(licenseInfo.expireAt); const now = new Date(); if (expireAt.getTime() < now.getTime()) return false; } return featureCodes.every((code) => (licenseInfo.licensedFeatures || []).includes(code), ); };