diff --git a/services/gunDB/Mediator/index.js b/services/gunDB/Mediator/index.js index 10c9b143..9593bee1 100644 --- a/services/gunDB/Mediator/index.js +++ b/services/gunDB/Mediator/index.js @@ -1,6 +1,7 @@ /** * @format */ +const Common = require('shock-common') const Gun = require('gun') // @ts-ignore require('gun/nts') @@ -308,6 +309,16 @@ const getUser = () => { * @returns {Promise} */ const authenticate = async (alias, pass, __user) => { + if (!Common.isPopulatedString(alias)) { + throw new TypeError( + `Expected alias to be a populated string, instead got: ${alias}` + ) + } + if (!Common.isPopulatedString(pass)) { + throw new TypeError( + `Expected pass to be a populated string, instead got: ${pass}` + ) + } const _user = __user || user const isFreshGun = _user !== user if (isFreshGun) {