stytch 3.5.0 → 3.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -3
- data/lib/stytch/client.rb +3 -1
- data/lib/stytch/passwords.rb +150 -0
- data/lib/stytch/version.rb +1 -1
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95b360d5a8279e14e7f5f296a1f87cf8a228f71199b8f7ad819c5738ffabed5c
|
4
|
+
data.tar.gz: d039db12c094d0108053986133159641fb70f6ea78774fc8fb6c3d4bbd9cba08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49525be08d53de93aadce97f254d0e3526e9334119b11508b89a8234133ef23a27a880666b176b03ef57fb938c17c90adeb9804ce159e9832f60a7a7f9821972
|
7
|
+
data.tar.gz: 4212ed7c21195091055bbfe24abe613c1f670216808fd51e15c39b565ab49b2252f941398fc82fd3480d2a5af8999056051a0696f7edd157390cb11bcbe0a16c
|
data/README.md
CHANGED
@@ -32,9 +32,10 @@ This client library supports all of Stytch's live products:
|
|
32
32
|
- [x] [WhatsApp passcodes](https://stytch.com/docs/api/whatsapp-send)
|
33
33
|
- [x] [Email passcodes](https://stytch.com/docs/api/send-otp-by-email)
|
34
34
|
- [x] [Session Management](https://stytch.com/docs/api/sessions-overview)
|
35
|
-
- [x] [WebAuthn
|
36
|
-
- [x] [Time-based one-time passcodes (TOTPs)
|
37
|
-
- [x] [Crypto wallets
|
35
|
+
- [x] [WebAuthn](https://stytch.com/docs/api/webauthn-overview)
|
36
|
+
- [x] [Time-based one-time passcodes (TOTPs)](https://stytch.com/docs/api/totps-overview)
|
37
|
+
- [x] [Crypto wallets](https://stytch.com/docs/api/crypto-wallet-overview)
|
38
|
+
- [x] [Passwords (Beta)](https://stytch.com/docs/api/password-overview)
|
38
39
|
|
39
40
|
### Example usage
|
40
41
|
Create an API client:
|
data/lib/stytch/client.rb
CHANGED
@@ -8,12 +8,13 @@ require_relative 'sessions'
|
|
8
8
|
require_relative 'totps'
|
9
9
|
require_relative 'webauthn'
|
10
10
|
require_relative 'crypto_wallets'
|
11
|
+
require_relative 'passwords'
|
11
12
|
|
12
13
|
module Stytch
|
13
14
|
class Client
|
14
15
|
ENVIRONMENTS = %i[live test].freeze
|
15
16
|
|
16
|
-
attr_reader :users, :magic_links, :oauth, :otps, :sessions, :totps, :webauthn, :crypto_wallets
|
17
|
+
attr_reader :users, :magic_links, :oauth, :otps, :sessions, :totps, :webauthn, :crypto_wallets, :passwords
|
17
18
|
|
18
19
|
def initialize(env:, project_id:, secret:, &block)
|
19
20
|
@api_host = api_host(env)
|
@@ -30,6 +31,7 @@ module Stytch
|
|
30
31
|
@totps = Stytch::TOTPs.new(@connection)
|
31
32
|
@webauthn = Stytch::WebAuthn.new(@connection)
|
32
33
|
@crypto_wallets = Stytch::CryptoWallets.new(@connection)
|
34
|
+
@passwords = Stytch::Passwords.new(@connection)
|
33
35
|
end
|
34
36
|
|
35
37
|
private
|
@@ -0,0 +1,150 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'request_helper'
|
4
|
+
|
5
|
+
module Stytch
|
6
|
+
class Passwords
|
7
|
+
include Stytch::RequestHelper
|
8
|
+
|
9
|
+
attr_reader :email
|
10
|
+
|
11
|
+
PATH = '/v1/passwords'
|
12
|
+
|
13
|
+
def initialize(connection)
|
14
|
+
@connection = connection
|
15
|
+
|
16
|
+
@email = Stytch::Passwords::Email.new(@connection)
|
17
|
+
end
|
18
|
+
|
19
|
+
def create(
|
20
|
+
email:,
|
21
|
+
password:,
|
22
|
+
session_duration_minutes: nil,
|
23
|
+
session_custom_claims: nil
|
24
|
+
)
|
25
|
+
request = {
|
26
|
+
email: email,
|
27
|
+
password: password
|
28
|
+
}
|
29
|
+
|
30
|
+
request[:session_duration_minutes] = session_duration_minutes unless session_duration_minutes.nil?
|
31
|
+
request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil?
|
32
|
+
|
33
|
+
post_request(PATH.to_s, request)
|
34
|
+
end
|
35
|
+
|
36
|
+
def authenticate(
|
37
|
+
email:,
|
38
|
+
password:,
|
39
|
+
session_token: nil,
|
40
|
+
session_jwt: nil,
|
41
|
+
session_duration_minutes: nil,
|
42
|
+
session_custom_claims: nil
|
43
|
+
)
|
44
|
+
request = {
|
45
|
+
email: email,
|
46
|
+
password: password
|
47
|
+
}
|
48
|
+
|
49
|
+
request[:session_token] = session_token unless session_token.nil?
|
50
|
+
request[:session_jwt] = session_jwt unless session_jwt.nil?
|
51
|
+
request[:session_duration_minutes] = session_duration_minutes unless session_duration_minutes.nil?
|
52
|
+
request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil?
|
53
|
+
|
54
|
+
post_request("#{PATH}/authenticate", request)
|
55
|
+
end
|
56
|
+
|
57
|
+
def strength_check(
|
58
|
+
password:,
|
59
|
+
email: nil
|
60
|
+
)
|
61
|
+
request = {
|
62
|
+
password: password
|
63
|
+
}
|
64
|
+
|
65
|
+
request[:email] = email unless email.nil?
|
66
|
+
|
67
|
+
post_request("#{PATH}/strength_check", request)
|
68
|
+
end
|
69
|
+
|
70
|
+
def migrate(
|
71
|
+
email:,
|
72
|
+
hash:,
|
73
|
+
hash_type:,
|
74
|
+
md_5_config: {},
|
75
|
+
argon_2_config: {}
|
76
|
+
)
|
77
|
+
request = {
|
78
|
+
email: email,
|
79
|
+
hash: hash,
|
80
|
+
hash_type: hash_type
|
81
|
+
}
|
82
|
+
|
83
|
+
request[:md_5_config] = md_5_config unless md_5_config != {}
|
84
|
+
request[:argon_2_config] = argon_2_config unless argon_2_config != {}
|
85
|
+
|
86
|
+
post_request("#{PATH}/migrate", request)
|
87
|
+
end
|
88
|
+
|
89
|
+
class Email
|
90
|
+
include Stytch::RequestHelper
|
91
|
+
|
92
|
+
PATH = "#{Stytch::Passwords::PATH}/email"
|
93
|
+
|
94
|
+
def initialize(connection)
|
95
|
+
@connection = connection
|
96
|
+
end
|
97
|
+
|
98
|
+
def reset_start(
|
99
|
+
email:,
|
100
|
+
login_redirect_url: nil,
|
101
|
+
reset_password_redirect_url: nil,
|
102
|
+
reset_password_expiration_minutes: nil,
|
103
|
+
attributes: {},
|
104
|
+
code_challenge: nil
|
105
|
+
)
|
106
|
+
request = {
|
107
|
+
email: email
|
108
|
+
}
|
109
|
+
|
110
|
+
request[:login_redirect_url] = login_redirect_url unless login_redirect_url.nil?
|
111
|
+
request[:reset_password_redirect_url] = reset_password_redirect_url unless reset_password_redirect_url.nil?
|
112
|
+
unless reset_password_expiration_minutes.nil?
|
113
|
+
request[:reset_password_expiration_minutes] =
|
114
|
+
reset_password_expiration_minutes
|
115
|
+
end
|
116
|
+
request[:attributes] = attributes if attributes != {}
|
117
|
+
request[:code_challenge] = code_challenge unless code_challenge.nil?
|
118
|
+
|
119
|
+
post_request("#{PATH}/reset/start", request)
|
120
|
+
end
|
121
|
+
|
122
|
+
def reset(
|
123
|
+
token:,
|
124
|
+
password:,
|
125
|
+
session_token: nil,
|
126
|
+
session_jwt: nil,
|
127
|
+
session_duration_minutes: nil,
|
128
|
+
session_custom_claims: nil,
|
129
|
+
attributes: {},
|
130
|
+
options: {},
|
131
|
+
code_verifier: nil
|
132
|
+
)
|
133
|
+
request = {
|
134
|
+
token: token,
|
135
|
+
password: password
|
136
|
+
}
|
137
|
+
|
138
|
+
request[:session_token] = session_token unless session_token.nil?
|
139
|
+
request[:session_jwt] = session_jwt unless session_jwt.nil?
|
140
|
+
request[:session_duration_minutes] = session_duration_minutes unless session_duration_minutes.nil?
|
141
|
+
request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil?
|
142
|
+
request[:attributes] = attributes if attributes != {}
|
143
|
+
request[:options] = options if options != {}
|
144
|
+
request[:code_verifier] = code_verifier unless code_verifier.nil?
|
145
|
+
|
146
|
+
post_request("#{PATH}/reset", request)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
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.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- stytch
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-07-
|
11
|
+
date: 2022-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -92,7 +92,7 @@ dependencies:
|
|
92
92
|
- - ">="
|
93
93
|
- !ruby/object:Gem::Version
|
94
94
|
version: 3.5.3
|
95
|
-
description:
|
95
|
+
description:
|
96
96
|
email:
|
97
97
|
- support@stytch.com
|
98
98
|
executables: []
|
@@ -119,6 +119,7 @@ files:
|
|
119
119
|
- lib/stytch/middleware.rb
|
120
120
|
- lib/stytch/oauth.rb
|
121
121
|
- lib/stytch/otps.rb
|
122
|
+
- lib/stytch/passwords.rb
|
122
123
|
- lib/stytch/request_helper.rb
|
123
124
|
- lib/stytch/sessions.rb
|
124
125
|
- lib/stytch/totps.rb
|
@@ -132,7 +133,7 @@ licenses:
|
|
132
133
|
metadata:
|
133
134
|
homepage_uri: https://stytch.com
|
134
135
|
source_code_uri: https://github.com/stytchauth/stytch-ruby
|
135
|
-
post_install_message:
|
136
|
+
post_install_message:
|
136
137
|
rdoc_options: []
|
137
138
|
require_paths:
|
138
139
|
- lib
|
@@ -147,8 +148,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
148
|
- !ruby/object:Gem::Version
|
148
149
|
version: '0'
|
149
150
|
requirements: []
|
150
|
-
rubygems_version: 3.
|
151
|
-
signing_key:
|
151
|
+
rubygems_version: 3.1.4
|
152
|
+
signing_key:
|
152
153
|
specification_version: 4
|
153
154
|
summary: Stytch Ruby Gem
|
154
155
|
test_files: []
|