@riddix/hamh 2.1.0-alpha.593 → 2.1.0-alpha.594
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/backend/cli.js
CHANGED
|
@@ -149122,9 +149122,7 @@ function lockCredentialApi(lockCredentialStorage) {
|
|
|
149122
149122
|
async (_req, res) => {
|
|
149123
149123
|
const credentials = lockCredentialStorage.getAllCredentials();
|
|
149124
149124
|
const sanitizedCredentials = credentials.map(sanitizeCredential);
|
|
149125
|
-
res.json({
|
|
149126
|
-
credentials: sanitizedCredentials
|
|
149127
|
-
});
|
|
149125
|
+
res.json({ credentials: sanitizedCredentials });
|
|
149128
149126
|
}
|
|
149129
149127
|
);
|
|
149130
149128
|
router.get(
|
|
@@ -153122,7 +153120,7 @@ var EntityMappingStorage = class extends Service {
|
|
|
153122
153120
|
|
|
153123
153121
|
// src/services/storage/lock-credential-storage.ts
|
|
153124
153122
|
init_service();
|
|
153125
|
-
import { pbkdf2Sync, randomBytes as randomBytes2 } from "node:crypto";
|
|
153123
|
+
import { pbkdf2Sync, randomBytes as randomBytes2, timingSafeEqual as timingSafeEqual2 } from "node:crypto";
|
|
153126
153124
|
var CURRENT_VERSION2 = 2;
|
|
153127
153125
|
var HASH_ITERATIONS = 1e5;
|
|
153128
153126
|
var HASH_KEY_LENGTH = 64;
|
|
@@ -153203,8 +153201,15 @@ var LockCredentialStorage = class extends Service {
|
|
|
153203
153201
|
if (!credential?.enabled) {
|
|
153204
153202
|
return false;
|
|
153205
153203
|
}
|
|
153206
|
-
const
|
|
153207
|
-
|
|
153204
|
+
const computed = Buffer.from(
|
|
153205
|
+
this.hashPin(pin, credential.pinCodeSalt),
|
|
153206
|
+
"hex"
|
|
153207
|
+
);
|
|
153208
|
+
const expected = Buffer.from(credential.pinCodeHash, "hex");
|
|
153209
|
+
if (computed.length !== expected.length) {
|
|
153210
|
+
return false;
|
|
153211
|
+
}
|
|
153212
|
+
return timingSafeEqual2(computed, expected);
|
|
153208
153213
|
}
|
|
153209
153214
|
/**
|
|
153210
153215
|
* Check if a credential exists and is enabled for an entity
|