n8n-nodes-dataverse
Version:
n8n community node for communicating to dataverse
29 lines • 1.01 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.formatPrivateKey = void 0;
function formatPrivateKey(privateKey) {
if (/\n/.test(privateKey)) {
return privateKey;
}
let formattedPrivateKey = '';
const parts = privateKey.split('-----').filter((item) => item !== '');
parts.forEach((part) => {
const regex = /(PRIVATE KEY|CERTIFICATE|PUBLIC KEY)/;
if (regex.test(part)) {
formattedPrivateKey += `-----${part}-----`;
}
else {
const passRegex = /Proc-Type|DEK-Info/;
if (passRegex.test(part)) {
part = part.replace(/:\s+/g, ':');
formattedPrivateKey += part.replace(/\s+/g, '\n');
}
else {
formattedPrivateKey += part.replace(/\s+/g, '\n');
}
}
});
return formattedPrivateKey;
}
exports.formatPrivateKey = formatPrivateKey;
//# sourceMappingURL=utils.js.map