Skip to content

fix: handle NIP-42 auth-required by retrying REQ/EVENT after AUTH#401

Merged
nogringo merged 7 commits intomasterfrom
fix/nip42-auth-flow
Feb 3, 2026
Merged

fix: handle NIP-42 auth-required by retrying REQ/EVENT after AUTH#401
nogringo merged 7 commits intomasterfrom
fix/nip42-auth-flow

Conversation

@nogringo
Copy link
Collaborator

@nogringo nogringo commented Jan 31, 2026

Summary

  • Handle CLOSED auth-required by signing AUTH and re-sending REQ
  • Handle OK false auth-required by signing AUTH and re-sending EVENT
  • Add eagerAuth config option (default: false for privacy)
  • Support multiple accounts in authenticateAs parameter
  • Add timeout for pending AUTH callbacks to prevent memory leaks

Auth Strategies

  • Lazy (default): AUTH only after relay responds with auth-required
  • Eager: AUTH immediately when relay sends challenge

@codecov
Copy link

codecov bot commented Jan 31, 2026

Codecov Report

❌ Patch coverage is 75.00000% with 27 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.34%. Comparing base (a9316c0) to head (126255c).
⚠️ Report is 8 commits behind head on master.

Files with missing lines Patch % Lines
...s/ndk/lib/domain_layer/usecases/relay_manager.dart 74.03% 27 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #401      +/-   ##
==========================================
- Coverage   72.51%   72.34%   -0.17%     
==========================================
  Files         144      144              
  Lines        5599     5696      +97     
==========================================
+ Hits         4060     4121      +61     
- Misses       1539     1575      +36     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@nogringo nogringo requested review from 1-leo and frnandu January 31, 2026 23:14
@nogringo nogringo self-assigned this Jan 31, 2026
@nogringo nogringo changed the title test: add NIP-42 auth flow tests demonstrating retry bugs fix: handle NIP-42 auth-required by retrying REQ/EVENT after AUTH Jan 31, 2026
@nogringo nogringo requested a review from 1-leo February 2, 2026 10:52
@nogringo nogringo merged commit ac8c6e6 into master Feb 3, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants