mirror of
https://github.com/n8n-io/n8n
synced 2026-04-21 15:47:20 +00:00
feat(Crypto Node): Add credentials for Hmac and Sign operations (#24798)
This commit is contained in:
parent
326869e794
commit
25f5199b46
11 changed files with 1460 additions and 565 deletions
|
|
@ -51,7 +51,7 @@
|
|||
"change-case": "^5.4.4",
|
||||
"eslint-import-resolver-typescript": "^4.4.3",
|
||||
"eslint-plugin-import-x": "^4.15.2",
|
||||
"eslint-plugin-n8n-nodes-base": "1.16.3",
|
||||
"eslint-plugin-n8n-nodes-base": "1.16.5",
|
||||
"fast-glob": "catalog:",
|
||||
"handlebars": "4.7.8",
|
||||
"picocolors": "catalog:",
|
||||
|
|
|
|||
37
packages/nodes-base/credentials/Crypto.credentials.ts
Normal file
37
packages/nodes-base/credentials/Crypto.credentials.ts
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
import type { ICredentialType, INodeProperties, Icon, ThemeIconColor } from 'n8n-workflow';
|
||||
|
||||
export class Crypto implements ICredentialType {
|
||||
name = 'crypto';
|
||||
|
||||
displayName = 'Crypto';
|
||||
|
||||
documentationUrl = 'crypto';
|
||||
|
||||
icon: Icon = 'fa:key';
|
||||
|
||||
iconColor: ThemeIconColor = 'green';
|
||||
|
||||
properties: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Hmac Secret',
|
||||
name: 'hmacSecret',
|
||||
type: 'string',
|
||||
description: 'Secret used in the Hmac action',
|
||||
typeOptions: {
|
||||
password: true,
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Private Key',
|
||||
name: 'signPrivateKey',
|
||||
type: 'string',
|
||||
description: 'Private Key used in the Sign action',
|
||||
typeOptions: {
|
||||
rows: 4,
|
||||
password: true,
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
|
@ -1,552 +1,27 @@
|
|||
import type { BinaryToTextEncoding } from 'crypto';
|
||||
import { createHash, createHmac, createSign, getHashes, randomBytes } from 'crypto';
|
||||
import set from 'lodash/set';
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
INodeExecutionData,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
JsonObject,
|
||||
} from 'n8n-workflow';
|
||||
import { deepCopy, BINARY_ENCODING, NodeConnectionTypes } from 'n8n-workflow';
|
||||
import { pipeline } from 'stream/promises';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import type { INodeTypeBaseDescription, IVersionedNodeType } from 'n8n-workflow';
|
||||
import { VersionedNodeType } from 'n8n-workflow';
|
||||
|
||||
const unsupportedAlgorithms = [
|
||||
'RSA-MD4',
|
||||
'RSA-MDC2',
|
||||
'md4',
|
||||
'md4WithRSAEncryption',
|
||||
'mdc2',
|
||||
'mdc2WithRSA',
|
||||
];
|
||||
import { CryptoV1 } from './v1/CryptoV1.node';
|
||||
import { CryptoV2 } from './v2/CryptoV2.node';
|
||||
|
||||
const supportedAlgorithms = getHashes()
|
||||
.filter((algorithm) => !unsupportedAlgorithms.includes(algorithm))
|
||||
.map((algorithm) => ({ name: algorithm, value: algorithm }));
|
||||
export class Crypto extends VersionedNodeType {
|
||||
constructor() {
|
||||
const baseDescription: INodeTypeBaseDescription = {
|
||||
displayName: 'Crypto',
|
||||
name: 'crypto',
|
||||
icon: 'fa:key',
|
||||
iconColor: 'green',
|
||||
group: ['transform'],
|
||||
defaultVersion: 2,
|
||||
subtitle: '={{$parameter["action"]}}',
|
||||
description: 'Provide cryptographic utilities',
|
||||
};
|
||||
|
||||
export class Crypto implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'Crypto',
|
||||
name: 'crypto',
|
||||
icon: 'fa:key',
|
||||
iconColor: 'green',
|
||||
group: ['transform'],
|
||||
version: 1,
|
||||
subtitle: '={{$parameter["action"]}}',
|
||||
description: 'Provide cryptographic utilities',
|
||||
defaults: {
|
||||
name: 'Crypto',
|
||||
color: '#408000',
|
||||
},
|
||||
usableAsTool: true,
|
||||
inputs: [NodeConnectionTypes.Main],
|
||||
outputs: [NodeConnectionTypes.Main],
|
||||
properties: [
|
||||
{
|
||||
displayName: 'Action',
|
||||
name: 'action',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Generate',
|
||||
description: 'Generate random string',
|
||||
value: 'generate',
|
||||
action: 'Generate random string',
|
||||
},
|
||||
{
|
||||
name: 'Hash',
|
||||
description: 'Hash a text or file in a specified format',
|
||||
value: 'hash',
|
||||
action: 'Hash a text or file in a specified format',
|
||||
},
|
||||
{
|
||||
name: 'Hmac',
|
||||
description: 'Hmac a text or file in a specified format',
|
||||
value: 'hmac',
|
||||
action: 'HMAC a text or file in a specified format',
|
||||
},
|
||||
{
|
||||
name: 'Sign',
|
||||
description: 'Sign a string using a private key',
|
||||
value: 'sign',
|
||||
action: 'Sign a string using a private key',
|
||||
},
|
||||
],
|
||||
default: 'hash',
|
||||
},
|
||||
{
|
||||
displayName: 'Type',
|
||||
name: 'type',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['hash'],
|
||||
},
|
||||
},
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'MD5',
|
||||
value: 'MD5',
|
||||
},
|
||||
{
|
||||
name: 'SHA256',
|
||||
value: 'SHA256',
|
||||
},
|
||||
{
|
||||
name: 'SHA3-256',
|
||||
value: 'SHA3-256',
|
||||
},
|
||||
{
|
||||
name: 'SHA3-384',
|
||||
value: 'SHA3-384',
|
||||
},
|
||||
{
|
||||
name: 'SHA3-512',
|
||||
value: 'SHA3-512',
|
||||
},
|
||||
{
|
||||
name: 'SHA384',
|
||||
value: 'SHA384',
|
||||
},
|
||||
{
|
||||
name: 'SHA512',
|
||||
value: 'SHA512',
|
||||
},
|
||||
],
|
||||
default: 'MD5',
|
||||
description: 'The hash type to use',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Binary File',
|
||||
name: 'binaryData',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['hash', 'hmac'],
|
||||
},
|
||||
},
|
||||
description: 'Whether the data to hashed should be taken from binary field',
|
||||
},
|
||||
{
|
||||
displayName: 'Binary Property Name',
|
||||
name: 'binaryPropertyName',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['hash', 'hmac'],
|
||||
binaryData: [true],
|
||||
},
|
||||
},
|
||||
type: 'string',
|
||||
default: 'data',
|
||||
description: 'Name of the binary property which contains the input data',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['hash'],
|
||||
binaryData: [false],
|
||||
},
|
||||
},
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The value that should be hashed',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Property Name',
|
||||
name: 'dataPropertyName',
|
||||
type: 'string',
|
||||
default: 'data',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['hash'],
|
||||
},
|
||||
},
|
||||
description: 'Name of the property to which to write the hash',
|
||||
},
|
||||
{
|
||||
displayName: 'Encoding',
|
||||
name: 'encoding',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['hash'],
|
||||
},
|
||||
},
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'BASE64',
|
||||
value: 'base64',
|
||||
},
|
||||
{
|
||||
name: 'HEX',
|
||||
value: 'hex',
|
||||
},
|
||||
],
|
||||
default: 'hex',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Type',
|
||||
name: 'type',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['hmac'],
|
||||
},
|
||||
},
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'MD5',
|
||||
value: 'MD5',
|
||||
},
|
||||
{
|
||||
name: 'SHA256',
|
||||
value: 'SHA256',
|
||||
},
|
||||
{
|
||||
name: 'SHA3-256',
|
||||
value: 'SHA3-256',
|
||||
},
|
||||
{
|
||||
name: 'SHA3-384',
|
||||
value: 'SHA3-384',
|
||||
},
|
||||
{
|
||||
name: 'SHA3-512',
|
||||
value: 'SHA3-512',
|
||||
},
|
||||
{
|
||||
name: 'SHA384',
|
||||
value: 'SHA384',
|
||||
},
|
||||
{
|
||||
name: 'SHA512',
|
||||
value: 'SHA512',
|
||||
},
|
||||
],
|
||||
default: 'MD5',
|
||||
description: 'The hash type to use',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['hmac'],
|
||||
binaryData: [false],
|
||||
},
|
||||
},
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The value of which the hmac should be created',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Property Name',
|
||||
name: 'dataPropertyName',
|
||||
type: 'string',
|
||||
default: 'data',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['hmac'],
|
||||
},
|
||||
},
|
||||
description: 'Name of the property to which to write the hmac',
|
||||
},
|
||||
{
|
||||
displayName: 'Secret',
|
||||
name: 'secret',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['hmac'],
|
||||
},
|
||||
},
|
||||
type: 'string',
|
||||
typeOptions: { password: true },
|
||||
default: '',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Encoding',
|
||||
name: 'encoding',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['hmac'],
|
||||
},
|
||||
},
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'BASE64',
|
||||
value: 'base64',
|
||||
},
|
||||
{
|
||||
name: 'HEX',
|
||||
value: 'hex',
|
||||
},
|
||||
],
|
||||
default: 'hex',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['sign'],
|
||||
},
|
||||
},
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The value that should be signed',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Property Name',
|
||||
name: 'dataPropertyName',
|
||||
type: 'string',
|
||||
default: 'data',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['sign'],
|
||||
},
|
||||
},
|
||||
description: 'Name of the property to which to write the signed value',
|
||||
},
|
||||
{
|
||||
displayName: 'Algorithm Name or ID',
|
||||
name: 'algorithm',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['sign'],
|
||||
},
|
||||
},
|
||||
type: 'options',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
options: supportedAlgorithms,
|
||||
default: '',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Encoding',
|
||||
name: 'encoding',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['sign'],
|
||||
},
|
||||
},
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'BASE64',
|
||||
value: 'base64',
|
||||
},
|
||||
{
|
||||
name: 'HEX',
|
||||
value: 'hex',
|
||||
},
|
||||
],
|
||||
default: 'hex',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Private Key',
|
||||
name: 'privateKey',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['sign'],
|
||||
},
|
||||
},
|
||||
type: 'string',
|
||||
description: 'Private key to use when signing the string',
|
||||
default: '',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Property Name',
|
||||
name: 'dataPropertyName',
|
||||
type: 'string',
|
||||
default: 'data',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['generate'],
|
||||
},
|
||||
},
|
||||
description: 'Name of the property to which to write the random string',
|
||||
},
|
||||
{
|
||||
displayName: 'Type',
|
||||
name: 'encodingType',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['generate'],
|
||||
},
|
||||
},
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'ASCII',
|
||||
value: 'ascii',
|
||||
},
|
||||
{
|
||||
name: 'BASE64',
|
||||
value: 'base64',
|
||||
},
|
||||
{
|
||||
name: 'HEX',
|
||||
value: 'hex',
|
||||
},
|
||||
{
|
||||
name: 'UUID',
|
||||
value: 'uuid',
|
||||
},
|
||||
],
|
||||
default: 'uuid',
|
||||
description: 'Encoding that will be used to generate string',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Length',
|
||||
name: 'stringLength',
|
||||
type: 'number',
|
||||
default: 32,
|
||||
description: 'Length of the generated string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['generate'],
|
||||
encodingType: ['ascii', 'base64', 'hex'],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
const nodeVersions: IVersionedNodeType['nodeVersions'] = {
|
||||
1: new CryptoV1(baseDescription),
|
||||
2: new CryptoV2(baseDescription),
|
||||
};
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
const action = this.getNodeParameter('action', 0) as string;
|
||||
|
||||
let item: INodeExecutionData;
|
||||
for (let i = 0; i < length; i++) {
|
||||
try {
|
||||
item = items[i];
|
||||
const dataPropertyName = this.getNodeParameter('dataPropertyName', i);
|
||||
const value = this.getNodeParameter('value', i, '') as string;
|
||||
let newValue;
|
||||
let binaryProcessed = false;
|
||||
|
||||
if (action === 'generate') {
|
||||
const encodingType = this.getNodeParameter('encodingType', i);
|
||||
if (encodingType === 'uuid') {
|
||||
newValue = uuid();
|
||||
} else {
|
||||
const stringLength = this.getNodeParameter('stringLength', i) as number;
|
||||
if (encodingType === 'base64') {
|
||||
newValue = randomBytes(stringLength)
|
||||
.toString(encodingType as BufferEncoding)
|
||||
.replace(/\W/g, '')
|
||||
.slice(0, stringLength);
|
||||
} else {
|
||||
newValue = randomBytes(stringLength)
|
||||
.toString(encodingType as BufferEncoding)
|
||||
.slice(0, stringLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (action === 'hash' || action === 'hmac') {
|
||||
const type = this.getNodeParameter('type', i) as string;
|
||||
const encoding = this.getNodeParameter('encoding', i) as BinaryToTextEncoding;
|
||||
const hashOrHmac =
|
||||
action === 'hash'
|
||||
? createHash(type)
|
||||
: createHmac(type, this.getNodeParameter('secret', i) as string);
|
||||
if (this.getNodeParameter('binaryData', i)) {
|
||||
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
|
||||
const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
|
||||
if (binaryData.id) {
|
||||
const binaryStream = await this.helpers.getBinaryStream(binaryData.id);
|
||||
hashOrHmac.setEncoding(encoding);
|
||||
await pipeline(binaryStream, hashOrHmac);
|
||||
newValue = hashOrHmac.read();
|
||||
} else {
|
||||
newValue = hashOrHmac
|
||||
.update(Buffer.from(binaryData.data, BINARY_ENCODING))
|
||||
.digest(encoding);
|
||||
}
|
||||
binaryProcessed = true;
|
||||
} else {
|
||||
newValue = hashOrHmac.update(value).digest(encoding);
|
||||
}
|
||||
}
|
||||
|
||||
if (action === 'sign') {
|
||||
const algorithm = this.getNodeParameter('algorithm', i) as string;
|
||||
const encoding = this.getNodeParameter('encoding', i) as BinaryToTextEncoding;
|
||||
const privateKey = this.getNodeParameter('privateKey', i) as string;
|
||||
const sign = createSign(algorithm);
|
||||
sign.write(value);
|
||||
sign.end();
|
||||
newValue = sign.sign(privateKey, encoding);
|
||||
}
|
||||
|
||||
let newItem: INodeExecutionData;
|
||||
if (dataPropertyName.includes('.')) {
|
||||
// Uses dot notation so copy all data
|
||||
newItem = {
|
||||
json: deepCopy(item.json),
|
||||
pairedItem: {
|
||||
item: i,
|
||||
},
|
||||
};
|
||||
} else {
|
||||
// Does not use dot notation so shallow copy is enough
|
||||
newItem = {
|
||||
json: { ...item.json },
|
||||
pairedItem: {
|
||||
item: i,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
if (item.binary !== undefined && !binaryProcessed) {
|
||||
newItem.binary = item.binary;
|
||||
}
|
||||
|
||||
set(newItem, ['json', dataPropertyName], newValue);
|
||||
|
||||
returnData.push(newItem);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({
|
||||
json: {
|
||||
error: (error as JsonObject).message,
|
||||
},
|
||||
pairedItem: {
|
||||
item: i,
|
||||
},
|
||||
});
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [returnData];
|
||||
super(nodeVersions, baseDescription);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
564
packages/nodes-base/nodes/Crypto/v1/CryptoV1.node.ts
Normal file
564
packages/nodes-base/nodes/Crypto/v1/CryptoV1.node.ts
Normal file
|
|
@ -0,0 +1,564 @@
|
|||
import type { BinaryToTextEncoding } from 'crypto';
|
||||
import { createHash, createHmac, createSign, getHashes, randomBytes } from 'crypto';
|
||||
import set from 'lodash/set';
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
INodeExecutionData,
|
||||
INodeType,
|
||||
INodeTypeBaseDescription,
|
||||
INodeTypeDescription,
|
||||
JsonObject,
|
||||
} from 'n8n-workflow';
|
||||
import { deepCopy, BINARY_ENCODING, NodeConnectionTypes } from 'n8n-workflow';
|
||||
import { pipeline } from 'stream/promises';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
|
||||
const unsupportedAlgorithms = [
|
||||
'RSA-MD4',
|
||||
'RSA-MDC2',
|
||||
'md4',
|
||||
'md4WithRSAEncryption',
|
||||
'mdc2',
|
||||
'mdc2WithRSA',
|
||||
];
|
||||
|
||||
const supportedAlgorithms = getHashes()
|
||||
.filter((algorithm) => !unsupportedAlgorithms.includes(algorithm))
|
||||
.map((algorithm) => ({ name: algorithm, value: algorithm }));
|
||||
|
||||
const versionDescription: INodeTypeDescription = {
|
||||
displayName: 'Crypto',
|
||||
name: 'crypto',
|
||||
icon: 'fa:key',
|
||||
iconColor: 'green',
|
||||
group: ['transform'],
|
||||
version: 1,
|
||||
subtitle: '={{$parameter["action"]}}',
|
||||
description: 'Provide cryptographic utilities',
|
||||
defaults: {
|
||||
name: 'Crypto',
|
||||
color: '#408000',
|
||||
},
|
||||
usableAsTool: true,
|
||||
inputs: [NodeConnectionTypes.Main],
|
||||
outputs: [NodeConnectionTypes.Main],
|
||||
properties: [
|
||||
{
|
||||
displayName: 'Action',
|
||||
name: 'action',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Generate',
|
||||
description: 'Generate random string',
|
||||
value: 'generate',
|
||||
action: 'Generate random string',
|
||||
},
|
||||
{
|
||||
name: 'Hash',
|
||||
description: 'Hash a text or file in a specified format',
|
||||
value: 'hash',
|
||||
action: 'Hash a text or file in a specified format',
|
||||
},
|
||||
{
|
||||
name: 'Hmac',
|
||||
description: 'Hmac a text or file in a specified format',
|
||||
value: 'hmac',
|
||||
action: 'HMAC a text or file in a specified format',
|
||||
},
|
||||
{
|
||||
name: 'Sign',
|
||||
description: 'Sign a string using a private key',
|
||||
value: 'sign',
|
||||
action: 'Sign a string using a private key',
|
||||
},
|
||||
],
|
||||
default: 'hash',
|
||||
},
|
||||
{
|
||||
displayName: 'Binary File',
|
||||
name: 'binaryData',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['hash', 'hmac'],
|
||||
},
|
||||
},
|
||||
description: 'Whether the data to hashed should be taken from binary field',
|
||||
},
|
||||
{
|
||||
displayName: 'Binary Property Name',
|
||||
name: 'binaryPropertyName',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['hash', 'hmac'],
|
||||
binaryData: [true],
|
||||
},
|
||||
},
|
||||
type: 'string',
|
||||
default: 'data',
|
||||
description: 'Name of the binary property which contains the input data',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Type',
|
||||
name: 'type',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['hash'],
|
||||
},
|
||||
},
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'MD5',
|
||||
value: 'MD5',
|
||||
},
|
||||
{
|
||||
name: 'SHA256',
|
||||
value: 'SHA256',
|
||||
},
|
||||
{
|
||||
name: 'SHA3-256',
|
||||
value: 'SHA3-256',
|
||||
},
|
||||
{
|
||||
name: 'SHA3-384',
|
||||
value: 'SHA3-384',
|
||||
},
|
||||
{
|
||||
name: 'SHA3-512',
|
||||
value: 'SHA3-512',
|
||||
},
|
||||
{
|
||||
name: 'SHA384',
|
||||
value: 'SHA384',
|
||||
},
|
||||
{
|
||||
name: 'SHA512',
|
||||
value: 'SHA512',
|
||||
},
|
||||
],
|
||||
default: 'MD5',
|
||||
description: 'The hash type to use',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['hash'],
|
||||
binaryData: [false],
|
||||
},
|
||||
},
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The value that should be hashed',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Property Name',
|
||||
name: 'dataPropertyName',
|
||||
type: 'string',
|
||||
default: 'data',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['hash'],
|
||||
},
|
||||
},
|
||||
description: 'Name of the property to which to write the hash',
|
||||
},
|
||||
{
|
||||
displayName: 'Encoding',
|
||||
name: 'encoding',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['hash'],
|
||||
},
|
||||
},
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'BASE64',
|
||||
value: 'base64',
|
||||
},
|
||||
{
|
||||
name: 'HEX',
|
||||
value: 'hex',
|
||||
},
|
||||
],
|
||||
default: 'hex',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Type',
|
||||
name: 'type',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['hmac'],
|
||||
},
|
||||
},
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'MD5',
|
||||
value: 'MD5',
|
||||
},
|
||||
{
|
||||
name: 'SHA256',
|
||||
value: 'SHA256',
|
||||
},
|
||||
{
|
||||
name: 'SHA3-256',
|
||||
value: 'SHA3-256',
|
||||
},
|
||||
{
|
||||
name: 'SHA3-384',
|
||||
value: 'SHA3-384',
|
||||
},
|
||||
{
|
||||
name: 'SHA3-512',
|
||||
value: 'SHA3-512',
|
||||
},
|
||||
{
|
||||
name: 'SHA384',
|
||||
value: 'SHA384',
|
||||
},
|
||||
{
|
||||
name: 'SHA512',
|
||||
value: 'SHA512',
|
||||
},
|
||||
],
|
||||
default: 'MD5',
|
||||
description: 'The hash type to use',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['hmac'],
|
||||
binaryData: [false],
|
||||
},
|
||||
},
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The value of which the hmac should be created',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Property Name',
|
||||
name: 'dataPropertyName',
|
||||
type: 'string',
|
||||
default: 'data',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['hmac'],
|
||||
},
|
||||
},
|
||||
description: 'Name of the property to which to write the hmac',
|
||||
},
|
||||
{
|
||||
displayName: 'Secret',
|
||||
name: 'secret',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['hmac'],
|
||||
},
|
||||
},
|
||||
type: 'string',
|
||||
typeOptions: { password: true },
|
||||
default: '',
|
||||
required: true,
|
||||
description: 'Secret used for Hmac',
|
||||
},
|
||||
{
|
||||
displayName: 'Encoding',
|
||||
name: 'encoding',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['hmac'],
|
||||
},
|
||||
},
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'BASE64',
|
||||
value: 'base64',
|
||||
},
|
||||
{
|
||||
name: 'HEX',
|
||||
value: 'hex',
|
||||
},
|
||||
],
|
||||
default: 'hex',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['sign'],
|
||||
},
|
||||
},
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The value that should be signed',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Property Name',
|
||||
name: 'dataPropertyName',
|
||||
type: 'string',
|
||||
default: 'data',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['sign'],
|
||||
},
|
||||
},
|
||||
description: 'Name of the property to which to write the signed value',
|
||||
},
|
||||
{
|
||||
displayName: 'Algorithm Name or ID',
|
||||
name: 'algorithm',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['sign'],
|
||||
},
|
||||
},
|
||||
type: 'options',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
options: supportedAlgorithms,
|
||||
default: '',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Encoding',
|
||||
name: 'encoding',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['sign'],
|
||||
},
|
||||
},
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'BASE64',
|
||||
value: 'base64',
|
||||
},
|
||||
{
|
||||
name: 'HEX',
|
||||
value: 'hex',
|
||||
},
|
||||
],
|
||||
default: 'hex',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Private Key',
|
||||
name: 'privateKey',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['sign'],
|
||||
},
|
||||
},
|
||||
type: 'string',
|
||||
typeOptions: { password: true },
|
||||
description: 'Private key to use when signing the string',
|
||||
default: '',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Property Name',
|
||||
name: 'dataPropertyName',
|
||||
type: 'string',
|
||||
default: 'data',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['generate'],
|
||||
},
|
||||
},
|
||||
description: 'Name of the property to which to write the random string',
|
||||
},
|
||||
{
|
||||
displayName: 'Type',
|
||||
name: 'encodingType',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['generate'],
|
||||
},
|
||||
},
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'ASCII',
|
||||
value: 'ascii',
|
||||
},
|
||||
{
|
||||
name: 'BASE64',
|
||||
value: 'base64',
|
||||
},
|
||||
{
|
||||
name: 'HEX',
|
||||
value: 'hex',
|
||||
},
|
||||
{
|
||||
name: 'UUID',
|
||||
value: 'uuid',
|
||||
},
|
||||
],
|
||||
default: 'uuid',
|
||||
description: 'Encoding that will be used to generate string',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Length',
|
||||
name: 'stringLength',
|
||||
type: 'number',
|
||||
default: 32,
|
||||
description: 'Length of the generated string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['generate'],
|
||||
encodingType: ['ascii', 'base64', 'hex'],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export class CryptoV1 implements INodeType {
|
||||
description: INodeTypeDescription;
|
||||
|
||||
constructor(baseDescription: INodeTypeBaseDescription) {
|
||||
this.description = {
|
||||
...baseDescription,
|
||||
...versionDescription,
|
||||
};
|
||||
}
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
const action = this.getNodeParameter('action', 0) as string;
|
||||
|
||||
let item: INodeExecutionData;
|
||||
for (let i = 0; i < length; i++) {
|
||||
try {
|
||||
item = items[i];
|
||||
const dataPropertyName = this.getNodeParameter('dataPropertyName', i);
|
||||
const value = this.getNodeParameter('value', i, '') as string;
|
||||
let newValue;
|
||||
let binaryProcessed = false;
|
||||
|
||||
if (action === 'generate') {
|
||||
const encodingType = this.getNodeParameter('encodingType', i);
|
||||
if (encodingType === 'uuid') {
|
||||
newValue = uuid();
|
||||
} else {
|
||||
const stringLength = this.getNodeParameter('stringLength', i) as number;
|
||||
if (encodingType === 'base64') {
|
||||
newValue = randomBytes(stringLength)
|
||||
.toString(encodingType as BufferEncoding)
|
||||
.replace(/\W/g, '')
|
||||
.slice(0, stringLength);
|
||||
} else {
|
||||
newValue = randomBytes(stringLength)
|
||||
.toString(encodingType as BufferEncoding)
|
||||
.slice(0, stringLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (action === 'hash' || action === 'hmac') {
|
||||
const type = this.getNodeParameter('type', i) as string;
|
||||
const encoding = this.getNodeParameter('encoding', i) as BinaryToTextEncoding;
|
||||
const hashOrHmac =
|
||||
action === 'hash'
|
||||
? createHash(type)
|
||||
: createHmac(type, this.getNodeParameter('secret', i) as string);
|
||||
if (this.getNodeParameter('binaryData', i)) {
|
||||
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
|
||||
const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
|
||||
if (binaryData.id) {
|
||||
const binaryStream = await this.helpers.getBinaryStream(binaryData.id);
|
||||
hashOrHmac.setEncoding(encoding);
|
||||
await pipeline(binaryStream, hashOrHmac);
|
||||
newValue = hashOrHmac.read();
|
||||
} else {
|
||||
newValue = hashOrHmac
|
||||
.update(Buffer.from(binaryData.data, BINARY_ENCODING))
|
||||
.digest(encoding);
|
||||
}
|
||||
binaryProcessed = true;
|
||||
} else {
|
||||
newValue = hashOrHmac.update(value).digest(encoding);
|
||||
}
|
||||
}
|
||||
|
||||
if (action === 'sign') {
|
||||
const algorithm = this.getNodeParameter('algorithm', i) as string;
|
||||
const encoding = this.getNodeParameter('encoding', i) as BinaryToTextEncoding;
|
||||
const privateKey = this.getNodeParameter('privateKey', i) as string;
|
||||
const sign = createSign(algorithm);
|
||||
sign.write(value);
|
||||
sign.end();
|
||||
newValue = sign.sign(privateKey, encoding);
|
||||
}
|
||||
|
||||
let newItem: INodeExecutionData;
|
||||
if (dataPropertyName.includes('.')) {
|
||||
// Uses dot notation so copy all data
|
||||
newItem = {
|
||||
json: deepCopy(item.json),
|
||||
pairedItem: {
|
||||
item: i,
|
||||
},
|
||||
};
|
||||
} else {
|
||||
// Does not use dot notation so shallow copy is enough
|
||||
newItem = {
|
||||
json: { ...item.json },
|
||||
pairedItem: {
|
||||
item: i,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
if (item.binary !== undefined && !binaryProcessed) {
|
||||
newItem.binary = item.binary;
|
||||
}
|
||||
|
||||
set(newItem, ['json', dataPropertyName], newValue);
|
||||
|
||||
returnData.push(newItem);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
returnData.push({
|
||||
json: {
|
||||
error: (error as JsonObject).message,
|
||||
},
|
||||
pairedItem: {
|
||||
item: i,
|
||||
},
|
||||
});
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [returnData];
|
||||
}
|
||||
}
|
||||
|
|
@ -247,9 +247,7 @@
|
|||
]
|
||||
},
|
||||
"No Operation, do nothing": {
|
||||
"main": [
|
||||
[]
|
||||
]
|
||||
"main": [[]]
|
||||
},
|
||||
"Read Binary Files": {
|
||||
"main": [
|
||||
|
|
@ -276,4 +274,4 @@
|
|||
"instanceId": "104a4d08d8897b8bdeb38aaca515021075e0bd8544c983c2bb8c86e6a8e6081c"
|
||||
},
|
||||
"tags": []
|
||||
}
|
||||
}
|
||||
586
packages/nodes-base/nodes/Crypto/v2/CryptoV2.node.ts
Normal file
586
packages/nodes-base/nodes/Crypto/v2/CryptoV2.node.ts
Normal file
|
|
@ -0,0 +1,586 @@
|
|||
import type { BinaryToTextEncoding } from 'crypto';
|
||||
import { createHash, createHmac, createSign, getHashes, randomBytes } from 'crypto';
|
||||
import set from 'lodash/set';
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
INodeExecutionData,
|
||||
INodeType,
|
||||
INodeTypeBaseDescription,
|
||||
INodeTypeDescription,
|
||||
JsonObject,
|
||||
} from 'n8n-workflow';
|
||||
import { deepCopy, BINARY_ENCODING, NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';
|
||||
import { pipeline } from 'stream/promises';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
|
||||
import { formatPrivateKey } from '../../../utils/utilities';
|
||||
|
||||
const unsupportedAlgorithms = [
|
||||
'RSA-MD4',
|
||||
'RSA-MDC2',
|
||||
'md4',
|
||||
'md4WithRSAEncryption',
|
||||
'mdc2',
|
||||
'mdc2WithRSA',
|
||||
];
|
||||
|
||||
const supportedAlgorithms = getHashes()
|
||||
.filter((algorithm) => !unsupportedAlgorithms.includes(algorithm))
|
||||
.map((algorithm) => ({ name: algorithm, value: algorithm }));
|
||||
|
||||
const versionDescription: INodeTypeDescription = {
|
||||
displayName: 'Crypto',
|
||||
name: 'crypto',
|
||||
icon: 'fa:key',
|
||||
iconColor: 'green',
|
||||
group: ['transform'],
|
||||
version: 2,
|
||||
subtitle: '={{$parameter["action"]}}',
|
||||
description: 'Provide cryptographic utilities',
|
||||
defaults: {
|
||||
name: 'Crypto',
|
||||
color: '#408000',
|
||||
},
|
||||
usableAsTool: true,
|
||||
inputs: [NodeConnectionTypes.Main],
|
||||
outputs: [NodeConnectionTypes.Main],
|
||||
credentials: [
|
||||
{
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-credentials-name-unsuffixed
|
||||
name: 'crypto',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['hmac', 'sign'],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
properties: [
|
||||
{
|
||||
displayName: 'Action',
|
||||
name: 'action',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Generate',
|
||||
description: 'Generate random string',
|
||||
value: 'generate',
|
||||
action: 'Generate random string',
|
||||
},
|
||||
{
|
||||
name: 'Hash',
|
||||
description: 'Hash a text or file in a specified format',
|
||||
value: 'hash',
|
||||
action: 'Hash a text or file in a specified format',
|
||||
},
|
||||
{
|
||||
name: 'Hmac',
|
||||
description: 'Hmac a text or file in a specified format',
|
||||
value: 'hmac',
|
||||
action: 'HMAC a text or file in a specified format',
|
||||
},
|
||||
{
|
||||
name: 'Sign',
|
||||
description: 'Sign a string using a private key',
|
||||
value: 'sign',
|
||||
action: 'Sign a string using a private key',
|
||||
},
|
||||
],
|
||||
default: 'hash',
|
||||
},
|
||||
{
|
||||
displayName: 'Binary File',
|
||||
name: 'binaryData',
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['hash', 'hmac'],
|
||||
},
|
||||
},
|
||||
description: 'Whether the data to hashed should be taken from binary field',
|
||||
},
|
||||
{
|
||||
displayName: 'Binary Property Name',
|
||||
name: 'binaryPropertyName',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['hash', 'hmac'],
|
||||
binaryData: [true],
|
||||
},
|
||||
},
|
||||
type: 'string',
|
||||
default: 'data',
|
||||
description: 'Name of the binary property which contains the input data',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Type',
|
||||
name: 'type',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['hash'],
|
||||
},
|
||||
},
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'MD5',
|
||||
value: 'MD5',
|
||||
},
|
||||
{
|
||||
name: 'SHA256',
|
||||
value: 'SHA256',
|
||||
},
|
||||
{
|
||||
name: 'SHA3-256',
|
||||
value: 'SHA3-256',
|
||||
},
|
||||
{
|
||||
name: 'SHA3-384',
|
||||
value: 'SHA3-384',
|
||||
},
|
||||
{
|
||||
name: 'SHA3-512',
|
||||
value: 'SHA3-512',
|
||||
},
|
||||
{
|
||||
name: 'SHA384',
|
||||
value: 'SHA384',
|
||||
},
|
||||
{
|
||||
name: 'SHA512',
|
||||
value: 'SHA512',
|
||||
},
|
||||
],
|
||||
default: 'SHA256',
|
||||
description: 'The hash type to use',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['hash'],
|
||||
binaryData: [false],
|
||||
},
|
||||
},
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The value that should be hashed',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Property Name',
|
||||
name: 'dataPropertyName',
|
||||
type: 'string',
|
||||
default: 'data',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['hash'],
|
||||
},
|
||||
},
|
||||
description: 'Name of the property to which to write the hash',
|
||||
},
|
||||
{
|
||||
displayName: 'Encoding',
|
||||
name: 'encoding',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['hash'],
|
||||
},
|
||||
},
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'BASE64',
|
||||
value: 'base64',
|
||||
},
|
||||
{
|
||||
name: 'HEX',
|
||||
value: 'hex',
|
||||
},
|
||||
],
|
||||
default: 'hex',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Type',
|
||||
name: 'type',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['hmac'],
|
||||
},
|
||||
},
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'MD5',
|
||||
value: 'MD5',
|
||||
},
|
||||
{
|
||||
name: 'SHA256',
|
||||
value: 'SHA256',
|
||||
},
|
||||
{
|
||||
name: 'SHA3-256',
|
||||
value: 'SHA3-256',
|
||||
},
|
||||
{
|
||||
name: 'SHA3-384',
|
||||
value: 'SHA3-384',
|
||||
},
|
||||
{
|
||||
name: 'SHA3-512',
|
||||
value: 'SHA3-512',
|
||||
},
|
||||
{
|
||||
name: 'SHA384',
|
||||
value: 'SHA384',
|
||||
},
|
||||
{
|
||||
name: 'SHA512',
|
||||
value: 'SHA512',
|
||||
},
|
||||
],
|
||||
default: 'SHA256',
|
||||
description: 'The hash type to use',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['hmac'],
|
||||
binaryData: [false],
|
||||
},
|
||||
},
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The value of which the hmac should be created',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Property Name',
|
||||
name: 'dataPropertyName',
|
||||
type: 'string',
|
||||
default: 'data',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['hmac'],
|
||||
},
|
||||
},
|
||||
description: 'Name of the property to which to write the hmac',
|
||||
},
|
||||
{
|
||||
displayName: 'Encoding',
|
||||
name: 'encoding',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['hmac'],
|
||||
},
|
||||
},
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'BASE64',
|
||||
value: 'base64',
|
||||
},
|
||||
{
|
||||
name: 'HEX',
|
||||
value: 'hex',
|
||||
},
|
||||
],
|
||||
default: 'hex',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Value',
|
||||
name: 'value',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['sign'],
|
||||
},
|
||||
},
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The value that should be signed',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Property Name',
|
||||
name: 'dataPropertyName',
|
||||
type: 'string',
|
||||
default: 'data',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['sign'],
|
||||
},
|
||||
},
|
||||
description: 'Name of the property to which to write the signed value',
|
||||
},
|
||||
{
|
||||
displayName: 'Algorithm Name or ID',
|
||||
name: 'algorithm',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['sign'],
|
||||
},
|
||||
},
|
||||
type: 'options',
|
||||
description:
|
||||
'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
||||
options: supportedAlgorithms,
|
||||
default: '',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Encoding',
|
||||
name: 'encoding',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['sign'],
|
||||
},
|
||||
},
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'BASE64',
|
||||
value: 'base64',
|
||||
},
|
||||
{
|
||||
name: 'HEX',
|
||||
value: 'hex',
|
||||
},
|
||||
],
|
||||
default: 'hex',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Property Name',
|
||||
name: 'dataPropertyName',
|
||||
type: 'string',
|
||||
default: 'data',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['generate'],
|
||||
},
|
||||
},
|
||||
description: 'Name of the property to which to write the random string',
|
||||
},
|
||||
{
|
||||
displayName: 'Type',
|
||||
name: 'encodingType',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['generate'],
|
||||
},
|
||||
},
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'ASCII',
|
||||
value: 'ascii',
|
||||
},
|
||||
{
|
||||
name: 'BASE64',
|
||||
value: 'base64',
|
||||
},
|
||||
{
|
||||
name: 'HEX',
|
||||
value: 'hex',
|
||||
},
|
||||
{
|
||||
name: 'UUID',
|
||||
value: 'uuid',
|
||||
},
|
||||
],
|
||||
default: 'uuid',
|
||||
description: 'Encoding that will be used to generate string',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
displayName: 'Length',
|
||||
name: 'stringLength',
|
||||
type: 'number',
|
||||
default: 32,
|
||||
description: 'Length of the generated string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: ['generate'],
|
||||
encodingType: ['ascii', 'base64', 'hex'],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export class CryptoV2 implements INodeType {
|
||||
description: INodeTypeDescription;
|
||||
|
||||
constructor(baseDescription: INodeTypeBaseDescription) {
|
||||
this.description = {
|
||||
...baseDescription,
|
||||
...versionDescription,
|
||||
};
|
||||
}
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
const items = this.getInputData();
|
||||
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length;
|
||||
const action = this.getNodeParameter('action', 0) as string;
|
||||
|
||||
let hmacSecret = '';
|
||||
let signPrivateKey = '';
|
||||
|
||||
if (action === 'hmac' || action === 'sign') {
|
||||
const credentials = await this.getCredentials<{
|
||||
hmacSecret?: string;
|
||||
signPrivateKey?: string;
|
||||
}>('crypto');
|
||||
|
||||
if (action === 'hmac') {
|
||||
if (!credentials.hmacSecret) {
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
'No HMAC secret set in credentials. Please add an HMAC secret to your Crypto credentials.',
|
||||
);
|
||||
}
|
||||
hmacSecret = credentials.hmacSecret;
|
||||
}
|
||||
|
||||
if (action === 'sign') {
|
||||
if (!credentials.signPrivateKey) {
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
'No private key set in credentials. Please add a private key to your Crypto credentials.',
|
||||
);
|
||||
}
|
||||
signPrivateKey = formatPrivateKey(credentials.signPrivateKey);
|
||||
}
|
||||
}
|
||||
|
||||
let item: INodeExecutionData;
|
||||
for (let i = 0; i < length; i++) {
|
||||
try {
|
||||
item = items[i];
|
||||
const dataPropertyName = this.getNodeParameter('dataPropertyName', i);
|
||||
const value = this.getNodeParameter('value', i, '') as string;
|
||||
let newValue;
|
||||
let binaryProcessed = false;
|
||||
|
||||
if (action === 'generate') {
|
||||
const encodingType = this.getNodeParameter('encodingType', i);
|
||||
if (encodingType === 'uuid') {
|
||||
newValue = uuid();
|
||||
} else {
|
||||
const stringLength = this.getNodeParameter('stringLength', i) as number;
|
||||
if (encodingType === 'base64') {
|
||||
newValue = randomBytes(stringLength)
|
||||
.toString(encodingType as BufferEncoding)
|
||||
.replace(/\W/g, '')
|
||||
.slice(0, stringLength);
|
||||
} else {
|
||||
newValue = randomBytes(stringLength)
|
||||
.toString(encodingType as BufferEncoding)
|
||||
.slice(0, stringLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (action === 'hash' || action === 'hmac') {
|
||||
const type = this.getNodeParameter('type', i) as string;
|
||||
const encoding = this.getNodeParameter('encoding', i) as BinaryToTextEncoding;
|
||||
const hashOrHmac = action === 'hash' ? createHash(type) : createHmac(type, hmacSecret);
|
||||
if (this.getNodeParameter('binaryData', i)) {
|
||||
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
|
||||
const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
|
||||
if (binaryData.id) {
|
||||
const binaryStream = await this.helpers.getBinaryStream(binaryData.id);
|
||||
hashOrHmac.setEncoding(encoding);
|
||||
await pipeline(binaryStream, hashOrHmac);
|
||||
newValue = hashOrHmac.read();
|
||||
} else {
|
||||
newValue = hashOrHmac
|
||||
.update(Buffer.from(binaryData.data, BINARY_ENCODING))
|
||||
.digest(encoding);
|
||||
}
|
||||
binaryProcessed = true;
|
||||
} else {
|
||||
newValue = hashOrHmac.update(value).digest(encoding);
|
||||
}
|
||||
}
|
||||
|
||||
if (action === 'sign') {
|
||||
const algorithm = this.getNodeParameter('algorithm', i) as string;
|
||||
const encoding = this.getNodeParameter('encoding', i) as BinaryToTextEncoding;
|
||||
const sign = createSign(algorithm);
|
||||
sign.write(value);
|
||||
sign.end();
|
||||
newValue = sign.sign(signPrivateKey, encoding);
|
||||
}
|
||||
|
||||
let newItem: INodeExecutionData;
|
||||
if (dataPropertyName.includes('.')) {
|
||||
// Uses dot notation so copy all data
|
||||
newItem = {
|
||||
json: deepCopy(item.json),
|
||||
pairedItem: {
|
||||
item: i,
|
||||
},
|
||||
};
|
||||
} else {
|
||||
// Does not use dot notation so shallow copy is enough
|
||||
newItem = {
|
||||
json: { ...item.json },
|
||||
pairedItem: {
|
||||
item: i,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
if (item.binary !== undefined && !binaryProcessed) {
|
||||
newItem.binary = item.binary;
|
||||
}
|
||||
|
||||
set(newItem, ['json', dataPropertyName], newValue);
|
||||
|
||||
returnData.push(newItem);
|
||||
} catch (error) {
|
||||
if (this.continueOnFail()) {
|
||||
const errorDetails = error as Error & { code?: string };
|
||||
const errorData: JsonObject = {
|
||||
message: errorDetails.message,
|
||||
};
|
||||
if (errorDetails.name) {
|
||||
errorData.name = errorDetails.name;
|
||||
}
|
||||
if (errorDetails.code) {
|
||||
errorData.code = errorDetails.code;
|
||||
}
|
||||
returnData.push({
|
||||
json: {
|
||||
error: errorData,
|
||||
},
|
||||
pairedItem: {
|
||||
item: i,
|
||||
},
|
||||
});
|
||||
continue;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return [returnData];
|
||||
}
|
||||
}
|
||||
239
packages/nodes-base/nodes/Crypto/v2/test/Crypto.node.test.ts
Normal file
239
packages/nodes-base/nodes/Crypto/v2/test/Crypto.node.test.ts
Normal file
|
|
@ -0,0 +1,239 @@
|
|||
import { mockDeep } from 'jest-mock-extended';
|
||||
import type { IExecuteFunctions, INodeTypeBaseDescription } from 'n8n-workflow';
|
||||
import { NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
import { CryptoV2 } from '../CryptoV2.node';
|
||||
|
||||
describe('CryptoV2 Node', () => {
|
||||
let cryptoNode: CryptoV2;
|
||||
let mockExecuteFunctions: jest.Mocked<IExecuteFunctions>;
|
||||
|
||||
const baseDescription: INodeTypeBaseDescription = {
|
||||
displayName: 'Crypto',
|
||||
name: 'crypto',
|
||||
icon: 'fa:key',
|
||||
iconColor: 'green',
|
||||
group: ['transform'],
|
||||
defaultVersion: 2,
|
||||
subtitle: '={{$parameter["action"]}}',
|
||||
description: 'Provide cryptographic utilities',
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
cryptoNode = new CryptoV2(baseDescription);
|
||||
mockExecuteFunctions = mockDeep<IExecuteFunctions>();
|
||||
jest.clearAllMocks();
|
||||
|
||||
mockExecuteFunctions.getNode.mockReturnValue({
|
||||
id: 'crypto-node',
|
||||
name: 'Crypto',
|
||||
type: 'n8n-nodes-base.crypto',
|
||||
typeVersion: 2,
|
||||
position: [0, 0],
|
||||
parameters: {},
|
||||
});
|
||||
});
|
||||
|
||||
describe('Credential Validation', () => {
|
||||
describe('HMAC action', () => {
|
||||
it('should throw error when hmacSecret is not set in credentials', async () => {
|
||||
mockExecuteFunctions.getInputData.mockReturnValue([{ json: {} }]);
|
||||
mockExecuteFunctions.getNodeParameter.mockImplementation((paramName: string) => {
|
||||
const params: Record<string, string | boolean> = {
|
||||
action: 'hmac',
|
||||
type: 'SHA256',
|
||||
encoding: 'hex',
|
||||
dataPropertyName: 'data',
|
||||
binaryData: false,
|
||||
value: 'test value',
|
||||
};
|
||||
return params[paramName];
|
||||
});
|
||||
mockExecuteFunctions.getCredentials.mockResolvedValue({
|
||||
hmacSecret: '',
|
||||
signPrivateKey: 'some-key',
|
||||
});
|
||||
|
||||
await expect(cryptoNode.execute.call(mockExecuteFunctions)).rejects.toThrow(
|
||||
NodeOperationError,
|
||||
);
|
||||
await expect(cryptoNode.execute.call(mockExecuteFunctions)).rejects.toThrow(
|
||||
'No HMAC secret set in credentials',
|
||||
);
|
||||
});
|
||||
|
||||
it('should execute successfully when hmacSecret is provided', async () => {
|
||||
mockExecuteFunctions.getInputData.mockReturnValue([{ json: {} }]);
|
||||
mockExecuteFunctions.getNodeParameter.mockImplementation((paramName: string) => {
|
||||
const params: Record<string, string | boolean> = {
|
||||
action: 'hmac',
|
||||
type: 'SHA256',
|
||||
encoding: 'base64',
|
||||
dataPropertyName: 'data',
|
||||
binaryData: false,
|
||||
value: 'test',
|
||||
};
|
||||
return params[paramName];
|
||||
});
|
||||
mockExecuteFunctions.getCredentials.mockResolvedValue({
|
||||
hmacSecret:
|
||||
'-----BEGIN RSA PRIVATE KEY-----|MIIBOgIBAAJBAKj34GkxFhD90vcNLYLInFEX6Ppy1tPf9Cnzj4p4WGeKLs1Pt8QuKUpRKfFLfRYC9AIKjbJTWit+CqvjWYzvQwECAwEAAQJAIJLixBy2qpFoS4DSmoEmo3qGy0t6z09AIJtH+5OeRV1be+N4cDYJKffGzDa88vQENZiRm0GRq6a+HPGQMd2kTQIhAKMSvzIBnni7ot/OSie2TmJLY4SwTQAevXysE2RbFDYdAiEBCUEaRQnMnbp79mxDXDf6AU0cN/RPBjb9qSHDcWZHGzUCIG2Es59z8ugGrDY+pxLQnwfotadxd+Uyv/Ow5T0q5gIJAiEAyS4RaI9YG8EWx/2w0T67ZUVAw8eOMB6BIUg0Xcu+3okCIBOs/5OiPgoTdSy7bcF9IGpSE8ZgGKzgYQVZeN97YE00-----END RSA PRIVATE KEY-----',
|
||||
signPrivateKey: '',
|
||||
});
|
||||
|
||||
const result = await cryptoNode.execute.call(mockExecuteFunctions);
|
||||
|
||||
expect(result[0][0].json.data).toBe('hoB1e7VM7nbOTl8floCPteEqN4ZODWlVc9IWQjsEhUk=');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Sign action', () => {
|
||||
it('should throw error when signPrivateKey is not set in credentials', async () => {
|
||||
mockExecuteFunctions.getInputData.mockReturnValue([{ json: {} }]);
|
||||
mockExecuteFunctions.getNodeParameter.mockImplementation((paramName: string) => {
|
||||
const params: Record<string, string> = {
|
||||
action: 'sign',
|
||||
algorithm: 'RSA-SHA256',
|
||||
encoding: 'hex',
|
||||
dataPropertyName: 'data',
|
||||
value: 'test value',
|
||||
};
|
||||
return params[paramName];
|
||||
});
|
||||
mockExecuteFunctions.getCredentials.mockResolvedValue({
|
||||
hmacSecret: 'some-secret',
|
||||
signPrivateKey: '',
|
||||
});
|
||||
|
||||
await expect(cryptoNode.execute.call(mockExecuteFunctions)).rejects.toThrow(
|
||||
NodeOperationError,
|
||||
);
|
||||
await expect(cryptoNode.execute.call(mockExecuteFunctions)).rejects.toThrow(
|
||||
'No private key set in credentials',
|
||||
);
|
||||
});
|
||||
|
||||
it('should sign data with valid private key', async () => {
|
||||
// Key format matches V1 workflow JSON - uses \n escape sequences
|
||||
const privateKey =
|
||||
'-----BEGIN RSA PRIVATE KEY-----\nMIIBOgIBAAJBAKj34GkxFhD90vcNLYLInFEX6Ppy1tPf9Cnzj4p4WGeKLs1Pt8Qu\nKUpRKfFLfRYC9AIKjbJTWit+CqvjWYzvQwECAwEAAQJAIJLixBy2qpFoS4DSmoEm\no3qGy0t6z09AIJtH+5OeRV1be+N4cDYJKffGzDa88vQENZiRm0GRq6a+HPGQMd2k\nTQIhAKMSvzIBnni7ot/OSie2TmJLY4SwTQAevXysE2RbFDYdAiEBCUEaRQnMnbp7\n9mxDXDf6AU0cN/RPBjb9qSHDcWZHGzUCIG2Es59z8ugGrDY+pxLQnwfotadxd+Uy\nv/Ow5T0q5gIJAiEAyS4RaI9YG8EWx/2w0T67ZUVAw8eOMB6BIUg0Xcu+3okCIBOs\n/5OiPgoTdSy7bcF9IGpSE8ZgGKzgYQVZeN97YE00\n-----END RSA PRIVATE KEY-----';
|
||||
|
||||
mockExecuteFunctions.getInputData.mockReturnValue([{ json: {} }]);
|
||||
mockExecuteFunctions.getNodeParameter.mockImplementation((paramName: string) => {
|
||||
const params: Record<string, string> = {
|
||||
action: 'sign',
|
||||
algorithm: 'RSA-SHA256',
|
||||
encoding: 'base64',
|
||||
dataPropertyName: 'data',
|
||||
value: 'test',
|
||||
};
|
||||
return params[paramName];
|
||||
});
|
||||
mockExecuteFunctions.getCredentials.mockResolvedValue({
|
||||
hmacSecret: '',
|
||||
signPrivateKey: privateKey,
|
||||
});
|
||||
|
||||
const result = await cryptoNode.execute.call(mockExecuteFunctions);
|
||||
|
||||
expect(result[0][0].json.data).toBe(
|
||||
'ZlDI7xX0XElJHwEpTw08Ykz/D+IJ+hQkcb4Cr929bUjiiLRXy8Etagc0Miuld2WnksIaznNmlqn7bom5oOpDnw==',
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Hash action', () => {
|
||||
it('should hash with MD5 (hex encoding)', async () => {
|
||||
mockExecuteFunctions.getInputData.mockReturnValue([{ json: {} }]);
|
||||
mockExecuteFunctions.getNodeParameter.mockImplementation((paramName: string) => {
|
||||
const params: Record<string, string | boolean> = {
|
||||
action: 'hash',
|
||||
type: 'MD5',
|
||||
encoding: 'hex',
|
||||
dataPropertyName: 'data',
|
||||
binaryData: false,
|
||||
value: 'test',
|
||||
};
|
||||
return params[paramName];
|
||||
});
|
||||
|
||||
const result = await cryptoNode.execute.call(mockExecuteFunctions);
|
||||
|
||||
expect(result[0][0].json.data).toBe('098f6bcd4621d373cade4e832627b4f6');
|
||||
});
|
||||
|
||||
it('should hash with MD5 (base64 encoding)', async () => {
|
||||
mockExecuteFunctions.getInputData.mockReturnValue([{ json: {} }]);
|
||||
mockExecuteFunctions.getNodeParameter.mockImplementation((paramName: string) => {
|
||||
const params: Record<string, string | boolean> = {
|
||||
action: 'hash',
|
||||
type: 'MD5',
|
||||
encoding: 'base64',
|
||||
dataPropertyName: 'data',
|
||||
binaryData: false,
|
||||
value: 'test',
|
||||
};
|
||||
return params[paramName];
|
||||
});
|
||||
|
||||
const result = await cryptoNode.execute.call(mockExecuteFunctions);
|
||||
|
||||
expect(result[0][0].json.data).toBe('CY9rzUYh03PK3k6DJie09g==');
|
||||
});
|
||||
|
||||
it('should not require credentials for hash action', async () => {
|
||||
mockExecuteFunctions.getInputData.mockReturnValue([{ json: {} }]);
|
||||
mockExecuteFunctions.getNodeParameter.mockImplementation((paramName: string) => {
|
||||
const params: Record<string, string | boolean> = {
|
||||
action: 'hash',
|
||||
type: 'SHA256',
|
||||
encoding: 'hex',
|
||||
dataPropertyName: 'data',
|
||||
binaryData: false,
|
||||
value: 'test',
|
||||
};
|
||||
return params[paramName];
|
||||
});
|
||||
|
||||
await cryptoNode.execute.call(mockExecuteFunctions);
|
||||
|
||||
expect(mockExecuteFunctions.getCredentials).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Generate action', () => {
|
||||
it('should generate valid UUID', async () => {
|
||||
mockExecuteFunctions.getInputData.mockReturnValue([{ json: {} }]);
|
||||
mockExecuteFunctions.getNodeParameter.mockImplementation((paramName: string) => {
|
||||
const params: Record<string, string> = {
|
||||
action: 'generate',
|
||||
encodingType: 'uuid',
|
||||
dataPropertyName: 'data',
|
||||
};
|
||||
return params[paramName];
|
||||
});
|
||||
|
||||
const result = await cryptoNode.execute.call(mockExecuteFunctions);
|
||||
|
||||
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
||||
expect(result[0][0].json.data).toMatch(uuidRegex);
|
||||
});
|
||||
|
||||
it('should not require credentials for generate action', async () => {
|
||||
mockExecuteFunctions.getInputData.mockReturnValue([{ json: {} }]);
|
||||
mockExecuteFunctions.getNodeParameter.mockImplementation((paramName: string) => {
|
||||
const params: Record<string, string> = {
|
||||
action: 'generate',
|
||||
encodingType: 'uuid',
|
||||
dataPropertyName: 'data',
|
||||
};
|
||||
return params[paramName];
|
||||
});
|
||||
|
||||
await cryptoNode.execute.call(mockExecuteFunctions);
|
||||
|
||||
expect(mockExecuteFunctions.getCredentials).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -82,6 +82,7 @@
|
|||
"dist/credentials/CortexApi.credentials.js",
|
||||
"dist/credentials/CrateDb.credentials.js",
|
||||
"dist/credentials/CrowdStrikeOAuth2Api.credentials.js",
|
||||
"dist/credentials/Crypto.credentials.js",
|
||||
"dist/credentials/CurrentsApi.credentials.js",
|
||||
"dist/credentials/CustomerIoApi.credentials.js",
|
||||
"dist/credentials/DatadogApi.credentials.js",
|
||||
|
|
@ -881,7 +882,7 @@
|
|||
"@types/ssh2-sftp-client": "^9.0.5",
|
||||
"@types/uuid": "catalog:",
|
||||
"@types/xml2js": "catalog:",
|
||||
"eslint-plugin-n8n-nodes-base": "^1.16.3",
|
||||
"eslint-plugin-n8n-nodes-base": "^1.16.5",
|
||||
"n8n-core": "workspace:*"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
|||
|
|
@ -1185,8 +1185,8 @@ importers:
|
|||
specifier: ^4.15.2
|
||||
version: 4.15.2(@typescript-eslint/utils@8.35.0(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.2))(eslint-import-resolver-node@0.3.9)(eslint@9.29.0(jiti@2.6.1))
|
||||
eslint-plugin-n8n-nodes-base:
|
||||
specifier: 1.16.3
|
||||
version: 1.16.3(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.2)
|
||||
specifier: 1.16.5
|
||||
version: 1.16.5(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.2)
|
||||
fast-glob:
|
||||
specifier: 'catalog:'
|
||||
version: 3.2.12
|
||||
|
|
@ -3474,8 +3474,8 @@ importers:
|
|||
specifier: 'catalog:'
|
||||
version: 0.4.14
|
||||
eslint-plugin-n8n-nodes-base:
|
||||
specifier: ^1.16.3
|
||||
version: 1.16.3(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.2)
|
||||
specifier: ^1.16.5
|
||||
version: 1.16.5(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.2)
|
||||
n8n-containers:
|
||||
specifier: workspace:*
|
||||
version: link:../testing/containers
|
||||
|
|
@ -11753,17 +11753,14 @@ packages:
|
|||
'@typescript-eslint/parser':
|
||||
optional: true
|
||||
|
||||
eslint-plugin-local@1.0.0:
|
||||
resolution: {integrity: sha512-bcwcQnKL/Iw5Vi/F2lG1he5oKD2OGjhsLmrcctkWrWq5TujgiaYb0cj3pZgr3XI54inNVnneOFdAx1daLoYLJQ==}
|
||||
|
||||
eslint-plugin-lodash@8.0.0:
|
||||
resolution: {integrity: sha512-7DA8485FolmWRzh+8t4S8Pzin2TTuWfb0ZW3j/2fYElgk82ZanFz8vDcvc4BBPceYdX1p/za+tkbO68maDBGGw==}
|
||||
engines: {node: '>=10'}
|
||||
peerDependencies:
|
||||
eslint: '>=9.0.0'
|
||||
|
||||
eslint-plugin-n8n-nodes-base@1.16.3:
|
||||
resolution: {integrity: sha512-edLX42Vg4B+y0kzkitTVDmHZQrG5/wUZO874N5Z9leBuxt5TG1pqMY4zdr35RlpM4p4REr/T9x+6DpsQSL63WA==}
|
||||
eslint-plugin-n8n-nodes-base@1.16.5:
|
||||
resolution: {integrity: sha512-/Bx2xj1ZzwEN+KQmnf7i0QRzgNMuphythQI2qXHoJQd8nm6aJGC9ZyVmDBFkM9P1ZfVBgBK7bDdjNxcbIK8Hgw==}
|
||||
engines: {node: '>=20.15', pnpm: '>=9.6'}
|
||||
|
||||
eslint-plugin-playwright@2.2.2:
|
||||
|
|
@ -29410,18 +29407,15 @@ snapshots:
|
|||
- eslint-import-resolver-webpack
|
||||
- supports-color
|
||||
|
||||
eslint-plugin-local@1.0.0: {}
|
||||
|
||||
eslint-plugin-lodash@8.0.0(eslint@9.29.0(jiti@2.6.1)):
|
||||
dependencies:
|
||||
eslint: 9.29.0(jiti@2.6.1)
|
||||
lodash: 4.17.21
|
||||
|
||||
eslint-plugin-n8n-nodes-base@1.16.3(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.2):
|
||||
eslint-plugin-n8n-nodes-base@1.16.5(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.2):
|
||||
dependencies:
|
||||
'@typescript-eslint/utils': 6.21.0(eslint@9.29.0(jiti@2.6.1))(typescript@5.9.2)
|
||||
camel-case: 4.1.2
|
||||
eslint-plugin-local: 1.0.0
|
||||
indefinite: 2.5.1
|
||||
pascal-case: 3.1.2
|
||||
pluralize: 8.0.0
|
||||
|
|
|
|||
|
|
@ -127,6 +127,7 @@ minimumReleaseAgeExclude:
|
|||
- '@n8n_io/*'
|
||||
- 'tsdown@0.16.5'
|
||||
- eslint-plugin-storybook
|
||||
- eslint-plugin-n8n-nodes-base
|
||||
- '@langchain/*'
|
||||
- 'langchain'
|
||||
- '@anthropic-ai/sdk'
|
||||
|
|
|
|||
Loading…
Reference in a new issue