mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
feat(JWT Node): New node (#9005)
Co-authored-by: Giulio Andreini <andreini@netseven.it>
This commit is contained in:
@@ -223,14 +223,17 @@ export const keysToLowercase = <T>(headers: T) => {
|
||||
* @param privateKey - The private key to format.
|
||||
* @returns The formatted private key.
|
||||
*/
|
||||
export function formatPrivateKey(privateKey: string): string {
|
||||
export function formatPrivateKey(privateKey: string, keyIsPublic = false): string {
|
||||
let regex = /(PRIVATE KEY|CERTIFICATE)/;
|
||||
if (keyIsPublic) {
|
||||
regex = /(PUBLIC KEY)/;
|
||||
}
|
||||
if (!privateKey || /\n/.test(privateKey)) {
|
||||
return privateKey;
|
||||
}
|
||||
let formattedPrivateKey = '';
|
||||
const parts = privateKey.split('-----').filter((item) => item !== '');
|
||||
parts.forEach((part) => {
|
||||
const regex = /(PRIVATE KEY|CERTIFICATE)/;
|
||||
if (regex.test(part)) {
|
||||
formattedPrivateKey += `-----${part}-----`;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user