comet_backup_ruby_sdk 1.10.0 → 1.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -1
- data/comet_backup_ruby_sdk.gemspec +1 -1
- data/lib/comet/comet_server.rb +61 -3
- data/lib/comet/definitions.rb +3 -3
- data/lib/comet/models/admin_security_options.rb +23 -0
- data/lib/comet/models/admin_web_authn_registration.rb +112 -0
- data/lib/comet/models/allowed_admin_user.rb +212 -0
- data/lib/comet/models/browse_office_365list_virtual_accounts_response.rb +99 -0
- data/lib/comet/models/office_365custom_setting_v2.rb +108 -0
- data/lib/comet/models/office_365mixed_virtual_account.rb +203 -0
- data/lib/comet/models/stat_result.rb +9 -0
- data/lib/comet/models/web_authn_authenticator_selection.rb +96 -0
- data/lib/comet/models/web_authn_credential.rb +105 -0
- data/lib/comet/models/web_authn_credential_assertion.rb +74 -0
- data/lib/comet/models/web_authn_credential_descriptor.rb +101 -0
- data/lib/comet/models/web_authn_credential_entity.rb +86 -0
- data/lib/comet/models/web_authn_credential_parameter.rb +84 -0
- data/lib/comet/models/web_authn_public_key_credential_creation_options.rb +173 -0
- data/lib/comet/models/web_authn_public_key_credential_request_options.rb +141 -0
- data/lib/comet/models/web_authn_registration_challenge_response.rb +101 -0
- data/lib/comet/models/web_authn_relying_party_entity.rb +95 -0
- data/lib/comet/models/web_authn_sign_request.rb +83 -0
- data/lib/comet/models/web_authn_sign_response.rb +84 -0
- data/lib/comet/models/web_authn_user_entity.rb +105 -0
- data/lib/comet_backup_ruby_sdk.rb +15 -0
- metadata +20 -2
@@ -0,0 +1,108 @@
|
|
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 'json'
|
11
|
+
|
12
|
+
module Comet
|
13
|
+
|
14
|
+
# Office365CustomSettingV2 is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class Office365CustomSettingV2
|
16
|
+
|
17
|
+
# @type [Boolean] organization
|
18
|
+
attr_accessor :organization
|
19
|
+
|
20
|
+
# @type [Hash{String => Number}] backup_options
|
21
|
+
attr_accessor :backup_options
|
22
|
+
|
23
|
+
# @type [Hash{String => Number}] member_backup_options
|
24
|
+
attr_accessor :member_backup_options
|
25
|
+
|
26
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
27
|
+
attr_accessor :unknown_json_fields
|
28
|
+
|
29
|
+
def initialize
|
30
|
+
clear
|
31
|
+
end
|
32
|
+
|
33
|
+
def clear
|
34
|
+
@backup_options = {}
|
35
|
+
@member_backup_options = {}
|
36
|
+
@unknown_json_fields = {}
|
37
|
+
end
|
38
|
+
|
39
|
+
# @param [String] json_string The complete object in JSON format
|
40
|
+
def from_json(json_string)
|
41
|
+
raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
|
42
|
+
|
43
|
+
from_hash(JSON.parse(json_string))
|
44
|
+
end
|
45
|
+
|
46
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
47
|
+
def from_hash(obj)
|
48
|
+
raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
|
49
|
+
|
50
|
+
obj.each do |k, v|
|
51
|
+
case k
|
52
|
+
when 'Organization'
|
53
|
+
@organization = v
|
54
|
+
when 'BackupOptions'
|
55
|
+
@backup_options = {}
|
56
|
+
if v.nil?
|
57
|
+
@backup_options = {}
|
58
|
+
else
|
59
|
+
v.each do |k1, v1|
|
60
|
+
raise TypeError, "'v1' expected Numeric, got #{v1.class}" unless v1.is_a? Numeric
|
61
|
+
|
62
|
+
@backup_options[k1] = v1
|
63
|
+
end
|
64
|
+
end
|
65
|
+
when 'MemberBackupOptions'
|
66
|
+
@member_backup_options = {}
|
67
|
+
if v.nil?
|
68
|
+
@member_backup_options = {}
|
69
|
+
else
|
70
|
+
v.each do |k1, v1|
|
71
|
+
raise TypeError, "'v1' expected Numeric, got #{v1.class}" unless v1.is_a? Numeric
|
72
|
+
|
73
|
+
@member_backup_options[k1] = v1
|
74
|
+
end
|
75
|
+
end
|
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['Organization'] = @organization
|
86
|
+
unless @backup_options.nil?
|
87
|
+
ret['BackupOptions'] = @backup_options
|
88
|
+
end
|
89
|
+
unless @member_backup_options.nil?
|
90
|
+
ret['MemberBackupOptions'] = @member_backup_options
|
91
|
+
end
|
92
|
+
@unknown_json_fields.each do |k, v|
|
93
|
+
ret[k] = v
|
94
|
+
end
|
95
|
+
ret
|
96
|
+
end
|
97
|
+
|
98
|
+
# @return [Hash] The complete object as a Ruby hash
|
99
|
+
def to_h
|
100
|
+
to_hash
|
101
|
+
end
|
102
|
+
|
103
|
+
# @return [String] The complete object as a JSON string
|
104
|
+
def to_json(options = {})
|
105
|
+
to_hash.to_json(options)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,203 @@
|
|
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 'json'
|
11
|
+
|
12
|
+
module Comet
|
13
|
+
|
14
|
+
# Office365MixedVirtualAccount is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class Office365MixedVirtualAccount
|
16
|
+
|
17
|
+
# @type [String] id
|
18
|
+
attr_accessor :id
|
19
|
+
|
20
|
+
# @type [Number] type
|
21
|
+
attr_accessor :type
|
22
|
+
|
23
|
+
# @type [String] display_name
|
24
|
+
attr_accessor :display_name
|
25
|
+
|
26
|
+
# @type [String] mail
|
27
|
+
attr_accessor :mail
|
28
|
+
|
29
|
+
# @type [String] job_title
|
30
|
+
attr_accessor :job_title
|
31
|
+
|
32
|
+
# @type [String] site_id
|
33
|
+
attr_accessor :site_id
|
34
|
+
|
35
|
+
# @type [String] web_id
|
36
|
+
attr_accessor :web_id
|
37
|
+
|
38
|
+
# @type [String] web_url
|
39
|
+
attr_accessor :web_url
|
40
|
+
|
41
|
+
# @type [Number] enabled_service_option
|
42
|
+
attr_accessor :enabled_service_option
|
43
|
+
|
44
|
+
# @type [Array<String>] members
|
45
|
+
attr_accessor :members
|
46
|
+
|
47
|
+
# @type [Number] service_options
|
48
|
+
attr_accessor :service_options
|
49
|
+
|
50
|
+
# @type [Number] member_service_options
|
51
|
+
attr_accessor :member_service_options
|
52
|
+
|
53
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
54
|
+
attr_accessor :unknown_json_fields
|
55
|
+
|
56
|
+
def initialize
|
57
|
+
clear
|
58
|
+
end
|
59
|
+
|
60
|
+
def clear
|
61
|
+
@id = ''
|
62
|
+
@type = 0
|
63
|
+
@display_name = ''
|
64
|
+
@mail = ''
|
65
|
+
@job_title = ''
|
66
|
+
@site_id = ''
|
67
|
+
@web_id = ''
|
68
|
+
@web_url = ''
|
69
|
+
@enabled_service_option = 0
|
70
|
+
@members = []
|
71
|
+
@service_options = 0
|
72
|
+
@member_service_options = 0
|
73
|
+
@unknown_json_fields = {}
|
74
|
+
end
|
75
|
+
|
76
|
+
# @param [String] json_string The complete object in JSON format
|
77
|
+
def from_json(json_string)
|
78
|
+
raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
|
79
|
+
|
80
|
+
from_hash(JSON.parse(json_string))
|
81
|
+
end
|
82
|
+
|
83
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
84
|
+
def from_hash(obj)
|
85
|
+
raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
|
86
|
+
|
87
|
+
obj.each do |k, v|
|
88
|
+
case k
|
89
|
+
when 'id'
|
90
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
91
|
+
|
92
|
+
@id = v
|
93
|
+
when 'Type'
|
94
|
+
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
|
95
|
+
|
96
|
+
@type = v
|
97
|
+
when 'DisplayName'
|
98
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
99
|
+
|
100
|
+
@display_name = v
|
101
|
+
when 'Mail'
|
102
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
103
|
+
|
104
|
+
@mail = v
|
105
|
+
when 'JobTitle'
|
106
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
107
|
+
|
108
|
+
@job_title = v
|
109
|
+
when 'SiteID'
|
110
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
111
|
+
|
112
|
+
@site_id = v
|
113
|
+
when 'WebID'
|
114
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
115
|
+
|
116
|
+
@web_id = v
|
117
|
+
when 'WebURL'
|
118
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
119
|
+
|
120
|
+
@web_url = v
|
121
|
+
when 'EnabledServiceOption'
|
122
|
+
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
|
123
|
+
|
124
|
+
@enabled_service_option = v
|
125
|
+
when 'Members'
|
126
|
+
if v.nil?
|
127
|
+
@members = []
|
128
|
+
else
|
129
|
+
@members = Array.new(v.length)
|
130
|
+
v.each_with_index do |v1, i1|
|
131
|
+
raise TypeError, "'v1' expected String, got #{v1.class}" unless v1.is_a? String
|
132
|
+
|
133
|
+
@members[i1] = v1
|
134
|
+
end
|
135
|
+
end
|
136
|
+
when 'ServiceOptions'
|
137
|
+
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
|
138
|
+
|
139
|
+
@service_options = v
|
140
|
+
when 'MemberServiceOptions'
|
141
|
+
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
|
142
|
+
|
143
|
+
@member_service_options = v
|
144
|
+
else
|
145
|
+
@unknown_json_fields[k] = v
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
# @return [Hash] The complete object as a Ruby hash
|
151
|
+
def to_hash
|
152
|
+
ret = {}
|
153
|
+
ret['id'] = @id
|
154
|
+
unless @type.nil?
|
155
|
+
ret['Type'] = @type
|
156
|
+
end
|
157
|
+
unless @display_name.nil?
|
158
|
+
ret['DisplayName'] = @display_name
|
159
|
+
end
|
160
|
+
unless @mail.nil?
|
161
|
+
ret['Mail'] = @mail
|
162
|
+
end
|
163
|
+
unless @job_title.nil?
|
164
|
+
ret['JobTitle'] = @job_title
|
165
|
+
end
|
166
|
+
unless @site_id.nil?
|
167
|
+
ret['SiteID'] = @site_id
|
168
|
+
end
|
169
|
+
unless @web_id.nil?
|
170
|
+
ret['WebID'] = @web_id
|
171
|
+
end
|
172
|
+
unless @web_url.nil?
|
173
|
+
ret['WebURL'] = @web_url
|
174
|
+
end
|
175
|
+
unless @enabled_service_option.nil?
|
176
|
+
ret['EnabledServiceOption'] = @enabled_service_option
|
177
|
+
end
|
178
|
+
unless @members.nil?
|
179
|
+
ret['Members'] = @members
|
180
|
+
end
|
181
|
+
unless @service_options.nil?
|
182
|
+
ret['ServiceOptions'] = @service_options
|
183
|
+
end
|
184
|
+
unless @member_service_options.nil?
|
185
|
+
ret['MemberServiceOptions'] = @member_service_options
|
186
|
+
end
|
187
|
+
@unknown_json_fields.each do |k, v|
|
188
|
+
ret[k] = v
|
189
|
+
end
|
190
|
+
ret
|
191
|
+
end
|
192
|
+
|
193
|
+
# @return [Hash] The complete object as a Ruby hash
|
194
|
+
def to_h
|
195
|
+
to_hash
|
196
|
+
end
|
197
|
+
|
198
|
+
# @return [String] The complete object as a JSON string
|
199
|
+
def to_json(options = {})
|
200
|
+
to_hash.to_json(options)
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
@@ -26,6 +26,9 @@ module Comet
|
|
26
26
|
# @type [Number] boosters
|
27
27
|
attr_accessor :boosters
|
28
28
|
|
29
|
+
# @type [Number] network_devices
|
30
|
+
attr_accessor :network_devices
|
31
|
+
|
29
32
|
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
30
33
|
attr_accessor :unknown_json_fields
|
31
34
|
|
@@ -38,6 +41,7 @@ module Comet
|
|
38
41
|
@users = 0
|
39
42
|
@devices = 0
|
40
43
|
@boosters = 0
|
44
|
+
@network_devices = 0
|
41
45
|
@unknown_json_fields = {}
|
42
46
|
end
|
43
47
|
|
@@ -70,6 +74,10 @@ module Comet
|
|
70
74
|
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
|
71
75
|
|
72
76
|
@boosters = v
|
77
|
+
when 'NetworkDevices'
|
78
|
+
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
|
79
|
+
|
80
|
+
@network_devices = v
|
73
81
|
else
|
74
82
|
@unknown_json_fields[k] = v
|
75
83
|
end
|
@@ -83,6 +91,7 @@ module Comet
|
|
83
91
|
ret['Users'] = @users
|
84
92
|
ret['Devices'] = @devices
|
85
93
|
ret['Boosters'] = @boosters
|
94
|
+
ret['NetworkDevices'] = @network_devices
|
86
95
|
@unknown_json_fields.each do |k, v|
|
87
96
|
ret[k] = v
|
88
97
|
end
|
@@ -0,0 +1,96 @@
|
|
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 'json'
|
11
|
+
|
12
|
+
module Comet
|
13
|
+
|
14
|
+
# WebAuthnAuthenticatorSelection is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class WebAuthnAuthenticatorSelection
|
16
|
+
|
17
|
+
# @type [String] authenticator_attachment
|
18
|
+
attr_accessor :authenticator_attachment
|
19
|
+
|
20
|
+
# @type [Boolean] require_resident_key
|
21
|
+
attr_accessor :require_resident_key
|
22
|
+
|
23
|
+
# @type [String] user_verification
|
24
|
+
attr_accessor :user_verification
|
25
|
+
|
26
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
27
|
+
attr_accessor :unknown_json_fields
|
28
|
+
|
29
|
+
def initialize
|
30
|
+
clear
|
31
|
+
end
|
32
|
+
|
33
|
+
def clear
|
34
|
+
@authenticator_attachment = ''
|
35
|
+
@user_verification = ''
|
36
|
+
@unknown_json_fields = {}
|
37
|
+
end
|
38
|
+
|
39
|
+
# @param [String] json_string The complete object in JSON format
|
40
|
+
def from_json(json_string)
|
41
|
+
raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
|
42
|
+
|
43
|
+
from_hash(JSON.parse(json_string))
|
44
|
+
end
|
45
|
+
|
46
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
47
|
+
def from_hash(obj)
|
48
|
+
raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
|
49
|
+
|
50
|
+
obj.each do |k, v|
|
51
|
+
case k
|
52
|
+
when 'authenticatorAttachment'
|
53
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
54
|
+
|
55
|
+
@authenticator_attachment = v
|
56
|
+
when 'requireResidentKey'
|
57
|
+
@require_resident_key = v
|
58
|
+
when 'userVerification'
|
59
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
60
|
+
|
61
|
+
@user_verification = v
|
62
|
+
else
|
63
|
+
@unknown_json_fields[k] = v
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# @return [Hash] The complete object as a Ruby hash
|
69
|
+
def to_hash
|
70
|
+
ret = {}
|
71
|
+
unless @authenticator_attachment.nil?
|
72
|
+
ret['authenticatorAttachment'] = @authenticator_attachment
|
73
|
+
end
|
74
|
+
unless @require_resident_key.nil?
|
75
|
+
ret['requireResidentKey'] = @require_resident_key
|
76
|
+
end
|
77
|
+
unless @user_verification.nil?
|
78
|
+
ret['userVerification'] = @user_verification
|
79
|
+
end
|
80
|
+
@unknown_json_fields.each do |k, v|
|
81
|
+
ret[k] = v
|
82
|
+
end
|
83
|
+
ret
|
84
|
+
end
|
85
|
+
|
86
|
+
# @return [Hash] The complete object as a Ruby hash
|
87
|
+
def to_h
|
88
|
+
to_hash
|
89
|
+
end
|
90
|
+
|
91
|
+
# @return [String] The complete object as a JSON string
|
92
|
+
def to_json(options = {})
|
93
|
+
to_hash.to_json(options)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -0,0 +1,105 @@
|
|
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
|
+
# WebAuthnCredential is a typed class wrapper around the underlying Comet Server API data structure.
|
16
|
+
class WebAuthnCredential
|
17
|
+
|
18
|
+
# @type [Array<Object>] public_key
|
19
|
+
attr_accessor :public_key
|
20
|
+
|
21
|
+
# @type [String] attestation_type
|
22
|
+
attr_accessor :attestation_type
|
23
|
+
|
24
|
+
# @type [Array<Object>] aaguid
|
25
|
+
attr_accessor :aaguid
|
26
|
+
|
27
|
+
# @type [Number] sign_count
|
28
|
+
attr_accessor :sign_count
|
29
|
+
|
30
|
+
# @type [Boolean] clone_warning
|
31
|
+
attr_accessor :clone_warning
|
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
|
+
@public_key = []
|
42
|
+
@attestation_type = ''
|
43
|
+
@aaguid = []
|
44
|
+
@sign_count = 0
|
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 'PublicKey'
|
62
|
+
@public_key = Base64.decode64(v)
|
63
|
+
when 'AttestationType'
|
64
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
65
|
+
|
66
|
+
@attestation_type = v
|
67
|
+
when 'AAGUID'
|
68
|
+
@aaguid = Base64.decode64(v)
|
69
|
+
when 'SignCount'
|
70
|
+
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
|
71
|
+
|
72
|
+
@sign_count = v
|
73
|
+
when 'CloneWarning'
|
74
|
+
@clone_warning = v
|
75
|
+
else
|
76
|
+
@unknown_json_fields[k] = v
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# @return [Hash] The complete object as a Ruby hash
|
82
|
+
def to_hash
|
83
|
+
ret = {}
|
84
|
+
ret['PublicKey'] = Base64.strict_encode64(@public_key)
|
85
|
+
ret['AttestationType'] = @attestation_type
|
86
|
+
ret['AAGUID'] = Base64.strict_encode64(@aaguid)
|
87
|
+
ret['SignCount'] = @sign_count
|
88
|
+
ret['CloneWarning'] = @clone_warning
|
89
|
+
@unknown_json_fields.each do |k, v|
|
90
|
+
ret[k] = v
|
91
|
+
end
|
92
|
+
ret
|
93
|
+
end
|
94
|
+
|
95
|
+
# @return [Hash] The complete object as a Ruby hash
|
96
|
+
def to_h
|
97
|
+
to_hash
|
98
|
+
end
|
99
|
+
|
100
|
+
# @return [String] The complete object as a JSON string
|
101
|
+
def to_json(options = {})
|
102
|
+
to_hash.to_json(options)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
@@ -0,0 +1,74 @@
|
|
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 'json'
|
11
|
+
|
12
|
+
module Comet
|
13
|
+
|
14
|
+
# WebAuthnCredentialAssertion is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class WebAuthnCredentialAssertion
|
16
|
+
|
17
|
+
# @type [Comet::WebAuthnPublicKeyCredentialRequestOptions] response
|
18
|
+
attr_accessor :response
|
19
|
+
|
20
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
21
|
+
attr_accessor :unknown_json_fields
|
22
|
+
|
23
|
+
def initialize
|
24
|
+
clear
|
25
|
+
end
|
26
|
+
|
27
|
+
def clear
|
28
|
+
@response = Comet::WebAuthnPublicKeyCredentialRequestOptions.new
|
29
|
+
@unknown_json_fields = {}
|
30
|
+
end
|
31
|
+
|
32
|
+
# @param [String] json_string The complete object in JSON format
|
33
|
+
def from_json(json_string)
|
34
|
+
raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
|
35
|
+
|
36
|
+
from_hash(JSON.parse(json_string))
|
37
|
+
end
|
38
|
+
|
39
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
40
|
+
def from_hash(obj)
|
41
|
+
raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
|
42
|
+
|
43
|
+
obj.each do |k, v|
|
44
|
+
case k
|
45
|
+
when 'publicKey'
|
46
|
+
@response = Comet::WebAuthnPublicKeyCredentialRequestOptions.new
|
47
|
+
@response.from_hash(v)
|
48
|
+
else
|
49
|
+
@unknown_json_fields[k] = v
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# @return [Hash] The complete object as a Ruby hash
|
55
|
+
def to_hash
|
56
|
+
ret = {}
|
57
|
+
ret['publicKey'] = @response
|
58
|
+
@unknown_json_fields.each do |k, v|
|
59
|
+
ret[k] = v
|
60
|
+
end
|
61
|
+
ret
|
62
|
+
end
|
63
|
+
|
64
|
+
# @return [Hash] The complete object as a Ruby hash
|
65
|
+
def to_h
|
66
|
+
to_hash
|
67
|
+
end
|
68
|
+
|
69
|
+
# @return [String] The complete object as a JSON string
|
70
|
+
def to_json(options = {})
|
71
|
+
to_hash.to_json(options)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|