Files
klz-cables.com/.pnpm-store/v10/files/e1/37b2d709570e56be691cd384aa11c4562f0d9d5014d42caf968de23b122a9bec2a6e28c21776c02661dc6aa854c9bca4c2f51734818510aefa429abfb34d6a
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

28 lines
1007 B
Plaintext

// @ts-strict-ignore
import crypto from 'crypto';
export const authenticateLocalStrategy = async ({ doc, password })=>{
try {
const { hash, salt } = doc;
if (typeof salt === 'string' && typeof hash === 'string') {
const res = await new Promise((resolve, reject)=>{
crypto.pbkdf2(password, salt, 25000, 512, 'sha256', (e, hashBuffer)=>{
if (e) {
reject(e);
}
const storedHashBuffer = Buffer.from(hash, 'hex');
if (hashBuffer.length === storedHashBuffer.length && crypto.timingSafeEqual(hashBuffer, storedHashBuffer)) {
resolve(doc);
} else {
reject(new Error('Invalid password'));
}
});
});
return res;
}
return null;
} catch (ignore) {
return null;
}
};
//# sourceMappingURL=authenticate.js.map