basecradle 0.17.2 → 0.17.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f95fcda9f2157a91e2278019f201e714dc57a048f1f7e0b819bc2b39e968dfe
4
- data.tar.gz: a98cad0a7c156461386a585a794051ea6a4c26efd1f315779d46c85b5119049b
3
+ metadata.gz: cf1828960f1b610b87acc8263f49d47389f1ebbe56b1194747f8927bd43057b6
4
+ data.tar.gz: 7869cfdb12753c5da849d0341f0d8e4e73fccf14b7b6985964f0d02b0dc708f4
5
5
  SHA512:
6
- metadata.gz: bf93d1e87f3931c3924b5446d090d38307b1d54cfaaa4edb0365b96cc8b7af4111c908638e707c44f1bbed7499055de064324168141339428f895a89def52728
7
- data.tar.gz: df8cda75e927c9caa6d67066ec5ff4dcdb216981908f649fd8cdc8682006c1f7056c48d6e309a517b8aaf46c1540794f3d686da811ea958cb024e6e9550aadea
6
+ metadata.gz: 75e07cb441cf75f5c680de378494780e518faa2954dbc16cb9bcaa3984f0e381ac9fe769e064c371df687b9b83928be6491e56712839d67c81caa01e9381f4fa
7
+ data.tar.gz: 2ffbaf5284abb5067514dd0df3d1ffecf4fa0edc81e703ec417cbfd72beeb2a23ba8950d14f025d11fb7b9376f149164f021b4ef5482a9e24a497582c6d98ac5
data/CHANGELOG.md CHANGED
@@ -9,6 +9,67 @@ section**. The newest heading is always the version `lib/basecradle/version.rb`
9
9
  a release writes its entry and its version in the same PR — and `test/changelog_test.rb`
10
10
  fails CI if the two ever disagree.
11
11
 
