stytch 10.6.0 → 10.8.0

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: 1fc94b3f2682727e8313774b34312e8e5b621e012a99cf789c956cfc08a43419
4
- data.tar.gz: e82cbc5ef8e95c439b0e959c9aeb1b88d123b589e58816be36359654b5c642da
3
+ metadata.gz: 0dfb80803a3696d1a6f3d7118c859a571b42e52eacd550ad0e8f9450caba75e7
4
+ data.tar.gz: fb9e341e712dac2eed58d0b99b6281f328aecee8833b3fbd40c62f0b781c65c0
5
5
  SHA512:
6
- metadata.gz: e37526e4eeef1517b5aa1fc415a7b9f742943ba89fe97c88088ae7059ecb1840b4330dc7c7dffd7c8b822f3a69697ebcafac2965f735e53bfd1b6fc47dd82c68
7
- data.tar.gz: 8a84503310f85e276f94d7c8ce7adbc0a3b010669a8d9548256df0c9a8d35a1ec759eb803a74be530dd2226895483f385c0a4fa5e8d1e86e7bc29ddb5f8ce6f5
6
+ metadata.gz: e97f8ec4d069aa1f39822a2fc2de3ccdaad06e913d80180eb50d24bcfdb116cc61d8b1a5508f3675ef8e3b23ea4abe61391335258e65ed2a0a9701818b8eb673
7
+ data.tar.gz: 390ed7e78d764da278cd3c2e1ff1071a7f93be2e3a1d2d0905fbfc27e71ea62b2cb6873a70081897b259bed7c7defb7658c62f495f89bdf3f1ec354657ebad23
@@ -19,6 +19,8 @@ module StytchB2B
19
19
  # Authenticate an impersonation token to impersonate a. This endpoint requires an impersonation token that is not expired or previously used.
20
20
  # A Stytch session will be created for the impersonated member with a 60 minute duration. Impersonated sessions cannot be extended.
21
21
  #
22
+ # Prior to this step, you can generate an impersonation token by visiting the Stytch dashboard, viewing a member, and clicking the `Impersonate Member` button.
23
+ #
22
24
  # == Parameters:
23
25
  # impersonation_token::
24
26
  # The User Impersonation token to authenticate.
@@ -161,6 +161,9 @@ module StytchB2B
161
161
  # allowed_oauth_tenants::
162
162
  # A map of allowed OAuth tenants. If this field is not passed in, the Organization will not allow JIT provisioning by OAuth Tenant. Allowed keys are "slack", "hubspot", and "github".
163
163
  # The type of this field is nilable +object+.
164
+ # claimed_email_domains::
165
+ # A list of email domains that are claimed by the Organization.
166
+ # The type of this field is nilable list of +String+.
164
167
  #
165
168
  # == Returns:
166
169
  # An object with the following fields:
@@ -189,7 +192,8 @@ module StytchB2B
189
192
  mfa_methods: nil,
190
193
  allowed_mfa_methods: nil,
191
194
  oauth_tenant_jit_provisioning: nil,
192
- allowed_oauth_tenants: nil
195
+ allowed_oauth_tenants: nil,
196
+ claimed_email_domains: nil
193
197
  )
194
198
  headers = {}
195
199
  request = {
@@ -210,6 +214,7 @@ module StytchB2B
210
214
  request[:allowed_mfa_methods] = allowed_mfa_methods unless allowed_mfa_methods.nil?
211
215
  request[:oauth_tenant_jit_provisioning] = oauth_tenant_jit_provisioning unless oauth_tenant_jit_provisioning.nil?
212
216
  request[:allowed_oauth_tenants] = allowed_oauth_tenants unless allowed_oauth_tenants.nil?
217
+ request[:claimed_email_domains] = claimed_email_domains unless claimed_email_domains.nil?
213
218
 
214
219
  post_request('/v1/b2b/organizations', request, headers)
215
220
  end
@@ -389,6 +394,9 @@ module StytchB2B
389
394
  #
390
395
  # If this field is provided and a session header is passed into the request, the Member Session must have permission to perform the `update.settings.allowed-oauth-tenants` action on the `stytch.organization` Resource.
391
396
  # The type of this field is nilable +object+.
397
+ # claimed_email_domains::
398
+ # A list of email domains that are claimed by the Organization.
399
+ # The type of this field is nilable list of +String+.
392
400
  #
393
401
  # == Returns:
394
402
  # An object with the following fields:
@@ -424,6 +432,7 @@ module StytchB2B
424
432
  allowed_mfa_methods: nil,
425
433
  oauth_tenant_jit_provisioning: nil,
426
434
  allowed_oauth_tenants: nil,
435
+ claimed_email_domains: nil,
427
436
  method_options: nil
428
437
  )
