mirror of
https://github.com/AeThex-Corporation/AeThex-OS.git
synced 2026-04-18 22:37:21 +00:00
78 lines
No EOL
1.9 KiB
JavaScript
78 lines
No EOL
1.9 KiB
JavaScript
"use strict";
|
|
/**
|
|
* AeThex Compliance - COPPA/FERPA Age Gating & Audit Logging
|
|
* Provides compliance checks and audit trail management
|
|
*/
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.Compliance = void 0;
|
|
class Compliance {
|
|
/**
|
|
* Check if user is COPPA compliant (13+)
|
|
*/
|
|
static isCOPPACompliant(age) {
|
|
return age >= 13;
|
|
}
|
|
/**
|
|
* Check if user requires parental consent (<13)
|
|
*/
|
|
static requiresParentConsent(age) {
|
|
return age < 13;
|
|
}
|
|
/**
|
|
* Check if data collection is allowed
|
|
*/
|
|
static canCollectData(user) {
|
|
if (this.isCOPPACompliant(user.age)) {
|
|
return true;
|
|
}
|
|
// Under 13 requires parent consent
|
|
return user.parentConsent === true;
|
|
}
|
|
/**
|
|
* Log a compliance check for audit trail
|
|
*/
|
|
static logCheck(userId, type, result, metadata) {
|
|
this.auditLog.push({
|
|
userId,
|
|
type,
|
|
result,
|
|
timestamp: new Date(),
|
|
metadata
|
|
});
|
|
}
|
|
/**
|
|
* Get audit log for a user
|
|
*/
|
|
static getAuditLog(userId) {
|
|
if (userId) {
|
|
return this.auditLog.filter(entry => entry.userId === userId);
|
|
}
|
|
return [...this.auditLog];
|
|
}
|
|
/**
|
|
* Clear audit log (admin only)
|
|
*/
|
|
static clearAuditLog() {
|
|
this.auditLog = [];
|
|
}
|
|
/**
|
|
* Export audit log as JSON
|
|
*/
|
|
static exportAuditLog() {
|
|
return JSON.stringify(this.auditLog, null, 2);
|
|
}
|
|
/**
|
|
* Check FERPA compliance (educational records)
|
|
*/
|
|
static isFERPACompliant(user) {
|
|
// FERPA applies to educational records
|
|
// Requires parental consent for students under 18
|
|
if (!user.educationalContext) {
|
|
return true;
|
|
}
|
|
return user.age >= 18;
|
|
}
|
|
}
|
|
exports.Compliance = Compliance;
|
|
Compliance.auditLog = [];
|
|
//# sourceMappingURL=Compliance.js.map
|