mirror of
https://github.com/RoboSats/robosats.git
synced 2025-07-18 00:33:15 +00:00
Merge pull request #2055 from RoboSats/anually-verify-ratings
Simplify nostr key generation
This commit is contained in:
@ -1,5 +1,6 @@
|
|||||||
import { sha256 } from 'js-sha256';
|
import { sha256 } from 'js-sha256';
|
||||||
import { sha256 as sha256Hash } from '@noble/hashes/sha256';
|
import { sha256 as sha256Hash } from '@noble/hashes/sha256';
|
||||||
|
import { sha512 } from '@noble/hashes/sha512';
|
||||||
import { Robot, Order, type Federation } from '.';
|
import { Robot, Order, type Federation } from '.';
|
||||||
import { roboidentitiesClient } from '../services/Roboidentities/Web';
|
import { roboidentitiesClient } from '../services/Roboidentities/Web';
|
||||||
import { hexToBase91, validateTokenEntropy } from '../utils';
|
import { hexToBase91, validateTokenEntropy } from '../utils';
|
||||||
@ -27,8 +28,8 @@ class Slot {
|
|||||||
const { hasEnoughEntropy, bitsEntropy, shannonEntropy } = validateTokenEntropy(token);
|
const { hasEnoughEntropy, bitsEntropy, shannonEntropy } = validateTokenEntropy(token);
|
||||||
const tokenSHA256 = hexToBase91(sha256(token));
|
const tokenSHA256 = hexToBase91(sha256(token));
|
||||||
|
|
||||||
const nostrHash = sha256Hash(this.token);
|
const nostrHash = sha256Hash(sha512(this.token));
|
||||||
this.nostrSecKey = new Uint8Array(nostrHash);
|
this.nostrSecKey = nostrHash;
|
||||||
const nostrPubKey = getPublicKey(this.nostrSecKey);
|
const nostrPubKey = getPublicKey(this.nostrSecKey);
|
||||||
this.nostrPubKey = nostrPubKey;
|
this.nostrPubKey = nostrPubKey;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user