check that alias and pass are populated strings
This commit is contained in:
parent
a0d5824696
commit
aaf4c6292f
1 changed files with 11 additions and 0 deletions
|
|
@ -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<string>}
|
||||
*/
|
||||
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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue