Class: OryClient::DeviceAuthnKey

Inherits:
ApiModelBase show all
Defined in:
lib/ory-client/models/device_authn_key.rb

Overview

Represents a hardware-backed signing key enrolled from a mobile device. The private key resides inside the device and never exists on the server. To list the identity's enrolled keys, fetch a settings flow: each key's remove button (a ui.nodes entry named deviceauthn_remove in group deviceauthn) carries the key, with its PIN state redacted, in the node label's context.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ DeviceAuthnKey

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/ory-client/models/device_authn_key.rb', line 121

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `OryClient::DeviceAuthnKey` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `OryClient::DeviceAuthnKey`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'attestation')
    self.attestation = attributes[:'attestation']
  end

  if attributes.key?(:'client_key_id')
    self.client_key_id = attributes[:'client_key_id']
  end

  if attributes.key?(:'created_at')
    self.created_at = attributes[:'created_at']
  end

  if attributes.key?(:'device_name')
    self.device_name = attributes[:'device_name']
  end

  if attributes.key?(:'device_type')
    self.device_type = attributes[:'device_type']
  end

  if attributes.key?(:'pin')
    self.pin = attributes[:'pin']
  end

  if attributes.key?(:'public_key')
    self.public_key = attributes[:'public_key']
  end

  if attributes.key?(:'relaxed_attestation_expires_at')
    self.relaxed_attestation_expires_at = attributes[:'relaxed_attestation_expires_at']
  end

  if attributes.key?(:'state')
    self.state = attributes[:'state']
  end

  if attributes.key?(:'user_verification')
    self.user_verification = attributes[:'user_verification']
  end

  if attributes.key?(:'version')
    self.version = attributes[:'version']
  end
end

Instance Attribute Details

#attestationObject

Returns the value of attribute attestation.



19
20
21
# File 'lib/ory-client/models/device_authn_key.rb', line 19

def attestation
  @attestation
end

#client_key_idObject

The key's stable id, unique per identity. Submit it as the client_key_id when logging in with the key, deleting it, or rotating its pin_secret. The device can also compute the id without reading it back from the server: it is the lowercase-hex SHA-256 of public_key (the key's PKIX, ASN.1 DER encoding). Keys enrolled before the server derived the id keep their original client-chosen value, so prefer reading this field over recomputing it for older keys.



22
23
24
# File 'lib/ory-client/models/device_authn_key.rb', line 22

def client_key_id
  @client_key_id
end

#created_atObject

When the key was enrolled. Only used for troubleshooting and UI.



25
26
27
# File 'lib/ory-client/models/device_authn_key.rb', line 25

def created_at
  @created_at
end

#device_nameObject

A human-readable name for the device, helping the user tell this key apart from others.



28
29
30
# File 'lib/ory-client/models/device_authn_key.rb', line 28

def device_name
  @device_name
end

#device_typeObject

Returns the value of attribute device_type.



30
31
32
# File 'lib/ory-client/models/device_authn_key.rb', line 30

def device_type
  @device_type
end

#pinObject

Returns the value of attribute pin.



32
33
34
# File 'lib/ory-client/models/device_authn_key.rb', line 32

def pin
  @pin
end

#public_keyObject

The device's public key (an elliptic-curve key on P-224, P-256, P-384, or P-521 in version 1) in PKIX, ASN.1 DER (SubjectPublicKeyInfo) form, base64-encoded. Signatures are verified against this key.



35
36
37
# File 'lib/ory-client/models/device_authn_key.rb', line 35

def public_key
  @public_key
end

#relaxed_attestation_expires_atObject

Set only when the key's attestation chain was accepted under relaxed rules (software roots, expired certificates, software security level) rather than strict hardware attestation. Such keys are refused at login after this time, or immediately once relaxed attestation is turned off. Absent for hardware-attested keys that pass strict validation.



38
39
40
# File 'lib/ory-client/models/device_authn_key.rb', line 38

def relaxed_attestation_expires_at
  @relaxed_attestation_expires_at
end

#stateObject

Returns the value of attribute state.



40
41
42
# File 'lib/ory-client/models/device_authn_key.rb', line 40

def state
  @state
end

#user_verificationObject

Returns the value of attribute user_verification.



42
43
44
# File 'lib/ory-client/models/device_authn_key.rb', line 42

def user_verification
  @user_verification
end

#versionObject

The cryptography version of the key. Version 1 uses ECDSA with SHA-256 on an elliptic curve (P-224, P-256, P-384, or P-521); further versions are reserved for future signature suites.



45
46
47
# File 'lib/ory-client/models/device_authn_key.rb', line 45

def version
  @version
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



87
88
89
# File 'lib/ory-client/models/device_authn_key.rb', line 87

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



92
93
94
# File 'lib/ory-client/models/device_authn_key.rb', line 92

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/ory-client/models/device_authn_key.rb', line 70

def self.attribute_map
  {
    :'attestation' => :'attestation',
    :'client_key_id' => :'client_key_id',
    :'created_at' => :'created_at',
    :'device_name' => :'device_name',
    :'device_type' => :'device_type',
    :'pin' => :'pin',
    :'public_key' => :'public_key',
    :'relaxed_attestation_expires_at' => :'relaxed_attestation_expires_at',
    :'state' => :'state',
    :'user_verification' => :'user_verification',
    :'version' => :'version'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
# File 'lib/ory-client/models/device_authn_key.rb', line 228

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



114
115
116
117
# File 'lib/ory-client/models/device_authn_key.rb', line 114

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/ory-client/models/device_authn_key.rb', line 97

def self.openapi_types
  {
    :'attestation' => :'DeviceAuthnAttestation',
    :'client_key_id' => :'String',
    :'created_at' => :'Time',
    :'device_name' => :'String',
    :'device_type' => :'DeviceType',
    :'pin' => :'PINConfig',
    :'public_key' => :'String',
    :'relaxed_attestation_expires_at' => :'Time',
    :'state' => :'KeyState',
    :'user_verification' => :'UserVerification',
    :'version' => :'Integer'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# File 'lib/ory-client/models/device_authn_key.rb', line 197

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      attestation == o.attestation &&
      client_key_id == o.client_key_id &&
      created_at == o.created_at &&
      device_name == o.device_name &&
      device_type == o.device_type &&
      pin == o.pin &&
      public_key == o.public_key &&
      relaxed_attestation_expires_at == o.relaxed_attestation_expires_at &&
      state == o.state &&
      user_verification == o.user_verification &&
      version == o.version
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


215
216
217
# File 'lib/ory-client/models/device_authn_key.rb', line 215

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



221
222
223
# File 'lib/ory-client/models/device_authn_key.rb', line 221

def hash
  [attestation, client_key_id, created_at, device_name, device_type, pin, public_key, relaxed_attestation_expires_at, state, user_verification, version].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



182
183
184
185
186
# File 'lib/ory-client/models/device_authn_key.rb', line 182

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



250
251
252
253
254
255
256
257
258
259
260
261
262
# File 'lib/ory-client/models/device_authn_key.rb', line 250

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



190
191
192
193
# File 'lib/ory-client/models/device_authn_key.rb', line 190

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  true
end