fix(server): decrypt api key master password before hashing in createOrUpdate mutation

This commit is contained in:
Melvin Chia
2025-11-28 16:34:29 +08:00
parent 5dbddda391
commit 8a756b0f86

View File

@@ -33,7 +33,9 @@ const createOrUpdate = forgeController
.callback(async ({ pb, body: { password } }) => {
const salt = await bcrypt.genSalt(10)
const APIKeysMasterPasswordHash = await bcrypt.hash(password, salt)
const decryptedMaster = decrypt2(password, challenge)
const APIKeysMasterPasswordHash = await bcrypt.hash(decryptedMaster, salt)
const id = pb.instance.authStore.record!.id