stytch 2.6.0 → 2.7.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: 245003578710b944f8b2ffe1cfd080517b2177fcb2e01884f8b1087549ff09b8
4
- data.tar.gz: e1d90c9591290ba11c64fe37cc5f4a4602a256deede647eca5cf003ff6cd5c39
3
+ metadata.gz: 471f88289d40496c784ae4c59b23460ed0db628e98106e50dddb324a311f9957
4
+ data.tar.gz: 9292dbede554e351d20dbccf5dd62b4d4f4266a60f3a30fc7636b59c7164e905
5
5
  SHA512:
6
- metadata.gz: 1c2f2b097b711c28549050b7306d0a84112d30b65acc635a30dab4ff296622a38bd6c93b10c22b8170ad0904041cc3122a73d5f77c6dd190a0c5b6bbe8f21617
7
- data.tar.gz: bb4cc6263f19ef61f98a7bc53867fb35a855ac72caa184673dba2346c4b1780534577d22b8c4b206213e5b758cff0e819c100f038dcc8eb0bbaeeed940fefe48
6
+ metadata.gz: 86c1f5fedf5dfa62e807ce98bf960330de3dbe02b06fc750a9eeee4196e13e0b0d996589d33dec08f5aa4d4dcd64cd6388eced50fd9064c709b758c377bf5c64
7
+ data.tar.gz: bcb083e45706ccdc855db519a781c2f9254ccf639a72a91f65b034d119160b2c080959efc70587913b9dcae0c62d5402f73a69611e5e6f8095e1aac2329dc349
data/README.md CHANGED
@@ -24,6 +24,17 @@ Or install it yourself as:
24
24
 
