Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
ab22d13
fix: reject undefined NIP-44 versions (#112)
AustinKelsay Jul 18, 2026
fa85df2
test: cover legacy NIP-44 rejection through decrypt (#112)
AustinKelsay Jul 18, 2026
03e4eb5
fix: enforce NIP-44 v2 nonce size (#112)
AustinKelsay Jul 18, 2026
aaba75c
docs: record NIP-44 cleanup PR (#112)
AustinKelsay Jul 18, 2026
9d3a1f9
docs: harden NIP-44 compatibility demos (#112)
AustinKelsay Jul 18, 2026
c7cb99f
Merge pull request #120 from AustinKelsay/feature/nip44-legacy-compat
AustinKelsay Jul 18, 2026
003e8d8
refactor: centralize protocol message types (#118)
AustinKelsay Jul 18, 2026
f1f09fe
fix: preserve invalid REQ diagnostics (#118)
AustinKelsay Jul 18, 2026
22199a1
test: use portable Relay transport for REQ diagnostics (#118)
AustinKelsay Jul 18, 2026
8c36233
Merge pull request #121 from AustinKelsay/feature/protocol-message-types
AustinKelsay Jul 18, 2026
ad32550
refactor: extract Relay event store (#113)
AustinKelsay Jul 18, 2026
da7361e
Merge pull request #122 from AustinKelsay/feature/relay-event-store
AustinKelsay Jul 18, 2026
b05a41d
refactor: extract NIP-47 protocol machinery (#114)
AustinKelsay Jul 18, 2026
d7763ed
fix: address NIP-47 hosted review
AustinKelsay Jul 18, 2026
4e40b63
Merge pull request #123 from AustinKelsay/feature/nip47-protocol-codecs
AustinKelsay Jul 18, 2026
766f792
refactor: extract Nostr relay registry (#115)
AustinKelsay Jul 18, 2026
9e3aca8
Merge pull request #124 from AustinKelsay/feature/nostr-relay-registry
AustinKelsay Jul 18, 2026
a67af0f
refactor: clarify ephemeral Relay ownership (#116)
AustinKelsay Jul 18, 2026
ad90e70
test: verify packed testing subpaths (#116)
AustinKelsay Jul 18, 2026
94eed4a
Merge pull request #125 from AustinKelsay/feature/ephemeral-relay-own…
AustinKelsay Jul 18, 2026
e888f99
refactor: consolidate security validation ownership (#117)
AustinKelsay Jul 18, 2026
e0824a7
test: document validation compatibility (#117)
AustinKelsay Jul 18, 2026
1838789
Merge pull request #126 from AustinKelsay/feature/security-validation…
AustinKelsay Jul 18, 2026
9195801
chore: declare canonical package-manager policy (#119)
AustinKelsay Jul 18, 2026
46055d6
test: enforce package-manager workflow ownership (#119)
AustinKelsay Jul 18, 2026
8a04c9a
Merge pull request #127 from AustinKelsay/feature/package-manager-policy
AustinKelsay Jul 18, 2026
6338a75
docs: close deep-cleanup integration audit (#111)
AustinKelsay Jul 18, 2026
3312cdf
Merge pull request #128 from AustinKelsay/chore/deep-cleanup-final-audit
AustinKelsay Jul 18, 2026
02e0f8f
docs: label cleanup delivery PRs accurately (#111)
AustinKelsay Jul 18, 2026
f4bda34
Merge pull request #129 from AustinKelsay/docs/final-ledger-label
AustinKelsay Jul 18, 2026
7ed8433
fix(nip46): redact sensitive diagnostics
AustinKelsay Jul 18, 2026
00104cc
test(nip46): harden diagnostic redaction
AustinKelsay Jul 18, 2026
21b4ad9
fix(nip46): cover private-key diagnostics
AustinKelsay Jul 19, 2026
4ce57a3
docs(agents): record nip46 redaction delivery
AustinKelsay Jul 19, 2026
af127f6
docs(agents): link nip46 redaction pr
AustinKelsay Jul 19, 2026
426c17b
fix(nip46): redact reflected diagnostic errors
AustinKelsay Jul 19, 2026
2c8e5be
docs(agents): record hosted diagnostic review
AustinKelsay Jul 19, 2026
4ea5fbc
docs(agents): record clean local review
AustinKelsay Jul 19, 2026
9a5883c
docs(agents): mark nip46 hosted gates green
AustinKelsay Jul 19, 2026
cf705f0
Merge pull request #140 from AustinKelsay/feature/nip46-diagnostic-re…
AustinKelsay Jul 19, 2026
0c111d7
fix(types): remove Jest from published declarations
AustinKelsay Jul 19, 2026
20565a0
test(types): harden declaration purity checks
AustinKelsay Jul 19, 2026
abfc836
docs(review): record local CodeRabbit outcome
AustinKelsay Jul 19, 2026
dea7aa0
fix(pack): surface consumer install failures
AustinKelsay Jul 19, 2026
466d1d5
docs(review): record clean declaration review
AustinKelsay Jul 19, 2026
0d0ef41
docs(run): link declaration purity PR
AustinKelsay Jul 19, 2026
a197824
docs(run): record hosted declaration gates
AustinKelsay Jul 19, 2026
46d7289
Merge pull request #141 from AustinKelsay/feature/public-type-test-pu…
AustinKelsay Jul 19, 2026
b238461
feat: complete shared diagnostic seam
AustinKelsay Jul 19, 2026
6dd75c3
fix: harden diagnostic policy propagation
AustinKelsay Jul 19, 2026
ae15ace
fix: keep failure classification non-throwing
AustinKelsay Jul 19, 2026
2a3556d
Merge pull request #142 from AustinKelsay/feature/shared-diagnostics-…
AustinKelsay Jul 19, 2026
569b266
fix(nip47): make service lifecycle restart-safe
AustinKelsay Jul 19, 2026
644b52f
docs: record issue 134 verification
AustinKelsay Jul 19, 2026
ec8a754
docs: address issue 134 review record
AustinKelsay Jul 19, 2026
d9b2f69
docs: finalize issue 134 local review
AustinKelsay Jul 19, 2026
4782fdb
docs: record issue 134 pull request
AustinKelsay Jul 19, 2026
25e055d
Merge pull request #143 from AustinKelsay/feature/nip47-service-lifec…
AustinKelsay Jul 19, 2026
0909227
refactor(nip57): consolidate zap client behavior
AustinKelsay Jul 19, 2026
1b12872
fix(nip57): harden shared zap flow
AustinKelsay Jul 19, 2026
47d3707
docs: finalize issue 135 local review
AustinKelsay Jul 19, 2026
b66d483
fix(nip57): normalize empty zap statistics
AustinKelsay Jul 19, 2026
ed9fa4a
Merge pull request #144 from AustinKelsay/feature/nip57-client-consol…
AustinKelsay Jul 19, 2026
cf3819b
refactor(nip46): unify protocol machinery
AustinKelsay Jul 19, 2026
baa2bf2
fix(nip46): harden shared protocol core
AustinKelsay Jul 19, 2026
03a6652
fix(nip46): bound bunker publishes
AustinKelsay Jul 19, 2026
7b5a7d0
test(nip46): cover correlator cleanup
AustinKelsay Jul 19, 2026
2d4fc6f
test(nip46): use synthetic wire keys
AustinKelsay Jul 19, 2026
d983bae
test(nip46): make correlator assertions portable
AustinKelsay Jul 19, 2026
01a7aea
docs: finalize issue 136 review evidence
AustinKelsay Jul 19, 2026
bc342cd
fix(nip46): clean up rejected connects
AustinKelsay Jul 19, 2026
9e029be
docs: align issue 136 hosted state
AustinKelsay Jul 19, 2026
1c38f2c
fix(nip46): harden lifecycle follow-ups
AustinKelsay Jul 19, 2026
2bf1938
docs: record issue 136 follow-up reviews
AustinKelsay Jul 19, 2026
d881cc7
docs: record final issue 136 local gates
AustinKelsay Jul 19, 2026
8b970e4
Merge pull request #145 from AustinKelsay/feature/nip46-protocol-core
AustinKelsay Jul 19, 2026
0de11d9
test: split routine and slow assurance lanes
AustinKelsay Jul 19, 2026
91ffafa
test: cover complete lane discovery contract
AustinKelsay Jul 19, 2026
45a1a4f
docs: record fast test lane verification
AustinKelsay Jul 19, 2026
295d114
test: keep Bun watch discovery dynamic
AustinKelsay Jul 19, 2026
d8de419
test: support pinned Bun watch filtering
AustinKelsay Jul 19, 2026
a39ee85
docs: synchronize issue 137 commit record
AustinKelsay Jul 19, 2026
5a2d94b
docs: clarify pinned Bun verification
AustinKelsay Jul 19, 2026
2c278e7
docs: record final issue 137 verification
AustinKelsay Jul 19, 2026
8dd73fb
docs: separate test lane commands
AustinKelsay Jul 19, 2026
b33f31f
Merge pull request #146 from AustinKelsay/feature/fast-default-test-loop
AustinKelsay Jul 19, 2026
bfd3314
test: define public behavior seam contract
AustinKelsay Jul 19, 2026
93cde85
test: replace Nostr and Relay private-shape adapters
AustinKelsay Jul 19, 2026
72c8d90
test: replace NIP-46 and NIP-47 private-shape casts
AustinKelsay Jul 19, 2026
9312c38
test: remove remaining Relay and Nostr private casts
AustinKelsay Jul 19, 2026
2074453
test: tighten behavior seams after review
AustinKelsay Jul 19, 2026
7fa8772
test: restore cleanup and replacement sensitivity
AustinKelsay Jul 19, 2026
81d3710
test: close final behavior coverage gaps
AustinKelsay Jul 19, 2026
241b4b5
test: address CodeRabbit cleanup findings
AustinKelsay Jul 19, 2026
7bdbcfa
test: keep NIP-04 permission fixture restrictive
AustinKelsay Jul 19, 2026
2424807
docs: record issue 138 verification
AustinKelsay Jul 19, 2026
0cfb1c6
test: harden behavior control cleanup
AustinKelsay Jul 19, 2026
3c1e905
Merge pull request #147 from AustinKelsay/feature/public-behavior-tes…
AustinKelsay Jul 19, 2026
e82cce5
docs: start issue 139 session
AustinKelsay Jul 19, 2026
d6504f6
refactor: split ephemeral relay internals
AustinKelsay Jul 19, 2026
7a48586
refactor: deepen relay internal boundaries
AustinKelsay Jul 19, 2026
f8e9aac
fix: harden relay transport cleanup
AustinKelsay Jul 19, 2026
96dd79f
test: stop relay session polling cleanly
AustinKelsay Jul 19, 2026
26a86ef
docs: record issue 139 review evidence
AustinKelsay Jul 19, 2026
d2576f0
docs: finalize issue 139 review
AustinKelsay Jul 19, 2026
d5b7cf5
docs: correct issue 139 verification totals
AustinKelsay Jul 19, 2026
9c9e14c
Merge pull request #148 from AustinKelsay/feature/ephemeral-relay-int…
AustinKelsay Jul 19, 2026
9d102ef
docs: finalize cleanup run ledger
AustinKelsay Jul 19, 2026
d6613e1
Merge pull request #149 from AustinKelsay/docs/finalize-cleanup-ledger
AustinKelsay Jul 19, 2026
829f4d4
Merge main into staging
AustinKelsay Jul 19, 2026
e1c0dca
Merge pull request #151 from AustinKelsay/fix/staging-main-conflicts
AustinKelsay Jul 19, 2026
8bbc115
docs: prepare cleanup release candidate (#152)
AustinKelsay Jul 19, 2026
adbabce
test: stabilize wrong-key NIP-04 coverage (#153)
AustinKelsay Jul 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,28 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Use canonical npm version
run: corepack prepare npm@9.8.1 --activate

- name: Install dependencies
run: npm ci

- name: Verify package-manager policy
run: npm run package-manager:verify

- name: Lint
run: npm run lint

- name: Run tests
- name: Run routine tests
run: npm test

- name: Run slow security and performance tests
run: npm run test:slow

- name: Run test coverage
- name: Run complete test coverage
if: matrix.node-version == '20.x'
run: npm run test:coverage
run: npm run test:coverage:all

- name: Build library
run: npm run build
Expand Down Expand Up @@ -141,12 +150,18 @@ jobs:
- name: Install dependencies
run: bun install --frozen-lockfile

- name: Verify package-manager policy
run: bun run package-manager:verify

- name: Lint
run: bun run lint

- name: Run Bun tests
- name: Run Bun routine tests
run: bun run test:bun

- name: Run Bun slow security and performance tests
run: bun run test:bun:slow

- name: Build library
run: bun run build

Expand Down
19 changes: 14 additions & 5 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,51 @@
# Repository Guidelines

## Project Structure & Module Organization

- `src/` — library code by NIP in `src/nipXX/` (e.g., `src/nip46/`). Shared types in `src/types/`, utilities in `src/utils/`. Export surfaces in `src/index.ts` (update when adding modules). Follow `src/NIP_STANDARDIZATION.md` for NIP changes.
- `tests/` — Jest tests mirror `src/` by NIP (`tests/nipXX/`) plus focused tests like `tests/utils/*.test.ts`.
- `examples/` — runnable TypeScript examples by feature/NIP.
- `dist/` — compiled output; do not edit.
- `scripts/` — helper scripts (e.g., `scripts/promote-to-main.sh`).

## Build, Test, and Development Commands
- `npm install` — install dependencies.

- `corepack prepare npm@9.8.1 --activate` — activate the canonical npm toolchain.
- `npm ci` — install the canonical dependency graph from `package-lock.json`.
- `npm run package-manager:verify` — verify npm/Bun metadata, lockfiles, and CI policy.
- `npm run build` — clean and compile TypeScript to `dist/`.
- `npm test` | `npm run test:watch` | `npm run test:coverage` — run Jest, watch mode, or coverage (reports in `coverage/`).
- `npm test` | `npm run test:watch` | `npm run test:coverage` — run the routine Jest lane, routine watch mode, or routine coverage.
- `npm run test:slow` | `npm run test:all` | `npm run test:coverage:all` — run the named security/performance lane or the complete test/coverage inventory.
- `npm run lint` — ESLint (`@typescript-eslint`) over `.ts` sources.
- `npm run format` — Prettier 3 for `src/`, `tests/`, `examples/`.
- `npm run example` (or `example:*`) | `npm start` — run examples; default is the NIP‑07 example.
- `npm run promote` — maintainers: promote `staging` → `main`.

## Coding Style & Naming Conventions

- Language: TypeScript (strict). Prefer explicit types; avoid `any`.
- Formatting: Prettier, 2‑space indent; run `npm run format` before pushing.
- Linting: `@typescript-eslint`; intentionally unused vars prefixed with `_`.
- Naming: `camelCase` for variables/functions; `PascalCase` for types/classes. New NIP code goes under `src/nipXX/` and is exported via `src/index.ts`.

## Testing Guidelines

- Framework: Jest with `ts-jest`, Node environment.
- Naming: `*.test.ts` or `*.spec.ts`; mirror the `src/` layout.
- Coverage: keep or improve; use `npm run test:coverage`.
- Coverage: keep or improve; use `npm run test:coverage:all` before review so slow-lane files remain covered.
- Use test vectors and the ephemeral relay; never include real credentials.

## Commit & Pull Request Guidelines

- Commits: Conventional Commits (`feat:`, `fix:`, `refactor:`, `docs:`, `test:`, `chore:`), imperative and concise.
- Branches: create from `staging` using `feature/<name>` or `fix/<name>`; PRs target `staging`.
- PR checklist: clear what/why, linked issues (e.g., `#123`), tests and examples updated if behavior changes. Run `npm run lint && npm test && npm run build` before opening.
- PR checklist: clear what/why, linked issues (e.g., `#123`), tests and examples updated if behavior changes. Run `npm run lint && npm run test:all && npm run build` before opening.

## Security & Configuration Tips

- Do not commit private keys, secrets, or real credentials.
- Prefer `.env` files ignored by Git; document required vars in examples or readme.

## Agent‑Specific Notes
- This AGENTS.md applies repo‑wide. A deeper `AGENTS.md` overrides within its folder subtree. Follow the structure and style above when adding files and exports.

- This AGENTS.md applies repo‑wide. A deeper `AGENTS.md` overrides within its folder subtree. Follow the structure and style above when adding files and exports.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added
- A supported `snstr/testing` subpath now owns the Node-only `NostrRelay` test Relay and framework-neutral Relay test-double types without leaking Jest into published application declarations.
- Canonical NIP-01 client and Relay wire-message tuple types now provide one authoritative protocol definition.
- Repository tooling now enforces npm 9.8.1 as the release package manager, Bun as a pinned compatibility runner, and explicit routine, slow, and complete test lanes.

### Changed
- Relay event storage, Nostr Relay registry management, NIP-47 protocol codecs and dispatch, NIP-46 request machinery, NIP-57 client behavior, and ephemeral Relay transport/session/filter responsibilities now live behind smaller internal modules while preserving their public 0.x facades.
- Production diagnostics now use one compatible logger policy across Nostr, Relay, RelayPool, NIP-46, NIP-47, NIP-57, and stateless protocol helpers.
- Structural regression tests now prefer public behavior and owned testing seams over private implementation shapes.

### Fixed
- NIP-44 decryption now rejects unsupported legacy payload versions and malformed v2 nonce sizes through the public decrypt path.
- NIP-47 service initialization is idempotent, concurrent-safe, and restartable after disconnect.
- NIP-57 client flows share cache, filter, invoice, and statistics behavior while preserving explicit limit values, including zero.
- Ephemeral Relay shutdown now retains runtime error handling, releases transports when session cleanup rejects, and stops session polling without stale routes.

### Security
- NIP-46 connection secrets, private keys, decrypted payloads, and untrusted error text are excluded from diagnostic output.
- Generic key, wire-format, and resource-limit validation now has canonical ownership so NIP-specific policies cannot silently drift.

## [0.5.0] - 2026-07-18

### Added
Expand Down
9 changes: 6 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ npm run format # Format code with Prettier

### Testing
```bash
npm test # Run all tests
npm run test:watch # Run tests in watch mode
npm run test:coverage # Generate coverage report
npm test # Run the routine feedback lane
npm run test:slow # Run security/performance load tests
npm run test:all # Run the complete routine + slow inventory
npm run test:watch # Run routine tests in watch mode
npm run test:coverage # Generate routine coverage
npm run test:coverage:all # Generate complete coverage for review/CI
npm run test:nip01 # Test core NIP-01 functionality
npm run test:nip04 # Test specific NIP (replace 04 with any NIP number)
npm run test:crypto # Test all crypto functionality
Expand Down
20 changes: 18 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ Thank you for your interest in contributing to SNSTR! This document provides gui

1. Fork the repository
2. Clone your fork: `git clone https://github.com/your-username/snstr.git`
3. Install dependencies: `npm install`
4. Build the project: `npm run build`
3. Activate the canonical npm version: `corepack prepare npm@9.8.1 --activate`
4. Install dependencies: `npm ci`
5. Build the project: `npm run build`

## Development Workflow

Expand Down Expand Up @@ -91,6 +92,21 @@ The CI pipeline runs tests for both `main` and `staging` branches, but releases

## Release Process

### Package-manager policy

npm 9.8.1 is the canonical package manager for dependency changes, clean
installs, scripts, and releases. Use `npm install` when intentionally changing
dependencies, commit the resulting `package-lock.json`, and use `npm ci` for a
reproducible clean install. Do not add pnpm, Yarn, or shrinkwrap lockfiles.
Activate it with `corepack prepare npm@9.8.1 --activate`, then confirm
`npm --version` prints `9.8.1` before running canonical workflows.

Bun 1.3.9 is a supported compatibility runner, pinned in `.bun-version`.
When dependencies change, refresh and commit `bun.lock`, then confirm
`bun install --frozen-lockfile` succeeds. Bun does not own releases or the
canonical dependency graph. Run `npm run package-manager:verify` before
submitting dependency or CI changes.

SNSTR releases are currently performed manually from `main` after verified
changes are promoted from `staging`.

Expand Down
Loading
Loading