Simplify nostr key generation

This commit is contained in:
koalasat
2025-07-09 20:41:15 +02:00
parent 6728c68dd0
commit a71173abe3

View File

@ -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;