Forráskód Böngészése

fix: hash API keys with bcrypt in seed (was plaintext)

clawPi4Bot 2 hónapja
szülő
commit
e54c51d1e5
1 módosított fájl, 2 hozzáadás és 1 törlés
  1. 2 1
      apps/api-server/src/db/seed.ts

+ 2 - 1
apps/api-server/src/db/seed.ts

@@ -65,7 +65,8 @@ async function seed() {
 
   for (const d of deviceNames) {
     const deviceId = d.serial  // ID = serial for easy POC testing
-    const apiKeyHash = `dev-api-key-${d.serial.toLowerCase()}`
+    const apiKeyPlain = `dev-api-key-${d.serial.toLowerCase()}`
+    const apiKeyHash = await bcrypt.hash(apiKeyPlain, 10)
     await db.insert(devices).values({
       id: deviceId,
       orgId,