429
438
  headers = {}
@@ -447,6 +456,7 @@ module StytchB2B
447
456
  request[:allowed_mfa_methods] = allowed_mfa_methods unless allowed_mfa_methods.nil?
448
457
  request[:oauth_tenant_jit_provisioning] = oauth_tenant_jit_provisioning unless oauth_tenant_jit_provisioning.nil?
449
458
  request[:allowed_oauth_tenants] = allowed_oauth_tenants unless allowed_oauth_tenants.nil?
459
+ request[:claimed_email_domains] = claimed_email_domains unless claimed_email_domains.nil?
450
460
 
451
461
  put_request("/v1/b2b/organizations/#{organization_id}", request, headers)
452
462
  end
@@ -596,18 +596,18 @@ module StytchB2B
596
596
  #
597
597
  # == Returns:
598
598
  # An object with the following fields:
599
- # member::
600
- # The [Member object](https://stytch.com/docs/b2b/api/member-object)
601
- # The type of this field is +Member+ (+object+).
602
- # organization::
603
- # The [Organization object](https://stytch.com/docs/b2b/api/organization-object).
604
- # The type of this field is +Organization+ (+object+).
605
599
  # status_code::
606
600
  # The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
607
601
  # The type of this field is +Integer+.
608
602
  # member_id::
609
603
  # Globally unique UUID that identifies a specific Member.
610
604
  # The type of this field is nilable +String+.
605
+ # member::
606
+ # The [Member object](https://stytch.com/docs/b2b/api/member-object)
607
+ # The type of this field is nilable +Member+ (+object+).
608
+ # organization::
609
+ # The [Organization object](https://stytch.com/docs/b2b/api/organization-object).
610
+ # The type of this field is nilable +Organization+ (+object+).
611
611
  #
612
612
  # == Method Options:
613
613
  # This method supports an optional +StytchB2B::Passwords::Email::RequireResetRequestOptions+ object which will modify the headers sent in the HTTP request.
@@ -341,6 +341,77 @@ module StytchB2B
341
341
  post_request('/v1/b2b/sessions/exchange', request, headers)
342
342
  end
343
343
 
344
+ # Use this endpoint to exchange a Connected Apps Access Token back into a Member Session for the underlying Member.
345
+ # This session can be used with the Stytch SDKs and APIs.
346
+ #
347
+ # The Access Token must contain the `full_access` scope and must not be more than 5 minutes old. Access Tokens may only be exchanged a single time.
348
+ #
349
+ # Because the Member previously completed MFA and satisfied all Organization authentication requirements at the time of the original Access Token issuance, this endpoint will never return an `intermediate_session_token` or require MFA.
350
+ #
351
+ # == Parameters:
352
+ # access_token::
353
+ # The access token to exchange for a Stytch Session. Must be granted the `full_access` scope.
354
+ # The type of this field is +String+.
355
+ # session_duration_minutes::
356
+ # Set the session lifetime to be this many minutes from now. This will start a new session if one doesn't already exist,
357
+ # returning both an opaque `session_token` and `session_jwt` for this session. Remember that the `session_jwt` will have a fixed lifetime of
358
+ # five minutes regardless of the underlying session duration, and will need to be refreshed over time.
359
+ #
360
+ # This value must be a minimum of 5 and a maximum of 527040 minutes (366 days).
361
+ #
362
+ # If a `session_token` or `session_jwt` is provided then a successful authentication will continue to extend the session this many minutes.
363
+ #
364
+ # If the `session_duration_minutes` parameter is not specified, a Stytch session will be created with a 60 minute duration. If you don't want
365
+ # to use the Stytch session product, you can ignore the session fields in the response.
366
+ # The type of this field is nilable +Integer+.
367
+ # session_custom_claims::
368
+ # Add a custom claims map to the Session being authenticated. Claims are only created if a Session is initialized by providing a value in
369
+ # `session_duration_minutes`. Claims will be included on the Session object and in the JWT. To update a key in an existing Session, supply a new value. To
370
+ # delete a key, supply a null value. Custom claims made with reserved claims (`iss`, `sub`, `aud`, `exp`, `nbf`, `iat`, `jti`) will be ignored.
371
+ # Total custom claims size cannot exceed four kilobytes.
372
+ # The type of this field is nilable +object+.
373
+ #
374
+ # == Returns:
375
+ # An object with the following fields:
376
+ # request_id::
377
+ # Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue.
378
+ # The type of this field is +String+.
379
+ # member_id::
380
+ # Globally unique UUID that identifies a specific Member.
381
+ # The type of this field is +String+.
382
+ # session_token::
383
+ # A secret token for a given Stytch Session.
384
+ # The type of this field is +String+.
385
+ # session_jwt::
386
+ # The JSON Web Token (JWT) for a given Stytch Session.
387
+ # The type of this field is +String+.
388
+ # member::
389
+ # The [Member object](https://stytch.com/docs/b2b/api/member-object)
390
+ # The type of this field is +Member+ (+object+).
391
+ # organization::
392
+ # The [Organization object](https://stytch.com/docs/b2b/api/organization-object).
393
+ # The type of this field is +Organization+ (+object+).
394
+ # status_code::
395
+ # The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
396
+ # The type of this field is +Integer+.
397
+ # member_session::
398
+ # The [Session object](https://stytch.com/docs/b2b/api/session-object).
399
+ # The type of this field is nilable +MemberSession+ (+object+).
400
+ def exchange_access_token(
401
+ access_token:,
402
+ session_duration_minutes: nil,
403
+ session_custom_claims: nil
404
+ )
405
+ headers = {}
406
+ request = {
407
+ access_token: access_token
408
+ }
409
+ request[:session_duration_minutes] = session_duration_minutes unless session_duration_minutes.nil?
410
+ request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil?
411
+
412
+ post_request('/v1/b2b/sessions/exchange_access_token', request, headers)
413
+ end
414
+
344
415
  # Migrate a session from an external OIDC compliant endpoint. Stytch will call the external UserInfo endpoint defined in your Stytch Project settings in the [Dashboard](https://stytch.com/docs/dashboard), and then perform a lookup using the `session_token`. If the response contains a valid email address, Stytch will attempt to match that email address with an existing in your and create a Stytch Session. You will need to create the member before using this endpoint.
