stytch 3.7.0 → 3.10.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 +4 -4
- data/lib/stytch/passwords.rb +39 -5
- data/lib/stytch/sessions.rb +11 -2
- data/lib/stytch/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c3467a9df6c34d419a806c5822edd9878a6b17a60bc3abb7c85ab336695f25c
|
4
|
+
data.tar.gz: 8a7a8c5ea9f8247156d45b98b67708bf02bee10959269accb2cd5dc231787438
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63972fb9e432920750a1aedad82a1cd278305168dc38fc49cf987b288a8eeb857097a819d3c19c1f5ea65f9caf9978b06461fe9356e40b8390207e1471479446
|
7
|
+
data.tar.gz: b09cdec0f8430abac465cb0eae09183d71fda517019d4f583befa8f386207b4a941b7cdb4cd0bd9632facd053fca7c2734ef81e21351f159898d2375e11c9b6e
|
data/lib/stytch/passwords.rb
CHANGED
@@ -6,7 +6,7 @@ module Stytch
|
|
6
6
|
class Passwords
|
7
7
|
include Stytch::RequestHelper
|
8
8
|
|
9
|
-
attr_reader :email
|
9
|
+
attr_reader :email, :existing_password
|
10
10
|
|
11
11
|
PATH = '/v1/passwords'
|
12
12
|
|
@@ -14,6 +14,7 @@ module Stytch
|
|
14
14
|
@connection = connection
|
15
15
|
|
16
16
|
@email = Stytch::Passwords::Email.new(@connection)
|
17
|
+
@existing_password = Stytch::Passwords::ExistingPassword.new(@connection)
|
17
18
|
end
|
18
19
|
|
19
20
|
def create(
|
@@ -71,8 +72,8 @@ module Stytch
|
|
71
72
|
email:,
|
72
73
|
hash:,
|
73
74
|
hash_type:,
|
74
|
-
|
75
|
-
|
75
|
+
md_5_config: {},
|
76
|
+
argon_2_config: {}
|
76
77
|
)
|
77
78
|
request = {
|
78
79
|
email: email,
|
@@ -80,8 +81,8 @@ module Stytch
|
|
80
81
|
hash_type: hash_type
|
81
82
|
}
|
82
83
|
|
83
|
-
request[:
|
84
|
-
request[:
|
84
|
+
request[:md_5_config] = md_5_config unless md_5_config != {}
|
85
|
+
request[:argon_2_config] = argon_2_config unless argon_2_config != {}
|
85
86
|
|
86
87
|
post_request("#{PATH}/migrate", request)
|
87
88
|
end
|
@@ -146,5 +147,38 @@ module Stytch
|
|
146
147
|
post_request("#{PATH}/reset", request)
|
147
148
|
end
|
148
149
|
end
|
150
|
+
|
151
|
+
class ExistingPassword
|
152
|
+
include Stytch::RequestHelper
|
153
|
+
|
154
|
+
PATH = "#{Stytch::Passwords::PATH}/existing_password"
|
155
|
+
|
156
|
+
def initialize(connection)
|
157
|
+
@connection = connection
|
158
|
+
end
|
159
|
+
|
160
|
+
def reset(
|
161
|
+
email:,
|
162
|
+
existing_password:,
|
163
|
+
new_password:,
|
164
|
+
session_token: nil,
|
165
|
+
session_jwt: nil,
|
166
|
+
session_duration_minutes: nil,
|
167
|
+
session_custom_claims: nil
|
168
|
+
)
|
169
|
+
request = {
|
170
|
+
email: email,
|
171
|
+
existing_password: existing_password,
|
172
|
+
new_password: new_password
|
173
|
+
}
|
174
|
+
|
175
|
+
request[:session_token] = session_token unless session_token.nil?
|
176
|
+
request[:session_jwt] = session_jwt unless session_jwt.nil?
|
177
|
+
request[:session_duration_minutes] = session_duration_minutes unless session_duration_minutes.nil?
|
178
|
+
request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil?
|
179
|
+
|
180
|
+
post_request("#{PATH}/reset", request)
|
181
|
+
end
|
182
|
+
end
|
149
183
|
end
|
150
184
|
end
|
data/lib/stytch/sessions.rb
CHANGED
@@ -15,8 +15,17 @@ module Stytch
|
|
15
15
|
def initialize(connection, project_id)
|
16
16
|
@connection = connection
|
17
17
|
@project_id = project_id
|
18
|
-
@
|
19
|
-
|
18
|
+
@cache_last_update = 0
|
19
|
+
@jwks_loader = lambda do |options|
|
20
|
+
@cached_keys = nil if options[:invalidate] && @cache_last_update < Time.now.to_i - 300
|
21
|
+
@cached_keys ||= begin
|
22
|
+
@cache_last_update = Time.now.to_i
|
23
|
+
keys = []
|
24
|
+
jwks(project_id: @project_id)['keys'].each do |r|
|
25
|
+
keys << r
|
26
|
+
end
|
27
|
+
{ keys: keys }
|
28
|
+
end
|
20
29
|
end
|
21
30
|
end
|
22
31
|
|
data/lib/stytch/version.rb
CHANGED
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: 3.
|
4
|
+
version: 3.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- stytch
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|