comet_backup_ruby_sdk 1.7.0 → 1.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/CHANGELOG.md +27 -0
  4. data/Gemfile.lock +3 -3
  5. data/README.md +1 -1
  6. data/RELEASING.md +1 -0
  7. data/comet_backup_ruby_sdk.gemspec +2 -2
  8. data/lib/comet/comet_server.rb +171 -3
  9. data/lib/comet/definitions.rb +26 -2
  10. data/lib/comet/models/admin_security_options.rb +23 -0
  11. data/lib/comet/models/admin_web_authn_registration.rb +112 -0
  12. data/lib/comet/models/allowed_admin_user.rb +212 -0
  13. data/lib/comet/models/b2destination_location.rb +8 -0
  14. data/lib/comet/models/b2virtual_storage_role_settings.rb +6 -0
  15. data/lib/comet/models/browse_office_365list_virtual_accounts_response.rb +99 -0
  16. data/lib/comet/models/device_config.rb +11 -0
  17. data/lib/comet/models/dispatcher_windisk_snapshot_response.rb +99 -0
  18. data/lib/comet/models/email_report_generated_preview.rb +25 -0
  19. data/lib/comet/models/my_sqlconnection.rb +39 -0
  20. data/lib/comet/models/office_365connection.rb +8 -0
  21. data/lib/comet/models/office_365custom_setting_v2.rb +108 -0
  22. data/lib/comet/models/office_365mixed_virtual_account.rb +203 -0
  23. data/lib/comet/models/server_meta_branding_properties.rb +9 -0
  24. data/lib/comet/models/stat_result.rb +9 -0
  25. data/lib/comet/models/web_authn_authenticator_selection.rb +96 -0
  26. data/lib/comet/models/web_authn_credential.rb +105 -0
  27. data/lib/comet/models/web_authn_credential_assertion.rb +74 -0
  28. data/lib/comet/models/web_authn_credential_descriptor.rb +101 -0
  29. data/lib/comet/models/web_authn_credential_entity.rb +86 -0
  30. data/lib/comet/models/web_authn_credential_parameter.rb +84 -0
  31. data/lib/comet/models/web_authn_public_key_credential_creation_options.rb +173 -0
  32. data/lib/comet/models/web_authn_public_key_credential_request_options.rb +141 -0
  33. data/lib/comet/models/web_authn_registration_challenge_response.rb +101 -0
  34. data/lib/comet/models/web_authn_relying_party_entity.rb +95 -0
  35. data/lib/comet/models/web_authn_sign_request.rb +83 -0
  36. data/lib/comet/models/web_authn_sign_response.rb +84 -0
  37. data/lib/comet/models/web_authn_user_entity.rb +105 -0
  38. data/lib/comet/models/webhook_option.rb +16 -0
  39. data/lib/comet_backup_ruby_sdk.rb +19 -0
  40. metadata +24 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5978dc4b2eb4c0001eb7a7c44b3a215450fcbdc9ad7e639c75ba4b9b023b9ac5
4
- data.tar.gz: 8bfd3b9417fefa6bde04316a2fbd6917ded287594e42cc64d989f56be52a6af4
3
+ metadata.gz: 6d320abff24079c6c63042f2319ab6bf85895df807ae4e3c64e28f124931439d
4
+ data.tar.gz: 54992cd97acfdea46b281ec833bd6b42a5ee56968ca0f6a9a59a2dfaee4ee97b
5
5
  SHA512:
6
- metadata.gz: 7bf9d9f36941632b74473ab2d6aeb6d0252951bdcf9be1b6f9ef9b1e595bc2cd91ee813f689d9e84c0b08442378799c8e6fd563c43aef40fd75f23b57d33d5bc
7
- data.tar.gz: 859734f1a066f09426fb736ab83e28fa1b829ed795db56ed403622825fdf701723e25465f511be44e9316876d5d5f9e2a5f3904569005b1930db78aca3773a8c
6
+ metadata.gz: 3554197606a2d10499e981d642f7b2ad5645b2a424f13be88cf0be3d118da6c6df0caf9a784cc1d0c2536f9b591ef8320b1a04e46fffe0e42c4372c677dafa87
7
+ data.tar.gz: '0921fc302340b38c77bb6f7733c447d274347dc7379a8916b7f5a4fea0b97c666cdc126d793075be180ea40d431db1449659f279779bf965513c7e5af1235cb2'
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ *.gem
data/CHANGELOG.md CHANGED
@@ -1,4 +1,31 @@
1
1
  # CHANGELOG