345
416
  #
346
417
  # == Parameters:
data/lib/stytch/fraud.rb CHANGED
@@ -94,31 +94,37 @@ module Stytch
94
94
  @connection = connection
95
95
  end
96
96
 
97
- # Set a rule for a particular `visitor_id`, `browser_id`, `visitor_fingerprint`, `browser_fingerprint`, `hardware_fingerprint`, or `network_fingerprint`. This is helpful in cases where you want to allow or block a specific user or fingerprint. You should be careful when setting rules for `browser_fingerprint`, `hardware_fingerprint`, or `network_fingerprint` as they can be shared across multiple users, and you could affect more users than intended.
97
+ # Set a rule for a particular `visitor_id`, `browser_id`, `visitor_fingerprint`, `browser_fingerprint`, `hardware_fingerprint`, `network_fingerprint`, `cidr_block`, `asn`, or `country_code`. This is helpful in cases where you want to allow or block a specific user or fingerprint. You should be careful when setting rules for `browser_fingerprint`, `hardware_fingerprint`, or `network_fingerprint` as they can be shared across multiple users, and you could affect more users than intended.
98
+ #
99
+ # You may not set an `ALLOW` rule for a `country_code`.
98
100
  #
99
101
  # Rules are applied in the order specified above. For example, if an end user has an `ALLOW` rule set for their `visitor_id` but a `BLOCK` rule set for their `hardware_fingerprint`, they will receive an `ALLOW` verdict because the `visitor_id` rule takes precedence.
100
102
  #
103
+ # If there are conflicts between multiple `cidr_block` rules (for example, if the `ip_address` of the end user overlaps with multiple CIDR blocks that have rules set), the conflicts are resolved as follows:
104
+ # - The smallest block size takes precedence. For example, if an `ip_address` overlaps with a `cidr_block` rule of `ALLOW` for a block with a prefix of `/32` and a `cidr_block` rule of `BLOCK` with a prefix of `/24`, the rule match verdict will be `ALLOW`.
105
+ # - Among equivalent size blocks, `BLOCK` takes precedence over `CHALLENGE`, which takes precedence over `ALLOW`. For example, if an `ip_address` overlaps with two `cidr_block` rules with blocks of the same size that return `CHALLENGE` and `ALLOW`, the rule match verdict will be `CHALLENGE`.
106
+ #
101
107
  # == Parameters:
102
108
  # action::
