diff --git a/README.md b/README.md
index 04f1974b..0d2a2180 100644
--- a/README.md
+++ b/README.md
@@ -207,9 +207,9 @@ the entry point that matches their feature set:
2. **View counters ([NIP-71](https://github.com/nostr-protocol/nips/blob/master/71.md)):** `import { recordVideoView, subscribeVideoViewEvents } from './nostrViewEventsFacade.js';`
3. **Watch-history lists ([NIP-51](https://github.com/nostr-protocol/nips/blob/master/51.md) + [NIP-04](https://github.com/nostr-protocol/nips/blob/master/04.md) encryption):** `import { updateWatchHistoryListWithDefaultClient } from './nostrWatchHistoryFacade.js';`
-`js/nostr.js` remains as a compatibility shim while existing plugins migrate, but
-it will be removed in a future release. Move any legacy `import { ... } from './nostr.js';`
-calls over to the facades above so upgrades stay painless.
+The legacy `js/nostr.js` shim has been removed. Update any remaining
+`import { ... } from './nostr.js';` calls to use the facades above so upgrades
+stay painless.
The build command compiles Tailwind with `tailwind.config.cjs`, runs it through
the PostCSS pipeline defined in `postcss.config.cjs` (for autoprefixing), and
diff --git a/content/roadmap/02_bitvid_Enhanced_Migration_of_Note_Spec_Logic.md b/content/roadmap/02_bitvid_Enhanced_Migration_of_Note_Spec_Logic.md
index b76fe39f..48465916 100644
--- a/content/roadmap/02_bitvid_Enhanced_Migration_of_Note_Spec_Logic.md
+++ b/content/roadmap/02_bitvid_Enhanced_Migration_of_Note_Spec_Logic.md
@@ -7,10 +7,12 @@
Currently, logic related to the **video note specification** and how data is structured (version, `isPrivate`, encryption placeholders, and so on) is scattered across three files:
1. **app.js**: Contains UI handling, form submissions, and some note structure (like `version`, `title`, `magnet`).
-2. **nostr.js**: Builds and edits Nostr events (`publishVideo`, `editVideo`, `deleteVideo`). It also holds methods for “fake encryption” and “fake decryption,” among other utilities.
+2. **nostr client modules** (for example, `js/nostr/client.js`): Build and edit Nostr events (`publishVideo`, `editVideo`, `deleteVideo`). They also hold methods for “fake encryption” and “fake decryption,” among other utilities.
3. **webtorrent.js**: Mostly focuses on torrent streaming but does not handle note logic directly. It rarely touches the note data, so it may not need major restructuring.
-To isolate note-spec-related operations, you can create a new file (for example, `bitvidNoteSpec.js`). This file will have all the code that deals with creating or parsing your event content fields (version, magnet link encryption, etc.). Then `app.js` and `nostr.js` can import those functions.
+The legacy `nostr.js` shim no longer exists; references to it map to the nostr client layer under `js/nostr/`.
+
+To isolate note-spec-related operations, you can create a new file (for example, `bitvidNoteSpec.js`). This file will have all the code that deals with creating or parsing your event content fields (version, magnet link encryption, etc.). Then `app.js` and the nostr client modules can import those functions.
---
@@ -18,7 +20,7 @@ To isolate note-spec-related operations, you can create a new file (for example,
- **Centralize the note specification**: Keep details like `version`, `deleted`, `isPrivate`, encryption, and decryption in one place.
- **Simplify `app.js`**: Move form building/parsing to new spec-related functions. That way, `app.js` only handles UI and user actions.
-- **Streamline `nostr.js`**: Shift event creation logic into a function from the new note spec file. Nostr code then just calls that function, signs it, and publishes it.
+- **Streamline the nostr client layer**: Shift event creation logic into a function from the new note spec file. Nostr code then just calls that function, signs it, and publishes it.
---
@@ -118,17 +120,17 @@ Now `handleSubmit` is only handling the UI, while actual note-building moves to
---
-### 2. Extracting Logic from `nostr.js`
+### 2. Extracting Logic from the nostr client layer
-In `nostr.js`, you have methods like `publishVideo`, `editVideo`, and `deleteVideo`. They build the note content, sign it, and publish it. You can simplify them:
+In the nostr client modules, you have methods like `publishVideo`, `editVideo`, and `deleteVideo`. They build the note content, sign it, and publish it. You can simplify them:
- **Rename** them to something more generic (e.g., `publishNote`, `updateNote`, `deleteNote`) if that aligns better with Nostr usage.
-- **Import** helper functions from `bitvidNoteSpec.js` to build or edit the actual content. That way, `nostr.js` doesn’t need to know about `version`, `deleted`, or encryption details.
+- **Import** helper functions from `bitvidNoteSpec.js` to build or edit the actual content. That way, the nostr client layer doesn’t need to know about `version`, `deleted`, or encryption details.
For example, you might do this:
```js
-// nostr.js
+// nostr client module
import { buildEditNote, buildDeleteNote } from "./bitvidNoteSpec.js";
class NostrClient {
@@ -150,7 +152,7 @@ class NostrClient {
}
```
-By delegating the actual note-building to `buildEditNote` and `buildDeleteNote`, you keep `nostr.js` focused on signing and relaying events.
+By delegating the actual note-building to `buildEditNote` and `buildDeleteNote`, you keep the nostr client layer focused on signing and relaying events.
---
@@ -170,16 +172,16 @@ By delegating the actual note-building to `buildEditNote` and `buildDeleteNote`,
- Remove direct references to building the final note object in `handleSubmit`.
- Instead, gather user inputs, call a helper function from `bitvidNoteSpec.js` to produce the final note object, then pass that object to `nostrClient.publishNote` (or a similar method).
-3. **Update `nostr.js`:**
- - Rename or refactor `publishVideo`, `editVideo`, and `deleteVideo` to call your new helper methods from `bitvidNoteSpec.js`.
- - Keep the Nostr signing and publishing logic inside `nostr.js`.
+3. **Update the nostr client modules:**
+ - Rename or refactor `publishVideo`, `editVideo`, and `deleteVideo` to call your new helper methods from `bitvidNoteSpec.js`.
+ - Keep the Nostr signing and publishing logic inside the client layer.
4. **Verify Data Flow:**
- Confirm that after form submission, the final event object is built in `bitvidNoteSpec.js`, returned to `app.js`, and forwarded to `nostrClient`.
- Ensure you can still subscribe to events and parse them without issues.
-5. **Remove Redundant Code:**
- - Delete any leftover duplication in `app.js` or `nostr.js` relating to magnet encryption or note structuring.
+5. **Remove Redundant Code:**
+ - Delete any leftover duplication in `app.js` or the nostr client modules relating to magnet encryption or note structuring.
6. **Test Thoroughly:**
- Create, edit, and delete events to ensure everything behaves the same.
@@ -257,7 +259,7 @@ export function isValidNoteContent(content) {
}
```
-By keeping these details in a single file, you won’t have to search through `app.js` or `nostr.js` whenever you need to tweak the note structure.
+By keeping these details in a single file, you won’t have to search through `app.js` or the nostr client modules whenever you need to tweak the note structure.
---
diff --git a/docs/nostr-analytics.md b/docs/nostr-analytics.md
index d124829d..d10a0847 100644
--- a/docs/nostr-analytics.md
+++ b/docs/nostr-analytics.md
@@ -32,7 +32,7 @@ When wiring moderation or playback toggles into view analytics, import helpers f
import { recordVideoView, subscribeVideoViewEvents } from "../nostrViewEventsFacade.js";
```
-The facade wraps [`js/nostr/viewEventBindings.js`](../js/nostr/viewEventBindings.js) so feature flags, relay discovery, and COUNT/LIST fallbacks all run through the same guard clauses that enforce the NIP-71/NIP-78 schemas. `js/nostr.js` still exports shimmed versions for legacy bundles, but new code should migrate to the facades to keep the eventual removal painless. Modules that need to no-op when relays disable optional methods can rely on the binding’s "unavailable" errors to short-circuit cleanly.
+The facade wraps [`js/nostr/viewEventBindings.js`](../js/nostr/viewEventBindings.js) so feature flags, relay discovery, and COUNT/LIST fallbacks all run through the same guard clauses that enforce the NIP-71/NIP-78 schemas. Modules that need to no-op when relays disable optional methods can rely on the binding’s "unavailable" errors to short-circuit cleanly.
### Hydration, COUNT, and UI sync
diff --git a/docs/nostr-event-schemas.md b/docs/nostr-event-schemas.md
index ea5d2dde..492f0d3b 100644
--- a/docs/nostr-event-schemas.md
+++ b/docs/nostr-event-schemas.md
@@ -110,9 +110,8 @@ through the dedicated facade when you need to run a NIP-07 handshake:
import { nostrClient, requestDefaultExtensionPermissions } from "./nostrClientFacade.js";
```
-`js/nostr.js` remains as a compatibility shim while downstream packages migrate;
-it forwards to the new facades but is slated for removal once legacy imports
-are retired.【F:js/nostr/defaultClient.js†L1-L25】【F:js/nostr.js†L1-L92】
+The compatibility shim has been removed; import from the facades above to avoid
+broken references.【F:js/nostr/defaultClient.js†L1-L25】
For analytics, route through the
[NIP-71](https://github.com/nostr-protocol/nips/blob/master/71.md) helpers in
diff --git a/index.html b/index.html
index 72fe7fd4..913d63c6 100644
--- a/index.html
+++ b/index.html
@@ -362,7 +362,6 @@
-
diff --git a/js/nostr.js b/js/nostr.js
deleted file mode 100644
index 580df0c6..00000000
--- a/js/nostr.js
+++ /dev/null
@@ -1,136 +0,0 @@
-// js/nostr.js
-//
-// Compatibility shim that forwards legacy imports to the new domain-specific
-// facades. Prefer importing from the facades directly in new modules so the
-// wiring between the default client and helper layers stays explicit.
-
-import {
- nostrClient as defaultNostrClient,
- requestDefaultExtensionPermissions,
-} from "./nostrClientFacade.js";
-
-export { requestDefaultExtensionPermissions };
-export { defaultNostrClient as nostrClient };
-
-export const publishVideoReaction = (...args) => {
- if (
- !defaultNostrClient ||
- typeof defaultNostrClient.publishVideoReaction !== "function"
- ) {
- throw new Error("Video reaction publishing is unavailable in this build.");
- }
- return defaultNostrClient.publishVideoReaction(...args);
-};
-
-export const publishVideoComment = (...args) => {
- if (
- !defaultNostrClient ||
- typeof defaultNostrClient.publishVideoComment !== "function"
- ) {
- throw new Error("Video comment publishing is unavailable in this build.");
- }
- return defaultNostrClient.publishVideoComment(...args);
-};
-
-export const fetchVideoComments = (...args) => {
- if (
- !defaultNostrClient ||
- typeof defaultNostrClient.fetchVideoComments !== "function"
- ) {
- throw new Error("Video comment fetching is unavailable in this build.");
- }
- return defaultNostrClient.fetchVideoComments(...args);
-};
-
-export const subscribeVideoComments = (...args) => {
- if (
- !defaultNostrClient ||
- typeof defaultNostrClient.subscribeVideoComments !== "function"
- ) {
- throw new Error("Video comment subscriptions are unavailable in this build.");
- }
- return defaultNostrClient.subscribeVideoComments(...args);
-};
-
-export {
- __testExports,
- NostrClient,
- getActiveSigner,
- setActiveSigner,
- clearActiveSigner,
- resolveActiveSigner,
- shouldRequestExtensionPermissions,
-} from "./nostr/client.js";
-
-export {
- DEFAULT_NIP07_ENCRYPTION_METHODS,
- DEFAULT_NIP07_PERMISSION_METHODS,
-} from "./nostr/nip07Permissions.js";
-
-export {
- buildNip71MetadataTags,
- buildNip71VideoEvent,
- collectNip71PointerRequests,
- convertEventToVideo,
- extractNip71MetadataFromTags,
- getDTagValueFromTags,
- mergeNip71MetadataIntoVideo,
- populateNip71MetadataForVideos,
- processNip71Events,
- buildVideoPointerValue,
- stringFromInput,
-} from "./nostr/nip71.js";
-
-export {
- normalizePointerInput,
- pointerKey,
- buildWatchHistoryPayload,
- normalizeActorKey,
- parseWatchHistoryContentWithFallback,
- isNip04EncryptedWatchHistoryEvent,
- watchHistoryHelpers,
-} from "./nostr/watchHistory.js";
-
-export {
- recordVideoViewWithDefaultClient,
- listVideoViewEventsWithDefaultClient,
- subscribeVideoViewEventsWithDefaultClient,
- countVideoViewEventsWithDefaultClient,
-} from "./nostrViewEventsFacade.js";
-
-export {
- VIEW_EVENT_KIND,
- createVideoViewEventFilters,
- deriveViewEventBucketIndex,
- deriveViewEventPointerScope,
- getViewEventGuardWindowMs,
- hasRecentViewPublish,
- rememberViewPublish,
- publishViewEvent,
- recordVideoView as recordVideoViewWithClient,
- listVideoViewEvents as listVideoViewEventsWithClient,
- subscribeVideoViewEvents as subscribeVideoViewEventsWithClient,
- countVideoViewEvents as countVideoViewEventsWithClient,
-} from "./nostrViewEventsFacade.js";
-
-export {
- updateWatchHistoryListWithDefaultClient,
- removeWatchHistoryItemWithDefaultClient,
-} from "./nostrWatchHistoryFacade.js";
-
-export {
- updateWatchHistoryListWithDefaultClient as updateWatchHistoryList,
- removeWatchHistoryItemWithDefaultClient as removeWatchHistoryItem,
-} from "./nostrWatchHistoryFacade.js";
-
-export {
- recordVideoViewWithDefaultClient as recordVideoView,
- listVideoViewEventsWithDefaultClient as listVideoViewEvents,
- subscribeVideoViewEventsWithDefaultClient as subscribeVideoViewEvents,
- countVideoViewEventsWithDefaultClient as countVideoViewEvents,
-} from "./nostrViewEventsFacade.js";
-
-// Legacy modules should import from the specific facades above instead of this
-// shim. The wildcard export that previously forwarded the entire
-// "./nostr/index.js" barrel has intentionally been removed so bundlers can tree
-// shake unused helpers.
diff --git a/js/payments/platformAddress.js b/js/payments/platformAddress.js
index 80891965..d2ff6f53 100644
--- a/js/payments/platformAddress.js
+++ b/js/payments/platformAddress.js
@@ -1,7 +1,7 @@
// js/payments/platformAddress.js
import { PLATFORM_LUD16_OVERRIDE, ADMIN_SUPER_NPUB } from "../config.js";
-import { nostrClient } from "../nostr.js";
+import { nostrClient } from "../nostrClientFacade.js";
import { setProfileCacheEntry } from "../state/cache.js";
import { nostrToolsReady } from "../nostrToolsBootstrap.js";
import { userLogger } from "../utils/logger.js";
diff --git a/js/reactionCounter.js b/js/reactionCounter.js
index 102ed6a3..648caef3 100644
--- a/js/reactionCounter.js
+++ b/js/reactionCounter.js
@@ -1,4 +1,3 @@
-import { publishVideoReaction } from "./nostr.js";
import { nostrClient } from "./nostrClientFacade.js";
import { normalizePointerInput, pointerKey } from "./nostr/watchHistory.js";
import { devLogger, userLogger } from "./utils/logger.js";
@@ -749,7 +748,10 @@ export const reactionCounter = {
}
}
- const result = await publishVideoReaction(enrichedPointer, publishOptions);
+ const result = await nostrClient.publishVideoReaction(
+ enrichedPointer,
+ publishOptions,
+ );
if (!result || !result.ok) {
userLogger.warn(
"[reactionCounter] Reaction publish rejected by relays:",
diff --git a/js/services/moderationService.js b/js/services/moderationService.js
index 338c89df..6562567c 100644
--- a/js/services/moderationService.js
+++ b/js/services/moderationService.js
@@ -1,4 +1,4 @@
-import { nostrClient } from "../nostr.js";
+import { nostrClient } from "../nostrClientFacade.js";
import { publishEventToRelays, assertAnyRelayAccepted } from "../nostrPublish.js";
import { accessControl } from "../accessControl.js";
import { userBlocks, USER_BLOCK_EVENTS } from "../userBlocks.js";
diff --git a/js/services/nostrService.js b/js/services/nostrService.js
index 64a71a55..89da0d17 100644
--- a/js/services/nostrService.js
+++ b/js/services/nostrService.js
@@ -1,4 +1,4 @@
-import { nostrClient } from "../nostr.js";
+import { nostrClient } from "../nostrClientFacade.js";
import { convertEventToVideo } from "../nostr/index.js";
import { accessControl } from "../accessControl.js";
import { ALLOW_NSFW_CONTENT } from "../config.js";
diff --git a/js/utils/profileBatchFetcher.js b/js/utils/profileBatchFetcher.js
index 8b480c45..9a5111e6 100644
--- a/js/utils/profileBatchFetcher.js
+++ b/js/utils/profileBatchFetcher.js
@@ -1,6 +1,6 @@
// js/utils/profileBatchFetcher.js
-import { nostrClient } from "../nostr.js";
+import { nostrClient } from "../nostrClientFacade.js";
import { devLogger } from "./logger.js";
const DEFAULT_PROFILE_IMAGE = "assets/svg/default-profile.svg";
diff --git a/js/viewCounter.js b/js/viewCounter.js
index 801c65c8..29d83bc4 100644
--- a/js/viewCounter.js
+++ b/js/viewCounter.js
@@ -566,8 +566,9 @@ function ensureLiveSubscription(key, listeners) {
export function initViewCounter({ nostrClient } = {}) {
if (nostrClient && typeof nostrClient === "object") {
- // The singleton Nostr client is already registered inside js/nostr.js.
- // This hook remains for backwards compatibility.
+ // The singleton Nostr client is already registered inside
+ // js/nostr/defaultClient.js. This hook remains for backwards
+ // compatibility.
}
}
diff --git a/tests/admin-list-store.test.mjs b/tests/admin-list-store.test.mjs
index 5c85ae1f..bcf3df43 100644
--- a/tests/admin-list-store.test.mjs
+++ b/tests/admin-list-store.test.mjs
@@ -52,7 +52,10 @@ const {
} = await import(
"../js/adminListStore.js"
);
-const { nostrClient, setActiveSigner } = await import("../js/nostr.js");
+const [{ nostrClient }, { setActiveSigner }] = await Promise.all([
+ import("../js/nostrClientFacade.js"),
+ import("../js/nostr/client.js"),
+]);
const {
ADMIN_SUPER_NPUB,
ADMIN_LIST_NAMESPACE,
diff --git a/tests/app-batch-fetch-profiles.test.mjs b/tests/app-batch-fetch-profiles.test.mjs
index 4a3680d2..df90a4bc 100644
--- a/tests/app-batch-fetch-profiles.test.mjs
+++ b/tests/app-batch-fetch-profiles.test.mjs
@@ -1,6 +1,6 @@
import test from "node:test";
import assert from "node:assert/strict";
-import { nostrClient } from "../js/nostr.js";
+import { nostrClient } from "../js/nostrClientFacade.js";
import { batchFetchProfilesFromRelays } from "../js/utils/profileBatchFetcher.js";
const FAST_RELAY = "wss://fast.example";
diff --git a/tests/hashtag-preferences.test.mjs b/tests/hashtag-preferences.test.mjs
index f6bb3b66..63a98d7c 100644
--- a/tests/hashtag-preferences.test.mjs
+++ b/tests/hashtag-preferences.test.mjs
@@ -5,11 +5,11 @@ const hashtagPreferencesModule = await import(
"../js/services/hashtagPreferencesService.js"
);
const hashtagPreferences = hashtagPreferencesModule.default;
-const {
- nostrClient,
- setActiveSigner,
- clearActiveSigner,
-} = await import("../js/nostr.js");
+const [{ nostrClient }, { setActiveSigner, clearActiveSigner }] =
+ await Promise.all([
+ import("../js/nostrClientFacade.js"),
+ import("../js/nostr/client.js"),
+ ]);
if (typeof globalThis.window === "undefined") {
globalThis.window = {};
diff --git a/tests/legacy-infohash.test.mjs b/tests/legacy-infohash.test.mjs
index b6beeace..6a05fe0a 100644
--- a/tests/legacy-infohash.test.mjs
+++ b/tests/legacy-infohash.test.mjs
@@ -1,7 +1,7 @@
import "./test-helpers/setup-localstorage.mjs";
import assert from "node:assert/strict";
import { parseVideoEventPayload } from "../js/videoEventUtils.js";
-import { convertEventToVideo } from "../js/nostr.js";
+import { convertEventToVideo } from "../js/nostr/nip71.js";
import { deriveTorrentPlaybackConfig } from "../js/playbackUtils.js";
const LEGACY_INFO_HASH = "0123456789abcdef0123456789abcdef01234567";
diff --git a/tests/moderation/trusted-mute-lists.test.mjs b/tests/moderation/trusted-mute-lists.test.mjs
index fd4ea988..f6e211c2 100644
--- a/tests/moderation/trusted-mute-lists.test.mjs
+++ b/tests/moderation/trusted-mute-lists.test.mjs
@@ -11,7 +11,9 @@ import { withMockedNostrTools, createModerationServiceHarness } from "../helpers
const { userBlocks } = await import("../../js/userBlocks.js");
const { nostrClient } = await import("../../js/nostrClientFacade.js");
-const { setActiveSigner, clearActiveSigner } = await import("../../js/nostr.js");
+const { setActiveSigner, clearActiveSigner } = await import(
+ "../../js/nostr/client.js"
+);
test("trusted mute lists from seeds hide authors for anonymous viewers", async (t) => {
withMockedNostrTools(t);
diff --git a/tests/nip71-base-event-tags.test.mjs b/tests/nip71-base-event-tags.test.mjs
index b1050579..ab04e40b 100644
--- a/tests/nip71-base-event-tags.test.mjs
+++ b/tests/nip71-base-event-tags.test.mjs
@@ -2,7 +2,8 @@ import assert from "node:assert/strict";
import test from "node:test";
import { buildVideoPostEvent } from "../js/nostrEventSchemas.js";
-import { buildNip71MetadataTags, NostrClient } from "../js/nostr.js";
+import { buildNip71MetadataTags } from "../js/nostr/nip71.js";
+import { NostrClient } from "../js/nostr/client.js";
test("30078 events carry nip71 metadata tags and hydrate fallback metadata", () => {
const metadataInput = {
diff --git a/tests/nip71-builder.test.mjs b/tests/nip71-builder.test.mjs
index 6fa005be..8facfc5f 100644
--- a/tests/nip71-builder.test.mjs
+++ b/tests/nip71-builder.test.mjs
@@ -4,7 +4,7 @@ import test from "node:test";
import {
buildNip71VideoEvent,
extractNip71MetadataFromTags,
-} from "../js/nostr.js";
+} from "../js/nostr/nip71.js";
const participantNpub = "npub1bitvidparticipantfixture";
const participantHexFromNpub = "c".repeat(64);
diff --git a/tests/nostr-count-fallback.test.mjs b/tests/nostr-count-fallback.test.mjs
index f3490498..2903b2c2 100644
--- a/tests/nostr-count-fallback.test.mjs
+++ b/tests/nostr-count-fallback.test.mjs
@@ -12,9 +12,7 @@ if (!globalThis.window.NostrTools) {
}
const { VIEW_COUNT_BACKFILL_MAX_DAYS } = await import("../js/config.js");
-const { nostrClient } = await import("../js/nostr.js");
-
-const NostrClient = nostrClient.constructor;
+const { NostrClient } = await import("../js/nostr/client.js");
async function withFrozenTime(timestampSeconds, callback) {
const originalNow = Date.now;
diff --git a/tests/nostr-delete-flow.test.mjs b/tests/nostr-delete-flow.test.mjs
index 4b5d7a4a..c0848fe6 100644
--- a/tests/nostr-delete-flow.test.mjs
+++ b/tests/nostr-delete-flow.test.mjs
@@ -1,6 +1,6 @@
import "./test-helpers/setup-localstorage.mjs";
import assert from "node:assert/strict";
-import { NostrClient } from "../js/nostr.js";
+import { NostrClient } from "../js/nostr/client.js";
import { NostrService } from "../js/services/nostrService.js";
await (async function testDeleteFlowPublishesDeletionFlag() {
diff --git a/tests/nostr-login-permissions.test.mjs b/tests/nostr-login-permissions.test.mjs
index 5f389496..541a12d3 100644
--- a/tests/nostr-login-permissions.test.mjs
+++ b/tests/nostr-login-permissions.test.mjs
@@ -2,7 +2,8 @@ import "./test-helpers/setup-localstorage.mjs";
import assert from "node:assert/strict";
import test from "node:test";
-import { NostrClient, nostrClient, __testExports } from "../js/nostr.js";
+import { nostrClient } from "../js/nostrClientFacade.js";
+import { NostrClient, __testExports } from "../js/nostr/client.js";
import { accessControl } from "../js/accessControl.js";
const {
diff --git a/tests/nostr-private-key-signer.test.mjs b/tests/nostr-private-key-signer.test.mjs
index f2e7d154..b7301187 100644
--- a/tests/nostr-private-key-signer.test.mjs
+++ b/tests/nostr-private-key-signer.test.mjs
@@ -17,9 +17,11 @@ test("registerPrivateKeySigner exposes nip04 helpers", async () => {
value: canonicalTools,
});
- const { nostrClient, getActiveSigner, clearActiveSigner } = await import(
- "../js/nostr.js"
- );
+ const [{ nostrClient }, { getActiveSigner, clearActiveSigner }] =
+ await Promise.all([
+ import("../js/nostrClientFacade.js"),
+ import("../js/nostr/client.js"),
+ ]);
const privateKeyBytes = nostrTools.generateSecretKey();
const privateKeyHex = nostrTools.utils.bytesToHex(privateKeyBytes);
diff --git a/tests/nostr-publish-rejection.test.mjs b/tests/nostr-publish-rejection.test.mjs
index 24dfce57..93ac0d6e 100644
--- a/tests/nostr-publish-rejection.test.mjs
+++ b/tests/nostr-publish-rejection.test.mjs
@@ -48,7 +48,11 @@ let activeSignerCleanup = null;
try {
const { RelayPublishError } = await import("../js/nostrPublish.js");
- const { nostrClient, setActiveSigner, clearActiveSigner } = await import("../js/nostr.js");
+ const [{ nostrClient }, { setActiveSigner, clearActiveSigner }] =
+ await Promise.all([
+ import("../js/nostrClientFacade.js"),
+ import("../js/nostr/client.js"),
+ ]);
const { subscriptions } = await import("../js/subscriptions.js");
const { userBlocks } = await import("../js/userBlocks.js");
const { Application } = await import("../js/app.js");
diff --git a/tests/nostr-send-direct-message.test.mjs b/tests/nostr-send-direct-message.test.mjs
index d50eed7c..4af04f7f 100644
--- a/tests/nostr-send-direct-message.test.mjs
+++ b/tests/nostr-send-direct-message.test.mjs
@@ -25,9 +25,11 @@ test("sendDirectMessage succeeds with private key signer and no extension", asyn
value: canonicalTools,
});
- const { nostrClient, getActiveSigner, clearActiveSigner } = await import(
- "../js/nostr.js"
- );
+ const [{ nostrClient }, { getActiveSigner, clearActiveSigner }] =
+ await Promise.all([
+ import("../js/nostrClientFacade.js"),
+ import("../js/nostr/client.js"),
+ ]);
const previousPool = nostrClient.pool;
const previousRelays = Array.isArray(nostrClient.relays)
diff --git a/tests/nostr/edit-video-dtag.test.mjs b/tests/nostr/edit-video-dtag.test.mjs
index dd3b5070..edc15ce1 100644
--- a/tests/nostr/edit-video-dtag.test.mjs
+++ b/tests/nostr/edit-video-dtag.test.mjs
@@ -5,7 +5,7 @@ import {
NostrClient,
setActiveSigner,
clearActiveSigner,
-} from "../../js/nostr.js";
+} from "../../js/nostr/client.js";
const noop = () => {};
diff --git a/tests/nostr/integration-remote-flow.test.mjs b/tests/nostr/integration-remote-flow.test.mjs
index 3ec81091..e4dd56d2 100644
--- a/tests/nostr/integration-remote-flow.test.mjs
+++ b/tests/nostr/integration-remote-flow.test.mjs
@@ -12,8 +12,8 @@ import {
const {
nostrClient,
- clearActiveSigner,
-} = await import("../../js/nostr.js");
+} = await import("../../js/nostrClientFacade.js");
+const { clearActiveSigner } = await import("../../js/nostr/client.js");
const { accessControl } = await import("../../js/accessControl.js");
const { WATCH_HISTORY_KIND } = await import("../../js/config.js");
const { normalizeActorKey } = await import("../../js/nostr/watchHistory.js");
diff --git a/tests/nostr/revert-video-dtag.test.mjs b/tests/nostr/revert-video-dtag.test.mjs
index 758a109c..9b35c723 100644
--- a/tests/nostr/revert-video-dtag.test.mjs
+++ b/tests/nostr/revert-video-dtag.test.mjs
@@ -5,7 +5,7 @@ import {
NostrClient,
setActiveSigner,
clearActiveSigner,
-} from "../../js/nostr.js";
+} from "../../js/nostr/client.js";
function createStubPool() {
return {
diff --git a/tests/nostr/signers.test.mjs b/tests/nostr/signers.test.mjs
index a4cb2591..469d7b4d 100644
--- a/tests/nostr/signers.test.mjs
+++ b/tests/nostr/signers.test.mjs
@@ -5,7 +5,7 @@ const {
setActiveSigner,
resolveActiveSigner,
clearActiveSigner,
-} = await import("../../js/nostr.js");
+} = await import("../../js/nostr/client.js");
test("setActiveSigner hydrates extension capabilities from window.nostr", async () => {
clearActiveSigner();
diff --git a/tests/subscriptions-manager.test.mjs b/tests/subscriptions-manager.test.mjs
index e7c50597..f72d40eb 100644
--- a/tests/subscriptions-manager.test.mjs
+++ b/tests/subscriptions-manager.test.mjs
@@ -3,7 +3,8 @@ import assert from "node:assert/strict";
import { JSDOM } from "jsdom";
-import { nostrClient, getActiveSigner, setActiveSigner } from "../js/nostr.js";
+import { nostrClient } from "../js/nostrClientFacade.js";
+import { getActiveSigner, setActiveSigner } from "../js/nostr/client.js";
import { subscriptions } from "../js/subscriptions.js";
import { setApplication } from "../js/applicationContext.js";
import nostrService from "../js/services/nostrService.js";
diff --git a/tests/user-blocks.test.mjs b/tests/user-blocks.test.mjs
index 044c2568..3a418e39 100644
--- a/tests/user-blocks.test.mjs
+++ b/tests/user-blocks.test.mjs
@@ -4,10 +4,10 @@ import assert from "node:assert/strict";
const { userBlocks, USER_BLOCK_EVENTS } = await import("../js/userBlocks.js");
const {
nostrClient,
- setActiveSigner,
- clearActiveSigner,
- getActiveSigner,
-} = await import("../js/nostr.js");
+} = await import("../js/nostrClientFacade.js");
+const { setActiveSigner, clearActiveSigner, getActiveSigner } = await import(
+ "../js/nostr/client.js"
+);
if (typeof globalThis.window === "undefined") {
globalThis.window = {};
diff --git a/tests/video-modal-zap.test.mjs b/tests/video-modal-zap.test.mjs
index 1011fb1c..0a1ae2bd 100644
--- a/tests/video-modal-zap.test.mjs
+++ b/tests/video-modal-zap.test.mjs
@@ -431,7 +431,7 @@ await (async () => {
splitAndZap: async () => ({ receipts: [] }),
});
- const { nostrClient } = await import("../js/nostr.js");
+ const { nostrClient } = await import("../js/nostrClientFacade.js");
const originalSessionActor = nostrClient.sessionActor;
const sessionPubkey = "a".repeat(64);
nostrClient.sessionActor = { pubkey: sessionPubkey, privateKey: "priv" };
diff --git a/tests/video-schema-and-conversion.test.mjs b/tests/video-schema-and-conversion.test.mjs
index facb4652..efc4056c 100644
--- a/tests/video-schema-and-conversion.test.mjs
+++ b/tests/video-schema-and-conversion.test.mjs
@@ -5,7 +5,7 @@ import {
NOTE_TYPES,
getNostrEventSchema,
} from "../js/nostrEventSchemas.js";
-import { convertEventToVideo } from "../js/nostr.js";
+import { convertEventToVideo } from "../js/nostr/nip71.js";
test("video post schema documents nsfw and kids flags", () => {
const schema = getNostrEventSchema(NOTE_TYPES.VIDEO_POST);
diff --git a/tests/view-counter.test.mjs b/tests/view-counter.test.mjs
index fa8e415b..7c5cbef8 100644
--- a/tests/view-counter.test.mjs
+++ b/tests/view-counter.test.mjs
@@ -142,7 +142,7 @@ assert.ok(
"invalid additional tag values should not be coerced to object strings"
);
-const { nostrClient } = await import("../js/nostr.js");
+const { nostrClient } = await import("../js/nostrClientFacade.js");
function createMockNostrHarness() {
const storedEvents = new Map();
diff --git a/tests/watch-history.test.mjs b/tests/watch-history.test.mjs
index c2ed27ab..2dd5f9a6 100644
--- a/tests/watch-history.test.mjs
+++ b/tests/watch-history.test.mjs
@@ -17,9 +17,11 @@ const {
getWatchHistoryV2Enabled,
setWatchHistoryV2Enabled,
} = await import("../js/constants.js");
-const { nostrClient, setActiveSigner, getActiveSigner, clearActiveSigner } = await import(
- "../js/nostr.js",
-);
+const [{ nostrClient }, { setActiveSigner, getActiveSigner, clearActiveSigner }] =
+ await Promise.all([
+ import("../js/nostrClientFacade.js"),
+ import("../js/nostr/client.js"),
+ ]);
const { rememberNostrTools } = await import("../js/nostr/toolkit.js");
const { normalizeActorKey } = await import("../js/nostr/watchHistory.js");
const { watchHistoryService } = await import("../js/watchHistoryService.js");
diff --git a/tests/zap-split.test.mjs b/tests/zap-split.test.mjs
index 9eb95665..44a44757 100644
--- a/tests/zap-split.test.mjs
+++ b/tests/zap-split.test.mjs
@@ -90,7 +90,7 @@ const {
requestInvoice,
} = lnurlModule;
const { decodeLnurlBech32 } = lnurlModule.__TESTING__;
-const { nostrClient } = await import("../js/nostr.js");
+const { nostrClient } = await import("../js/nostrClientFacade.js");
const DEFAULT_WALLET_RELAYS = [
"wss://wallet.primary.example",