sinkra-os
1.4.0Instalador do LOCAL layer SINKRA para alunos do cohort (gated por license). install/update/doctor via managed-merge.
License Sources
| Source | License | Class |
|---|---|---|
Licensie (detected) | Pending | - |
npm (reported) | UNLICENSED | Unknown |
License detection is still in progress for this version.
Loading dependencies…
License File
'use strict';
/**
* license.js — chama a Edge Function validate-license (gating). EPIC-187 W3.2.
* Retorna { status, active, url?, error? }. Online a cada install/update (detecta revogação — R5).
*/
const readline = require('readline');
const cfg = require('./config');
async function validateLicense(email) {
let res;
try {
res = await fetch(cfg.VALIDATE_LICENSE_URL, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email }),
});
} catch (e) {
throw new Error(`não foi possível contatar o servidor de licença: ${e.message}`);
}
let body = {};
try { body = await res.json(); } catch { /* */ }
return { status: res.status, ...body };
}
// resolve o email: --email | $SINKRA_EMAIL | prompt interativo
async function resolveEmail(flag) {
if (flag && typeof flag === 'string') return flag.trim();
if (process.env.SINKRA_EMAIL) return process.env.SINKRA_EMAIL.trim();
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
const ans = await new Promise((resolve) => rl.question('Email do aluno (cohort): ', resolve));
rl.close();
return String(ans).trim();
}
module.exports = { validateLicense, resolveEmail };