25
25
  You can find your API credentials in the [Stytch Dashboard](https://stytch.com/dashboard/api-keys).
26
26
 
27
+ This client library supports all of Stytch's live products:
28
+ - [x] [Email Magic Links](https://stytch.com/docs/api/send-by-email)
29
+ - [x] [Embeddable Magic Links](https://stytch.com/docs/api/create-magic-link-overview)
30
+ - [x] [OAuth logins](https://stytch.com/docs/api/oauth-overview)
31
+ - [x] [SMS passcodes](https://stytch.com/docs/api/send-otp-by-sms)
32
+ - [x] [WhatsApp passcodes](https://stytch.com/docs/api/whatsapp-send)
33
+ - [x] [Email passcodes](https://stytch.com/docs/api/send-otp-by-email)
34
+ - [x] [Session Management (Beta)](https://stytch.com/docs/api/sessions-overview)
35
+ - [x] [WebAuthn (Beta)](https://stytch.com/docs/api/webauthn-overview)
36
+
37
+ ### Example usage
27
38
  Create an API client:
28
39
  ```ruby
29
40
  client = Stytch::Client.new(
data/lib/stytch/client.rb CHANGED
@@ -5,12 +5,13 @@ require_relative 'magic_links'
5
5
  require_relative 'oauth'
6
6
  require_relative 'otps'
7
7
  require_relative 'sessions'
8
+ require_relative 'webauthn'
8
9
 
9
10
  module Stytch
10
11
  class Client
11
12
  ENVIRONMENTS = %i[live test].freeze
12
13
 
13
- attr_reader :users, :magic_links, :oauth, :otps, :sessions
14
+ attr_reader :users, :magic_links, :oauth, :otps, :sessions, :webauthn
14
15
 
15
16
  def initialize(env:, project_id:, secret:, &block)
16
17
  @api_host = api_host(env)
@@ -24,6 +25,7 @@ module Stytch
24
25
  @oauth = Stytch::OAuth.new(@connection)
25
26
  @otps = Stytch::OTPs.new(@connection)
26
27
  @sessions = Stytch::Sessions.new(@connection)
28
+ @webauthn = Stytch::WebAuthn.new(@connection)
27
29
  end
28
30
 
29
31
  private
data/lib/stytch/users.rb CHANGED
@@ -83,6 +83,12 @@ module Stytch
83
83
  delete_request("#{PATH}/phone_numbers/#{phone_id}")
84
84
  end
85
85
 
86
+ def delete_webauthn_registration(
87
+ webauthn_registration_id:
88
+ )
89
+ delete_request("#{PATH}/webauthn_registrations/#{webauthn_registration_id}")
90
+ end
91
+
86
92
  private
87
93
 
88
94
  def format_emails(emails)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stytch
4
- VERSION = '2.6.0'
4
+ VERSION = '2.7.0'
5
5
  end
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'request_helper'
4
+
5
+ module Stytch
6
+ class WebAuthn
7
+ include Stytch::RequestHelper
8
+
9
+ PATH = '/v1/webauthn'
10
+
11
+ def initialize(connection)
12
+ @connection = connection
13
+ end
14
+
15
+ def register_start(
16
+ user_id:,
17
+ domain:,
18
+ user_agent: nil,
19
+ authenticator_type: nil
20
+ )
21
+ request = {
22
+ user_id: user_id,
23
+ domain: domain
24
+ }
25
+
26
+ request[:user_agent] = user_agent unless user_agent.nil?
27
+ request[:authenticator_type] = authenticator_type unless authenticator_type.nil?
28
+
29
+ post_request("#{PATH}/register/start", request)
30
+ end
31
+
32
+ def register(
33
+ user_id:,
34
+ public_key_credential:
35
+ )
36
+ request = {
37
+ user_id: user_id,
38
+ public_key_credential: public_key_credential
39
+ }
40
+
41
+ post_request("#{PATH}/register", request)
42
+ end
43
+
44
+ def authenticate_start(
45
+ user_id:,
46
+ domain:
47
+ )
48
+ request = {
49
+ user_id: user_id,
50
+ domain: domain
51
+ }
52
+
53
+ post_request("#{PATH}/authenticate/start", request)
54
+ end
55
+
56
+ def authenticate(
57
+ public_key_credential:,
58
+ session_token: nil,
59
+ session_duration_minutes: nil
60
+ )
61
+ request = {
62
+ public_key_credential: public_key_credential
63
+ }
64
+
65
+ request[:session_token] = session_token unless session_token.nil?
66
+ request[:session_duration_minutes] = session_duration_minutes unless session_duration_minutes.nil?
67
+
68
+ post_request("#{PATH}/authenticate", request)
69
+ end
70
+ end
71
+ 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: 2.6.0
4
+ version: 2.7.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: 2021-09-30 00:00:00.000000000 Z
11
+ date: 2021-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -50,7 +50,7 @@ dependencies:
50
50
  - - "<"
51
51
  - !ruby/object:Gem::Version
52
52
  version: '2.0'
53
- description:
53
+ description:
54
54
  email:
55
55
  - support@stytch.com
56
56
  executables: []
@@ -79,6 +79,7 @@ files:
79
79
  - lib/stytch/sessions.rb
80
80
  - lib/stytch/users.rb
81
81
  - lib/stytch/version.rb
82
+ - lib/stytch/webauthn.rb
82
83
  - stytch.gemspec
83
84
  homepage: https://stytch.com
84
85
  licenses:
@@ -86,7 +87,7 @@ licenses:
86
87
  metadata:
87
88
  homepage_uri: https://stytch.com
88
89
  source_code_uri: https://github.com/stytchauth/stytch-ruby
89
- post_install_message:
90
+ post_install_message:
90
91
  rdoc_options: []
91
92
  require_paths:
92
93
  - lib
@@ -101,8 +102,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
102
  - !ruby/object:Gem::Version
102
103
  version: '0'
103
104
  requirements: []
104
- rubygems_version: 3.0.3
105
- signing_key:
105
+ rubygems_version: 3.1.4
106
+ signing_key:
106
107
  specification_version: 4
107
108
  summary: Stytch Ruby Gem
108
109
  test_files: []