feat: use blasters for new user metadata

This commit is contained in:
2023-11-17 22:21:24 +00:00
parent e3cb397d1d
commit f2ff2c65be
3 changed files with 9 additions and 2 deletions

View File

@ -59,6 +59,11 @@ export const DefaultImgProxy = {
*/ */
export const DerivationPath = "m/44'/1237'/0'/0/0"; export const DerivationPath = "m/44'/1237'/0'/0/0";
/**
* Blaster relays
*/
export const Blasters = ["wss://nostr.mutinywallet.com"];
/** /**
* Regex to match email address * Regex to match email address
*/ */

View File

@ -12,7 +12,7 @@ import { unixNowMs } from "@snort/shared";
import * as secp from "@noble/curves/secp256k1"; import * as secp from "@noble/curves/secp256k1";
import * as utils from "@noble/curves/abstract/utils"; import * as utils from "@noble/curves/abstract/utils";
import { SnortPubKey } from "Const"; import { Blasters, SnortPubKey } from "Const";
import { LoginStore, UserPreferences, LoginSession, LoginSessionType, SnortAppData, Newest } from "Login"; import { LoginStore, UserPreferences, LoginSession, LoginSessionType, SnortAppData, Newest } from "Login";
import { generateBip39Entropy, entropyToPrivateKey } from "nip6"; import { generateBip39Entropy, entropyToPrivateKey } from "nip6";
import { bech32ToHex, dedupeById, getCountry, sanitizeRelayUrl, unwrap } from "SnortUtils"; import { bech32ToHex, dedupeById, getCountry, sanitizeRelayUrl, unwrap } from "SnortUtils";
@ -123,10 +123,12 @@ export async function generateNewLogin(
// Create relay metadata event // Create relay metadata event
const ev2 = await publisher.relayList(newRelays); const ev2 = await publisher.relayList(newRelays);
await system.BroadcastEvent(ev2); await system.BroadcastEvent(ev2);
await Promise.all(Blasters.map(a => system.WriteOnceToRelay(a, ev2)));
// Publish new profile // Publish new profile
const ev3 = await publisher.metadata(profile); const ev3 = await publisher.metadata(profile);
await system.BroadcastEvent(ev3); await system.BroadcastEvent(ev3);
await Promise.all(Blasters.map(a => system.WriteOnceToRelay(a, ev3)));
LoginStore.loginWithPrivateKey(await pin(privateKey), entropy, newRelays); LoginStore.loginWithPrivateKey(await pin(privateKey), entropy, newRelays);
} }

View File

@ -11,9 +11,9 @@ import AsyncButton from "Element/AsyncButton";
import SnortApi, { RelayDistance } from "External/SnortApi"; import SnortApi, { RelayDistance } from "External/SnortApi";
import { getCountry, getRelayName, sanitizeRelayUrl } from "SnortUtils"; import { getCountry, getRelayName, sanitizeRelayUrl } from "SnortUtils";
import { formatShort } from "Number"; import { formatShort } from "Number";
import { Blasters } from "Const";
import messages from "./messages"; import messages from "./messages";
const Blasters = ["wss://nostr.mutinywallet.com"];
export async function saveRelays( export async function saveRelays(
system: SystemInterface, system: SystemInterface,