- Implements `scripts/agent/interop-test.mjs` using Playwright to run integration tests in a browser context.
- Tests include:
- Publishing `VIDEO_POST` (Kind 30078) events using schema builders.
- Verifying event roundtrip (fetch by ID).
- Publishing `VIEW_EVENT` (Watch History).
- Sending and decrypting Encrypted DMs (NIP-04/NIP-44) using ephemeral keys.
- Uses local `simple-relay.mjs` (port 8008) and Python HTTP server (port 8001) to ensure environment isolation.
- Generates artifacts in `artifacts/` folder including logs and reports.
- Added `scripts/agent/validate-events.mjs` to validate event builders against schemas.
- Fixed `NOTE_TYPES.REPOST` schema content format (json instead of empty).
- Added `NOTE_TYPES.MUTE_LIST` and `buildMuteListEvent`.
- Added `buildProfileMetadataEvent` to standardise Kind 0 creation.
- Updated `js/ui/profileModalController.js` to use `buildProfileMetadataEvent`.
- Updated `js/userBlocks.js` to use `buildMuteListEvent` for publishing mute list snapshots.
- Updated `docs/nostr-event-schemas.md` with new schemas and builders.
Implements `scripts/agent/load-test.mjs` to simulate N clients publishing
video and view events to a relay. Includes:
- Latency and throughput metrics.
- Signing time profiling.
- Safety guardrails to prevent accidental stress testing of public relays.
- A lightweight local relay (`scripts/agent/simple-relay.mjs`) for testing.
Outputs a report to `artifacts/load-report-YYYYMMDD.json`.
Removes a premature call to `initializeLoginModalController` in `ApplicationBootstrap` which was attempting to initialize the login modal before the DOM was fully hydrated, causing a "modal container not found" warning during startup. The modal is already correctly initialized later in `js/index.js` after markup loading completes.
- Add fuzz testing scripts for `nostrEventSchemas.js`, `dmDecryptor.js`, and `magnetUtils.js` in `scripts/agent/`.
- Fix `build...` functions in `nostrEventSchemas.js` to handle `null`/`undefined` inputs.
- Fix `buildVideoPostEvent` to gracefully handle circular references in content serialization.
- Fix `normalizeAndAugmentMagnet` in `magnetUtils.js` to handle non-iterable `extraTrackers`.
- Include minimal reproducers for discovered crashes in `examples/reproducers/`.
Implements `scripts/agent/interop-test.mjs` to validate core Nostr operations
(Video Post, View Event, Encrypted DM) against a small set of public relays.
Ensures ephemeral keys are used and no private data is persisted.
Features:
- Ephemeral sender/receiver key generation.
- Polyfills for WebSocket, localStorage, and Crypto for Node.js environment.
- Verification of event signatures, IDs, and content shape.
- DM encryption/decryption roundtrip verification.
- Safe relay list usage (only 2 known relays).
Added `scripts/agent/smoke-test.mjs` to verify key application flows in a headless environment.
Features:
- Verifies Relay Connection
- Verifies NSEC Login (Ephemeral)
- Verifies Video Publishing (Sign & Send)
- Verifies Event Retrieval
- Verifies DM Encryption/Decryption
Usage:
```bash
npm install
node scripts/agent/smoke-test.mjs
```
Artifacts (logs/reports) are generated in `artifacts/` and are ignored by git.
Utilizes `scripts/agent/simple-relay.mjs` for a local relay.
Uses `jsdom` to polyfill browser environment for `NostrClient`.