fix: tests

This commit is contained in:
Kieran 2023-10-18 15:36:39 +01:00
parent 4d4106a3ff
commit 3b3a920124
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
2 changed files with 10 additions and 19 deletions

View File

@ -1,5 +1,4 @@
import { RelaySettings } from "@snort/system";
import { bech32ToHex } from "SnortUtils";
/**
* 1 Hour in seconds
@ -61,10 +60,10 @@ export const DefaultRelays = new Map<string, RelaySettings>([
export const SearchRelays = ["wss://relay.nostr.band"];
export const DeveloperAccounts = [
bech32ToHex(KieranPubKey), // kieran
bech32ToHex("npub1g53mukxnjkcmr94fhryzkqutdz2ukq4ks0gvy5af25rgmwsl4ngq43drvk"), // Martti
bech32ToHex("npub107jk7htfv243u0x5ynn43scq9wrxtaasmrwwa8lfu2ydwag6cx2quqncxg"), // verbiricha
bech32ToHex("npub1r0rs5q2gk0e3dk3nlc7gnu378ec6cnlenqp8a3cjhyzu6f8k5sgs4sq9ac"), // Karnage
"63fe6318dc58583cfe16810f86dd09e18bfd76aabc24a0081ce2856f330504ed", // kieran
"4523be58d395b1b196a9b8c82b038b6895cb02b683d0c253a955068dba1facd0", // Martti
"7fa56f5d6962ab1e3cd424e758c3002b8665f7b0d8dcee9fe9e288d7751ac194", // verbiricha
"1bc70a0148b3f316da33fe3c89f23e3e71ac4ff998027ec712b905cd24f6a411", // Karnage
];
/**

View File

@ -75,13 +75,9 @@ export function parseId(id: string) {
}
export function bech32ToHex(str: string) {
try {
const nKey = bech32.decode(str, 1_000);
const nKey = bech32.decode(str, 10_000);
const buff = bech32.fromWords(nKey.words);
return utils.bytesToHex(Uint8Array.from(buff));
} catch (e) {
return str;
}
return bytesToHex(buff);
}
/**
@ -90,13 +86,9 @@ export function bech32ToHex(str: string) {
* @returns
*/
export function bech32ToText(str: string) {
try {
const decoded = bech32.decode(str, 1000);
const buf = bech32.fromWords(decoded.words);
return new TextDecoder().decode(Uint8Array.from(buf));
} catch {
return "";
}
const nKey = bech32.decode(str, 10_000);
const buff = bech32.fromWords(nKey.words);
return new TextDecoder().decode(buff);
}
/**