/* Ory Identities API This is the API specification for Ory Identities with features such as registration, login, recovery, account verification, profile settings, password reset, identity management, session management, email and sms delivery, and more. API version: Contact: office@ory.sh */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package client import ( "encoding/json" "time" ) // checks if the DeviceAuthnKey type satisfies the MappedNullable interface at compile time var _ MappedNullable = &DeviceAuthnKey{} // DeviceAuthnKey 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`. type DeviceAuthnKey struct { Attestation *DeviceAuthnAttestation `json:"attestation,omitempty"` // 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. ClientKeyId *string `json:"client_key_id,omitempty"` // When the key was enrolled. Only used for troubleshooting and UI. CreatedAt *time.Time `json:"created_at,omitempty"` // A human-readable name for the device, helping the user tell this key apart from others. DeviceName *string `json:"device_name,omitempty"` DeviceType *DeviceType `json:"device_type,omitempty"` Pin *PINConfig `json:"pin,omitempty"` // 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. PublicKey *string `json:"public_key,omitempty"` // 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. RelaxedAttestationExpiresAt *time.Time `json:"relaxed_attestation_expires_at,omitempty"` State *KeyState `json:"state,omitempty"` UserVerification *UserVerification `json:"user_verification,omitempty"` // 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. Version *int64 `json:"version,omitempty"` AdditionalProperties map[string]interface{} } type _DeviceAuthnKey DeviceAuthnKey // NewDeviceAuthnKey instantiates a new DeviceAuthnKey object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed func NewDeviceAuthnKey() *DeviceAuthnKey { this := DeviceAuthnKey{} return &this } // NewDeviceAuthnKeyWithDefaults instantiates a new DeviceAuthnKey object // This constructor will only assign default values to properties that have it defined, // but it doesn't guarantee that properties required by API are set func NewDeviceAuthnKeyWithDefaults() *DeviceAuthnKey { this := DeviceAuthnKey{} return &this } // GetAttestation returns the Attestation field value if set, zero value otherwise. func (o *DeviceAuthnKey) GetAttestation() DeviceAuthnAttestation { if o == nil || IsNil(o.Attestation) { var ret DeviceAuthnAttestation return ret } return *o.Attestation } // GetAttestationOk returns a tuple with the Attestation field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *DeviceAuthnKey) GetAttestationOk() (*DeviceAuthnAttestation, bool) { if o == nil || IsNil(o.Attestation) { return nil, false } return o.Attestation, true } // HasAttestation returns a boolean if a field has been set. func (o *DeviceAuthnKey) HasAttestation() bool { if o != nil && !IsNil(o.Attestation) { return true } return false } // SetAttestation gets a reference to the given DeviceAuthnAttestation and assigns it to the Attestation field. func (o *DeviceAuthnKey) SetAttestation(v DeviceAuthnAttestation) { o.Attestation = &v } // GetClientKeyId returns the ClientKeyId field value if set, zero value otherwise. func (o *DeviceAuthnKey) GetClientKeyId() string { if o == nil || IsNil(o.ClientKeyId) { var ret string return ret } return *o.ClientKeyId } // GetClientKeyIdOk returns a tuple with the ClientKeyId field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *DeviceAuthnKey) GetClientKeyIdOk() (*string, bool) { if o == nil || IsNil(o.ClientKeyId) { return nil, false } return o.ClientKeyId, true } // HasClientKeyId returns a boolean if a field has been set. func (o *DeviceAuthnKey) HasClientKeyId() bool { if o != nil && !IsNil(o.ClientKeyId) { return true } return false } // SetClientKeyId gets a reference to the given string and assigns it to the ClientKeyId field. func (o *DeviceAuthnKey) SetClientKeyId(v string) { o.ClientKeyId = &v } // GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. func (o *DeviceAuthnKey) GetCreatedAt() time.Time { if o == nil || IsNil(o.CreatedAt) { var ret time.Time return ret } return *o.CreatedAt } // GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *DeviceAuthnKey) GetCreatedAtOk() (*time.Time, bool) { if o == nil || IsNil(o.CreatedAt) { return nil, false } return o.CreatedAt, true } // HasCreatedAt returns a boolean if a field has been set. func (o *DeviceAuthnKey) HasCreatedAt() bool { if o != nil && !IsNil(o.CreatedAt) { return true } return false } // SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. func (o *DeviceAuthnKey) SetCreatedAt(v time.Time) { o.CreatedAt = &v } // GetDeviceName returns the DeviceName field value if set, zero value otherwise. func (o *DeviceAuthnKey) GetDeviceName() string { if o == nil || IsNil(o.DeviceName) { var ret string return ret } return *o.DeviceName } // GetDeviceNameOk returns a tuple with the DeviceName field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *DeviceAuthnKey) GetDeviceNameOk() (*string, bool) { if o == nil || IsNil(o.DeviceName) { return nil, false } return o.DeviceName, true } // HasDeviceName returns a boolean if a field has been set. func (o *DeviceAuthnKey) HasDeviceName() bool { if o != nil && !IsNil(o.DeviceName) { return true } return false } // SetDeviceName gets a reference to the given string and assigns it to the DeviceName field. func (o *DeviceAuthnKey) SetDeviceName(v string) { o.DeviceName = &v } // GetDeviceType returns the DeviceType field value if set, zero value otherwise. func (o *DeviceAuthnKey) GetDeviceType() DeviceType { if o == nil || IsNil(o.DeviceType) { var ret DeviceType return ret } return *o.DeviceType } // GetDeviceTypeOk returns a tuple with the DeviceType field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *DeviceAuthnKey) GetDeviceTypeOk() (*DeviceType, bool) { if o == nil || IsNil(o.DeviceType) { return nil, false } return o.DeviceType, true } // HasDeviceType returns a boolean if a field has been set. func (o *DeviceAuthnKey) HasDeviceType() bool { if o != nil && !IsNil(o.DeviceType) { return true } return false } // SetDeviceType gets a reference to the given DeviceType and assigns it to the DeviceType field. func (o *DeviceAuthnKey) SetDeviceType(v DeviceType) { o.DeviceType = &v } // GetPin returns the Pin field value if set, zero value otherwise. func (o *DeviceAuthnKey) GetPin() PINConfig { if o == nil || IsNil(o.Pin) { var ret PINConfig return ret } return *o.Pin } // GetPinOk returns a tuple with the Pin field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *DeviceAuthnKey) GetPinOk() (*PINConfig, bool) { if o == nil || IsNil(o.Pin) { return nil, false } return o.Pin, true } // HasPin returns a boolean if a field has been set. func (o *DeviceAuthnKey) HasPin() bool { if o != nil && !IsNil(o.Pin) { return true } return false } // SetPin gets a reference to the given PINConfig and assigns it to the Pin field. func (o *DeviceAuthnKey) SetPin(v PINConfig) { o.Pin = &v } // GetPublicKey returns the PublicKey field value if set, zero value otherwise. func (o *DeviceAuthnKey) GetPublicKey() string { if o == nil || IsNil(o.PublicKey) { var ret string return ret } return *o.PublicKey } // GetPublicKeyOk returns a tuple with the PublicKey field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *DeviceAuthnKey) GetPublicKeyOk() (*string, bool) { if o == nil || IsNil(o.PublicKey) { return nil, false } return o.PublicKey, true } // HasPublicKey returns a boolean if a field has been set. func (o *DeviceAuthnKey) HasPublicKey() bool { if o != nil && !IsNil(o.PublicKey) { return true } return false } // SetPublicKey gets a reference to the given string and assigns it to the PublicKey field. func (o *DeviceAuthnKey) SetPublicKey(v string) { o.PublicKey = &v } // GetRelaxedAttestationExpiresAt returns the RelaxedAttestationExpiresAt field value if set, zero value otherwise. func (o *DeviceAuthnKey) GetRelaxedAttestationExpiresAt() time.Time { if o == nil || IsNil(o.RelaxedAttestationExpiresAt) { var ret time.Time return ret } return *o.RelaxedAttestationExpiresAt } // GetRelaxedAttestationExpiresAtOk returns a tuple with the RelaxedAttestationExpiresAt field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *DeviceAuthnKey) GetRelaxedAttestationExpiresAtOk() (*time.Time, bool) { if o == nil || IsNil(o.RelaxedAttestationExpiresAt) { return nil, false } return o.RelaxedAttestationExpiresAt, true } // HasRelaxedAttestationExpiresAt returns a boolean if a field has been set. func (o *DeviceAuthnKey) HasRelaxedAttestationExpiresAt() bool { if o != nil && !IsNil(o.RelaxedAttestationExpiresAt) { return true } return false } // SetRelaxedAttestationExpiresAt gets a reference to the given time.Time and assigns it to the RelaxedAttestationExpiresAt field. func (o *DeviceAuthnKey) SetRelaxedAttestationExpiresAt(v time.Time) { o.RelaxedAttestationExpiresAt = &v } // GetState returns the State field value if set, zero value otherwise. func (o *DeviceAuthnKey) GetState() KeyState { if o == nil || IsNil(o.State) { var ret KeyState return ret } return *o.State } // GetStateOk returns a tuple with the State field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *DeviceAuthnKey) GetStateOk() (*KeyState, bool) { if o == nil || IsNil(o.State) { return nil, false } return o.State, true } // HasState returns a boolean if a field has been set. func (o *DeviceAuthnKey) HasState() bool { if o != nil && !IsNil(o.State) { return true } return false } // SetState gets a reference to the given KeyState and assigns it to the State field. func (o *DeviceAuthnKey) SetState(v KeyState) { o.State = &v } // GetUserVerification returns the UserVerification field value if set, zero value otherwise. func (o *DeviceAuthnKey) GetUserVerification() UserVerification { if o == nil || IsNil(o.UserVerification) { var ret UserVerification return ret } return *o.UserVerification } // GetUserVerificationOk returns a tuple with the UserVerification field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *DeviceAuthnKey) GetUserVerificationOk() (*UserVerification, bool) { if o == nil || IsNil(o.UserVerification) { return nil, false } return o.UserVerification, true } // HasUserVerification returns a boolean if a field has been set. func (o *DeviceAuthnKey) HasUserVerification() bool { if o != nil && !IsNil(o.UserVerification) { return true } return false } // SetUserVerification gets a reference to the given UserVerification and assigns it to the UserVerification field. func (o *DeviceAuthnKey) SetUserVerification(v UserVerification) { o.UserVerification = &v } // GetVersion returns the Version field value if set, zero value otherwise. func (o *DeviceAuthnKey) GetVersion() int64 { if o == nil || IsNil(o.Version) { var ret int64 return ret } return *o.Version } // GetVersionOk returns a tuple with the Version field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *DeviceAuthnKey) GetVersionOk() (*int64, bool) { if o == nil || IsNil(o.Version) { return nil, false } return o.Version, true } // HasVersion returns a boolean if a field has been set. func (o *DeviceAuthnKey) HasVersion() bool { if o != nil && !IsNil(o.Version) { return true } return false } // SetVersion gets a reference to the given int64 and assigns it to the Version field. func (o *DeviceAuthnKey) SetVersion(v int64) { o.Version = &v } func (o DeviceAuthnKey) MarshalJSON() ([]byte, error) { toSerialize, err := o.ToMap() if err != nil { return []byte{}, err } return json.Marshal(toSerialize) } func (o DeviceAuthnKey) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if !IsNil(o.Attestation) { toSerialize["attestation"] = o.Attestation } if !IsNil(o.ClientKeyId) { toSerialize["client_key_id"] = o.ClientKeyId } if !IsNil(o.CreatedAt) { toSerialize["created_at"] = o.CreatedAt } if !IsNil(o.DeviceName) { toSerialize["device_name"] = o.DeviceName } if !IsNil(o.DeviceType) { toSerialize["device_type"] = o.DeviceType } if !IsNil(o.Pin) { toSerialize["pin"] = o.Pin } if !IsNil(o.PublicKey) { toSerialize["public_key"] = o.PublicKey } if !IsNil(o.RelaxedAttestationExpiresAt) { toSerialize["relaxed_attestation_expires_at"] = o.RelaxedAttestationExpiresAt } if !IsNil(o.State) { toSerialize["state"] = o.State } if !IsNil(o.UserVerification) { toSerialize["user_verification"] = o.UserVerification } if !IsNil(o.Version) { toSerialize["version"] = o.Version } for key, value := range o.AdditionalProperties { toSerialize[key] = value } return toSerialize, nil } func (o *DeviceAuthnKey) UnmarshalJSON(data []byte) (err error) { varDeviceAuthnKey := _DeviceAuthnKey{} err = json.Unmarshal(data, &varDeviceAuthnKey) if err != nil { return err } *o = DeviceAuthnKey(varDeviceAuthnKey) additionalProperties := make(map[string]interface{}) if err = json.Unmarshal(data, &additionalProperties); err == nil { delete(additionalProperties, "attestation") delete(additionalProperties, "client_key_id") delete(additionalProperties, "created_at") delete(additionalProperties, "device_name") delete(additionalProperties, "device_type") delete(additionalProperties, "pin") delete(additionalProperties, "public_key") delete(additionalProperties, "relaxed_attestation_expires_at") delete(additionalProperties, "state") delete(additionalProperties, "user_verification") delete(additionalProperties, "version") o.AdditionalProperties = additionalProperties } return err } type NullableDeviceAuthnKey struct { value *DeviceAuthnKey isSet bool } func (v NullableDeviceAuthnKey) Get() *DeviceAuthnKey { return v.value } func (v *NullableDeviceAuthnKey) Set(val *DeviceAuthnKey) { v.value = val v.isSet = true } func (v NullableDeviceAuthnKey) IsSet() bool { return v.isSet } func (v *NullableDeviceAuthnKey) Unset() { v.value = nil v.isSet = false } func NewNullableDeviceAuthnKey(val *DeviceAuthnKey) *NullableDeviceAuthnKey { return &NullableDeviceAuthnKey{value: val, isSet: true} } func (v NullableDeviceAuthnKey) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } func (v *NullableDeviceAuthnKey) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) }