feat: v1.1.13, u2f-register
This commit is contained in:
16
src/fido.rs
16
src/fido.rs
@@ -58,13 +58,14 @@ pub struct U2fRegistrationData {
|
||||
pub device_name: Option<String>,
|
||||
pub client_data: String,
|
||||
pub registration_data: String,
|
||||
pub attestation_cert: Option<Vec<u8>>,
|
||||
pub attestation_cert_pem: Option<String>,
|
||||
pub pub_key: String,
|
||||
pub key_handle: String,
|
||||
pub pub_key: Vec<u8>,
|
||||
pub key_handle: Vec<u8>,
|
||||
}
|
||||
|
||||
impl U2fRegistrationData {
|
||||
pub fn from(app_id: &str, client_data: &str, register_result: RegisterResult) -> XResult<Self> {
|
||||
pub fn from(app_id: &str, client_data: &str, register_result: &RegisterResult) -> XResult<Self> {
|
||||
let registration = opt_result!(
|
||||
u2f::register::parse_registration(app_id.to_string(), client_data.as_bytes().to_vec(), register_result.0.to_vec()),
|
||||
"Parse registration data failed: {}");
|
||||
@@ -74,11 +75,12 @@ impl U2fRegistrationData {
|
||||
device_name: registration.device_name,
|
||||
client_data: client_data.into(),
|
||||
registration_data: base64::encode(®ister_result.0),
|
||||
attestation_cert_pem: registration.attestation_cert.map(|c| {
|
||||
bytes_to_pem("CERTIFICATE", c)
|
||||
attestation_cert: registration.attestation_cert.clone(),
|
||||
attestation_cert_pem: registration.attestation_cert.map(|cert| {
|
||||
bytes_to_pem("CERTIFICATE", cert)
|
||||
}),
|
||||
pub_key: hex::encode(registration.pub_key),
|
||||
key_handle: hex::encode(registration.key_handle),
|
||||
pub_key: registration.pub_key,
|
||||
key_handle: registration.key_handle,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user