bterkuileandClaude Sonnet 5 ac2558f5ce Fix critical webhook signature case bug; add correlationId + AR type registration
Strike sends X-Webhook-Signature in UPPERCASE hex. OpenSSL::HMAC.
hexdigest always returns lowercase, and valid_signature? compared them
case-sensitively via secure_compare — every genuine Strike webhook was
being silently rejected as an invalid signature. Confirmed live: executed
a real Lightning payment (payment-quotes/lightning + PATCH .../execute),
received a real payment.updated webhook, and recomputing the HMAC over
the captured payload/secret matched case-insensitively but not
case-sensitively — proving the algorithm/secret/body were already
correct and this was purely a case-comparison bug. Their own reference
docs (docs.strike.me/webhooks/signature-verification) don't mention the
case difference. Regression test added using the real captured signature,
upcased.

Also, both found via that same live test:
- Invoices::Invoice didn't declare correlationId, raising
  ActiveModel::UnknownAttributeError the moment a real one (which
  CreateInvoice always sends) round-tripped through a live response —
  no existing spec fixture's stubbed body had included it.
- BtcAttributeType was only registered with ActiveModel::Type, not
  ActiveRecord::Type (a separate registry) — an `attribute :x,
  :strike_btc` declaration on an ActiveRecord model raised "Unknown
  type" without this. Guarded behind defined?(ActiveRecord::Type) since
  this gem only depends on active_model.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-22 19:13:03 -05:00
2025-10-18 12:37:08 -05:00
2025-09-15 15:55:58 -05:00
2025-09-15 16:14:40 -05:00
2025-09-15 15:55:58 -05:00
2025-10-18 12:37:08 -05:00
2025-09-15 15:55:58 -05:00
2025-09-15 15:55:58 -05:00
2025-09-15 15:55:58 -05:00
2025-09-15 15:55:58 -05:00
2025-09-15 15:55:58 -05:00
2025-10-18 12:37:08 -05:00

StrikeMe::API

This is a ruby gem to interact with the strike.me API. It is an inition proof of concept implementation. As a reference, the documentation of the Strike API

Installation

TODO: Replace strike_me-api with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.

Install the gem and add to the application's Gemfile by executing:

bundle add strike_me-api

If bundler is not being used to manage dependencies, install the gem by executing:

gem install strike_me-api

Playground

To play around with this api you can start a REPL using one of the following commands from the project's root:

pry -r strike_me/api
# or
irb -I lib -r strike_me/api

Then type code like:

account = StrikeMe::API::Account.new
account.profile.attributes
account.balances.map(&:attributes) # same as account.balances.to_a
account.balances.btc # to get the BTC specific one

invoices = StrikeMe::API::Invoices.new
invoices.any?

Usage

TODO: Write usage instructions here, for now, look at Playground

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://gitlab.com/benja-2/strike_me-api.

License

The gem is available as open source under the terms of the MIT License.

S
Description
No description provided
Readme
65 KiB
0 Stars 1 Watchers 0 Forks
Languages
Ruby 99.7%
Shell 0.3%