stytch 6.5.1 → 6.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/stytch/version.rb +1 -1
- data/lib/stytch/webauthn.rb +66 -8
- 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: 3a2f460766302fa45dac9429da80a2c35f3bf81fdf699f1facd9b604c63ce29e
|
4
|
+
data.tar.gz: 997dc4dfddfdf15912a7d9c6b80ce2064264f7c27dc2530cb0a1868b9001cb42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 700ed564d563b810f48284d25a7d4a73857ed8807c192f38e30d6f1db75da6eb67265453579f1d4477f58a0c5544c30498fb2b7528c81b96fc4bb194dd972230
|
7
|
+
data.tar.gz: c9e904425177ec57295efebed39e6b10b1ef6e7dc223f8d86466590c50cbc4bebd5498b57d5a851d4a8c71ffc69b7bd87233362ab7bb72d789b498fe51e82052
|
data/lib/stytch/version.rb
CHANGED
data/lib/stytch/webauthn.rb
CHANGED
@@ -33,6 +33,9 @@ module Stytch
|
|
33
33
|
# authenticator_type::
|
34
34
|
# The requested authenticator type of the WebAuthn device. The two valid value are platform and cross-platform. If no value passed, we assume both values are allowed.
|
35
35
|
# The type of this field is nilable +String+.
|
36
|
+
# return_passkey_credential_options::
|
37
|
+
# If true, the public_key_credential_creation_options returned will be optimized for Passkeys.
|
38
|
+
# The type of this field is nilable +Boolean+.
|
36
39
|
#
|
37
40
|
# == Returns:
|
38
41
|
# An object with the following fields:
|
@@ -52,7 +55,8 @@ module Stytch
|
|
52
55
|
user_id:,
|
53
56
|
domain:,
|
54
57
|
user_agent: nil,
|
55
|
-
authenticator_type: nil
|
58
|
+
authenticator_type: nil,
|
59
|
+
return_passkey_credential_options: nil
|
56
60
|
)
|
57
61
|
request = {
|
58
62
|
user_id: user_id,
|
@@ -60,6 +64,7 @@ module Stytch
|
|
60
64
|
}
|
61
65
|
request[:user_agent] = user_agent unless user_agent.nil?
|
62
66
|
request[:authenticator_type] = authenticator_type unless authenticator_type.nil?
|
67
|
+
request[:return_passkey_credential_options] = return_passkey_credential_options unless return_passkey_credential_options.nil?
|
63
68
|
|
64
69
|
post_request('/v1/webauthn/register/start', request)
|
65
70
|
end
|
@@ -75,6 +80,20 @@ module Stytch
|
|
75
80
|
# public_key_credential::
|
76
81
|
# The response of the [navigator.credentials.create()](https://www.w3.org/TR/webauthn-2/#sctn-createCredential).
|
77
82
|
# The type of this field is +String+.
|
83
|
+
# session_token::
|
84
|
+
# The session token to authenticate.
|
85
|
+
# The type of this field is nilable +String+.
|
86
|
+
# session_duration_minutes::
|
87
|
+
# Set the session lifetime to be this many minutes from now; minimum of 5 and a maximum of 527040 minutes (366 days). Note that a successful authentication will continue to extend the session this many minutes.
|
88
|
+
# The type of this field is nilable +Integer+.
|
89
|
+
# session_jwt::
|
90
|
+
# The JWT to authenticate. You may provide a JWT that has expired according to its `exp` claim and needs to be refreshed. If the signature is valid and the underlying session is still active then Stytch will return a new JWT.
|
91
|
+
# The type of this field is nilable +String+.
|
92
|
+
# session_custom_claims::
|
93
|
+
# Add a custom claims map to the Session being authenticated. Claims are only created if a Session is initialized by providing a value in `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 delete a key, supply a null value.
|
94
|
+
#
|
95
|
+
# Custom claims made with reserved claims ("iss", "sub", "aud", "exp", "nbf", "iat", "jti") will be ignored. Total custom claims size cannot exceed four kilobytes.
|
96
|
+
# The type of this field is nilable +object+.
|
78
97
|
#
|
79
98
|
# == Returns:
|
80
99
|
# An object with the following fields:
|
@@ -87,17 +106,40 @@ module Stytch
|
|
87
106
|
# webauthn_registration_id::
|
88
107
|
# The unique ID for the WebAuthn registration.
|
89
108
|
# The type of this field is +String+.
|
109
|
+
# session_token::
|
110
|
+
# A secret token for a given Stytch Session.
|
111
|
+
# The type of this field is +String+.
|
112
|
+
# session_jwt::
|
113
|
+
# The JSON Web Token (JWT) for a given Stytch Session.
|
114
|
+
# The type of this field is +String+.
|
115
|
+
# user::
|
116
|
+
# The `user` object affected by this API call. See the [Get user endpoint](https://stytch.com/docs/api/get-user) for complete response field details.
|
117
|
+
# The type of this field is +User+ (+object+).
|
90
118
|
# status_code::
|
91
119
|
# 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.
|
92
120
|
# The type of this field is +Integer+.
|
121
|
+
# session::
|
122
|
+
# If you initiate a Session, by including `session_duration_minutes` in your authenticate call, you'll receive a full Session object in the response.
|
123
|
+
#
|
124
|
+
# See [GET sessions](https://stytch.com/docs/api/session-get) for complete response fields.
|
125
|
+
#
|
126
|
+
# The type of this field is nilable +Session+ (+object+).
|
93
127
|
def register(
|
94
128
|
user_id:,
|
95
|
-
public_key_credential
|
129
|
+
public_key_credential:,
|
130
|
+
session_token: nil,
|
131
|
+
session_duration_minutes: nil,
|
132
|
+
session_jwt: nil,
|
133
|
+
session_custom_claims: nil
|
96
134
|
)
|
97
135
|
request = {
|
98
136
|
user_id: user_id,
|
99
137
|
public_key_credential: public_key_credential
|
100
138
|
}
|
139
|
+
request[:session_token] = session_token unless session_token.nil?
|
140
|
+
request[:session_jwt] = session_jwt unless session_jwt.nil?
|
141
|
+
request[:session_duration_minutes] = session_duration_minutes unless session_duration_minutes.nil?
|
142
|
+
request[:session_custom_claims] = session_custom_claims unless session_custom_claims.nil?
|
101
143
|
|
102
144
|
post_request('/v1/webauthn/register', request)
|
103
145
|
end
|
@@ -107,12 +149,15 @@ module Stytch
|
|
107
149
|
# If you are not using the [webauthn-json](https://github.com/github/webauthn-json) library, `the public_key_credential_request_options` will need to be converted to a suitable public key by unmarshalling the JSON and converting some the fields to array buffers.
|
108
150
|
#
|
109
151
|
# == Parameters:
|
110
|
-
# user_id::
|
111
|
-
# The `user_id` of an active user the WebAuthn registration should be tied to.
|
112
|
-
# The type of this field is +String+.
|
113
152
|
# domain::
|
114
153
|
# The domain for WebAuthn. Defaults to `window.location.hostname`.
|
115
154
|
# The type of this field is +String+.
|
155
|
+
# user_id::
|
156
|
+
# The `user_id` of an active user the WebAuthn registration should be tied to.
|
157
|
+
# The type of this field is nilable +String+.
|
158
|
+
# return_passkey_credential_options::
|
159
|
+
# If true, the public_key_credential_creation_options returned will be optimized for Passkeys.
|
160
|
+
# The type of this field is nilable +Boolean+.
|
116
161
|
#
|
117
162
|
# == Returns:
|
118
163
|
# An object with the following fields:
|
@@ -129,13 +174,15 @@ module Stytch
|
|
129
174
|
# 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.
|
130
175
|
# The type of this field is +Integer+.
|
131
176
|
def authenticate_start(
|
132
|
-
|
133
|
-
|
177
|
+
domain:,
|
178
|
+
user_id: nil,
|
179
|
+
return_passkey_credential_options: nil
|
134
180
|
)
|
135
181
|
request = {
|
136
|
-
user_id: user_id,
|
137
182
|
domain: domain
|
138
183
|
}
|
184
|
+
request[:user_id] = user_id unless user_id.nil?
|
185
|
+
request[:return_passkey_credential_options] = return_passkey_credential_options unless return_passkey_credential_options.nil?
|
139
186
|
|
140
187
|
post_request('/v1/webauthn/authenticate/start', request)
|
141
188
|
end
|
@@ -217,5 +264,16 @@ module Stytch
|
|
217
264
|
|
218
265
|
post_request('/v1/webauthn/authenticate', request)
|
219
266
|
end
|
267
|
+
|
268
|
+
def update(
|
269
|
+
webauthn_registration_id:,
|
270
|
+
name:
|
271
|
+
)
|
272
|
+
request = {
|
273
|
+
name: name
|
274
|
+
}
|
275
|
+
|
276
|
+
put_request("/v1/webauthn/#{webauthn_registration_id}", request)
|
277
|
+
end
|
220
278
|
end
|
221
279
|
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: 6.5.
|
4
|
+
version: 6.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- stytch
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|