12
+ ## [0.17.4] - 2026-11-27
13
+
14
+ A patch release that corrects what the SDK says about a platform change of 2026-11-27
15
+ ([#336](https://github.com/basecradle/basecradle-ruby/issues/336)), and gives the error code
16
+ it added a class. No verb is added or removed, and no signature changes.
17
+
18
+ ### Fixed
19
+
20
+ - **An endpoint's `verifier` has seven schemes, not five.** The platform now verifies
21
+ `stripe` and `sns`. `configure_verification` already passed the verifier through as a
22
+ string, so both work with this SDK as it is; only the docs listed five. The README,
23
+ `WebhookVerification` and `configure_verification` now list all seven.
24
+ - **`stripe`**, for a Stripe webhook destination. The secret is the destination's
25
+ Signing secret at Stripe (`whsec_…`). It reads Stripe's own `Stripe-Signature`, fixed,
26
+ so `signature_header` is ignored, as under `github`, `slack` and `twilio`. A delivery
27
+ whose signed timestamp is more than five minutes from now is refused, and a repeat of
28
+ one Stripe event (the same event `id`) is stored once.
29
+ - **`sns`**, for an Amazon SNS topic. The credential is **the ARN of the topic** the
30
+ endpoint listens to: not a secret, and still write-only. SNS signs inside the message,
31
+ so **`verification.signature_header` is an empty string** for an `sns` endpoint; the
32
+ SDK reads it as sent (a test now pins it), and nothing in the SDK assumed it was
33
+ non-empty. Pass `credential:` in the same call that moves an endpoint to or from `sns`:
34
+ an ARN is never carried over to a secret scheme, nor a secret to `sns`, so a call that
35
+ passes only `verifier:` raises `BaseCradle::ValidationError`. The endpoint confirms
36
+ the SNS subscription by itself, and the confirmation creates no event, so set the ARN
37
+ before you subscribe the topic. Raw message delivery must be off, and a repeat of one
38
+ SNS message (the same `MessageId`) is stored once.
39
+ - **`service_unavailable` maps to `BaseCradle::ServiceUnavailableError`.** The API
40
+ documents this code (`503`): a webhook delivery could not be verified right now, because
41
+ the sender's own certificate (Amazon SNS's) could not be fetched or its handshake could
42
+ not be completed, so nothing was stored and the sender sends it again. It is an answer to
43
+ a *sender*; no call this SDK makes receives it today. Until now the registry did not
44
+ list it, so it would have read as a bare `BaseCradle::Error`.
45
+
46
+ ## [0.17.3] - 2026-11-26
47
+
48
+ A patch release that corrects what the SDK says about a platform change of 2026-11-26
49
+ ([#334](https://github.com/basecradle/basecradle-ruby/issues/334)). No code path changes:
50
+ no verb is added or removed, and no signature changes.
51
+
52
+ ### Fixed
53
+
54
+ - **An endpoint's `verifier` has five schemes, not four.** The platform now verifies
55
+ `twilio`, for the webhooks Twilio sends (an incoming text message, a recording or
56
+ transcription callback, a status callback). It reads Twilio's own `X-Twilio-Signature`,
57
+ fixed, so `signature_header` is ignored as it is under `github` and `slack`, and a move
58
+ from `shared_secret_header` to `twilio` that names no header resets it to `X-Signature`.
59
+ The secret is a shared key made at Twilio for signing webhooks (Twilio's own
60
+ recommendation) or the account's Auth Token. Twilio signs the URL it was given, so give
61
+ it the endpoint's `ingest_url` exactly as the endpoint reports it. Twilio also reads the
62
+ reply to a delivery, so a `twilio` endpoint answers each delivery it stores with
63
+ `200 OK` and an empty TwiML document in place of the empty `201`; that is the
64
+ endpoint's answer to the sender, and nothing this SDK returns changes. The empty answer
65
+ ends a voice call, so an `ingest_url` is never a number's voice URL, and an endpoint
66
+ holds one secret, so a change between a shared key and the Auth Token is made here in
67
+ the same minute as at Twilio; the README says both.
68
+ `configure_verification` already passed the verifier through as a string, so `twilio`
69
+ works with this SDK as it is; only the docs listed four. The README,
70
+ `WebhookVerification` and `configure_verification` now list all five.
71
+ *Corrected in 0.17.4: since 2026-11-27 it has seven, adding `stripe` and `sns`.*
72
+
12
73
  ## [0.17.2] - 2026-11-26
13
74
 
14
75
  A patch release that corrects what the SDK says about two platform changes of 2026-11-25
@@ -39,6 +100,8 @@ no verb is added or removed, and no signature changes.
39
100
  `slack`. It is required in the same call that moves an endpoint to
40
101
  `shared_secret_header`, or from it back to `hmac_sha256_hex`; a call that passes only
41
102
  `verifier:` there raises `BaseCradle::ValidationError`.
103
+ *Corrected in 0.17.3: since 2026-11-26 it has five, adding `twilio`; and in 0.17.4: since
104
+ 2026-11-27 seven, adding `stripe` and `sns`.*
42
105
 
43
106
  ## [0.17.1] - 2026-11-21
44
107
 
@@ -150,7 +213,9 @@ you upgrade your own Ruby, to 3.3.14, 3.4.13 or 4.0.10.
150
213
  `hmac_sha256_hex` only. A `github` endpoint always reads `X-Hub-Signature-256`.
151
214
  *Corrected in 0.17.2: since 2026-11-25 the platform has four schemes, adding
152
215
  `shared_secret_header` and `slack`, and `signature_header:` also names the header a
153
- `shared_secret_header` endpoint reads the secret from.*
216
+ `shared_secret_header` endpoint reads the secret from. Corrected again in 0.17.3:
217
+ since 2026-11-26 it has five, adding `twilio`. Corrected again in 0.17.4: since
218
+ 2026-11-27 it has seven, adding `stripe` and `sns`.*
154
219
  - **`clear_verification`** sends `clear_credential: true`, which removes the secret and
155
220
  turns verification off.
156
221
  - Both update the endpoint in place and return it, like `rotate`, so the new state
@@ -1077,6 +1142,8 @@ the Python SDK's behavior in idiomatic Ruby. Zero runtime dependencies.
1077
1142
  - **Quality bars** — a README-as-tested-doc harness (every example runs against a mocked
1078
1143
  API) and a spec drift-guard (CI fails if the live API grows beyond the SDK).
1079
1144
 
1145
+ [0.17.4]: https://github.com/basecradle/basecradle-ruby/releases/tag/v0.17.4
1146
+ [0.17.3]: https://github.com/basecradle/basecradle-ruby/releases/tag/v0.17.3
1080
1147
  [0.17.2]: https://github.com/basecradle/basecradle-ruby/releases/tag/v0.17.2
1081
1148
  [0.17.1]: https://github.com/basecradle/basecradle-ruby/releases/tag/v0.17.1
1082
1149
  [0.17.0]: https://github.com/basecradle/basecradle-ruby/releases/tag/v0.17.0
data/README.md CHANGED
@@ -226,7 +226,7 @@ and the SDK invents none. `BaseCradle.uuid_of(endpoint)` reads it too, and is wh
226
226
  **Signature verification is configured with two verbs.**
227
227
  `endpoint.configure_verification(verifier:, credential:, signature_header:)` sends only
228
228
  the keywords you pass, so anything left out stays as it is; passing none raises
229
- `ArgumentError` before any request. `verifier:` is the scheme, one of four today:
229
+ `ArgumentError` before any request. `verifier:` is the scheme, one of seven today:
230
230
 
231
231
  | `verifier:` | For | The header it reads |
232
232
  |---|---|---|
@@ -234,23 +234,52 @@ the keywords you pass, so anything left out stays as it is; passing none raises
234
234
  | `"github"` | a GitHub webhook, pointed straight at the `ingest_url` | `X-Hub-Signature-256`, fixed |
235
235
  | `"shared_secret_header"` | a sender that cannot sign | the `signature_header:` you set; carries the secret itself |
236
236
  | `"slack"` | a Slack app's Events API | `X-Slack-Signature`, fixed; the endpoint answers Slack's `url_verification` handshake itself, and the handshake creates no event |
237
+ | `"stripe"` | a Stripe webhook destination | `Stripe-Signature`, fixed; it carries the signed timestamp and the digest |
238
+ | `"twilio"` | the webhooks Twilio sends (an incoming text message, a recording or transcription callback, a status callback) | `X-Twilio-Signature`, fixed; Twilio signs the URL it was given, so give it the `ingest_url` exactly as the endpoint reports it |
239
+ | `"sns"` | an Amazon SNS topic's HTTPS subscription | none: SNS signs inside the message, so `verification.signature_header` is an empty string |
240
+
241
+ Under `stripe` the secret is the destination's Signing secret at Stripe (`whsec_…`), which
242
+ is not an API key. A delivery whose signed timestamp is more than five minutes from now is
243
+ refused, and a repeat of one Stripe event (the same event `id`) is stored once.
244
+
245
+ Under `twilio` the secret is a shared key made at Twilio for signing webhooks (Twilio's own
246
+ recommendation) or the account's Auth Token. Twilio reads the reply to a delivery, so a
247
+ `twilio` endpoint answers each delivery it stores with `200 OK` and an empty TwiML document
248
+ in place of the empty `201`. That is the endpoint's answer to the sender; nothing this SDK
249
+ returns changes. The empty answer also ends a voice call, so never make the `ingest_url` a
250
+ number's voice URL: answer the call with TwiML of your own that records a message, and point
251
+ the recording's callbacks here. An endpoint holds one secret, a delivery signed with the
252
+ other is refused with `401`, and Twilio does not resend it by default, so when you switch
253
+ between a shared key and the Auth Token, or replace a shared key, change the secret here in
254
+ the same minute you change it at Twilio.
255
+
256
+ Under `sns` the credential is **the ARN of the topic** the endpoint listens to. It is not a
257
+ secret, and it is still write-only: the API never returns it. **Pass `credential:` in the
258
+ same call that moves an endpoint to or from `sns`**: a topic's ARN is never carried over to
259
+ a secret scheme, nor a secret to `sns`, so a call that passes only `verifier:` there raises
260
+ `BaseCradle::ValidationError`.
261
+ The endpoint confirms the SNS subscription by itself, and the confirmation creates no event,
262
+ so set the ARN before you subscribe the topic: with no ARN set, the confirmation is stored as
263
+ an event and its `SubscribeURL` is yours to open. Topics in the standard and GovCloud regions
264
+ are supported, the China regions are not. Raw message delivery must be off, and a repeat of
265
+ one SNS message (the same `MessageId`) is stored once.
237
266
 
238
267
  The verifier is passed through as given, so a scheme the platform adds later needs no SDK
239
268
  release; one it does not know raises `BaseCradle::ValidationError`. Use a signing scheme
240
269
  whenever the sender can sign: `shared_secret_header` proves only that the sender holds the
241
270
  secret, not that the body arrived unaltered. `credential:` is the signing secret (under
242
271
  `shared_secret_header`, the header's exact value, compared as sent, so include any prefix
243
- such as `Bearer `), and setting it turns verification on; a blank one is no change at all (the API's rule): the current secret
272
+ such as `Bearer `; under `sns`, the topic's ARN), and setting it turns verification on; a blank one is no change at all (the API's rule): the current secret
244
273
  stays, and `verification.enabled` cannot tell you a rotation was skipped, so make sure a
245
274
  secret read from the environment is not empty before passing it. It is **write-only**: the
246
275
  API never returns it, and the SDK keeps no copy and never puts it in an `inspect` or an
247
276
  error message. `signature_header:` names the header that is read: the signature's under
248
- `hmac_sha256_hex`, the secret's under `shared_secret_header`; a `github` or `slack`
249
- endpoint ignores it. **Pass it in the same call that moves an endpoint to
277
+ `hmac_sha256_hex`, the secret's under `shared_secret_header`; a `github`, `slack`, `sns`,
278
+ `stripe` or `twilio` endpoint ignores it. **Pass it in the same call that moves an endpoint to
250
279
  `shared_secret_header`, or from it back to `hmac_sha256_hex`** — a header named for one
251
280
  scheme is never carried over to the other, so a call that passes only `verifier:` raises
252
- `BaseCradle::ValidationError`. A move from `shared_secret_header` to `github` or `slack`
253
- that names no header resets it to `X-Signature`. `endpoint.clear_verification` removes the secret and turns verification
281
+ `BaseCradle::ValidationError`. A move from `shared_secret_header` to `github`, `slack`,
282
+ `sns`, `stripe` or `twilio` that names no header resets it to `X-Signature`. `endpoint.clear_verification` removes the secret and turns verification
254
283
  off. Both return the endpoint, updated in place; read the result at
255
284
  `endpoint.content.verification`. How senders sign is in the API docs:
256
285
  [Verifying Inbound Deliveries](https://basecradle.com/docs/api#verifying-inbound-deliveries-optional).
@@ -56,7 +56,10 @@ module BaseCradle
56
56
  # +invalid_credentials+ — sign-in failed: the email address or password is wrong.
57
57
  class InvalidCredentialsError < AuthenticationError; end
58
58
 
59
- # +invalid_signature+ — webhook ingest: the signature is missing or does not match.
59
+ # +invalid_signature+ — webhook ingest: the delivery did not prove it holds the
60
+ # endpoint's secret. Its signature (or, under "shared_secret_header", its secret header)
61
+ # is missing or does not match, or a signed timestamp is more than five minutes from now,
62
+ # or, under "sns", the message is not from the endpoint's topic.
60
63
  class InvalidSignatureError < AuthenticationError; end
61
64
 
62
65
  # --- 403: account / permissions --------------------------------------------------------
@@ -153,6 +156,12 @@ module BaseCradle
153
156
  # +binary_payload+ — webhook ingest: the request body is not UTF-8 text (HTTP 415).
154
157
  class BinaryPayloadError < Error; end
155
158
 
159
+ # +service_unavailable+ — webhook ingest: the delivery could not be verified right now,
160
+ # because the sender's own certificate could not be fetched (Amazon SNS's) or its
161
+ # handshake could not be completed (HTTP 503). Nothing was stored; the sender sends it
162
+ # again. It is an answer to a *sender*: no call this SDK makes receives it today.
163
+ class ServiceUnavailableError < Error; end
164
+
156
165
  # --- the code => class registry ----------------------------------------------------------
157
166
 
158
167
  # Every API error is an RFC 9457 application/problem+json document with a stable,
@@ -177,7 +186,8 @@ module BaseCradle
177
186
  "invalid_filter" => InvalidFilterError,
178
187
  "endpoint_disabled" => EndpointDisabledError,
179
188
  "payload_too_large" => PayloadTooLargeError,
180
- "binary_payload" => BinaryPayloadError
189
+ "binary_payload" => BinaryPayloadError,
190
+ "service_unavailable" => ServiceUnavailableError
181
191
  }.freeze
182
192
 
183
193
  class Error
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BaseCradle
4
- VERSION = "0.17.2"
4
+ VERSION = "0.17.4"
5
5
  end
@@ -19,10 +19,13 @@ module BaseCradle
19
19
  attribute :enabled
20
20
  # The header deliveries are checked against: the signature's under "hmac_sha256_hex",
21
21
  # the secret's under "shared_secret_header". A "github" endpoint reports its fixed
22
- # X-Hub-Signature-256 here; a "slack" endpoint always reads X-Slack-Signature.
22
+ # X-Hub-Signature-256 here; a "slack" endpoint always reads X-Slack-Signature, a
23
+ # "stripe" endpoint Stripe-Signature, and a "twilio" endpoint X-Twilio-Signature. An
24
+ # "sns" endpoint reports an empty string: SNS signs inside the message, so no header
25
+ # is read.
23
26
  attribute :signature_header
24
- # "hmac_sha256_hex", "github", "shared_secret_header" or "slack" today — an open set;
25
- # read it as a string.
27
+ # "hmac_sha256_hex", "github", "shared_secret_header", "slack", "stripe", "twilio" or
28
+ # "sns" today — an open set; read it as a string.
26
29
  attribute :verifier
27
30
  end
28
31
 
@@ -76,31 +79,57 @@ module BaseCradle
76
79
  # stays as it is; pass at least one, or this raises ArgumentError before any request
77
80
  # is made.
78
81
  #
79
- # - +verifier+ is the scheme, one of four today: "hmac_sha256_hex" (the default; any
80
- # sender you control signs the body), "github" (a GitHub webhook), "slack" (a Slack
81
- # app's Events API; the endpoint answers Slack's url_verification handshake itself,
82
- # and the handshake creates no event) or "shared_secret_header" (a sender that
83
- # cannot sign sends the secret itself in a header). It is passed through as given,
84
- # so a scheme the platform adds later works here unchanged; one it does not know
85
- # raises ValidationError.
82
+ # - +verifier+ is the scheme, one of seven today: "hmac_sha256_hex" (the default; any
83
+ # sender you control signs the body), "github" (a GitHub webhook),
84
+ # "shared_secret_header" (a sender that cannot sign sends the secret itself in a
85
+ # header), "slack" (a Slack app's Events API; the endpoint answers Slack's
86
+ # url_verification handshake itself, and the handshake creates no event), "stripe"
87
+ # (a Stripe webhook destination; a delivery whose signed timestamp is more than five
88
+ # minutes from now is refused, and a repeat of one Stripe event, the same event id,
89
+ # is stored once), "twilio" (the webhooks Twilio sends: an incoming text message, a
90
+ # recording or transcription callback, a status callback) or "sns" (an Amazon SNS
91
+ # topic's HTTPS subscription, in a standard or GovCloud region, not China; the
92
+ # endpoint confirms the subscription itself, and the confirmation creates no event,
93
+ # so set the topic's ARN before subscribing it, since with no ARN set the
94
+ # confirmation is stored as an event whose SubscribeURL is yours to open; raw message
95
+ # delivery must be off; a repeat of one SNS message, the same MessageId, is stored
96
+ # once). It is passed through as given, so a scheme the platform adds later
97
+ # works here unchanged; one it does not know raises ValidationError. Twilio signs the
98
+ # URL it was given, so give it +content.ingest_url+ exactly as the endpoint reports
99
+ # it. Twilio also reads the reply, so a "twilio" endpoint answers each delivery it
100
+ # stores with 200 OK and an empty TwiML document in place of the empty 201: the
101
+ # answer to the sender, which changes nothing this method returns. That empty answer
102
+ # ends a voice call, so the ingest_url is never a number's voice URL; point a
103
+ # recording's callbacks at it instead.
86
104
  # - +credential+ is the signing secret, sent as +verification_credential+: setting it
87
105
  # turns verification on. Under "shared_secret_header" nothing is signed: it is the
88
- # header's exact value, compared as sent, so include any prefix the sender adds. A
89
- # blank one is sent as given and the API treats it as no change: the current
90
- # secret, if any, stays, and +content.verification.enabled+
91
- # cannot tell that skipped rotation from a real one, so make sure a secret read from
92
- # the environment is not empty before passing it. It is sent as its bytes, which
93
- # must be UTF-8 (a BINARY string read from a file is fine); a credential that is not
94
- # a String, or whose bytes are not UTF-8, raises ArgumentError before any request,
95
- # and the error never shows it. It is write-only: the API never returns it, and this
96
- # SDK keeps no copy and never puts it in an inspect or an error message.
106
+ # header's exact value, compared as sent, so include any prefix the sender adds.
107
+ # Under "stripe" it is the destination's Signing secret at Stripe (whsec_...), not an
108
+ # API key. Under "sns" it is the ARN of the topic the endpoint listens to: not a
109
+ # secret, and still write-only. Pass it in the same call that moves an endpoint to
110
+ # or from "sns": a topic's ARN is never carried over to a secret scheme, nor a secret
111
+ # to "sns", so passing only +verifier+ there raises ValidationError.
112
+ # Under "twilio" it is a shared key made at Twilio for signing webhooks (Twilio's own
113
+ # recommendation) or the account's Auth Token. An endpoint holds one secret, a
114
+ # delivery signed with the other is refused with 401, and Twilio does not resend it
115
+ # by default: when you switch between the two, or replace a shared key, change it
116
+ # here in the same minute you change it at Twilio. A blank credential is sent as
117
+ # given and the API treats it as no change: the current secret, if any, stays, and
118
+ # +content.verification.enabled+ cannot tell that skipped rotation from a real one,
119
+ # so make sure a secret read from the environment is not empty before passing it. It
120
+ # is sent as its bytes, which must be UTF-8 (a BINARY string read from a file is
121
+ # fine); a credential that is not a String, or whose bytes are not UTF-8, raises
122
+ # ArgumentError before any request, and the error never shows it. It is write-only:
123
+ # the API never returns it, and this SDK keeps no copy and never puts it in an
124
+ # inspect or an error message.
97
125
  # - +signature_header+ is the header that is read: the signature's under
98
- # "hmac_sha256_hex", the secret's under "shared_secret_header". A "github" or
99
- # "slack" endpoint ignores it. Pass it in the same call that moves an endpoint to
100
- # "shared_secret_header", or from it back to "hmac_sha256_hex": a header named for
101
- # one is never carried over to the other, so passing only +verifier+ there raises
102
- # ValidationError. A move from "shared_secret_header" to "github" or "slack" that
103
- # names no header resets it to X-Signature.
126
+ # "hmac_sha256_hex", the secret's under "shared_secret_header". A "github", "slack",
127
+ # "sns", "stripe" or "twilio" endpoint ignores it. Pass it in the same call that
128
+ # moves an endpoint to "shared_secret_header", or from it back to "hmac_sha256_hex":
129
+ # a header named for one is never carried over to the other, so passing only
130
+ # +verifier+ there raises ValidationError. A move from "shared_secret_header" to
131
+ # "github", "slack", "sns", "stripe" or "twilio" that names no header resets it to
132
+ # X-Signature.
104
133
  #
105
134
  # Any viewer of the endpoint's timeline may configure it, locked timeline or not.
106
135
  # Returns this endpoint, which adopts the one the API returns, so
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: basecradle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.2
4
+ version: 0.17.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Drawk Kwast