node-nfe-nfce
Version:
Modulo que auxilia na geração de NFe e NFCe
20 lines • 928 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.setupLoadCertificateFromPath = void 0;
const errors_1 = require("../errors");
const fs_1 = __importDefault(require("fs"));
const load_certificate_1 = require("./load-certificate");
const setupLoadCertificateFromPath = () => (input) => {
if (!fs_1.default.existsSync(input.path)) {
throw new errors_1.CertificateNotFoundError();
}
const pfx = fs_1.default.readFileSync(input.path);
const p12buffer = pfx.toString("base64");
const load = (0, load_certificate_1.setupLoadCertificate)();
return load({ password: input.password, buffer: p12buffer });
};
exports.setupLoadCertificateFromPath = setupLoadCertificateFromPath;
//# sourceMappingURL=load-certificate-from-path.js.map