2
+
3
+ ## 2021-12-22 v1.11.0
4
+ - Based on 21.12.1
5
+ - Add `AdminAccountWebauthnRegistration` endpoint for new webauthn support.
6
+ - Deprecate `AdminACcountU2fSubmitChallenge` as U2F is ending browser support in February 2022.
7
+
8
+ ## 2021-11-24 v1.10.0
9
+ - Based on 21.9.12
10
+ - Add support for Thai and Danish localizations
11
+ - Add From and To fields to the EmailReportGenerated API
12
+ - Add `AdminDispatcherEmailPreview` api method for requesting the HTML content of an email
13
+ - Add `ImageEtag` field to the response of the ServerMetaBrandingProperties endpoint.
14
+ - Add support for new engine properties on the Office365 backup type.
15
+ - Add `AdminDispatcherOffice365ListVirtualAccounts` api method for requesting Objects that Office365 is capable of backing up.
16
+
17
+ ## 2021-10-21 1.9.0
18
+ - Based on 21.9.7
19
+ - Add Support for `HideFiles` parameter in B2 Destination Locations
20
+ - Add support for `RegistrationTime` to `DeviceConfig`
21
+ - Upgrade MYSQL to support new TLS connection options
22
+ - Add support for new API: `AdminMetaReadAllLogsRequest` and `AdminDispatcherRequestWindiskSnapshot`
23
+
24
+ ## 2021-09-14 1.8.0
25
+ - Based on Comet 21.9.2
26
+ - Support new `custom_headers` field on the `WebhookOption` class for specifying custom HTTP headers
27
+ to be sent in webhook POST requests from Comet Server
28
+
2
29
  ## 2021-09-08 v1.7.0
3
30
  - Based on Comet 21.9.1
4
31
  - Support new `device_timezone` field on the `DeviceConfig` class.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- comet_backup_ruby_sdk (1.7.0)
