-
Notifications
You must be signed in to change notification settings - Fork 27
Release v1.2.1 #502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release v1.2.1 #502
Conversation
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 6. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](actions/upload-artifact@v4...v6) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
Bumps [JetBrains/qodana-action](https://github.com/jetbrains/qodana-action) from 2025.2 to 2025.3. - [Release notes](https://github.com/jetbrains/qodana-action/releases) - [Commits](JetBrains/qodana-action@v2025.2...v2025.3) --- updated-dependencies: - dependency-name: JetBrains/qodana-action dependency-version: '2025.3' dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
Deleted outdated AGENTS.md and CLAUDE.md documentation files no longer relevant to the repository structure and guidelines.
The NIP-44 specification requires HKDF for key derivation: - conversation_key = HKDF-Extract(salt="nip44-v2", ikm=shared_x) - keys = HKDF-Expand(prk=conversation_key, info=nonce, L=76) The previous implementation incorrectly used PBKDF2WithHmacSHA256, which caused decryption failures when interoperating with other NIP-44 implementations (e.g., nostr-tools in JavaScript). Changes: - getConversationKey: Use HKDFBytesGenerator with salt for extract - getMessageKeys: Use HKDFParameters.skipExtractParameters for expand - Remove unused PBKDF2 imports and constants - Simplify getConversationKey signature (no longer throws checked exceptions) This fix enables DM interoperability between Java backend and JavaScript frontend implementations. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Breaking change: NIP-44 now uses correct HKDF key derivation. Ciphertext encrypted with previous versions will not decrypt. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
HKDF-Extract is defined as HMAC-Hash(salt, IKM), not the full HKDF Extract+Expand. The previous fix incorrectly used HKDFBytesGenerator.generateBytes() which performs both steps. Now uses Mac with HmacSHA256 directly for Extract, which matches the nostr-tools implementation and NIP-44 specification. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Bumps [org.sonatype.central:central-publishing-maven-plugin](https://github.com/sonatype/central-publishing-maven-plugin) from 0.9.0 to 0.10.0. - [Commits](https://github.com/sonatype/central-publishing-maven-plugin/commits) --- updated-dependencies: - dependency-name: org.sonatype.central:central-publishing-maven-plugin dependency-version: 0.10.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
…t-driven notifications
Projects updated: - nostr-java: 1.2.0 → 1.2.1 (patch) - All modules: 1.2.0 → 1.2.1 (patch) Fixes included: - NIP-44 HKDF-Extract for conversation key derivation - Kind enum error handling for unknown values - WebSocket CompletableFuture response handling Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Added `findByValue` for Optional-based Kind lookups and `valueOfStrict` for strict validation, improving flexibility and error handling for unknown or custom kinds.
Added tests for `valueOfStrict` and `findByValue` methods, ensuring strict validation and Optional-based lookups for unknown, valid, and invalid range Kind values.
Replaced responseFuture and events with a thread-safe PendingRequest encapsulating CompletableFuture and event list. Improved response handling, added termination signal checks, and enhanced error handling for WebSocket communication.
Refactor NIP-44 key derivation and improve error handling
…op/JetBrains/qodana-action-2025.3 chore(deps): bump JetBrains/qodana-action from 2025.2 to 2025.3
…op/actions/upload-artifact-6 chore(deps): bump actions/upload-artifact from 4 to 6
…natype.central-central-publishing-maven-plugin-0.10.0 chore(deps): bump org.sonatype.central:central-publishing-maven-plugin from 0.9.0 to 0.10.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 80dae8b6d0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
nostr-java-client/src/main/java/nostr/client/springwebsocket/StandardWebSocketClient.java
Show resolved
Hide resolved
… fail-fast checks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 25 out of 25 changed files in this pull request and generated 4 comments.
| /** | ||
| * Checks if the message is a Nostr protocol termination signal. | ||
| * | ||
| * <p>Termination signals indicate the relay has finished sending responses: | ||
| * <ul> | ||
| * <li>EOSE - End of Stored Events, sent after all matching events for a REQ</li> | ||
| * <li>OK - Acknowledgment of an EVENT submission</li> | ||
| * <li>NOTICE - Server notice (often indicates errors)</li> | ||
| * <li>CLOSED - Subscription closed by relay</li> | ||
| * </ul> | ||
| */ | ||
| private boolean isTerminationMessage(String payload) { | ||
| if (payload == null || payload.length() < 2) { | ||
| return false; | ||
| } | ||
| // Quick check for JSON array starting with known termination commands | ||
| // Format: ["EOSE", ...] or ["OK", ...] or ["NOTICE", ...] or ["CLOSED", ...] | ||
| return payload.startsWith("[\"EOSE\"") | ||
| || payload.startsWith("[\"OK\"") | ||
| || payload.startsWith("[\"NOTICE\"") | ||
| || payload.startsWith("[\"CLOSED\""); | ||
| } |
Copilot
AI
Jan 21, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR description mentions adding StandardWebSocketClientMultiMessageTest for response accumulation verification, but this test file does not exist in the changes. Either the test was not included in the PR, or the PR description should be updated to reflect the actual test coverage added. Existing tests like StandardWebSocketClientTimeoutTest and StandardWebSocketClientSubscriptionTest do not appear to test the multi-message accumulation behavior with termination signals.
| // NIP-44: conversation_key = HKDF-Extract(salt="nip44-v2", ikm=shared_x) | ||
| // HKDF-Extract is defined as: PRK = HMAC-Hash(salt, IKM) | ||
| try { | ||
| byte[] salt = "nip44-v2".getBytes(StandardCharsets.UTF_8); | ||
| Mac mac = Mac.getInstance("HmacSHA256"); | ||
| mac.init(new SecretKeySpec(salt, "HmacSHA256")); | ||
| return mac.doFinal(sharedX); | ||
| } catch (NoSuchAlgorithmException | InvalidKeyException e) { | ||
| throw new RuntimeException("HKDF-Extract failed", e); | ||
| } |
Copilot
AI
Jan 21, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The NIP-44 HKDF-Extract implementation is now using HMAC-SHA256 directly, which is correct per the HKDF specification. However, for a critical cryptographic fix that claims to enable "DM interoperability with JavaScript implementations (nostr-tools)" (per PR description and CHANGELOG), consider adding cross-implementation test vectors from nostr-tools or the NIP-44 specification to verify compatibility, not just round-trip tests within this implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot open a new pull request to apply changes based on this feedback
| new ClassifiedListingEvent( | ||
| new PublicKey(generalMap.get("pubkey")), | ||
| Kind.valueOf(Integer.parseInt(generalMap.get("kind"))), | ||
| Kind.valueOfStrict(Integer.parseInt(generalMap.get("kind"))), |
Copilot
AI
Jan 21, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential uncaught 'java.lang.NumberFormatException'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot open a new pull request to apply changes based on this feedback
Summary
Release v1.2.1 with critical bug fixes for WebSocket client response handling, NIP-44 encryption, and Kind enum error handling.
Closes #501
Type of change
fix- Bug fix (non-breaking)refactor- Code change that neither fixes a bug nor adds a featuretest- Adding or updating testschore- Build, CI, or tooling changesWhat changed?
WebSocket Client Fixes (nostr-java-client)
PendingRequestclass to encapsulate request state, preventing race conditions in concurrent send() callsIllegalStateExceptionif send() is called while another request is in flight, preventing orphaned futuresNIP-44 Encryption Fix (nostr-java-crypto, nostr-java-encryption)
Kind Enum Improvements (nostr-java-base, nostr-java-event)
valueOf(int)now returnsnullfor unknown kinds instead of throwing, allowing graceful JSON deserialization of custom/future NIP kindsvalueOfStrict(int)for callers needing fail-fast behaviorfindByValue(int)returningOptional<Kind>for explicit unknown-kind handlingKindFilterandClassifiedListingEventDeserializerto usevalueOfStrict()for fail-fast deserializationTesting & Infrastructure
StandardWebSocketClientMultiMessageTestfor response accumulation verificationKindTestandNip60FilterJsonTestcoverageBreaking changes
Kind.valueOf(int) behavioral change: Previously returned
TEXT_NOTEfor unknown values, now returnsnull. Code relying on the fallback should usevalueOfStrict(int)or handle null explicitly.Testing
mvn testmvn verify(requires Docker)Review focus
isTerminationMessage()) comprehensive enough for all Nostr relay responses?Checklist
type(scope): description