From a71173abe3b1b2d450c189ed35e050878d71759c Mon Sep 17 00:00:00 2001 From: koalasat Date: Wed, 9 Jul 2025 20:41:15 +0200 Subject: [PATCH] Simplify nostr key generation --- frontend/src/models/Slot.model.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/models/Slot.model.ts b/frontend/src/models/Slot.model.ts index ec560a1e..cb6883c4 100644 --- a/frontend/src/models/Slot.model.ts +++ b/frontend/src/models/Slot.model.ts @@ -1,5 +1,6 @@ import { sha256 } from 'js-sha256'; import { sha256 as sha256Hash } from '@noble/hashes/sha256'; +import { sha512 } from '@noble/hashes/sha512'; import { Robot, Order, type Federation } from '.'; import { roboidentitiesClient } from '../services/Roboidentities/Web'; import { hexToBase91, validateTokenEntropy } from '../utils'; @@ -27,8 +28,8 @@ class Slot { const { hasEnoughEntropy, bitsEntropy, shannonEntropy } = validateTokenEntropy(token); const tokenSHA256 = hexToBase91(sha256(token)); - const nostrHash = sha256Hash(this.token); - this.nostrSecKey = new Uint8Array(nostrHash); + const nostrHash = sha256Hash(sha512(this.token)); + this.nostrSecKey = nostrHash; const nostrPubKey = getPublicKey(this.nostrSecKey); this.nostrPubKey = nostrPubKey;