diff --git a/package.json b/package.json index 528c20b..8d0f00a 100644 --- a/package.json +++ b/package.json @@ -37,4 +37,4 @@ "npmextra.json", "readme.md" ] -} +} \ No newline at end of file diff --git a/test/test.ts b/test/test.ts index defddf2..9c16ec7 100644 --- a/test/test.ts +++ b/test/test.ts @@ -38,7 +38,7 @@ tap.test('should receive a message', async () => { id: '123', type: 'none' }, - message: 'hi there', + message: 'hi there' } }); }); diff --git a/ts/sl.classes.smartlogreceiver.ts b/ts/sl.classes.smartlogreceiver.ts index c8e4371..f3f593b 100644 --- a/ts/sl.classes.smartlogreceiver.ts +++ b/ts/sl.classes.smartlogreceiver.ts @@ -3,7 +3,7 @@ import * as plugins from './sl.receiver.plugins'; import { ILogPackage, ILogPackageAuthenticated, - ILogDestination, + ILogDestination } from '@pushrocks/smartlog-interfaces'; export type TValidatorFunction = (logPackage: ILogPackage) => Promise; @@ -24,7 +24,11 @@ export class SmartlogReceiver { constructor(smartlogReceiverOptions: ISmartlogReceiverOptions) { this.passphrase = smartlogReceiverOptions.passphrase; - this.validatorFunction = smartlogReceiverOptions.validatorFunction || (async (logpackageArg) => {return true}); + this.validatorFunction = + smartlogReceiverOptions.validatorFunction || + (async logpackageArg => { + return true; + }); this.smartlogInstance = smartlogReceiverOptions.smartlogInstance; } @@ -36,8 +40,8 @@ export class SmartlogReceiver { const logPackage = authenticatedLogPackageArg.logPackage; if ( - authString === plugins.smarthash.sha256FromStringSync(this.passphrase) - && await this.validatorFunction(logPackage) + authString === plugins.smarthash.sha256FromStringSync(this.passphrase) && + (await this.validatorFunction(logPackage)) ) { // Message authenticated lets clean up. logPackage.correlation ? null : (logPackage.correlation = { id: '123', type: 'none' });