Encode credentials as a protocol buffer message

This permits to decode a credential of a different version without failing.
This commit is contained in:
Julien Cretin
2020-05-09 15:55:55 +02:00
parent a2eff7c632
commit f4b791ed91
5 changed files with 102 additions and 59 deletions

View File

@@ -335,6 +335,7 @@ where
user_handle: vec![],
other_ui: None,
cred_random: None,
unknown_fields: BTreeMap::new(),
})
}
@@ -501,6 +502,7 @@ where
.user_display_name
.map(|s| truncate_to_char_boundary(&s, 64).to_string()),
cred_random,
unknown_fields: BTreeMap::new(),
};
self.persistent_store.store_credential(credential_source)?;
random_id
@@ -1279,6 +1281,7 @@ mod test {
user_handle: vec![],
other_ui: None,
cred_random: None,
unknown_fields: BTreeMap::new(),
};
assert!(ctap_state
.persistent_store
@@ -1476,6 +1479,7 @@ mod test {
user_handle: vec![],
other_ui: None,
cred_random: None,
unknown_fields: BTreeMap::new(),
};
assert!(ctap_state
.persistent_store