ThomasMoreAI/legal-skills-open / br/data-protection/skills/lgpd-enterprise-auditor-brunolagoa
lgpd-enterprise-auditor-brunolagoa
FlaggedAuditoria de conformidade LGPD (Lei nº 13.709/2018) orientada a evidências, com ECA Digital e plataformas digitais — checklist em 17 domínios, severidade, score 0–100 e relatório com plano de adequação. Use quando o usuário pedir auditoria, diagnóstico ou adequação à LGPD/ANPD de um sistema, SaaS, site, app mobile, pipeline DevSecOps ou sistema de IA/LLM.
examples/saas-demo/src/auth.js
View on GitHubconst bcrypt = require('bcrypt');
const jwt = require('jsonwebtoken');
const db = require('./db');
const SALT_ROUNDS = 12;
async function hashSenha(senha) {
return bcrypt.hash(senha, SALT_ROUNDS);
}
async function login(req, res) {
const { email, senha } = req.body || {};
const { rows } = await db.query(
'SELECT id, clinica_id, papel, senha_hash FROM usuarios WHERE email = $1',
[email]
);
const usuario = rows[0];
if (!usuario || !(await bcrypt.compare(senha || '', usuario.senha_hash))) {
console.warn(`[login] falha de autenticação para ${email}`);
return res.status(401).json({ erro: 'Credenciais inválidas' });
}
const token = jwt.sign(
{ sub: usuario.id, clinica: usuario.clinica_id, papel: usuario.papel },
process.env.JWT_SECRET
);
return res.json({ token });
}
function autenticar(req, res, next) {
const [, token] = (req.headers.authorization || '').split(' ');
if (!token) return res.status(401).json({ erro: 'Token ausente' });
try {
req.usuario = jwt.verify(token, process.env.JWT_SECRET);
return next();
} catch {
return res.status(401).json({ erro: 'Token inválido' });
}
}
function exigirPapel(papel) {
return (req, res, next) => {
if (req.usuario?.papel !== papel) {
return res.status(403).json({ erro: 'Acesso negado' });
}
return next();
};
}
module.exports = { hashSenha, login, autenticar, exigirPapel };
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |