/*
* Ory APIs
*
* # Introduction Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers. ## SDKs This document describes the APIs available in the Ory Network. The APIs are available as SDKs for the following languages: | Language | Download SDK | Documentation | | -------------- | ---------------------------------------------------------------- | ------------------------------------------------------------------------------------ | | Dart | [pub.dev](https://pub.dev/packages/ory_client) | [README](https://github.com/ory/sdk/blob/master/clients/client/dart/README.md) | | .NET | [nuget.org](https://www.nuget.org/packages/Ory.Client/) | [README](https://github.com/ory/sdk/blob/master/clients/client/dotnet/README.md) | | Elixir | [hex.pm](https://hex.pm/packages/ory_client) | [README](https://github.com/ory/sdk/blob/master/clients/client/elixir/README.md) | | Go | [github.com](https://github.com/ory/client-go) | [README](https://github.com/ory/sdk/blob/master/clients/client/go/README.md) | | Java | [maven.org](https://search.maven.org/artifact/sh.ory/ory-client) | [README](https://github.com/ory/sdk/blob/master/clients/client/java/README.md) | | JavaScript | [npmjs.com](https://www.npmjs.com/package/@ory/client) | [README](https://github.com/ory/sdk/blob/master/clients/client/typescript/README.md) | | JavaScript (With fetch) | [npmjs.com](https://www.npmjs.com/package/@ory/client-fetch) | [README](https://github.com/ory/sdk/blob/master/clients/client/typescript-fetch/README.md) | | PHP | [packagist.org](https://packagist.org/packages/ory/client) | [README](https://github.com/ory/sdk/blob/master/clients/client/php/README.md) | | Python | [pypi.org](https://pypi.org/project/ory-client/) | [README](https://github.com/ory/sdk/blob/master/clients/client/python/README.md) | | Ruby | [rubygems.org](https://rubygems.org/gems/ory-client) | [README](https://github.com/ory/sdk/blob/master/clients/client/ruby/README.md) | | Rust | [crates.io](https://crates.io/crates/ory-client) | [README](https://github.com/ory/sdk/blob/master/clients/client/rust/README.md) |
*
* The version of the OpenAPI document: v1.22.89
* Contact: support@ory.sh
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
use serde_with::serde_as;
/// 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`.
#[serde_as]
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct DeviceAuthnKey {
#[serde(rename = "attestation", skip_serializing_if = "Option::is_none")]
pub attestation: Option<Box<models::DeviceAuthnAttestation>>,
/// 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.
#[serde(rename = "client_key_id", skip_serializing_if = "Option::is_none")]
pub client_key_id: Option<String>,
/// When the key was enrolled. Only used for troubleshooting and UI.
#[serde(rename = "created_at", skip_serializing_if = "Option::is_none")]
pub created_at: Option<String>,
/// A human-readable name for the device, helping the user tell this key apart from others.
#[serde(rename = "device_name", skip_serializing_if = "Option::is_none")]
pub device_name: Option<String>,
#[serde(rename = "device_type", skip_serializing_if = "Option::is_none")]
pub device_type: Option<models::DeviceType>,
#[serde(rename = "pin", skip_serializing_if = "Option::is_none")]
pub pin: Option<Box<models::PinConfig>>,
/// 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.
#[serde_as(as = "Option<serde_with::base64::Base64>")]
#[serde(rename = "public_key", skip_serializing_if = "Option::is_none")]
pub public_key: Option<Vec<u8>>,
/// 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.
#[serde(rename = "relaxed_attestation_expires_at", skip_serializing_if = "Option::is_none")]
pub relaxed_attestation_expires_at: Option<String>,
#[serde(rename = "state", skip_serializing_if = "Option::is_none")]
pub state: Option<models::KeyState>,
#[serde(rename = "user_verification", skip_serializing_if = "Option::is_none")]
pub user_verification: Option<models::UserVerification>,
/// 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.
#[serde(rename = "version", skip_serializing_if = "Option::is_none")]
pub version: Option<i64>,
}
impl 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`.
pub fn new() -> DeviceAuthnKey {
DeviceAuthnKey {
attestation: None,
client_key_id: None,
created_at: None,
device_name: None,
device_type: None,
pin: None,
public_key: None,
relaxed_attestation_expires_at: None,
state: None,
user_verification: None,
version: None,
}
}
}