stytch 3.5.0 → 3.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e14a2ef2166355c60c94db8b352690af8f307c1b5dad77309d662d9bab0f0838
4
- data.tar.gz: 2ab96922302d86fda507b7ab12ad205106ee345adf1c0a88553a8930f286b9fc
3
+ metadata.gz: 4b0df049845701e13ae486eaf2031c118115588171ff8e486c7c5a7e0c6adc58
4
+ data.tar.gz: 7532843bccf0d29542b3a2358969085fc8faf9800010770b8d288d624713a0bf
5
5
  SHA512:
6
- metadata.gz: 22569e30740820e2f3e05e960484d1d846ea6bf2f6b88dfa36e17b9ec8e2bbd90933357995370188fe79864909f4d777b526c12816029c5382ba3632553e91eb
7
- data.tar.gz: 17c64f8bcc4374caae275fd83a6d2e2d02142b918cd428abb00298b58f7d46dbecca1fe1d3ca2bc9c69ca3f7c102f57d2f81f9d42dbf1e90c0ae4388f45c6723
6
+ metadata.gz: 0777de15b4986e805daf9640e178b479e28f5954d133dc2ed11e8c21c1ab192d3eb7917bde055dc7a23836ba112f8d446f4877c7fdbb6af711ae17f974352cda
7
+ data.tar.gz: d2ae3531f577256dceecd0d7e1326f65ceda2176bc27cb301409d6bf2a87cb5a5d9740ced383d7fafe83ba9673299db714e36d745e82e859e4badb48b2b4d324
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 (Beta)](https://stytch.com/docs/api/webauthn-overview)
36
- - [x] [Time-based one-time passcodes (TOTPs) (Beta)](https://stytch.com/docs/api/totps-overview)
37
- - [x] [Crypto wallets (Beta)](https://stytch.com/docs/api/crypto-wallet-overview)
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,152 @@
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
+ prepend_salt: nil,
75
+ append_salt: nil
76
+ )
77
+ request = {
78
+ email: email,
79
+ hash: hash,
80
+ hash_type: hash_type
81
+ }
82
+
83
+ request[:prepend_salt] = prepend_salt unless prepend_salt.nil?
84
+ request[:append_salt] = append_salt unless append_salt.nil?
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
+ login_expiration_minutes: nil,
103
+ reset_password_expiration_minutes: nil,
104
+ attributes: {},
105
+ code_challenge: nil
106
+ )
107
+ request = {
108
+ email: email
109
+ }
110
+
111
+ request[:login_redirect_url] = login_redirect_url unless login_redirect_url.nil?
112
+ request[:reset_password_redirect_url] = reset_password_redirect_url unless reset_password_redirect_url.nil?
113
+ request[:login_expiration_minutes] = login_expiration_minutes unless login_expiration_minutes.nil?
114
+ unless reset_password_expiration_minutes.nil?
115
+ request[:reset_password_expiration_minutes] =
116
+ reset_password_expiration_minutes
117
+ end
118
+ request[:attributes] = attributes if attributes != {}
119
+ request[:code_challenge] = code_challenge unless code_challenge.nil?
120
+
121
+ post_request("#{PATH}/reset/start", request)
122
+ end
123
+
124
+ def reset(
125
+ token:,
126
+ password:,
127
+ session_token: nil,
128
+ session_jwt: nil,
129
+ session_duration_minutes: nil,
130
+ session_custom_claims: nil,
131
+ attributes: {},
132
+ options: {},
133
+ code_verifier: nil
134
+ )
135
+ request = {
136
+ token: token,
137
+ password: password
138
+ }
139
+
140
+ request[:session_token] = session_token unless session_token.nil?
141
+ request[:session_jwt] = session_jwt unless session_jwt.nil?
142
+ request[:session_duration_minutes] = session_duration_minutes unless session_duration_minutes.nil?
143
+ request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil?
144
+ request[:attributes] = attributes if attributes != {}
145
+ request[:options] = options if options != {}
146
+ request[:code_verifier] = code_verifier unless code_verifier.nil?
147
+
148
+ post_request("#{PATH}/reset", request)
149
+ end
150
+ end
151
+ end
152
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stytch
4
- VERSION = '3.5.0'
4
+ VERSION = '3.6.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: 3.5.0
4
+ version: 3.6.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-01 00:00:00.000000000 Z
11
+ date: 2022-07-11 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.0.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: []