Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

refactor(web): use SHA-256 for anonymous session hashing

Richie McIlroy83031ad15792
diff --git a/apps/web/lib/anonymous-names.ts b/apps/web/lib/anonymous-names.ts
index df2372bf3..e6f6a2e5f 100644
--- a/apps/web/lib/anonymous-names.ts
+++ b/apps/web/lib/anonymous-names.ts
@@ -1,3 +1,5 @@
+import { createHash } from "node:crypto";
+
const ANIMALS = [
"Walrus",
"Capybara",
@@ -49,5 +51,5 @@ export function getAnonymousName(sessionId: string): string {
}
export function getSessionHash(sessionId: string): string {
- return hashSessionId(sessionId).toString(36);
+ return createHash("sha256").update(sessionId).digest("hex").slice(0, 16);
}