103
- # The action that should be returned by a fingerprint lookup for that fingerprint or ID with a `RULE_MATCH` reason. The following values are valid: `ALLOW`, `BLOCK`, `CHALLENGE`, or `NONE`. If a `NONE` action is specified, it will clear the stored rule.
109
+ # The action that should be returned by a fingerprint lookup for that identifier with a `RULE_MATCH` reason. The following values are valid: `ALLOW`, `BLOCK`, `CHALLENGE`, or `NONE`. For country codes, `ALLOW` actions are not allowed. If a `NONE` action is specified, it will clear the stored rule.
104
110
  # The type of this field is +RuleAction+ (string enum).
105
111
  # visitor_id::
106
- # The visitor ID we want to set a rule for. Only one fingerprint or ID can be specified in the request.
112
+ # The visitor ID we want to set a rule for. Only one identifier can be specified in the request.
107
113
  # The type of this field is nilable +String+.
108
114
  # browser_id::
109
- # The browser ID we want to set a rule for. Only one fingerprint or ID can be specified in the request.
115
+ # The browser ID we want to set a rule for. Only one identifier can be specified in the request.
110
116
  # The type of this field is nilable +String+.
111
117
  # visitor_fingerprint::
112
- # The visitor fingerprint we want to set a rule for. Only one fingerprint or ID can be specified in the request.
118
+ # The visitor fingerprint we want to set a rule for. Only one identifier can be specified in the request.
113
119
  # The type of this field is nilable +String+.
114
120
  # browser_fingerprint::
115
- # The browser fingerprint we want to set a rule for. Only one fingerprint or ID can be specified in the request.
121
+ # The browser fingerprint we want to set a rule for. Only one identifier can be specified in the request.
116
122
  # The type of this field is nilable +String+.
117
123
  # hardware_fingerprint::
118
- # The hardware fingerprint we want to set a rule for. Only one fingerprint or ID can be specified in the request.
124
+ # The hardware fingerprint we want to set a rule for. Only one identifier can be specified in the request.
119
125
  # The type of this field is nilable +String+.
120
126
  # network_fingerprint::
121
- # The network fingerprint we want to set a rule for. Only one fingerprint or ID can be specified in the request.
127
+ # The network fingerprint we want to set a rule for. Only one identifier can be specified in the request.
122
128
  # The type of this field is nilable +String+.
123
129
  # expires_in_minutes::
124
130
  # The number of minutes until this rule expires. If no `expires_in_minutes` is specified, then the rule is kept permanently.
@@ -126,6 +132,15 @@ module Stytch
126
132
  # description::
127
133
  # An optional description for the rule.
128
134
  # The type of this field is nilable +String+.
135
+ # cidr_block::
136
+ # The CIDR block we want to set a rule for. You may pass either an IP address or a CIDR block. The CIDR block prefix must be between 16 and 32, inclusive. If an end user's IP address is within this CIDR block, this rule will be applied. Only one identifier can be specified in the request.
137
+ # The type of this field is nilable +String+.
138
+ # country_code::
139
+ # The country code we want to set a rule for. The country code must be a valid ISO 3166-1 alpha-2 code. You may not set `ALLOW` rules for country codes. Only one identifier can be specified in the request.
140
+ # The type of this field is nilable +String+.
141
+ # asn::
142
+ # The ASN we want to set a rule for. The ASN must be the string representation of an integer between 0 and 4294967295, inclusive. Only one identifier can be specified in the request.
143
+ # The type of this field is nilable +String+.
129
144
  #
130
145
  # == Returns:
131
146
  # An object with the following fields:
@@ -139,26 +154,35 @@ module Stytch
139
154
  # The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
140
155
  # The type of this field is +Integer+.
141
156
  # visitor_id::
142
- # The cookie stored on the user's device that uniquely identifies them.
157
+ # The visitor ID that a rule was set for.
143
158
  # The type of this field is nilable +String+.
144
159
  # browser_id::
145
- # Combination of VisitorID and NetworkFingerprint to create a clear identifier of a browser.
160
+ # The browser ID that a rule was set for.
146
161
  # The type of this field is nilable +String+.
147
162
  # visitor_fingerprint::
148
- # Cookie-less way of identifying a unique user.
163
+ # The visitor fingerprint that a rule was set for.
149
164
  # The type of this field is nilable +String+.
150
165
  # browser_fingerprint::
151
- # Combination of signals to identify a browser and its specific version.
166
+ # The browser fingerprint that a rule was set for.
152
167
  # The type of this field is nilable +String+.
153
168
  # hardware_fingerprint::
154
- # Combinations of signals to identify an operating system and architecture.
169
+ # The hardware fingerprint that a rule was set for.
155
170
  # The type of this field is nilable +String+.
156
171
  # network_fingerprint::
157
- # Combination of signals associated with a specific network commonly known as TLS fingerprinting.
172
+ # The network fingerprint that a rule was set for.
158
173
  # The type of this field is nilable +String+.
