#!/usr/bin/env node
"use strict";
/**
 * SignDocsBrasil Assinador
 *
 * Standalone PKCS#11 bridge that enables hardware token (A3 certificate)
 * signing from web browsers. Runs an HTTP server on localhost:8756 with
 * the same API contract as the SignDocs Flutter desktop app.
 *
 * Usage:
 *   signdocsbrasil-assinador        # Start the bridge
 *
 * The bridge detects installed PKCS#11 middleware (SafeSign, OpenSC, etc.)
 * and provides endpoints for token detection, PIN verification, certificate
 * listing, and data signing.
 */
Object.defineProperty(exports, "__esModule", { value: true });
const server_1 = require("./server");
const middleware_detector_1 = require("./middleware-detector");
console.log('SignDocsBrasil Assinador');
console.log('=======================');
// Detect installed middleware
const installed = (0, middleware_detector_1.getInstalledMiddleware)();
if (installed.length > 0) {
    console.log(`Detected PKCS#11 middleware: ${installed.map(m => m.name).join(', ')}`);
}
else {
    console.log('No PKCS#11 middleware detected. Hardware tokens may not be accessible.');
    console.log('Install a PKCS#11 driver (SafeSign, OpenSC, etc.) for your token.');
}
console.log('');
// Start the HTTP server
(0, server_1.startServer)();
