telnyx 5.68.1 → 5.68.2
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/lib/telnyx/lib/webhook_verification.rb +1 -0
- data/lib/telnyx/lib/webhook_verification_error.rb +27 -0
- data/lib/telnyx/lib/webhooks_ed25519.rb +50 -0
- data/lib/telnyx/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fc15a744f447e7c613e7e755a58535df1b6f45e5f2e224ca7c2ae0b34a047778
|
|
4
|
+
data.tar.gz: 647b8a4d529deb94ae909c30c7d1de71b00f5199f8caa7782508dd37550ca6a8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 67a69b663b07bc3507001555c0178d4a4de7c9bc61b656970c25ab236377ee34b91723fb32bc6b821095007582d164bc8c46109d4f870548fa0cd7b38e2c7296
|
|
7
|
+
data.tar.gz: 633e6228be91505a6693026b2e64404fcf6f452ad0de12157f7845a0643b2f3131cc08bd13bdbd325d856db865fafc2509891d9fff1671e670b7ddf8f7436f5c
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 5.68.2 (2026-03-31)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v5.68.1...v5.68.2](https://github.com/team-telnyx/telnyx-ruby/compare/v5.68.1...v5.68.2)
|
|
6
|
+
|
|
3
7
|
## 5.68.1 (2026-03-31)
|
|
4
8
|
|
|
5
9
|
Full Changelog: [v5.68.0...v5.68.1](https://github.com/team-telnyx/telnyx-ruby/compare/v5.68.0...v5.68.1)
|
data/README.md
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Telnyx
|
|
4
|
+
module Errors
|
|
5
|
+
# Error raised when webhook signature verification fails.
|
|
6
|
+
#
|
|
7
|
+
# This error is raised by the webhook verification module when:
|
|
8
|
+
# - No public key is configured
|
|
9
|
+
# - Required headers are missing (telnyx-signature-ed25519, telnyx-timestamp)
|
|
10
|
+
# - Timestamp is too old or too new (outside 5-minute tolerance)
|
|
11
|
+
# - Signature verification fails
|
|
12
|
+
# - Public key or signature format is invalid
|
|
13
|
+
#
|
|
14
|
+
# @example Handling verification errors
|
|
15
|
+
# begin
|
|
16
|
+
# client.webhooks.verify!(payload, headers)
|
|
17
|
+
# rescue Telnyx::Errors::WebhookVerificationError => e
|
|
18
|
+
# puts "Webhook verification failed: #{e.message}"
|
|
19
|
+
# end
|
|
20
|
+
class WebhookVerificationError < StandardError
|
|
21
|
+
# @param message [String] The error message describing the verification failure
|
|
22
|
+
def initialize(message:)
|
|
23
|
+
super(message)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "webhook_verification"
|
|
4
|
+
require_relative "webhook_verification_error"
|
|
5
|
+
|
|
6
|
+
module Telnyx
|
|
7
|
+
module Resources
|
|
8
|
+
# Extends the generated Webhooks class with ED25519 signature verification.
|
|
9
|
+
#
|
|
10
|
+
# This reopens the Webhooks class to include the WebhookVerification module,
|
|
11
|
+
# which adds ED25519 signature verification matching Python, Node, Go, and Java SDKs.
|
|
12
|
+
#
|
|
13
|
+
# Usage:
|
|
14
|
+
#
|
|
15
|
+
# require "telnyx"
|
|
16
|
+
# require "telnyx/lib/webhooks_ed25519"
|
|
17
|
+
#
|
|
18
|
+
# client = Telnyx::Client.new(
|
|
19
|
+
# api_key: ENV["TELNYX_API_KEY"],
|
|
20
|
+
# public_key: ENV["TELNYX_PUBLIC_KEY"] # Base64 from Mission Control
|
|
21
|
+
# )
|
|
22
|
+
#
|
|
23
|
+
# # Verify signature only (raises WebhookVerificationError on failure)
|
|
24
|
+
# client.webhooks.verify!(payload, headers)
|
|
25
|
+
#
|
|
26
|
+
# # Verify and parse (ED25519 verification, then parse)
|
|
27
|
+
# event = client.webhooks.unwrap(payload, headers: headers)
|
|
28
|
+
#
|
|
29
|
+
class Webhooks
|
|
30
|
+
include Telnyx::Lib::WebhookVerification
|
|
31
|
+
|
|
32
|
+
# Override unwrap to use ED25519 verification instead of StandardWebhooks.
|
|
33
|
+
#
|
|
34
|
+
# @param payload [String] The raw webhook payload as a string
|
|
35
|
+
# @param headers [Hash{String=>String}] The raw HTTP headers
|
|
36
|
+
# @param key [String, nil] Optional public key override (base64-encoded ED25519)
|
|
37
|
+
#
|
|
38
|
+
# @return [Telnyx::Models::UnwrapWebhookEvent]
|
|
39
|
+
# @raise [Telnyx::Errors::WebhookVerificationError] If verification fails
|
|
40
|
+
def unwrap(payload, headers:, key: nil)
|
|
41
|
+
# Use ED25519 verification
|
|
42
|
+
do_verify_signature(payload, headers, key || @client.public_key)
|
|
43
|
+
|
|
44
|
+
# Parse the payload
|
|
45
|
+
parsed = JSON.parse(payload, symbolize_names: true)
|
|
46
|
+
Telnyx::Internal::Type::Converter.coerce(Telnyx::Models::UnwrapWebhookEvent, parsed)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
data/lib/telnyx/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: telnyx
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.68.
|
|
4
|
+
version: 5.68.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Telnyx
|
|
@@ -94,6 +94,8 @@ files:
|
|
|
94
94
|
- lib/telnyx/internal/type/unknown.rb
|
|
95
95
|
- lib/telnyx/internal/util.rb
|
|
96
96
|
- lib/telnyx/lib/webhook_verification.rb
|
|
97
|
+
- lib/telnyx/lib/webhook_verification_error.rb
|
|
98
|
+
- lib/telnyx/lib/webhooks_ed25519.rb
|
|
97
99
|
- lib/telnyx/lib/websocket.rb
|
|
98
100
|
- lib/telnyx/lib/websocket/base.rb
|
|
99
101
|
- lib/telnyx/lib/websocket/speech_to_text_stream_params.rb
|