• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

sgerrand / ex_teya / 36126855899
100%

Build:
DEFAULT BRANCH: main
Ran 25 Sep 2026 10:58AM UTC
Jobs 1
Files 21
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

25 Sep 2026 10:58AM UTC coverage: 100.0%. Remained the same
36126855899

push

github

web-flow
feat(webhook)!: check the signature on an incoming webhook (#43)

* feat(webhook): check the signature on an incoming webhook

Teya signs every webhook with SHA256withRSA over the bytes it sent and
puts the signature, Base64 encoded, in the x-teya-signature header.
Checking it by hand is easy to get wrong, and getting it wrong means
acting on a payment nobody made.

Teya.Webhook.verify/3 answers whether a body carries Teya's signature.
parse/3 does the same and decodes the body, but only once the signature
has been accepted. Keys are taken as the PEM text or the Base64 the
Business Portal shows. Nothing new is needed to build this: the signature
work is OTP's own :public_key.

The README says how to keep the raw body while Plug.Parsers reads it,
since a body decoded and encoded again no longer matches the signature.

* fix(webhook): handle a missing signature and fix the example code

A request with no x-teya-signature header gives the handler nil, and
verify/3 raised on it rather than answering. Every unsigned request to a
webhook URL came back as a 500. A missing or empty signature is now
{:error, :missing_signature}.

decode_key/1 reads a key once, so a bad key shows up when the application
starts instead of when the first real webhook is turned away; verify/3
and parse/3 take the decoded key as well as the text. The key is checked
before the signature, so a bad key is reported as one whatever the
signature holds. Of the exceptions OTP's key decoders raise, only the
kinds they raise on unreadable input are caught, in one place; anything
else surfaces as the bug it is.

The example code crashed in three ways: matching the header list as
[signature] raised when the header was missing or repeated, the case had
no clause for events other than payment.succeeded.v1, and the body reader
raised on a body over the length limit where Plug.Parsers answers with a
413. The body reader also kept a raw copy of every request's body, and
the examples never showed t... (continued)

51 of 51 new or added lines in 1 file covered. (100.0%)

232 of 232 relevant lines covered (100.0%)

15.03 hits per line

Jobs
ID Job ID Ran Files Coverage
1 36126855899.1 25 Sep 2026 10:58AM UTC 21
100.0
GitHub Action Run
Source Files on build 36126855899
  • Tree
  • List 21
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #36126855899
  • 6f58e078 on github
  • Prev Build on main (#36008612957)
  • Next Build on main (#36173176686)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc