chore: re-org u2f code

This commit is contained in:
2022-04-12 23:06:59 +08:00
parent 20754c119e
commit 4a90258b6b
3 changed files with 25 additions and 28 deletions

View File

@@ -117,9 +117,7 @@ impl U2fV2Challenge {
if with_time_stamp_prefix {
let timestamp = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap().as_millis() as u64;
let timestamp_be_bytes = timestamp.to_be_bytes();
for i in 0..8 {
rand_bytes[i] = timestamp_be_bytes[i];
}
rand_bytes[..8].clone_from_slice(&timestamp_be_bytes[..8]);
}
let challenge = base64::encode_config(&rand_bytes, URL_SAFE_NO_PAD);