securenative 0.1.17 → 0.1.18
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/.github/workflows/ci.yml +5 -2
- data/.github/workflows/test.yml +5 -2
- data/.gitignore +3 -1
- data/Gemfile +5 -2
- data/Gemfile.lock +218 -10
- data/README.md +3 -3
- data/VERSION +1 -1
- data/lib/api_manager.rb +35 -0
- data/lib/config/configuration_builder.rb +30 -0
- data/lib/config/configuration_manager.rb +55 -0
- data/lib/config/securenative_options.rb +22 -0
- data/lib/context/hanami_context.rb +35 -0
- data/lib/context/rails_context.rb +41 -0
- data/lib/context/securenative_context.rb +67 -0
- data/lib/context/sinatra_context.rb +35 -0
- data/lib/enums/api_route.rb +6 -0
- data/lib/enums/event_types.rb +23 -0
- data/lib/enums/failover_strategy.rb +6 -0
- data/lib/enums/risk_level.rb +7 -0
- data/lib/errors/securenative_config_error.rb +4 -0
- data/lib/errors/securenative_http_error.rb +4 -0
- data/lib/errors/securenative_invalid_options_error.rb +4 -0
- data/lib/errors/securenative_invalid_uri_error.rb +4 -0
- data/lib/errors/securenative_parse_error.rb +4 -0
- data/lib/errors/securenative_sdk_Illegal_state_error.rb +4 -0
- data/lib/errors/securenative_sdk_error.rb +4 -0
- data/lib/event_manager.rb +156 -0
- data/lib/{securenative/event_options_builder.rb → event_options.rb} +5 -3
- data/lib/http/secure_native_http_response.rb +12 -0
- data/lib/http/securenative_http_client.rb +32 -0
- data/lib/{securenative/models → models}/client_token.rb +2 -0
- data/lib/{securenative/models → models}/device.rb +3 -1
- data/lib/models/event_options.rb +15 -0
- data/lib/models/request_context.rb +18 -0
- data/lib/models/request_options.rb +12 -0
- data/lib/models/sdk_event.rb +35 -0
- data/lib/models/user_traits.rb +13 -0
- data/lib/models/verify_result.rb +12 -0
- data/lib/securenative.rb +95 -0
- data/lib/utils/date_utils.rb +9 -0
- data/lib/{securenative/utils → utils}/encryption_utils.rb +1 -4
- data/lib/{securenative/utils → utils}/ip_utils.rb +7 -6
- data/lib/utils/request_utils.rb +54 -0
- data/lib/{securenative/logger.rb → utils/secure_native_logger.rb} +5 -3
- data/lib/{securenative/utils → utils}/signature_utils.rb +4 -2
- data/lib/utils/utils.rb +9 -0
- data/lib/{securenative/utils → utils}/version_utils.rb +3 -1
- data/{lib/securenative → out/production/securenative-ruby}/api_manager.rb +6 -5
- data/{lib/securenative → out/production/securenative-ruby}/config/configuration_builder.rb +7 -3
- data/{lib/securenative → out/production/securenative-ruby}/config/configuration_manager.rb +5 -3
- data/{lib/securenative → out/production/securenative-ruby}/config/securenative_options.rb +3 -1
- data/out/production/securenative-ruby/context/securenative_context.rb +40 -0
- data/out/production/securenative-ruby/enums/api_route.rb +6 -0
- data/out/production/securenative-ruby/enums/event_types.rb +23 -0
- data/out/production/securenative-ruby/enums/failover_strategy.rb +6 -0
- data/out/production/securenative-ruby/enums/risk_level.rb +7 -0
- data/out/production/securenative-ruby/errors/securenative_config_error.rb +4 -0
- data/out/production/securenative-ruby/errors/securenative_http_error.rb +4 -0
- data/out/production/securenative-ruby/errors/securenative_invalid_options_error.rb +4 -0
- data/out/production/securenative-ruby/errors/securenative_invalid_uri_error.rb +4 -0
- data/out/production/securenative-ruby/errors/securenative_parse_error.rb +4 -0
- data/out/production/securenative-ruby/errors/securenative_sdk_Illegal_state_error.rb +4 -0
- data/out/production/securenative-ruby/errors/securenative_sdk_error.rb +4 -0
- data/out/production/securenative-ruby/event_manager.rb +156 -0
- data/out/production/securenative-ruby/event_options.rb +32 -0
- data/{lib/securenative → out/production/securenative-ruby}/http/http_response.rb +3 -1
- data/out/production/securenative-ruby/http/securenative_http_client.rb +32 -0
- data/out/production/securenative-ruby/models/client_token.rb +12 -0
- data/out/production/securenative-ruby/models/device.rb +10 -0
- data/{lib/securenative → out/production/securenative-ruby}/models/event_options.rb +3 -1
- data/{lib/securenative → out/production/securenative-ruby}/models/request_context.rb +5 -2
- data/out/production/securenative-ruby/models/request_options.rb +12 -0
- data/{lib/securenative → out/production/securenative-ruby}/models/sdk_event.rb +11 -3
- data/{lib/securenative → out/production/securenative-ruby}/models/user_traits.rb +3 -1
- data/{lib/securenative → out/production/securenative-ruby}/models/verify_result.rb +3 -1
- data/{lib/securenative → out/production/securenative-ruby}/securenative.rb +24 -15
- data/out/production/securenative-ruby/utils/date_utils.rb +9 -0
- data/out/production/securenative-ruby/utils/encryption_utils.rb +35 -0
- data/out/production/securenative-ruby/utils/ip_utils.rb +23 -0
- data/{lib/securenative → out/production/securenative-ruby}/utils/request_utils.rb +5 -3
- data/out/production/securenative-ruby/utils/secure_native_logger.rb +44 -0
- data/out/production/securenative-ruby/utils/signature_utils.rb +16 -0
- data/out/production/securenative-ruby/utils/utils.rb +9 -0
- data/out/production/securenative-ruby/utils/version_utils.rb +12 -0
- data/out/test/securenative-ruby/spec_api_manager.rb +81 -0
- data/out/test/securenative-ruby/spec_context_builder.rb +69 -0
- data/out/test/securenative-ruby/spec_date_utils.rb +13 -0
- data/out/test/securenative-ruby/spec_encryption_utils.rb +26 -0
- data/out/test/securenative-ruby/spec_event_manager.rb +59 -0
- data/out/test/securenative-ruby/spec_helper.rb +20 -0
- data/out/test/securenative-ruby/spec_ip_utils.rb +41 -0
- data/out/test/securenative-ruby/spec_securenative.rb +65 -0
- data/out/test/securenative-ruby/spec_securenative_http_client.rb +23 -0
- data/out/test/securenative-ruby/spec_signature_utils.rb +18 -0
- data/securenative.gemspec +1 -1
- metadata +89 -42
- data/.travis.yml +0 -6
- data/lib/securenative/context/context_builder.rb +0 -59
- data/lib/securenative/context/securenative_context.rb +0 -14
- data/lib/securenative/enums/api_route.rb +0 -4
- data/lib/securenative/enums/event_types.rb +0 -21
- data/lib/securenative/enums/failover_strategy.rb +0 -4
- data/lib/securenative/enums/risk_level.rb +0 -5
- data/lib/securenative/event_manager.rb +0 -150
- data/lib/securenative/exceptions/securenative_config_exception.rb +0 -2
- data/lib/securenative/exceptions/securenative_http_exception.rb +0 -2
- data/lib/securenative/exceptions/securenative_invalid_options_exception.rb +0 -2
- data/lib/securenative/exceptions/securenative_invalid_uri_exception.rb +0 -2
- data/lib/securenative/exceptions/securenative_parse_exception.rb +0 -2
- data/lib/securenative/exceptions/securenative_sdk_Illegal_state_exception.rb +0 -2
- data/lib/securenative/exceptions/securenative_sdk_exception.rb +0 -2
- data/lib/securenative/http/securenative_http_client.rb +0 -30
- data/lib/securenative/models/request_options.rb +0 -10
- data/lib/securenative/securenative.iml +0 -9
- data/lib/securenative/utils/date_utils.rb +0 -7
- data/lib/securenative/utils/utils.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d858e629da2a2f7f0c3cfaed2578bebe8560231c80b150a63286c2b06783aa4
|
4
|
+
data.tar.gz: ad059fb8d2ae68ee261cc42fc33039091ef69988d81d5df268a9480006b21509
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c011475a3513e520305e4a7fab927238050b22c29142b726801544b10c7dd6fdba348a0eb9ac3dee2e69b67dca037fa77aa1ed2f4cae1ae6f6ec95293855d93f
|
7
|
+
data.tar.gz: 811bb374f34727eb9c0ef82ec3fa7e54248cfa753fb880129660643716e79dbaf56b276f87fb63e711bc32544020b3f6eedea09f88578f71eaab6f85d6c5468f
|
data/.github/workflows/ci.yml
CHANGED
@@ -10,7 +10,10 @@ on:
|
|
10
10
|
jobs:
|
11
11
|
test:
|
12
12
|
name: CI
|
13
|
-
runs-on:
|
13
|
+
runs-on: ${{ matrix.os }}
|
14
|
+
strategy:
|
15
|
+
matrix:
|
16
|
+
os: [ubuntu-latest]
|
14
17
|
steps:
|
15
18
|
- uses: actions/checkout@v1
|
16
19
|
- uses: actions/setup-ruby@v1
|
@@ -21,7 +24,7 @@ jobs:
|
|
21
24
|
gem install bundler
|
22
25
|
bundler install
|
23
26
|
- name: Run tests
|
24
|
-
run:
|
27
|
+
run: bundle exec rspec spec --pattern **/spec_*.rb
|
25
28
|
|
26
29
|
- name: Notify slack success
|
27
30
|
if: success()
|
data/.github/workflows/test.yml
CHANGED
@@ -9,7 +9,10 @@ on:
|
|
9
9
|
jobs:
|
10
10
|
test:
|
11
11
|
name: Testing
|
12
|
-
runs-on:
|
12
|
+
runs-on: ${{ matrix.os }}
|
13
|
+
strategy:
|
14
|
+
matrix:
|
15
|
+
os: [ubuntu-latest]
|
13
16
|
steps:
|
14
17
|
- uses: actions/checkout@v1
|
15
18
|
- uses: actions/setup-ruby@v1
|
@@ -20,7 +23,7 @@ jobs:
|
|
20
23
|
gem install bundler
|
21
24
|
bundler install
|
22
25
|
- name: Run tests
|
23
|
-
run:
|
26
|
+
run: bundle exec rspec spec --pattern **/spec_*.rb
|
24
27
|
|
25
28
|
- name: Notify slack success
|
26
29
|
if: success()
|
data/.gitignore
CHANGED
@@ -10,6 +10,7 @@
|
|
10
10
|
/test/version_tmp/
|
11
11
|
/tmp/
|
12
12
|
.idea
|
13
|
+
*.iml
|
13
14
|
# Used by dotenv library to load environment variables.
|
14
15
|
# .env
|
15
16
|
|
@@ -35,4 +36,5 @@
|
|
35
36
|
|
36
37
|
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
37
38
|
.rvmrc
|
38
|
-
.DS_Store
|
39
|
+
.DS_Store
|
40
|
+
.rspec_status
|
data/Gemfile
CHANGED
@@ -5,5 +5,8 @@ gem "rspec"
|
|
5
5
|
gem "rake"
|
6
6
|
gem "httpclient"
|
7
7
|
gem "parseconfig"
|
8
|
-
gem "
|
9
|
-
gem "
|
8
|
+
gem "simplecov", :require => false, :group => :test
|
9
|
+
gem "webmock", :require => false, :group => :test
|
10
|
+
gem "rails", :require => false, :group => :test
|
11
|
+
gem "hanami", :require => false, :group => :test
|
12
|
+
gem "sinatra", :require => false, :group => :test
|
data/Gemfile.lock
CHANGED
@@ -1,27 +1,208 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
securenative (0.1.
|
4
|
+
securenative (0.1.18)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
+
actioncable (6.0.3.2)
|
10
|
+
actionpack (= 6.0.3.2)
|
11
|
+
nio4r (~> 2.0)
|
12
|
+
websocket-driver (>= 0.6.1)
|
13
|
+
actionmailbox (6.0.3.2)
|
14
|
+
actionpack (= 6.0.3.2)
|
15
|
+
activejob (= 6.0.3.2)
|
16
|
+
activerecord (= 6.0.3.2)
|
17
|
+
activestorage (= 6.0.3.2)
|
18
|
+
activesupport (= 6.0.3.2)
|
19
|
+
mail (>= 2.7.1)
|
20
|
+
actionmailer (6.0.3.2)
|
21
|
+
actionpack (= 6.0.3.2)
|
22
|
+
actionview (= 6.0.3.2)
|
23
|
+
activejob (= 6.0.3.2)
|
24
|
+
mail (~> 2.5, >= 2.5.4)
|
25
|
+
rails-dom-testing (~> 2.0)
|
26
|
+
actionpack (6.0.3.2)
|
27
|
+
actionview (= 6.0.3.2)
|
28
|
+
activesupport (= 6.0.3.2)
|
29
|
+
rack (~> 2.0, >= 2.0.8)
|
30
|
+
rack-test (>= 0.6.3)
|
31
|
+
rails-dom-testing (~> 2.0)
|
32
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
33
|
+
actiontext (6.0.3.2)
|
34
|
+
actionpack (= 6.0.3.2)
|
35
|
+
activerecord (= 6.0.3.2)
|
36
|
+
activestorage (= 6.0.3.2)
|
37
|
+
activesupport (= 6.0.3.2)
|
38
|
+
nokogiri (>= 1.8.5)
|
39
|
+
actionview (6.0.3.2)
|
40
|
+
activesupport (= 6.0.3.2)
|
41
|
+
builder (~> 3.1)
|
42
|
+
erubi (~> 1.4)
|
43
|
+
rails-dom-testing (~> 2.0)
|
44
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
45
|
+
activejob (6.0.3.2)
|
46
|
+
activesupport (= 6.0.3.2)
|
47
|
+
globalid (>= 0.3.6)
|
48
|
+
activemodel (6.0.3.2)
|
49
|
+
activesupport (= 6.0.3.2)
|
50
|
+
activerecord (6.0.3.2)
|
51
|
+
activemodel (= 6.0.3.2)
|
52
|
+
activesupport (= 6.0.3.2)
|
53
|
+
activestorage (6.0.3.2)
|
54
|
+
actionpack (= 6.0.3.2)
|
55
|
+
activejob (= 6.0.3.2)
|
56
|
+
activerecord (= 6.0.3.2)
|
57
|
+
marcel (~> 0.3.1)
|
58
|
+
activesupport (6.0.3.2)
|
59
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
60
|
+
i18n (>= 0.7, < 2)
|
61
|
+
minitest (~> 5.1)
|
62
|
+
tzinfo (~> 1.1)
|
63
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
9
64
|
addressable (2.7.0)
|
10
65
|
public_suffix (>= 2.0.2, < 5.0)
|
11
|
-
|
12
|
-
|
13
|
-
simplecov
|
14
|
-
url
|
66
|
+
builder (3.2.4)
|
67
|
+
concurrent-ruby (1.1.7)
|
15
68
|
crack (0.4.3)
|
16
69
|
safe_yaml (~> 1.0.0)
|
70
|
+
crass (1.0.6)
|
17
71
|
diff-lcs (1.3)
|
18
72
|
docile (1.3.2)
|
73
|
+
dry-configurable (0.11.6)
|
74
|
+
concurrent-ruby (~> 1.0)
|
75
|
+
dry-core (~> 0.4, >= 0.4.7)
|
76
|
+
dry-equalizer (~> 0.2)
|
77
|
+
dry-container (0.7.2)
|
78
|
+
concurrent-ruby (~> 1.0)
|
79
|
+
dry-configurable (~> 0.1, >= 0.1.3)
|
80
|
+
dry-core (0.4.9)
|
81
|
+
concurrent-ruby (~> 1.0)
|
82
|
+
dry-equalizer (0.3.0)
|
83
|
+
dry-logic (0.4.2)
|
84
|
+
dry-container (~> 0.2, >= 0.2.6)
|
85
|
+
dry-core (~> 0.2)
|
86
|
+
dry-equalizer (~> 0.2)
|
87
|
+
dry-types (0.12.3)
|
88
|
+
concurrent-ruby (~> 1.0)
|
89
|
+
dry-configurable (~> 0.1)
|
90
|
+
dry-container (~> 0.3)
|
91
|
+
dry-core (~> 0.2, >= 0.2.1)
|
92
|
+
dry-equalizer (~> 0.2)
|
93
|
+
dry-logic (~> 0.4, >= 0.4.2)
|
94
|
+
inflecto (~> 0.0.0, >= 0.0.2)
|
95
|
+
dry-validation (0.11.2)
|
96
|
+
concurrent-ruby (~> 1.0)
|
97
|
+
dry-configurable (~> 0.1, >= 0.1.3)
|
98
|
+
dry-core (~> 0.2, >= 0.2.1)
|
99
|
+
dry-equalizer (~> 0.2)
|
100
|
+
dry-logic (~> 0.4.2)
|
101
|
+
dry-types (~> 0.12.0)
|
102
|
+
erubi (1.9.0)
|
103
|
+
globalid (0.4.2)
|
104
|
+
activesupport (>= 4.2.0)
|
105
|
+
hanami (1.3.3)
|
106
|
+
bundler (>= 1.6, < 3)
|
107
|
+
concurrent-ruby (~> 1.0)
|
108
|
+
hanami-assets (~> 1.3)
|
109
|
+
hanami-cli (~> 0.3)
|
110
|
+
hanami-controller (~> 1.3)
|
111
|
+
hanami-helpers (~> 1.3)
|
112
|
+
hanami-mailer (~> 1.3)
|
113
|
+
hanami-router (~> 1.3)
|
114
|
+
hanami-utils (~> 1.3)
|
115
|
+
hanami-validations (>= 1.3, < 3)
|
116
|
+
hanami-view (~> 1.3)
|
117
|
+
hanami-assets (1.3.4)
|
118
|
+
hanami-helpers (~> 1.3)
|
119
|
+
hanami-utils (~> 1.3)
|
120
|
+
tilt (~> 2.0, >= 2.0.2)
|
121
|
+
hanami-cli (0.3.1)
|
122
|
+
concurrent-ruby (~> 1.0)
|
123
|
+
hanami-utils (~> 1.3)
|
124
|
+
hanami-controller (1.3.3)
|
125
|
+
hanami-utils (~> 1.3)
|
126
|
+
rack (~> 2.0)
|
127
|
+
hanami-helpers (1.3.3)
|
128
|
+
hanami-utils (~> 1.3)
|
129
|
+
hanami-mailer (1.3.2)
|
130
|
+
hanami-utils (~> 1.3)
|
131
|
+
mail (~> 2.6)
|
132
|
+
tilt (~> 2.0, >= 2.0.1)
|
133
|
+
hanami-router (1.3.2)
|
134
|
+
hanami-utils (~> 1.3)
|
135
|
+
http_router (= 0.11.2)
|
136
|
+
rack (~> 2.0)
|
137
|
+
hanami-utils (1.3.6)
|
138
|
+
concurrent-ruby (~> 1.0)
|
139
|
+
transproc (~> 1.0)
|
140
|
+
hanami-validations (1.3.6)
|
141
|
+
dry-logic (~> 0.4.2, < 0.5)
|
142
|
+
dry-validation (~> 0.11, < 0.12)
|
143
|
+
hanami-utils (~> 1.3)
|
144
|
+
hanami-view (1.3.3)
|
145
|
+
hanami-utils (~> 1.3)
|
146
|
+
tilt (~> 2.0, >= 2.0.1)
|
19
147
|
hashdiff (1.0.1)
|
148
|
+
http_router (0.11.2)
|
149
|
+
rack (>= 1.0.0)
|
150
|
+
url_mount (~> 0.2.1)
|
20
151
|
httpclient (2.8.3)
|
21
|
-
|
152
|
+
i18n (1.8.5)
|
153
|
+
concurrent-ruby (~> 1.0)
|
154
|
+
inflecto (0.0.2)
|
155
|
+
loofah (2.6.0)
|
156
|
+
crass (~> 1.0.2)
|
157
|
+
nokogiri (>= 1.5.9)
|
158
|
+
mail (2.7.1)
|
159
|
+
mini_mime (>= 0.1.1)
|
160
|
+
marcel (0.3.3)
|
161
|
+
mimemagic (~> 0.3.2)
|
162
|
+
method_source (1.0.0)
|
163
|
+
mimemagic (0.3.5)
|
164
|
+
mini_mime (1.0.2)
|
165
|
+
mini_portile2 (2.4.0)
|
166
|
+
minitest (5.14.1)
|
167
|
+
mustermann (1.1.1)
|
168
|
+
ruby2_keywords (~> 0.0.1)
|
169
|
+
nio4r (2.5.2)
|
170
|
+
nokogiri (1.10.10)
|
171
|
+
mini_portile2 (~> 2.4.0)
|
22
172
|
parseconfig (1.0.8)
|
23
173
|
public_suffix (4.0.5)
|
24
|
-
|
174
|
+
rack (2.2.3)
|
175
|
+
rack-protection (2.0.8.1)
|
176
|
+
rack
|
177
|
+
rack-test (1.1.0)
|
178
|
+
rack (>= 1.0, < 3)
|
179
|
+
rails (6.0.3.2)
|
180
|
+
actioncable (= 6.0.3.2)
|
181
|
+
actionmailbox (= 6.0.3.2)
|
182
|
+
actionmailer (= 6.0.3.2)
|
183
|
+
actionpack (= 6.0.3.2)
|
184
|
+
actiontext (= 6.0.3.2)
|
185
|
+
actionview (= 6.0.3.2)
|
186
|
+
activejob (= 6.0.3.2)
|
187
|
+
activemodel (= 6.0.3.2)
|
188
|
+
activerecord (= 6.0.3.2)
|
189
|
+
activestorage (= 6.0.3.2)
|
190
|
+
activesupport (= 6.0.3.2)
|
191
|
+
bundler (>= 1.3.0)
|
192
|
+
railties (= 6.0.3.2)
|
193
|
+
sprockets-rails (>= 2.0.0)
|
194
|
+
rails-dom-testing (2.0.3)
|
195
|
+
activesupport (>= 4.2.0)
|
196
|
+
nokogiri (>= 1.6)
|
197
|
+
rails-html-sanitizer (1.3.0)
|
198
|
+
loofah (~> 2.3)
|
199
|
+
railties (6.0.3.2)
|
200
|
+
actionpack (= 6.0.3.2)
|
201
|
+
activesupport (= 6.0.3.2)
|
202
|
+
method_source
|
203
|
+
rake (>= 0.8.7)
|
204
|
+
thor (>= 0.20.3, < 2.0)
|
205
|
+
rake (13.0.1)
|
25
206
|
rspec (3.8.0)
|
26
207
|
rspec-core (~> 3.8.0)
|
27
208
|
rspec-expectations (~> 3.8.0)
|
@@ -35,28 +216,55 @@ GEM
|
|
35
216
|
diff-lcs (>= 1.2.0, < 2.0)
|
36
217
|
rspec-support (~> 3.8.0)
|
37
218
|
rspec-support (3.8.2)
|
219
|
+
ruby2_keywords (0.0.2)
|
38
220
|
safe_yaml (1.0.5)
|
39
|
-
simplecov (0.
|
221
|
+
simplecov (0.19.0)
|
40
222
|
docile (~> 1.1)
|
41
223
|
simplecov-html (~> 0.11)
|
42
224
|
simplecov-html (0.12.2)
|
43
|
-
|
225
|
+
sinatra (2.0.8.1)
|
226
|
+
mustermann (~> 1.0)
|
227
|
+
rack (~> 2.0)
|
228
|
+
rack-protection (= 2.0.8.1)
|
229
|
+
tilt (~> 2.0)
|
230
|
+
sprockets (4.0.2)
|
231
|
+
concurrent-ruby (~> 1.0)
|
232
|
+
rack (> 1, < 3)
|
233
|
+
sprockets-rails (3.2.1)
|
234
|
+
actionpack (>= 4.0)
|
235
|
+
activesupport (>= 4.0)
|
236
|
+
sprockets (>= 3.0.0)
|
237
|
+
thor (1.0.1)
|
238
|
+
thread_safe (0.3.6)
|
239
|
+
tilt (2.0.10)
|
240
|
+
transproc (1.1.1)
|
241
|
+
tzinfo (1.2.7)
|
242
|
+
thread_safe (~> 0.1)
|
243
|
+
url_mount (0.2.1)
|
244
|
+
rack
|
44
245
|
webmock (3.8.3)
|
45
246
|
addressable (>= 2.3.6)
|
46
247
|
crack (>= 0.3.2)
|
47
248
|
hashdiff (>= 0.4.0, < 2.0.0)
|
249
|
+
websocket-driver (0.7.3)
|
250
|
+
websocket-extensions (>= 0.1.0)
|
251
|
+
websocket-extensions (0.1.5)
|
252
|
+
zeitwerk (2.4.0)
|
48
253
|
|
49
254
|
PLATFORMS
|
50
255
|
ruby
|
51
256
|
|
52
257
|
DEPENDENCIES
|
53
258
|
bundler (~> 2.0)
|
54
|
-
|
259
|
+
hanami
|
55
260
|
httpclient
|
56
261
|
parseconfig
|
262
|
+
rails
|
57
263
|
rake
|
58
264
|
rspec
|
59
265
|
securenative!
|
266
|
+
simplecov
|
267
|
+
sinatra
|
60
268
|
webmock
|
61
269
|
|
62
270
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -99,7 +99,7 @@ securenative = SecureNative.instance
|
|
99
99
|
context = securenative.context_builder(ip = '127.0.0.1', client_token = 'SECURED_CLIENT_TOKEN',
|
100
100
|
headers = { 'user-agent' => 'Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405' })
|
101
101
|
|
102
|
-
event_options =
|
102
|
+
event_options = EventOptions(event_type = EventTypes::LOG_IN,
|
103
103
|
user_id = '1234', user_traits = UserTraits('Your Name', 'name@gmail.com', '+1234567890'),
|
104
104
|
context = context, properties = {prop1 => 'CUSTOM_PARAM_VALUE', prop2 => true, prop3 => 3}).build
|
105
105
|
|
@@ -119,7 +119,7 @@ def track(request)
|
|
119
119
|
securenative = SecureNative.instance
|
120
120
|
context = SecureNative.context_builder.from_http_request(request).build
|
121
121
|
|
122
|
-
event_options =
|
122
|
+
event_options = EventOptions(event_type = EventTypes::LOG_IN,
|
123
123
|
user_id = '1234', user_traits = UserTraits('Your Name', 'name@gmail.com', '+1234567890'),
|
124
124
|
context = context, properties = {prop1 => 'CUSTOM_PARAM_VALUE', prop2 => true, prop3 => 3}).build
|
125
125
|
|
@@ -142,7 +142,7 @@ def verify(request)
|
|
142
142
|
securenative = SecureNative.instance
|
143
143
|
context = SecureNative.context_builder.from_http_request(request).build
|
144
144
|
|
145
|
-
event_options =
|
145
|
+
event_options = EventOptions(event_type = EventTypes::LOG_IN,
|
146
146
|
user_id = '1234', user_traits = UserTraits('Your Name', 'name@gmail.com', '+1234567890'),
|
147
147
|
context = context, properties = {prop1 => 'CUSTOM_PARAM_VALUE', prop2 => true, prop3 => 3}).build
|
148
148
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.18
|
data/lib/api_manager.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'models/sdk_event'
|
4
|
+
require 'enums/failover_strategy'
|
5
|
+
require 'json'
|
6
|
+
|
7
|
+
class ApiManager
|
8
|
+
def initialize(event_manager, securenative_options)
|
9
|
+
@event_manager = event_manager
|
10
|
+
@options = securenative_options
|
11
|
+
end
|
12
|
+
|
13
|
+
def track(event_options)
|
14
|
+
SecureNativeLogger.debug('Track event call')
|
15
|
+
event = SDKEvent.new(event_options, @options)
|
16
|
+
@event_manager.send_async(event, ApiRoute::TRACK)
|
17
|
+
end
|
18
|
+
|
19
|
+
def verify(event_options)
|
20
|
+
SecureNativeLogger.debug('Verify event call')
|
21
|
+
event = SDKEvent.new(event_options, @options)
|
22
|
+
|
23
|
+
begin
|
24
|
+
res = JSON.parse(@event_manager.send_sync(event, ApiRoute::VERIFY, false))
|
25
|
+
return VerifyResult.new(risk_level: res['riskLevel'], score: res['score'], triggers: res['triggers'])
|
26
|
+
rescue StandardError => e
|
27
|
+
SecureNativeLogger.debug("Failed to call verify; #{e}")
|
28
|
+
end
|
29
|
+
if @options.fail_over_strategy == FailOverStrategy::FAIL_OPEN
|
30
|
+
return VerifyResult.new(risk_level: RiskLevel::LOW, score: 0, triggers: nil)
|
31
|
+
end
|
32
|
+
|
33
|
+
VerifyResult.new(risk_level: RiskLevel::HIGH, score: 1, triggers: nil)
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'enums/failover_strategy'
|
4
|
+
|
5
|
+
class ConfigurationBuilder
|
6
|
+
attr_reader :api_key, :api_url, :interval, :max_events, :timeout, :auto_send, :disable, :log_level, :fail_over_strategy
|
7
|
+
attr_writer :api_key, :api_url, :interval, :max_events, :timeout, :auto_send, :disable, :log_level, :fail_over_strategy
|
8
|
+
|
9
|
+
def initialize(api_key: nil, api_url: 'https://api.securenative.com/collector/api/v1', interval: 1000,
|
10
|
+
max_events: 1000, timeout: 1500, auto_send: true, disable: false, log_level: 'FATAL',
|
11
|
+
fail_over_strategy: FailOverStrategy::FAIL_OPEN)
|
12
|
+
@api_key = api_key
|
13
|
+
@api_url = api_url
|
14
|
+
@interval = interval
|
15
|
+
@max_events = max_events
|
16
|
+
@timeout = timeout
|
17
|
+
@auto_send = auto_send
|
18
|
+
@disable = disable
|
19
|
+
@log_level = log_level
|
20
|
+
@fail_over_strategy = fail_over_strategy
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.default_config_builder
|
24
|
+
ConfigurationBuilder.new
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.default_securenative_options
|
28
|
+
SecureNativeOptions.new
|
29
|
+
end
|
30
|
+
end
|