Added scene chapters to GraphQL. Verifying API credential types.
This commit is contained in:
@@ -628,6 +628,14 @@ export async function verifyKey(userId, key, req) {
|
||||
throw new HttpError('The API credentials are not provided.', 401);
|
||||
}
|
||||
|
||||
if (typeof userId !== 'number') {
|
||||
throw new HttpError('User ID is not a number', 400);
|
||||
}
|
||||
|
||||
if (typeof key !== 'string') {
|
||||
throw new HttpError('Key is not a string', 400);
|
||||
}
|
||||
|
||||
const hashedKey = (await scrypt(key, '', 64)).toString('hex'); // salt redundant for randomly generated key
|
||||
|
||||
const storedKey = await knex('users_keys')
|
||||
|
||||
Reference in New Issue
Block a user