Skip to content

Conversation

tcheeric
Copy link
Owner

Summary

  • Avoid NullPointerException when signable has no signature consumer
  • Test signing with a null signature consumer

Testing

  • PATH=/bin:/usr/bin:$PATH ./mvnw -q verify (failed: Network is unreachable)

https://chatgpt.com/codex/tasks/task_b_68991defe10c8331839b85e4e887c18d

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a potential NullPointerException in the Identity signing functionality by adding null safety checks for the signature consumer. The fix ensures that signing operations can safely handle ISignable objects that return null from their getSignatureConsumer() method.

  • Added null check before calling accept() on the signature consumer
  • Added test coverage for signing with a null signature consumer

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
nostr-java-id/src/main/java/nostr/id/Identity.java Added null safety check for signature consumer before calling accept()
nostr-java-id/src/test/java/nostr/id/IdentityTest.java Added test case to verify signing behavior with null signature consumer


@Override
public Supplier<ByteBuffer> getByteArraySupplier() {
return () -> ByteBuffer.wrap("payload".getBytes(StandardCharsets.UTF_8));
Copy link
Preview

Copilot AI Aug 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing import for StandardCharsets. This will cause a compilation error.

Copilot uses AI. Check for mistakes.

@tcheeric tcheeric merged commit 9ac961c into develop Aug 10, 2025
1 check passed
@tcheeric tcheeric deleted the codex/add-null-check-for-consumer-in-accept branch August 10, 2025 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant