Skip to content

Commit

Permalink
⚡ Improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
RicardoE105 committed Mar 26, 2022
1 parent c8a2c1a commit 3a3fdd8
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions packages/nodes-base/nodes/Crypto/Crypto.node.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { set } from 'lodash';
import { IExecuteFunctions } from 'n8n-core';
import {
set,
} from 'lodash';

import {
IExecuteFunctions,
} from 'n8n-core';

import {
ILoadOptionsFunctions,
INodeExecutionData,
Expand All @@ -16,9 +22,10 @@ import {
createSign,
getHashes,
randomBytes,
randomUUID,
} from 'crypto';

import { v4 as uuid } from 'uuid';

export class Crypto implements INodeType {
description: INodeTypeDescription = {
displayName: 'Crypto',
Expand Down Expand Up @@ -372,11 +379,11 @@ export class Crypto implements INodeType {
value: 'ascii',
},
{
name: 'Base64',
name: 'BASE64',
value: 'base64',
},
{
name: 'Hex',
name: 'HEX',
value: 'hex',
},
{
Expand Down Expand Up @@ -449,8 +456,8 @@ export class Crypto implements INodeType {

if (action === 'generate') {
const encodingType = this.getNodeParameter('encodingType', i) as string;
if ( encodingType === 'uuid') {
newValue = randomUUID();
if (encodingType === 'uuid') {
newValue = uuid();
} else {
const stringLength = this.getNodeParameter('stringLength', i) as number;
if (encodingType === 'base64') {
Expand Down Expand Up @@ -504,7 +511,7 @@ export class Crypto implements INodeType {

} catch (error) {
if (this.continueOnFail()) {
returnData.push({json:{ error: (error as JsonObject).message }});
returnData.push({ json: { error: (error as JsonObject).message } });
continue;
}
throw error;
Expand Down

0 comments on commit 3a3fdd8

Please sign in to comment.