Skip to content

Add a property test: every signature verifies, and never over changed bytes #10

Description

@HackTuah

BeamMCP.Signer.Ed25519.sign/2 is tested with fixed inputs. A property test would cover many inputs at once:

  • For random bytes and a freshly generated key, the signature always verifies with :crypto.verify/5 against the matching public key.
  • The signature never verifies over bytes that differ in any way.
  • The key passed as a function, private_key: fn -> key end, signs identically to the same key passed as bytes.

What to change:

  • Add StreamData as a test-only dependency: {:stream_data, "~> 1.4", only: :test}.
  • Add a property test under test/beam_mcp/signer/. The existing ed25519_test.exs shows how keys are generated in tests (:crypto.generate_key(:eddsa, :ed25519)). No key is ever written to the tree.

Done when:

  • mix test passes, including the new property.
  • mix credo --strict and mix format --check-formatted are clean.
  • You have shown the property can fail: break the signing in a throwaway copy (for example, sign different bytes), show the property turn red, then restore it. Mention this in the PR.

How to contribute: see CONTRIBUTING.md. Sign off your commit with git commit -s.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions