svix 2.10.0 → 2.11.1
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/Gemfile.lock +2 -2
- data/lib/svix/api/endpoint.rb +46 -0
- data/lib/svix/models/client_secret_jwt_params_in.rb +66 -0
- data/lib/svix/models/endpoint_mtls_config_in.rb +47 -0
- data/lib/svix/models/endpoint_mtls_config_out.rb +46 -0
- data/lib/svix/models/endpoint_mtls_out.rb +49 -0
- data/lib/svix/models/endpoint_oauth_config_in.rb +102 -0
- data/lib/svix/models/endpoint_oauth_config_out.rb +67 -0
- data/lib/svix/models/endpoint_oauth_out.rb +49 -0
- data/lib/svix/models/oauth2_auth_method_in_out.rb +42 -0
- data/lib/svix/models/oauth2_grant_type_in_out.rb +29 -0
- data/lib/svix/models/oauth_jws_signing_algorithm.rb +28 -0
- data/lib/svix/svix_http_client.rb +1 -1
- data/lib/svix/util.rb +1 -1
- data/lib/svix/version.rb +1 -1
- data/lib/svix/webhook.rb +29 -9
- data/lib/svix.rb +10 -0
- metadata +12 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: af01fcfdd81fd94cc783ceed4209f816cc32a7d4e98dde3edfd34fbf1d016e3d
|
|
4
|
+
data.tar.gz: 2b4c99c6f031d5867d8554f9c5d3417f1eee90cd2fb9d3c7dcaa7db4a808fa47
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 959831787b6882fd066639d810934f360e2bdb0d42b11a1e69f670c63cf631ee501fed274ac309633b60cf44a9eba0264c279fcb371e714c1d01a72a4bf76f6e
|
|
7
|
+
data.tar.gz: ff5a02f47586ac477ec10661bedad3620196f908b7a0188ef01ad7b06f0db5c5325c0de7d16a51ae49361e6904a9e2409191ae18b977782d6f3b48f7f9d03809
|
data/Gemfile.lock
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
svix (2.
|
|
4
|
+
svix (2.11.1)
|
|
5
5
|
base64 (~> 0.3.0)
|
|
6
6
|
logger (~> 1.0)
|
|
7
7
|
|
|
8
8
|
GEM
|
|
9
9
|
remote: https://rubygems.org/
|
|
10
10
|
specs:
|
|
11
|
-
addressable (2.9.
|
|
11
|
+
addressable (2.9.1)
|
|
12
12
|
public_suffix (>= 2.0.2, < 8.0)
|
|
13
13
|
base64 (0.3.0)
|
|
14
14
|
bigdecimal (4.1.1)
|
data/lib/svix/api/endpoint.rb
CHANGED
|
@@ -144,6 +144,52 @@ module Svix
|
|
|
144
144
|
ReplayOut.deserialize(res)
|
|
145
145
|
end
|
|
146
146
|
|
|
147
|
+
def get_oauth_config(app_id, endpoint_id)
|
|
148
|
+
res = @client.execute_request(
|
|
149
|
+
"GET",
|
|
150
|
+
"/api/v1/app/#{app_id}/endpoint/#{endpoint_id}/oauth"
|
|
151
|
+
)
|
|
152
|
+
EndpointOauthOut.deserialize(res)
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
def set_oauth_config(app_id, endpoint_id, endpoint_oauth_config_in)
|
|
156
|
+
@client.execute_request(
|
|
157
|
+
"PUT",
|
|
158
|
+
"/api/v1/app/#{app_id}/endpoint/#{endpoint_id}/oauth",
|
|
159
|
+
body: endpoint_oauth_config_in
|
|
160
|
+
)
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def delete_oauth_config(app_id, endpoint_id)
|
|
164
|
+
@client.execute_request(
|
|
165
|
+
"DELETE",
|
|
166
|
+
"/api/v1/app/#{app_id}/endpoint/#{endpoint_id}/oauth"
|
|
167
|
+
)
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
def get_mtls_config(app_id, endpoint_id)
|
|
171
|
+
res = @client.execute_request(
|
|
172
|
+
"GET",
|
|
173
|
+
"/api/v1/app/#{app_id}/endpoint/#{endpoint_id}/mtls"
|
|
174
|
+
)
|
|
175
|
+
EndpointMtlsOut.deserialize(res)
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
def set_mtls_config(app_id, endpoint_id, endpoint_mtls_config_in)
|
|
179
|
+
@client.execute_request(
|
|
180
|
+
"PUT",
|
|
181
|
+
"/api/v1/app/#{app_id}/endpoint/#{endpoint_id}/mtls",
|
|
182
|
+
body: endpoint_mtls_config_in
|
|
183
|
+
)
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
def delete_mtls_config(app_id, endpoint_id)
|
|
187
|
+
@client.execute_request(
|
|
188
|
+
"DELETE",
|
|
189
|
+
"/api/v1/app/#{app_id}/endpoint/#{endpoint_id}/mtls"
|
|
190
|
+
)
|
|
191
|
+
end
|
|
192
|
+
|
|
147
193
|
def get_stats(app_id, endpoint_id, options = {})
|
|
148
194
|
options = options.transform_keys(&:to_s)
|
|
149
195
|
res = @client.execute_request(
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
5
|
+
module Svix
|
|
6
|
+
class ClientSecretJwtParamsIn
|
|
7
|
+
# The base64-encoded secret used for signing the JWT.
|
|
8
|
+
attr_accessor :secret_base64
|
|
9
|
+
# The algorithm used to sign the JWT.
|
|
10
|
+
attr_accessor :signing_algorithm
|
|
11
|
+
# Optional secret identifier.
|
|
12
|
+
#
|
|
13
|
+
# If supplied, this will be populated in the JWT header in the `kid` field.
|
|
14
|
+
attr_accessor :secret_id
|
|
15
|
+
# Optional number of seconds after which the JWT should expire.
|
|
16
|
+
#
|
|
17
|
+
# Defaults to 300 seconds.
|
|
18
|
+
attr_accessor :token_expiry_secs
|
|
19
|
+
|
|
20
|
+
ALL_FIELD ||= ["secret_base64", "signing_algorithm", "secret_id", "token_expiry_secs"].freeze
|
|
21
|
+
private_constant :ALL_FIELD
|
|
22
|
+
|
|
23
|
+
def initialize(attributes = {})
|
|
24
|
+
unless attributes.is_a?(Hash)
|
|
25
|
+
fail(
|
|
26
|
+
ArgumentError,
|
|
27
|
+
"The input argument (attributes) must be a hash in `Svix::ClientSecretJwtParamsIn` new method"
|
|
28
|
+
)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
attributes.each do |k, v|
|
|
32
|
+
unless ALL_FIELD.include?(k.to_s)
|
|
33
|
+
fail(ArgumentError, "The field #{k} is not part of Svix::ClientSecretJwtParamsIn")
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
instance_variable_set("@#{k}", v)
|
|
37
|
+
instance_variable_set("@__#{k}_is_defined", true)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def self.deserialize(attributes = {})
|
|
42
|
+
attributes = attributes.transform_keys(&:to_s)
|
|
43
|
+
attrs = Hash.new
|
|
44
|
+
attrs["secret_base64"] = attributes["secretBase64"]
|
|
45
|
+
attrs["signing_algorithm"] = Svix::OauthJwsSigningAlgorithm.deserialize(attributes["signingAlgorithm"])
|
|
46
|
+
attrs["secret_id"] = attributes["secretId"]
|
|
47
|
+
attrs["token_expiry_secs"] = attributes["tokenExpirySecs"]
|
|
48
|
+
new(attrs)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def serialize
|
|
52
|
+
out = Hash.new
|
|
53
|
+
out["secretBase64"] = Svix::serialize_primitive(@secret_base64) unless @secret_base64.nil?
|
|
54
|
+
out["signingAlgorithm"] = Svix::serialize_schema_ref(@signing_algorithm) unless @signing_algorithm.nil?
|
|
55
|
+
out["secretId"] = Svix::serialize_primitive(@secret_id) unless @secret_id.nil?
|
|
56
|
+
out["tokenExpirySecs"] = Svix::serialize_primitive(@token_expiry_secs) unless @token_expiry_secs.nil?
|
|
57
|
+
out
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Serializes the object to a json string
|
|
61
|
+
# @return String
|
|
62
|
+
def to_json(*args)
|
|
63
|
+
serialize.to_json(*args)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
5
|
+
module Svix
|
|
6
|
+
class EndpointMtlsConfigIn
|
|
7
|
+
# A PEM encoded private key and X.509 certificate to identify the webhook sender.
|
|
8
|
+
attr_accessor :identity
|
|
9
|
+
|
|
10
|
+
ALL_FIELD ||= ["identity"].freeze
|
|
11
|
+
private_constant :ALL_FIELD
|
|
12
|
+
|
|
13
|
+
def initialize(attributes = {})
|
|
14
|
+
unless attributes.is_a?(Hash)
|
|
15
|
+
fail(ArgumentError, "The input argument (attributes) must be a hash in `Svix::EndpointMtlsConfigIn` new method")
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
attributes.each do |k, v|
|
|
19
|
+
unless ALL_FIELD.include?(k.to_s)
|
|
20
|
+
fail(ArgumentError, "The field #{k} is not part of Svix::EndpointMtlsConfigIn")
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
instance_variable_set("@#{k}", v)
|
|
24
|
+
instance_variable_set("@__#{k}_is_defined", true)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def self.deserialize(attributes = {})
|
|
29
|
+
attributes = attributes.transform_keys(&:to_s)
|
|
30
|
+
attrs = Hash.new
|
|
31
|
+
attrs["identity"] = attributes["identity"]
|
|
32
|
+
new(attrs)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def serialize
|
|
36
|
+
out = Hash.new
|
|
37
|
+
out["identity"] = Svix::serialize_primitive(@identity) unless @identity.nil?
|
|
38
|
+
out
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Serializes the object to a json string
|
|
42
|
+
# @return String
|
|
43
|
+
def to_json(*args)
|
|
44
|
+
serialize.to_json(*args)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
5
|
+
module Svix
|
|
6
|
+
class EndpointMtlsConfigOut
|
|
7
|
+
|
|
8
|
+
ALL_FIELD ||= [].freeze
|
|
9
|
+
private_constant :ALL_FIELD
|
|
10
|
+
|
|
11
|
+
def initialize(attributes = {})
|
|
12
|
+
unless attributes.is_a?(Hash)
|
|
13
|
+
fail(
|
|
14
|
+
ArgumentError,
|
|
15
|
+
"The input argument (attributes) must be a hash in `Svix::EndpointMtlsConfigOut` new method"
|
|
16
|
+
)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
attributes.each do |k, v|
|
|
20
|
+
unless ALL_FIELD.include?(k.to_s)
|
|
21
|
+
fail(ArgumentError, "The field #{k} is not part of Svix::EndpointMtlsConfigOut")
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
instance_variable_set("@#{k}", v)
|
|
25
|
+
instance_variable_set("@__#{k}_is_defined", true)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def self.deserialize(attributes = {})
|
|
30
|
+
attributes = attributes.transform_keys(&:to_s)
|
|
31
|
+
attrs = Hash.new
|
|
32
|
+
new(attrs)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def serialize
|
|
36
|
+
out = Hash.new
|
|
37
|
+
out
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Serializes the object to a json string
|
|
41
|
+
# @return String
|
|
42
|
+
def to_json(*args)
|
|
43
|
+
serialize.to_json(*args)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
5
|
+
module Svix
|
|
6
|
+
class EndpointMtlsOut
|
|
7
|
+
attr_accessor :enabled
|
|
8
|
+
attr_accessor :config
|
|
9
|
+
|
|
10
|
+
ALL_FIELD ||= ["enabled", "config"].freeze
|
|
11
|
+
private_constant :ALL_FIELD
|
|
12
|
+
|
|
13
|
+
def initialize(attributes = {})
|
|
14
|
+
unless attributes.is_a?(Hash)
|
|
15
|
+
fail(ArgumentError, "The input argument (attributes) must be a hash in `Svix::EndpointMtlsOut` new method")
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
attributes.each do |k, v|
|
|
19
|
+
unless ALL_FIELD.include?(k.to_s)
|
|
20
|
+
fail(ArgumentError, "The field #{k} is not part of Svix::EndpointMtlsOut")
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
instance_variable_set("@#{k}", v)
|
|
24
|
+
instance_variable_set("@__#{k}_is_defined", true)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def self.deserialize(attributes = {})
|
|
29
|
+
attributes = attributes.transform_keys(&:to_s)
|
|
30
|
+
attrs = Hash.new
|
|
31
|
+
attrs["enabled"] = attributes["enabled"]
|
|
32
|
+
attrs["config"] = Svix::EndpointMtlsConfigOut.deserialize(attributes["config"]) if attributes["config"]
|
|
33
|
+
new(attrs)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def serialize
|
|
37
|
+
out = Hash.new
|
|
38
|
+
out["enabled"] = Svix::serialize_primitive(@enabled) unless @enabled.nil?
|
|
39
|
+
out["config"] = Svix::serialize_schema_ref(@config) unless @config.nil?
|
|
40
|
+
out
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Serializes the object to a json string
|
|
44
|
+
# @return String
|
|
45
|
+
def to_json(*args)
|
|
46
|
+
serialize.to_json(*args)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
5
|
+
module Svix
|
|
6
|
+
class EndpointOauthConfigIn
|
|
7
|
+
# The OAuth grant type.
|
|
8
|
+
attr_accessor :grant_type
|
|
9
|
+
attr_accessor :auth_method
|
|
10
|
+
# Optional JWT parameters. Only required for `clientSecretJwt`
|
|
11
|
+
attr_accessor :jwt_params
|
|
12
|
+
# The client ID. Required for all authentication types.
|
|
13
|
+
attr_accessor :client_id
|
|
14
|
+
# Optional client secret. This is only used for `clientSecretBasic` and `clientSecretPost`.
|
|
15
|
+
#
|
|
16
|
+
# For `clientSecretBasic`, the secret will be appended to the `Authorization` header.
|
|
17
|
+
# For `clientSecretPost`, this will be added to the body in a `client_secret` parameter.
|
|
18
|
+
attr_accessor :client_secret
|
|
19
|
+
# The URL of the authorization server.
|
|
20
|
+
attr_accessor :token_url
|
|
21
|
+
# Optional OAuth scopes added to the request body.
|
|
22
|
+
attr_accessor :scopes
|
|
23
|
+
# Extra parameters added to the request body as key-value pairs.
|
|
24
|
+
attr_accessor :extra_params
|
|
25
|
+
# For `refreshToken` grant type.
|
|
26
|
+
attr_accessor :refresh_token
|
|
27
|
+
# Optional headers added to the token request.
|
|
28
|
+
attr_accessor :extra_headers
|
|
29
|
+
|
|
30
|
+
ALL_FIELD ||= [
|
|
31
|
+
"grant_type",
|
|
32
|
+
"auth_method",
|
|
33
|
+
"jwt_params",
|
|
34
|
+
"client_id",
|
|
35
|
+
"client_secret",
|
|
36
|
+
"token_url",
|
|
37
|
+
"scopes",
|
|
38
|
+
"extra_params",
|
|
39
|
+
"refresh_token",
|
|
40
|
+
"extra_headers"
|
|
41
|
+
].freeze
|
|
42
|
+
private_constant :ALL_FIELD
|
|
43
|
+
|
|
44
|
+
def initialize(attributes = {})
|
|
45
|
+
unless attributes.is_a?(Hash)
|
|
46
|
+
fail(
|
|
47
|
+
ArgumentError,
|
|
48
|
+
"The input argument (attributes) must be a hash in `Svix::EndpointOauthConfigIn` new method"
|
|
49
|
+
)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
attributes.each do |k, v|
|
|
53
|
+
unless ALL_FIELD.include?(k.to_s)
|
|
54
|
+
fail(ArgumentError, "The field #{k} is not part of Svix::EndpointOauthConfigIn")
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
instance_variable_set("@#{k}", v)
|
|
58
|
+
instance_variable_set("@__#{k}_is_defined", true)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def self.deserialize(attributes = {})
|
|
63
|
+
attributes = attributes.transform_keys(&:to_s)
|
|
64
|
+
attrs = Hash.new
|
|
65
|
+
attrs["grant_type"] = Svix::Oauth2GrantTypeInOut.deserialize(attributes["grantType"])
|
|
66
|
+
attrs["auth_method"] = Svix::Oauth2AuthMethodInOut.deserialize(attributes["authMethod"])
|
|
67
|
+
if attributes["jwtParams"]
|
|
68
|
+
attrs["jwt_params"] = Svix::ClientSecretJwtParamsIn.deserialize(attributes["jwtParams"])
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
attrs["client_id"] = attributes["clientId"]
|
|
72
|
+
attrs["client_secret"] = attributes["clientSecret"]
|
|
73
|
+
attrs["token_url"] = attributes["tokenUrl"]
|
|
74
|
+
attrs["scopes"] = attributes["scopes"]
|
|
75
|
+
attrs["extra_params"] = attributes["extraParams"]
|
|
76
|
+
attrs["refresh_token"] = attributes["refreshToken"]
|
|
77
|
+
attrs["extra_headers"] = attributes["extraHeaders"]
|
|
78
|
+
new(attrs)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def serialize
|
|
82
|
+
out = Hash.new
|
|
83
|
+
out["grantType"] = Svix::serialize_schema_ref(@grant_type) unless @grant_type.nil?
|
|
84
|
+
out["authMethod"] = Svix::serialize_schema_ref(@auth_method) unless @auth_method.nil?
|
|
85
|
+
out["jwtParams"] = Svix::serialize_schema_ref(@jwt_params) unless @jwt_params.nil?
|
|
86
|
+
out["clientId"] = Svix::serialize_primitive(@client_id) unless @client_id.nil?
|
|
87
|
+
out["clientSecret"] = Svix::serialize_primitive(@client_secret) unless @client_secret.nil?
|
|
88
|
+
out["tokenUrl"] = Svix::serialize_primitive(@token_url) unless @token_url.nil?
|
|
89
|
+
out["scopes"] = Svix::serialize_primitive(@scopes) unless @scopes.nil?
|
|
90
|
+
out["extraParams"] = Svix::serialize_primitive(@extra_params) unless @extra_params.nil?
|
|
91
|
+
out["refreshToken"] = Svix::serialize_primitive(@refresh_token) unless @refresh_token.nil?
|
|
92
|
+
out["extraHeaders"] = Svix::serialize_primitive(@extra_headers) unless @extra_headers.nil?
|
|
93
|
+
out
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Serializes the object to a json string
|
|
97
|
+
# @return String
|
|
98
|
+
def to_json(*args)
|
|
99
|
+
serialize.to_json(*args)
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
5
|
+
module Svix
|
|
6
|
+
class EndpointOauthConfigOut
|
|
7
|
+
attr_accessor :grant_type
|
|
8
|
+
attr_accessor :auth_method
|
|
9
|
+
attr_accessor :client_id
|
|
10
|
+
attr_accessor :token_url
|
|
11
|
+
attr_accessor :scopes
|
|
12
|
+
attr_accessor :extra_params
|
|
13
|
+
attr_accessor :extra_headers
|
|
14
|
+
|
|
15
|
+
ALL_FIELD ||= ["grant_type", "auth_method", "client_id", "token_url", "scopes", "extra_params", "extra_headers"].freeze
|
|
16
|
+
private_constant :ALL_FIELD
|
|
17
|
+
|
|
18
|
+
def initialize(attributes = {})
|
|
19
|
+
unless attributes.is_a?(Hash)
|
|
20
|
+
fail(
|
|
21
|
+
ArgumentError,
|
|
22
|
+
"The input argument (attributes) must be a hash in `Svix::EndpointOauthConfigOut` new method"
|
|
23
|
+
)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
attributes.each do |k, v|
|
|
27
|
+
unless ALL_FIELD.include?(k.to_s)
|
|
28
|
+
fail(ArgumentError, "The field #{k} is not part of Svix::EndpointOauthConfigOut")
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
instance_variable_set("@#{k}", v)
|
|
32
|
+
instance_variable_set("@__#{k}_is_defined", true)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def self.deserialize(attributes = {})
|
|
37
|
+
attributes = attributes.transform_keys(&:to_s)
|
|
38
|
+
attrs = Hash.new
|
|
39
|
+
attrs["grant_type"] = Svix::Oauth2GrantTypeInOut.deserialize(attributes["grantType"])
|
|
40
|
+
attrs["auth_method"] = Svix::Oauth2AuthMethodInOut.deserialize(attributes["authMethod"])
|
|
41
|
+
attrs["client_id"] = attributes["clientId"]
|
|
42
|
+
attrs["token_url"] = attributes["tokenUrl"]
|
|
43
|
+
attrs["scopes"] = attributes["scopes"]
|
|
44
|
+
attrs["extra_params"] = attributes["extraParams"]
|
|
45
|
+
attrs["extra_headers"] = attributes["extraHeaders"]
|
|
46
|
+
new(attrs)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def serialize
|
|
50
|
+
out = Hash.new
|
|
51
|
+
out["grantType"] = Svix::serialize_schema_ref(@grant_type) unless @grant_type.nil?
|
|
52
|
+
out["authMethod"] = Svix::serialize_schema_ref(@auth_method) unless @auth_method.nil?
|
|
53
|
+
out["clientId"] = Svix::serialize_primitive(@client_id) unless @client_id.nil?
|
|
54
|
+
out["tokenUrl"] = Svix::serialize_primitive(@token_url) unless @token_url.nil?
|
|
55
|
+
out["scopes"] = Svix::serialize_primitive(@scopes) unless @scopes.nil?
|
|
56
|
+
out["extraParams"] = Svix::serialize_primitive(@extra_params) unless @extra_params.nil?
|
|
57
|
+
out["extraHeaders"] = Svix::serialize_primitive(@extra_headers) unless @extra_headers.nil?
|
|
58
|
+
out
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Serializes the object to a json string
|
|
62
|
+
# @return String
|
|
63
|
+
def to_json(*args)
|
|
64
|
+
serialize.to_json(*args)
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
require "json"
|
|
4
|
+
|
|
5
|
+
module Svix
|
|
6
|
+
class EndpointOauthOut
|
|
7
|
+
attr_accessor :enabled
|
|
8
|
+
attr_accessor :config
|
|
9
|
+
|
|
10
|
+
ALL_FIELD ||= ["enabled", "config"].freeze
|
|
11
|
+
private_constant :ALL_FIELD
|
|
12
|
+
|
|
13
|
+
def initialize(attributes = {})
|
|
14
|
+
unless attributes.is_a?(Hash)
|
|
15
|
+
fail(ArgumentError, "The input argument (attributes) must be a hash in `Svix::EndpointOauthOut` new method")
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
attributes.each do |k, v|
|
|
19
|
+
unless ALL_FIELD.include?(k.to_s)
|
|
20
|
+
fail(ArgumentError, "The field #{k} is not part of Svix::EndpointOauthOut")
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
instance_variable_set("@#{k}", v)
|
|
24
|
+
instance_variable_set("@__#{k}_is_defined", true)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def self.deserialize(attributes = {})
|
|
29
|
+
attributes = attributes.transform_keys(&:to_s)
|
|
30
|
+
attrs = Hash.new
|
|
31
|
+
attrs["enabled"] = attributes["enabled"]
|
|
32
|
+
attrs["config"] = Svix::EndpointOauthConfigOut.deserialize(attributes["config"]) if attributes["config"]
|
|
33
|
+
new(attrs)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def serialize
|
|
37
|
+
out = Hash.new
|
|
38
|
+
out["enabled"] = Svix::serialize_primitive(@enabled) unless @enabled.nil?
|
|
39
|
+
out["config"] = Svix::serialize_schema_ref(@config) unless @config.nil?
|
|
40
|
+
out
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Serializes the object to a json string
|
|
44
|
+
# @return String
|
|
45
|
+
def to_json(*args)
|
|
46
|
+
serialize.to_json(*args)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
module Svix
|
|
4
|
+
# The method used for authenticating to the OAuth authorization server.
|
|
5
|
+
#
|
|
6
|
+
# `clientSecretJwt` will construct a JWT used for authentication
|
|
7
|
+
# with the oauth authorization server. This method is less
|
|
8
|
+
# commonly used and may not be supported by all oauth providers.
|
|
9
|
+
# `clientSecretBasic` will authenticate to the oauth authorization server
|
|
10
|
+
# using an `Authorization` header with the client secret as the value.
|
|
11
|
+
# This is the most common means of authentication.
|
|
12
|
+
# `clientSecretPost` will authenticate to the oauth authorization server
|
|
13
|
+
# by passing the client secret in a `client_secret` field in the
|
|
14
|
+
# request body. This method may not be supported by all oauth providers,
|
|
15
|
+
# and in general `clientSecretBasic` should be preferred.
|
|
16
|
+
class Oauth2AuthMethodInOut
|
|
17
|
+
CLIENT_SECRET_JWT = "clientSecretJwt".freeze
|
|
18
|
+
CLIENT_SECRET_BASIC = "clientSecretBasic".freeze
|
|
19
|
+
CLIENT_SECRET_POST = "clientSecretPost".freeze
|
|
20
|
+
|
|
21
|
+
def self.all_vars
|
|
22
|
+
@all_vars ||= [CLIENT_SECRET_JWT, CLIENT_SECRET_BASIC, CLIENT_SECRET_POST].freeze
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def initialize(value)
|
|
26
|
+
unless Oauth2AuthMethodInOut.all_vars.include?(value)
|
|
27
|
+
raise "Invalid ENUM value '#{value}' for class #Oauth2AuthMethodInOut"
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
@value = value
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def self.deserialize(value)
|
|
34
|
+
return value if Oauth2AuthMethodInOut.all_vars.include?(value)
|
|
35
|
+
raise "Invalid ENUM value '#{value}' for class #Oauth2AuthMethodInOut"
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def serialize
|
|
39
|
+
@value
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
module Svix
|
|
4
|
+
class Oauth2GrantTypeInOut
|
|
5
|
+
CLIENT_CREDENTIALS = "clientCredentials".freeze
|
|
6
|
+
REFRESH_TOKEN = "refreshToken".freeze
|
|
7
|
+
|
|
8
|
+
def self.all_vars
|
|
9
|
+
@all_vars ||= [CLIENT_CREDENTIALS, REFRESH_TOKEN].freeze
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def initialize(value)
|
|
13
|
+
unless Oauth2GrantTypeInOut.all_vars.include?(value)
|
|
14
|
+
raise "Invalid ENUM value '#{value}' for class #Oauth2GrantTypeInOut"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
@value = value
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.deserialize(value)
|
|
21
|
+
return value if Oauth2GrantTypeInOut.all_vars.include?(value)
|
|
22
|
+
raise "Invalid ENUM value '#{value}' for class #Oauth2GrantTypeInOut"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def serialize
|
|
26
|
+
@value
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
# This file is @generated
|
|
3
|
+
module Svix
|
|
4
|
+
class OauthJwsSigningAlgorithm
|
|
5
|
+
RS256 = "RS256".freeze
|
|
6
|
+
|
|
7
|
+
def self.all_vars
|
|
8
|
+
@all_vars ||= [RS256].freeze
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def initialize(value)
|
|
12
|
+
unless OauthJwsSigningAlgorithm.all_vars.include?(value)
|
|
13
|
+
raise "Invalid ENUM value '#{value}' for class #OauthJwsSigningAlgorithm"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
@value = value
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def self.deserialize(value)
|
|
20
|
+
return value if OauthJwsSigningAlgorithm.all_vars.include?(value)
|
|
21
|
+
raise "Invalid ENUM value '#{value}' for class #OauthJwsSigningAlgorithm"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def serialize
|
|
25
|
+
@value
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -111,7 +111,7 @@ module Svix
|
|
|
111
111
|
[0.05, 0.1, 0.2].each_with_index do |sleep_duration, index|
|
|
112
112
|
begin
|
|
113
113
|
res = http.request(request)
|
|
114
|
-
return res unless Integer(res.code) >= 500
|
|
114
|
+
return res unless Integer(res.code) >= 500 || Integer(res.code) == 423
|
|
115
115
|
rescue *RETRYABLE_ERRORS
|
|
116
116
|
# retried below
|
|
117
117
|
end
|
data/lib/svix/util.rb
CHANGED
|
@@ -33,7 +33,7 @@ module Svix
|
|
|
33
33
|
# the secret length. This should be considered when using secure_compare
|
|
34
34
|
# to compare weak, short secrets to user input.
|
|
35
35
|
def secure_compare(a, b)
|
|
36
|
-
a.
|
|
36
|
+
a.bytesize == b.bytesize && fixed_length_secure_compare(a, b)
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
module_function :secure_compare
|
data/lib/svix/version.rb
CHANGED
data/lib/svix/webhook.rb
CHANGED
|
@@ -36,16 +36,12 @@ module Svix
|
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
def verify(payload, headers)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
# Svix sends the headers in lowercase, but some servers hand them back
|
|
40
|
+
# with a different casing (Rack typically yields "Svix-Id"), so normalize
|
|
41
|
+
# once up front the way the JavaScript library does.
|
|
42
|
+
msgId, msgTimestamp, msgSignature = find_signed_headers(downcase_keys(headers))
|
|
42
43
|
if !msgSignature || !msgId || !msgTimestamp
|
|
43
|
-
|
|
44
|
-
msgSignature = headers["webhook-signature"]
|
|
45
|
-
msgTimestamp = headers["webhook-timestamp"]
|
|
46
|
-
if !msgSignature || !msgId || !msgTimestamp
|
|
47
|
-
raise WebhookVerificationError, "Missing required headers"
|
|
48
|
-
end
|
|
44
|
+
raise WebhookVerificationError, "Missing required headers"
|
|
49
45
|
end
|
|
50
46
|
|
|
51
47
|
verify_timestamp(msgTimestamp)
|
|
@@ -83,6 +79,30 @@ module Svix
|
|
|
83
79
|
SECRET_PREFIX = "whsec_"
|
|
84
80
|
DEFAULT_TOLERANCE = 5 * 60
|
|
85
81
|
|
|
82
|
+
# Returns the id, timestamp and signature values, or nil when neither the
|
|
83
|
+
# branded nor the unbranded set of headers is present.
|
|
84
|
+
def find_signed_headers(headers)
|
|
85
|
+
["svix", "webhook"].each do |prefix|
|
|
86
|
+
msgId = headers["#{prefix}-id"]
|
|
87
|
+
msgTimestamp = headers["#{prefix}-timestamp"]
|
|
88
|
+
msgSignature = headers["#{prefix}-signature"]
|
|
89
|
+
|
|
90
|
+
if msgId && msgTimestamp && msgSignature
|
|
91
|
+
return [msgId, msgTimestamp, msgSignature]
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
nil
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def downcase_keys(headers)
|
|
99
|
+
return headers unless headers.respond_to?(:each_pair)
|
|
100
|
+
|
|
101
|
+
headers.each_pair.with_object({}) do |(name, value), downcased|
|
|
102
|
+
downcased[name.to_s.downcase] = value
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
86
106
|
def verify_timestamp(timestampHeader)
|
|
87
107
|
begin
|
|
88
108
|
now = Integer(Time.now)
|
data/lib/svix.rb
CHANGED
|
@@ -82,6 +82,7 @@ require "svix/models/checkbook_config_out"
|
|
|
82
82
|
require "svix/models/clickhouse_config_in"
|
|
83
83
|
require "svix/models/clickhouse_config_out"
|
|
84
84
|
require "svix/models/clickhouse_config_patch"
|
|
85
|
+
require "svix/models/client_secret_jwt_params_in"
|
|
85
86
|
require "svix/models/connector_in"
|
|
86
87
|
require "svix/models/connector_kind"
|
|
87
88
|
require "svix/models/connector_out"
|
|
@@ -116,6 +117,12 @@ require "svix/models/endpoint_headers_out"
|
|
|
116
117
|
require "svix/models/endpoint_headers_patch_in"
|
|
117
118
|
require "svix/models/endpoint_in"
|
|
118
119
|
require "svix/models/endpoint_message_out"
|
|
120
|
+
require "svix/models/endpoint_mtls_config_in"
|
|
121
|
+
require "svix/models/endpoint_mtls_config_out"
|
|
122
|
+
require "svix/models/endpoint_mtls_out"
|
|
123
|
+
require "svix/models/endpoint_oauth_config_in"
|
|
124
|
+
require "svix/models/endpoint_oauth_config_out"
|
|
125
|
+
require "svix/models/endpoint_oauth_out"
|
|
119
126
|
require "svix/models/endpoint_out"
|
|
120
127
|
require "svix/models/endpoint_patch"
|
|
121
128
|
require "svix/models/endpoint_secret_out"
|
|
@@ -212,6 +219,9 @@ require "svix/models/meta_config"
|
|
|
212
219
|
require "svix/models/meta_config_out"
|
|
213
220
|
require "svix/models/nango_config"
|
|
214
221
|
require "svix/models/nango_config_out"
|
|
222
|
+
require "svix/models/oauth2_auth_method_in_out"
|
|
223
|
+
require "svix/models/oauth2_grant_type_in_out"
|
|
224
|
+
require "svix/models/oauth_jws_signing_algorithm"
|
|
215
225
|
require "svix/models/open_claw_config"
|
|
216
226
|
require "svix/models/open_claw_config_out"
|
|
217
227
|
require "svix/models/operational_webhook_endpoint_headers_in"
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: svix
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.11.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Svix
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-11-
|
|
10
|
+
date: 2026-11-23 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: base64
|
|
@@ -193,6 +193,7 @@ files:
|
|
|
193
193
|
- lib/svix/models/clickhouse_config_in.rb
|
|
194
194
|
- lib/svix/models/clickhouse_config_out.rb
|
|
195
195
|
- lib/svix/models/clickhouse_config_patch.rb
|
|
196
|
+
- lib/svix/models/client_secret_jwt_params_in.rb
|
|
196
197
|
- lib/svix/models/connector_in.rb
|
|
197
198
|
- lib/svix/models/connector_kind.rb
|
|
198
199
|
- lib/svix/models/connector_out.rb
|
|
@@ -227,6 +228,12 @@ files:
|
|
|
227
228
|
- lib/svix/models/endpoint_headers_patch_in.rb
|
|
228
229
|
- lib/svix/models/endpoint_in.rb
|
|
229
230
|
- lib/svix/models/endpoint_message_out.rb
|
|
231
|
+
- lib/svix/models/endpoint_mtls_config_in.rb
|
|
232
|
+
- lib/svix/models/endpoint_mtls_config_out.rb
|
|
233
|
+
- lib/svix/models/endpoint_mtls_out.rb
|
|
234
|
+
- lib/svix/models/endpoint_oauth_config_in.rb
|
|
235
|
+
- lib/svix/models/endpoint_oauth_config_out.rb
|
|
236
|
+
- lib/svix/models/endpoint_oauth_out.rb
|
|
230
237
|
- lib/svix/models/endpoint_out.rb
|
|
231
238
|
- lib/svix/models/endpoint_patch.rb
|
|
232
239
|
- lib/svix/models/endpoint_secret_out.rb
|
|
@@ -323,6 +330,9 @@ files:
|
|
|
323
330
|
- lib/svix/models/meta_config_out.rb
|
|
324
331
|
- lib/svix/models/nango_config.rb
|
|
325
332
|
- lib/svix/models/nango_config_out.rb
|
|
333
|
+
- lib/svix/models/oauth2_auth_method_in_out.rb
|
|
334
|
+
- lib/svix/models/oauth2_grant_type_in_out.rb
|
|
335
|
+
- lib/svix/models/oauth_jws_signing_algorithm.rb
|
|
326
336
|
- lib/svix/models/open_claw_config.rb
|
|
327
337
|
- lib/svix/models/open_claw_config_out.rb
|
|
328
338
|
- lib/svix/models/operational_webhook_endpoint_headers_in.rb
|