From 44de364ae439ca801a93c8f15f69d3e5b3ee0ddc Mon Sep 17 00:00:00 2001 From: Daniel Lugo Date: Wed, 29 Jan 2020 12:36:16 -0400 Subject: [PATCH] better error checking --- services/gunDB/Mediator/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/gunDB/Mediator/index.js b/services/gunDB/Mediator/index.js index 4b22e1f8..03bd2a39 100644 --- a/services/gunDB/Mediator/index.js +++ b/services/gunDB/Mediator/index.js @@ -87,6 +87,12 @@ mySEA.decrypt = (encMsg, secret) => { } mySEA.secret = (recipientOrSenderEpub, recipientOrSenderSEA) => { + if (typeof recipientOrSenderEpub !== 'string') { + throw new TypeError('epub has to be an string') + } + if (typeof recipientOrSenderSEA !== 'object') { + throw new TypeError('sea has to be an object') + } if (recipientOrSenderEpub === recipientOrSenderSEA.pub) { throw new Error('Do not use pub for mysecret') }