This commit is contained in:
Bruce Berrios 2022-03-05 20:09:06 -05:00 committed by GitHub
parent 97f6a4ff8e
commit 6645c2d4bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -154,6 +154,11 @@ async function authenticateWithApeKey(
const keyOwner = (await UsersDAO.getUser(uid)) as MonkeyTypes.User;
const targetApeKey = _.get(keyOwner.apeKeys, keyId);
if (!targetApeKey.enabled) {
throw new MonkeyError(400, "ApeKey is disabled");
}
const isKeyValid = await compare(apeKey, targetApeKey?.hash);
if (!isKeyValid) {