stytch 2.10.1 → 2.11.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/README.md +3 -4
- data/lib/stytch/client.rb +3 -1
- data/lib/stytch/crypto_wallets.rb +49 -0
- data/lib/stytch/users.rb +9 -1
- 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: d9e1c109c231f2dedb872cf4528ad44366517c5bac06adff7139b355e09c0537
|
4
|
+
data.tar.gz: 1cfd8aa59c94ca621cda81a36a2669ff1352a84919d0ebe304aec47d6463a989
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21f8bd406c9f5e9135cb93e6f66f1bf7f3b9a4644b6a2e3309afa688302ce466b6cc343d871df5bc295fea07bcf20862a4ccdf0ea8d5eb1df7621a79cb86b6c1
|
7
|
+
data.tar.gz: 2f7bf4ae7d789858a36d65dea80a9ecd1c6f459748fb301d9eda97e2ce015a125a97f3bd9dda381ec0709d2e962ba268734736ce2aee0dc5e751ace10d7b9f13
|
data/README.md
CHANGED
@@ -34,6 +34,7 @@ This client library supports all of Stytch's live products:
|
|
34
34
|
- [x] [Session Management](https://stytch.com/docs/api/sessions-overview)
|
35
35
|
- [x] [WebAuthn (Beta)](https://stytch.com/docs/api/webauthn-overview)
|
36
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)
|
37
38
|
|
38
39
|
### Example usage
|
39
40
|
Create an API client:
|
@@ -48,16 +49,14 @@ client = Stytch::Client.new(
|
|
48
49
|
Send a magic link by email:
|
49
50
|
```ruby
|
50
51
|
client.magic_links.email.login_or_create(
|
51
|
-
email: "sandbox@stytch.com"
|
52
|
-
login_magic_link_url: "https://example.com/login",
|
53
|
-
signup_magic_link_url: "https://example.com/signup",
|
52
|
+
email: "sandbox@stytch.com"
|
54
53
|
)
|
55
54
|
```
|
56
55
|
|
57
56
|
Authenticate the token from the magic link:
|
58
57
|
```ruby
|
59
58
|
client.magic_links.authenticate(
|
60
|
-
token: "SeiGwdj5lKkrEVgcEY3QNJXt6srxS3IK2Nwkar6mXD4="
|
59
|
+
token: "SeiGwdj5lKkrEVgcEY3QNJXt6srxS3IK2Nwkar6mXD4="
|
61
60
|
)
|
62
61
|
```
|
63
62
|
|
data/lib/stytch/client.rb
CHANGED
@@ -7,12 +7,13 @@ require_relative 'otps'
|
|
7
7
|
require_relative 'sessions'
|
8
8
|
require_relative 'totps'
|
9
9
|
require_relative 'webauthn'
|
10
|
+
require_relative 'crypto_wallets'
|
10
11
|
|
11
12
|
module Stytch
|
12
13
|
class Client
|
13
14
|
ENVIRONMENTS = %i[live test].freeze
|
14
15
|
|
15
|
-
attr_reader :users, :magic_links, :oauth, :otps, :sessions, :totps, :webauthn
|
16
|
+
attr_reader :users, :magic_links, :oauth, :otps, :sessions, :totps, :webauthn, :crypto_wallets
|
16
17
|
|
17
18
|
def initialize(env:, project_id:, secret:, &block)
|
18
19
|
@api_host = api_host(env)
|
@@ -28,6 +29,7 @@ module Stytch
|
|
28
29
|
@sessions = Stytch::Sessions.new(@connection)
|
29
30
|
@totps = Stytch::TOTPs.new(@connection)
|
30
31
|
@webauthn = Stytch::WebAuthn.new(@connection)
|
32
|
+
@crypto_wallets = Stytch::CryptoWallets.new(@connection)
|
31
33
|
end
|
32
34
|
|
33
35
|
private
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'request_helper'
|
4
|
+
|
5
|
+
module Stytch
|
6
|
+
class CryptoWallets
|
7
|
+
include Stytch::RequestHelper
|
8
|
+
|
9
|
+
PATH = '/v1/crypto_wallets'
|
10
|
+
|
11
|
+
def initialize(connection)
|
12
|
+
@connection = connection
|
13
|
+
end
|
14
|
+
|
15
|
+
def authenticate_start(
|
16
|
+
crypto_wallet_address:,
|
17
|
+
crypto_wallet_type:,
|
18
|
+
user_id: nil
|
19
|
+
)
|
20
|
+
request = {
|
21
|
+
crypto_wallet_address: crypto_wallet_address,
|
22
|
+
crypto_wallet_type: crypto_wallet_type
|
23
|
+
}
|
24
|
+
|
25
|
+
request[:user_id] = user_id unless user_id.nil?
|
26
|
+
|
27
|
+
post_request("#{PATH}/authenticate/start", request)
|
28
|
+
end
|
29
|
+
|
30
|
+
def authenticate(
|
31
|
+
crypto_wallet_address:,
|
32
|
+
crypto_wallet_type:,
|
33
|
+
signature:,
|
34
|
+
session_token: nil,
|
35
|
+
session_duration_minutes: nil
|
36
|
+
)
|
37
|
+
request = {
|
38
|
+
crypto_wallet_address: crypto_wallet_address,
|
39
|
+
crypto_wallet_type: crypto_wallet_type,
|
40
|
+
signature: signature
|
41
|
+
}
|
42
|
+
|
43
|
+
request[:session_token] = session_token unless session_token.nil?
|
44
|
+
request[:session_duration_minutes] = session_duration_minutes unless session_duration_minutes.nil?
|
45
|
+
|
46
|
+
post_request("#{PATH}/authenticate", request)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
data/lib/stytch/users.rb
CHANGED
@@ -54,11 +54,13 @@ module Stytch
|
|
54
54
|
name: {},
|
55
55
|
emails: [],
|
56
56
|
phone_numbers: [],
|
57
|
+
crypto_wallets: [],
|
57
58
|
attributes: {}
|
58
59
|
)
|
59
60
|
request = {
|
60
61
|
emails: format_emails(emails),
|
61
|
-
phone_numbers: format_phone_numbers(phone_numbers)
|
62
|
+
phone_numbers: format_phone_numbers(phone_numbers),
|
63
|
+
crypto_wallets: crypto_wallets
|
62
64
|
}
|
63
65
|
|
64
66
|
request[:name] = name if name != {}
|
@@ -95,6 +97,12 @@ module Stytch
|
|
95
97
|
delete_request("#{PATH}/totps/#{totp_id}")
|
96
98
|
end
|
97
99
|
|
100
|
+
def delete_crypto_wallet(
|
101
|
+
crypto_wallet_id:
|
102
|
+
)
|
103
|
+
delete_request("#{PATH}/crypto_wallets/#{crypto_wallet_id}")
|
104
|
+
end
|
105
|
+
|
98
106
|
private
|
99
107
|
|
100
108
|
def format_emails(emails)
|
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: 2.
|
4
|
+
version: 2.11.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-
|
11
|
+
date: 2022-03-08 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: []
|
@@ -71,6 +71,7 @@ files:
|
|
71
71
|
- bin/setup
|
72
72
|
- lib/stytch.rb
|
73
73
|
- lib/stytch/client.rb
|
74
|
+
- lib/stytch/crypto_wallets.rb
|
74
75
|
- lib/stytch/magic_links.rb
|
75
76
|
- lib/stytch/middleware.rb
|
76
77
|
- lib/stytch/oauth.rb
|
@@ -88,7 +89,7 @@ licenses:
|
|
88
89
|
metadata:
|
89
90
|
homepage_uri: https://stytch.com
|
90
91
|
source_code_uri: https://github.com/stytchauth/stytch-ruby
|
91
|
-
post_install_message:
|
92
|
+
post_install_message:
|
92
93
|
rdoc_options: []
|
93
94
|
require_paths:
|
94
95
|
- lib
|
@@ -103,8 +104,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
104
|
- !ruby/object:Gem::Version
|
104
105
|
version: '0'
|
105
106
|
requirements: []
|
106
|
-
rubygems_version: 3.
|
107
|
-
signing_key:
|
107
|
+
rubygems_version: 3.1.4
|
108
|
+
signing_key:
|
108
109
|
specification_version: 4
|
109
110
|
summary: Stytch Ruby Gem
|
110
111
|
test_files: []
|