4
+ comet_backup_ruby_sdk (1.10.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -33,11 +33,11 @@ PLATFORMS
33
33
  ruby
34
34
 
35
35
  DEPENDENCIES
36
- bundler (~> 1.17)
36
+ bundler (~> 2.1.4)
37
37
  comet_backup_ruby_sdk!
38
38
  minitest (~> 5.14)
39
39
  rake (~> 13.0)
40
40
  rubocop (~> 0.88)
41
41
 
42
42
  BUNDLED WITH
43
- 1.17.2
43
+ 2.1.4
data/README.md CHANGED
@@ -84,7 +84,7 @@ end
84
84
  ```ruby
85
85
  bundle exec rake rubocop
86
86
 
87
- COMETSERVER_ADDRESS='http://127.0.0.1:8060' \
87
+ COMETSERVER_ADDRESS='http://127.0.0.1:8060' \
88
88
  COMETSERVER_ADMINUSER=admin \
89
89
  COMETSERVER_ADMINPASS=admin \
90
90
  bundle exec rake test
data/RELEASING.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # Procedure for releasing gem package updates
2
2
 
3
+ 0. As a cygwin user, with docker installed; `docker run -it -v "c://cygwin64/$PWD":/app -w /app ruby:2.7 bash` will get you with a suitable ruby environment for testing/building and releasing this package9.
3
4
  1. All tests passing
4
5
  2. Update changelog in `CHANGELOG.md`
5
6
  3. Update version number in `comet_backup_ruby_sdk.gemspec`
@@ -12,7 +12,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
12
12
 
13
13
  Gem::Specification.new do |spec|
14
14
  spec.name = 'comet_backup_ruby_sdk'
15
- spec.version = '1.7.0'
15
+ spec.version = '1.11.0'
16
16
  spec.authors = ['Comet Licensing Ltd.']
17
17
  spec.email = ['hello@cometbackup.com']
18
18
 
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  end
29
29
  spec.require_paths = ['lib']
30
30
 
31
- spec.add_development_dependency 'bundler', '~> 1.17'
31
+ spec.add_development_dependency 'bundler', '~> 2.1.4'
32
32
  spec.add_development_dependency 'minitest', '~> 5.14'
33
33
  spec.add_development_dependency 'rake', '~> 13.0'
34
34
  spec.add_development_dependency 'rubocop', '~> 0.88'
@@ -96,7 +96,7 @@ module Comet
96
96
  #
97
97
  # You must supply administrator authentication credentials to use this API.
98
98
  #
99
- # @param [String] self_address (Optional) External URL of this server (used for U2F AppID)
99
+ # @param [String] self_address (Optional) External URL of this server
100
100
  # @return [Comet::SessionKeyRegeneratedResponse]
101
101
  def admin_account_session_start(self_address = nil)
102
102
  submit_params = {}
@@ -166,6 +166,9 @@ module Comet
166
166
  # AdminAccountU2fRequestRegistrationChallenge
167
167
  #
168
168
  # Register a new FIDO U2F token.
169
+ # Browser support for U2F is ending in February 2022. WebAuthn is backwards
170
+ # compatible with U2F keys, and Comet will automatically migrate existing U2F keys
171
+ # to allow their use with the WebAuthn endpoints.
169
172
  #
170
173
  # You must supply administrator authentication credentials to use this API.
171
174
  #
@@ -188,6 +191,9 @@ module Comet
188
191
  # AdminAccountU2fSubmitChallengeResponse
189
192
  #
190
193
  # Register a new FIDO U2F token.
194
+ # Browser support for U2F is ending in February 2022. WebAuthn is backwards
195
+ # compatible with U2F keys, and Comet will automatically migrate existing U2F keys
196
+ # to allow their use with the WebAuthn endpoints.
191
197
  #
192
198
  # You must supply administrator authentication credentials to use this API.
193
199
  #
@@ -245,6 +251,58 @@ module Comet
245
251
  ret
246
252
  end
247
253
 
254
+ # AdminAccountWebauthnRequestRegistrationChallenge
255
+ #
256
+ # Register a new FIDO2 WebAuthn token.
257
+ #
258
+ # You must supply administrator authentication credentials to use this API.
259
+ #
260
+ # @param [String] self_address External URL of this server, used as WebAuthn ID
261
+ # @return [Comet::WebAuthnRegistrationChallengeResponse]
262
+ def admin_account_webauthn_request_registration_challenge(self_address)
263
+ submit_params = {}
264
+ raise TypeError, "'self_address' expected String, got #{self_address.class}" unless self_address.is_a? String
265
+
266
+ submit_params['SelfAddress'] = self_address
267
+
268
+ body = perform_request('api/v1/admin/account/webauthn/request-registration-challenge', submit_params)
269
+ json_body = JSON.parse body
270
+ check_status json_body
271
+ ret = Comet::WebAuthnRegistrationChallengeResponse.new
272
+ ret.from_hash(json_body)
273
+ ret
274
+ end
275
+
276
+ # AdminAccountWebauthnSubmitChallengeResponse
277
+ #
278
+ # Register a new FIDO2 WebAuthn token.
279
+ #
280
+ # You must supply administrator authentication credentials to use this API.
281
+ #
282
+ # @param [String] self_address External URL of this server, used as WebAuthn ID
283
+ # @param [String] challenge_id Associated value from AdminAccountWebAuthnRequestRegistrationChallenge API
284
+ # @param [String] credential JSON-encoded credential
285
+ # @return [Comet::CometAPIResponseMessage]
286
+ def admin_account_webauthn_submit_challenge_response(self_address, challenge_id, credential)
287
+ submit_params = {}
288
+ raise TypeError, "'self_address' expected String, got #{self_address.class}" unless self_address.is_a? String
289
+
290
+ submit_params['SelfAddress'] = self_address
291
+ raise TypeError, "'challenge_id' expected String, got #{challenge_id.class}" unless challenge_id.is_a? String
292
+
293
+ submit_params['ChallengeID'] = challenge_id
294
+ raise TypeError, "'credential' expected String, got #{credential.class}" unless credential.is_a? String
295
+
296
+ submit_params['Credential'] = credential
297
+
298
+ body = perform_request('api/v1/admin/account/webauthn/submit-challenge-response', submit_params)
299
+ json_body = JSON.parse body
300
+ check_status json_body
301
+ ret = Comet::CometAPIResponseMessage.new
302
+ ret.from_hash(json_body)
303
+ ret
304
+ end
305
+
248
306
  # AdminAddUser
249
307
  #
250
308
  # Add a new user account.
@@ -1001,6 +1059,42 @@ module Comet
1001
1059
  ret
1002
1060
  end
1003
1061
 
1062
+ # AdminDispatcherEmailPreview
1063
+ #
1064
+ # Request HTML content of an email.
1065
+ # The remote device must have given consent for an MSP to browse their mail
1066
+ #
1067
+ # You must supply administrator authentication credentials to use this API.
1068
+ # This API requires the Auth Role to be enabled.
1069
+ #
1070
+ # @param [String] target_id The live connection GUID
1071
+ # @param [String] snapshot where the email belongs to
1072
+ # @param [String] destination The Storage Vault ID
1073
+ # @param [String] path of the email to view
1074
+ # @return [Comet::EmailReportGeneratedPreview]
1075
+ def admin_dispatcher_email_preview(target_id, snapshot, destination, path)
1076
+ submit_params = {}
1077
+ raise TypeError, "'target_id' expected String, got #{target_id.class}" unless target_id.is_a? String
1078
+
1079
+ submit_params['TargetID'] = target_id
1080
+ raise TypeError, "'snapshot' expected String, got #{snapshot.class}" unless snapshot.is_a? String
1081
+
1082
+ submit_params['Snapshot'] = snapshot
1083
+ raise TypeError, "'destination' expected String, got #{destination.class}" unless destination.is_a? String
1084
+
1085
+ submit_params['Destination'] = destination
1086
+ raise TypeError, "'path' expected String, got #{path.class}" unless path.is_a? String
1087
+
1088
+ submit_params['Path'] = path
1089
+
1090
+ body = perform_request('api/v1/admin/dispatcher/email-preview', submit_params)
1091
+ json_body = JSON.parse body
1092
+ check_status json_body
1093
+ ret = Comet::EmailReportGeneratedPreview.new
1094
+ ret.from_hash(json_body)
1095
+ ret
1096
+ end
1097
+
1004
1098
  # AdminDispatcherImportApply
1005
1099
  #
1006
1100
  # Instruct a live connected device to import settings from an installed product.
@@ -1077,6 +1171,34 @@ module Comet
1077
1171
  ret
1078
1172
  end
1079
1173
 
1174
+ # AdminDispatcherOffice365ListVirtualAccounts
1175
+ #
1176
+ # Request a list of Office365 Resources (groups, sites, teams groups and users).
1177
+ # The remote device must have given consent for an MSP to browse their files.
1178
+ #
1179
+ # You must supply administrator authentication credentials to use this API.
1180
+ # This API requires the Auth Role to be enabled.
1181
+ #
1182
+ # @param [String] target_id The live connection GUID
1183
+ # @param [Comet::Office365Credential] credentials The Office365 account credential
1184
+ # @return [Comet::BrowseOffice365ListVirtualAccountsResponse]
1185
+ def admin_dispatcher_office_365list_virtual_accounts(target_id, credentials)
1186
+ submit_params = {}
1187
+ raise TypeError, "'target_id' expected String, got #{target_id.class}" unless target_id.is_a? String
1188
+
1189
+ submit_params['TargetID'] = target_id
1190
+ raise TypeError, "'credentials' expected Comet::Office365Credential, got #{credentials.class}" unless credentials.is_a? Comet::Office365Credential
1191
+
1192
+ submit_params['Credentials'] = credentials.to_json
1193
+
1194
+ body = perform_request('api/v1/admin/dispatcher/office365-list-virtual-accounts', submit_params)
1195
+ json_body = JSON.parse body
1196
+ check_status json_body
1197
+ ret = Comet::BrowseOffice365ListVirtualAccountsResponse.new
1198
+ ret.from_hash(json_body)
1199
+ ret
1200
+ end
1201
+
1080
1202
  # AdminDispatcherPingDestination
1081
1203
  #
1082
1204
  # Test the connection to the storage bucket.
@@ -1563,6 +1685,37 @@ module Comet
1563
1685
  ret
1564
1686
  end
1565
1687
 
1688
+ # AdminDispatcherRequestWindiskSnapshot
1689
+ #
1690
+ # Request a Disk Image snapshot with the windiskbrowse-style from a live connected device.
1691
+ #
1692
+ # You must supply administrator authentication credentials to use this API.
1693
+ # This API requires the Auth Role to be enabled.
1694
+ #
1695
+ # @param [String] target_id The live connection GUID
1696
+ # @param [String] destination The Storage Vault ID
1697
+ # @param [String] snapshot_id The Snapshot ID
1698
+ # @return [Comet::DispatcherWindiskSnapshotResponse]
1699
+ def admin_dispatcher_request_windisk_snapshot(target_id, destination, snapshot_id)
1700
+ submit_params = {}
1701
+ raise TypeError, "'target_id' expected String, got #{target_id.class}" unless target_id.is_a? String
1702
+
1703
+ submit_params['TargetID'] = target_id
1704
+ raise TypeError, "'destination' expected String, got #{destination.class}" unless destination.is_a? String
1705
+
1706
+ submit_params['Destination'] = destination
1707
+ raise TypeError, "'snapshot_id' expected String, got #{snapshot_id.class}" unless snapshot_id.is_a? String
1708
+
1709
+ submit_params['SnapshotID'] = snapshot_id
1710
+
1711
+ body = perform_request('api/v1/admin/dispatcher/request-windisk-snapshot', submit_params)
1712
+ json_body = JSON.parse body
1713
+ check_status json_body
1714
+ ret = Comet::DispatcherWindiskSnapshotResponse.new
1715
+ ret.from_hash(json_body)
1716
+ ret
1717
+ end
1718
+
1566
1719
  # AdminDispatcherRunBackup
1567
1720
  #
1568
1721
  # Instruct a live connected device to run a scheduled backup.
@@ -2139,6 +2292,7 @@ module Comet
2139
2292
  # Cancel a running job.
2140
2293
  # A request is sent to the live-connected device, asking it to cancel the operation. This may fail if there is no live-connection.
2141
2294
  # Only jobs from Comet 18.3.5 or newer can be cancelled. A job can only be cancelled if it has a non-empty CancellationID field in its properties.
2295
+ # If the device is running Comet 21.9.5 or later, this API will wait up to ten seconds for a confirmation from the client.
2142
2296
  #
2143
2297
  # You must supply administrator authentication credentials to use this API.
2144
2298
  # This API requires the Auth Role to be enabled.
@@ -2318,6 +2472,20 @@ module Comet
2318
2472
  ret
2319
2473
  end
2320
2474
 
2475
+ # AdminMetaReadAllLogs
2476
+ #
2477
+ # Get a ZIP file of all of the server's log files.
2478
+ # On non-Windows platforms, log content uses LF line endings. On Windows, Comet changed from LF to CRLF line endings in 18.3.2.
2479
+ # This API does not automatically convert line endings; around the 18.3.2 timeframe, log content may even contain mixed line-endings.
2480
+ #
2481
+ # You must supply administrator authentication credentials to use this API.
2482
+ # This API is only available for administrator accounts in the top-level Organization, not in any other Organization.
2483
+ #
2484
+ # @return [String]
2485
+ def admin_meta_read_all_logs
2486
+ perform_request('api/v1/admin/meta/read-all-logs')
2487
+ end
2488
+
2321
2489
  # AdminMetaReadLogs
2322
2490
  #
2323
2491
  # Get log file content.
@@ -3483,7 +3651,7 @@ module Comet
3483
3651
 
3484
3652
  ret_error = Comet::CometAPIResponseMessage.new
3485
3653
  ret_error.from_hash(obj)
3486
- raise Comet::APIResponseError.new(ret_error), 'Comet API response status was not OK'
3654
+ raise Comet::APIResponseError.new(ret_error)
3487
3655
  end
3488
3656
 
3489
3657
  # Perform a synchronous HTTP request.
@@ -3520,7 +3688,7 @@ module Comet
3520
3688
 
3521
3689
  form_params = []
3522
3690
  params.each do |k, v|
3523
- form_params.append [k, v, { :filename => k }]
3691
+ form_params.append [k, v, {:filename => k}]
3524
3692
  end
3525
3693
  req.set_form(form_params, 'multipart/form-data')
3526
3694
 
@@ -155,6 +155,24 @@ module Comet
155
155
 
156
156
  MONGODB_DEFAULT_PORT = 27_017
157
157
 
158
+ SERVICE_CALENDAR = 1
159
+
160
+ SERVICE_CONTACT = 2
161
+
162
+ SERVICE_MAIL = 4
163
+
164
+ SERVICE_SHAREPOINT = 8
165
+
166
+ SERVICE_ONEDRIVE = 16
167
+
168
+ MIXED_VIRTUAL_ACCOUNT_TYPE_USER = 1
169
+
170
+ MIXED_VIRTUAL_ACCOUNT_TYPE_GROUP = 2
171
+
172
+ MIXED_VIRTUAL_ACCOUNT_TYPE_TEAM_GROUP = 3
173
+
174
+ MIXED_VIRTUAL_ACCOUNT_TYPE_SHAREPOINT_ONLY = 4
175
+
158
176
  # RestoreType:
159
177
  RESTORETYPE_INVALID = -1
160
178
 
@@ -412,11 +430,11 @@ module Comet
412
430
 
413
431
  DEFAULT_TIMEZONE = 'UTC'
414
432
 
415
- APPLICATION_VERSION = '21.9.1'
433
+ APPLICATION_VERSION = '21.12.1'
416
434
 
417
435
  APPLICATION_VERSION_MAJOR = 21
418
436
 
419
- APPLICATION_VERSION_MINOR = 9
437
+ APPLICATION_VERSION_MINOR = 12
420
438
 
421
439
  APPLICATION_VERSION_REVISION = 1
422
440
 
@@ -591,6 +609,9 @@ module Comet
591
609
  # MacOSCodesignLevel:
592
610
  MACOSCODESIGN_LEVEL_SIGN_NOTARISE_STAPLE = 2
593
611
 
612
+ # StreamableEventType:
613
+ SEVT__MIN = 4000
614
+
594
615
  # StreamableEventType: Event is emitted when the webhook is registered, or when the server starts up. The Data associated is ServerMetaVersionInfo
595
616
  SEVT_META_HELLO = 4000
596
617
 
@@ -612,6 +633,9 @@ module Comet
612
633
  # StreamableEventType: Data is the string bucket ref
613
634
  SEVT_BUCKET_NEW = 4300
614
635
 
636
+ # StreamableEventType:
637
+ SEVT__MAX = 4999
638
+
615
639
  OFFICE365_REGION_PUBLIC = 'GlobalPublicCloud'
616
640
 
617
641
  OFFICE365_REGION_CHINA = 'ChinaCloud'
@@ -29,9 +29,15 @@ module Comet
29
29
  # @type [Boolean] allow_password_and_u2flogin
30
30
  attr_accessor :allow_password_and_u2flogin
31
31
 
32
+ # @type [Boolean] allow_password_and_web_authn_login
33
+ attr_accessor :allow_password_and_web_authn_login
34
+
32
35
  # @type [Array<Comet::AdminU2FRegistration>] u2fregistrations
33
36
  attr_accessor :u2fregistrations
34
37
 
38
+ # @type [Array<Comet::AdminWebAuthnRegistration>] web_authn_registrations
39
+ attr_accessor :web_authn_registrations
40
+
35
41
  # @type [Number] totpkey_encryption_format
36
42
  attr_accessor :totpkey_encryption_format
37
43
 
@@ -52,6 +58,7 @@ module Comet
52
58
  @password_format = 0
53
59
  @password = ''
54
60
  @u2fregistrations = []
61
+ @web_authn_registrations = []
55
62
  @totpkey_encryption_format = 0
56
63
  @totpkey = ''
57
64
  @ipwhitelist = ''
@@ -85,6 +92,8 @@ module Comet
85
92
  @allow_password_and_totplogin = v
86
93
  when 'AllowPasswordAndU2FLogin'
87
94
  @allow_password_and_u2flogin = v
95
+ when 'AllowPasswordAndWebAuthnLogin'
96
+ @allow_password_and_web_authn_login = v
88
97
  when 'U2FRegistrations'
89
98
  if v.nil?
90
99
  @u2fregistrations = []
@@ -95,6 +104,16 @@ module Comet
95
104
  @u2fregistrations[i1].from_hash(v1)
96
105
  end
97
106
  end
107
+ when 'WebAuthnRegistrations'
108
+ if v.nil?
109
+ @web_authn_registrations = []
110
+ else
111
+ @web_authn_registrations = Array.new(v.length)
112
+ v.each_with_index do |v1, i1|
113
+ @web_authn_registrations[i1] = Comet::AdminWebAuthnRegistration.new
114
+ @web_authn_registrations[i1].from_hash(v1)
115
+ end
116
+ end
98
117
  when 'TOTPKeyEncryptionFormat'
99
118
  raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
100
119
 
@@ -121,9 +140,13 @@ module Comet
121
140
  ret['AllowPasswordLogin'] = @allow_password_login
122
141
  ret['AllowPasswordAndTOTPLogin'] = @allow_password_and_totplogin
123
142
  ret['AllowPasswordAndU2FLogin'] = @allow_password_and_u2flogin
143
+ ret['AllowPasswordAndWebAuthnLogin'] = @allow_password_and_web_authn_login
124
144
  unless @u2fregistrations.nil?
125
145
  ret['U2FRegistrations'] = @u2fregistrations
126
146
  end
147
+ unless @web_authn_registrations.nil?
148
+ ret['WebAuthnRegistrations'] = @web_authn_registrations
149
+ end
127
150
  unless @totpkey_encryption_format.nil?
128
151
  ret['TOTPKeyEncryptionFormat'] = @totpkey_encryption_format
129
152
  end
@@ -0,0 +1,112 @@
1
+ #!/usr/bin/env ruby --enable-frozen-string-literal
2
+ #
3
+ # Copyright (c) 2020-2021 Comet Licensing Ltd.
4
+ # Please see the LICENSE file for usage information.
5
+ #
6
+ # SPDX-License-Identifier: MIT
7
+ #
8
+ # frozen_string_literal: true
9
+
10
+ require 'base64'
11
+ require 'json'
12
+
13
+ module Comet
14
+
15
+ # AdminWebAuthnRegistration is a typed class wrapper around the underlying Comet Server API data structure.
16
+ class AdminWebAuthnRegistration
17
+
18
+ # @type [String] description
19
+ attr_accessor :description
20
+
21
+ # @type [Number] register_time
22
+ attr_accessor :register_time
23
+
24
+ # @type [Boolean] is_legacy_u2f
25
+ attr_accessor :is_legacy_u2f
26
+
27
+ # @type [Array<Object>] id
28
+ attr_accessor :id
29
+
30
+ # @type [Comet::WebAuthnCredential] credential
31
+ attr_accessor :credential
32
+
33
+ # @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
34
+ attr_accessor :unknown_json_fields
35
+
36
+ def initialize
37
+ clear
38
+ end
39
+
40
+ def clear
41
+ @description = ''
42
+ @register_time = 0
43
+ @id = []
44
+ @credential = Comet::WebAuthnCredential.new
45
+ @unknown_json_fields = {}
46
+ end
47
+
48
+ # @param [String] json_string The complete object in JSON format
49
+ def from_json(json_string)
50
+ raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
51
+
52
+ from_hash(JSON.parse(json_string))
53
+ end
54
+
55
+ # @param [Hash] obj The complete object as a Ruby hash
56
+ def from_hash(obj)
57
+ raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
58
+
59
+ obj.each do |k, v|
60
+ case k
61
+ when 'Description'
62
+ raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
63
+
64
+ @description = v
65
+ when 'RegisterTime'
66
+ raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
67
+
68
+ @register_time = v
69
+ when 'IsLegacyU2F'
70
+ @is_legacy_u2f = v
71
+ when 'ID'
72
+ @id = Base64.decode64(v)
73
+ when 'Credential'
74
+ @credential = Comet::WebAuthnCredential.new
75
+ @credential.from_hash(v)
76
+ else
77
+ @unknown_json_fields[k] = v
78
+ end
79
+ end
80
+ end
81
+
82
+ # @return [Hash] The complete object as a Ruby hash
83
+ def to_hash
84
+ ret = {}
85
+ ret['Description'] = @description
86
+ ret['RegisterTime'] = @register_time
87
+ unless @is_legacy_u2f.nil?
88
+ ret['IsLegacyU2F'] = @is_legacy_u2f
89
+ end
90
+ unless @id.nil?
91
+ ret['ID'] = @id
92
+ end
93
+ unless @credential.nil?
94
+ ret['Credential'] = @credential
95
+ end
96
+ @unknown_json_fields.each do |k, v|
97
+ ret[k] = v
98
+ end
99
+ ret
100
+ end
101
+
102
+ # @return [Hash] The complete object as a Ruby hash
103
+ def to_h
104
+ to_hash
105
+ end
106
+
107
+ # @return [String] The complete object as a JSON string
108
+ def to_json(options = {})
109
+ to_hash.to_json(options)
110
+ end
111
+ end
112
+ end