sinkra-os

1.1.3 Not latest — view latest

Instalador do LOCAL layer SINKRA para alunos do cohort (gated por license). install/update/doctor via managed-merge.

Published
June 23, 2026
10d ago
Package Registry
README badge Customize →
License Sources
SourceLicenseClass
Licensie (detected)
Pending-
npm (reported)
UNLICENSEDUnknown

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 };
Versions
2 versions
VersionLicensePublishedStatus
1.4.0 Latest UNLICENSED (Unverified)Jul 3, 2026 Pending
1.1.3 ViewingUNLICENSED (Unverified)Jun 23, 2026 Pending