159
174
  # expires_at::
160
175
  # The timestamp when the rule expires. Values conform to the RFC 3339 standard and are expressed in UTC, e.g. `2021-12-29T12:33:09Z`.
161
176
  # The type of this field is nilable +String+.
177
+ # cidr_block::
178
+ # The CIDR block that a rule was set for. If an end user's IP address is within this CIDR block, this rule will be applied.
179
+ # The type of this field is nilable +String+.
180
+ # country_code::
181
+ # The country code that a rule was set for.
182
+ # The type of this field is nilable +String+.
183
+ # asn::
184
+ # The ASN that a rule was set for.
185
+ # The type of this field is nilable +String+.
162
186
  def set(
163
187
  action:,
164
188
  visitor_id: nil,
@@ -168,7 +192,10 @@ module Stytch
168
192
  hardware_fingerprint: nil,
169
193
  network_fingerprint: nil,
170
194
  expires_in_minutes: nil,
171
- description: nil
195
+ description: nil,
196
+ cidr_block: nil,
197
+ country_code: nil,
198
+ asn: nil
172
199
  )
173
200
  headers = {}
174
201
  request = {
@@ -182,6 +209,9 @@ module Stytch
182
209
  request[:network_fingerprint] = network_fingerprint unless network_fingerprint.nil?
183
210
  request[:expires_in_minutes] = expires_in_minutes unless expires_in_minutes.nil?
184
211
  request[:description] = description unless description.nil?
212
+ request[:cidr_block] = cidr_block unless cidr_block.nil?
213
+ request[:country_code] = country_code unless country_code.nil?
214
+ request[:asn] = asn unless asn.nil?
185
215
 
186
216
  post_request('/v1/rules/set', request, headers)
187
217
  end
@@ -19,6 +19,8 @@ module Stytch
19
19
  # Authenticate an impersonation token to impersonate a User. This endpoint requires an impersonation token that is not expired or previously used.
20
20
  # A Stytch session will be created for the impersonated user with a 60 minute duration. Impersonated sessions cannot be extended.
21
21
  #
22
+ # Prior to this step, you can generate an impersonation token by visiting the Stytch dashboard, viewing a user, and clicking the `Impersonate User` button.
23
+ #
22
24
  # == Parameters:
23
25
  # impersonation_token::
24
26
  # The User Impersonation token to authenticate.
data/lib/stytch/m2m.rb CHANGED
@@ -443,8 +443,7 @@ module Stytch
443
443
  @connection = connection
444
444
  end
445
445
 
446
- # Initiate the rotation of an M2M client secret. After this endpoint is called, both the client's `client_secret` and `next_client_secret` will be valid. To complete the secret rotation flow, update all usages of `client_secret` to `next_client_secret` and call the [Rotate Secret Endpoint](https://stytch.com/docs/b2b/api/m2m-rotate-secret)[Rotate Secret Endpoint](https://stytch.com/docs/api/m2m-rotate-secret) to complete the flow.
447
- # Secret rotation can be cancelled using the [Rotate Cancel Endpoint](https://stytch.com/docs/b2b/api/m2m-rotate-secret-cancel)[Rotate Cancel Endpoint](https://stytch.com/docs/api/m2m-rotate-secret-cancel).
446
+ # Initiate the rotation of an M2M client secret. After this endpoint is called, both the client's `client_secret` and `next_client_secret` will be valid. To complete the secret rotation flow, update all usages of `client_secret` to `next_client_secret` and call the [Rotate Secret Endpoint](https://stytch.com/docs/b2b/api/m2m-rotate-secret)[Rotate Secret Endpoint](https://stytch.com/docs/api/m2m-rotate-secret) to complete the flow.Secret rotation can be cancelled using the [Rotate Cancel Endpoint](https://stytch.com/docs/b2b/api/m2m-rotate-secret-cancel)[Rotate Cancel Endpoint](https://stytch.com/docs/api/m2m-rotate-secret-cancel).
448
447
  #
449
448
  # **Important:** This is the only time you will be able to view the generated `next_client_secret` in the API response. Stytch stores a hash of the `next_client_secret` and cannot recover the value if lost. Be sure to persist the `next_client_secret` in a secure location. If the `next_client_secret` is lost, you will need to trigger a secret rotation flow to receive another one.
450
449
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stytch
4
- VERSION = '10.6.0'
4
+ VERSION = '10.8.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stytch
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.6.0
4
+ version: 10.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - stytch
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-02-19 00:00:00.000000000 Z
11
+ date: 2025-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday