diff --git a/packages/nostr/src/index.ts b/packages/nostr/src/index.ts index c74de3f8..2e897582 100644 --- a/packages/nostr/src/index.ts +++ b/packages/nostr/src/index.ts @@ -1,3 +1,4 @@ export * from "./legacy" +import "./nostr-object" // TODO This file should only contain re-exports and only re-export what is needed diff --git a/packages/nostr/src/nostr-object.ts b/packages/nostr/src/nostr-object.ts index 96818d86..3f837f70 100644 --- a/packages/nostr/src/nostr-object.ts +++ b/packages/nostr/src/nostr-object.ts @@ -7,7 +7,6 @@ declare global { getPublicKey: () => Promise signEvent: (event: Unsigned) => Promise - // TODO It's unclear to me if I should use this anywhere. getRelays?: () => Promise<{ [url: string]: { read: boolean; write: boolean } }> diff --git a/packages/nostr/test/setup.ts b/packages/nostr/test/setup.ts index 95542319..25638acf 100644 --- a/packages/nostr/test/setup.ts +++ b/packages/nostr/test/setup.ts @@ -41,9 +41,9 @@ export async function setup( const publisherSecret = "nsec15fnff4uxlgyu79ua3l7327w0wstrd6x565cx6zze78zgkktmr8vs90j363" - // Set up the global window.nostr object for the publisher. if (typeof window !== "undefined") { if (window.location.pathname === "/nostr-object") { + // Mock the global window.nostr object for the publisher. window.nostr = { getPublicKey: () => Promise.resolve(parsePublicKey(publisherPubkey)), signEvent: (event: Unsigned) => @@ -74,7 +74,7 @@ export async function setup( }, } } else { - // Otherwise, disable the user's nostr extension if they have one. + // Disable the user's nostr extension if they have one. window.nostr = undefined } }