cleanup
This commit is contained in:
parent
48604d165b
commit
86649b56aa
@ -1,13 +1,12 @@
|
|||||||
#[deny(missing_debug_implementations, unused_results)]
|
#![deny(missing_debug_implementations, unused_results)]
|
||||||
use failure::_core::marker::PhantomData;
|
use failure::_core::marker::PhantomData;
|
||||||
use num_traits::{FromPrimitive, ToPrimitive};
|
use num_traits::{FromPrimitive, ToPrimitive};
|
||||||
use serde::de::{Error, MapAccess, Visitor};
|
use serde::de::{MapAccess, Visitor};
|
||||||
use serde::ser::{SerializeMap, SerializeSeq, SerializeStruct, SerializeStructVariant};
|
use serde::ser::SerializeMap;
|
||||||
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
|
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
|
||||||
use serde_cbor::de::IoRead;
|
|
||||||
use serde_cbor::ser::IoWrite;
|
use serde_cbor::ser::IoWrite;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::collections::{BTreeMap, HashMap};
|
use std::collections::BTreeMap;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
use std::io::{Read, Write};
|
use std::io::{Read, Write};
|
||||||
@ -548,7 +547,7 @@ impl<'a, 'de> Deserialize<'de> for CoseKey<'a> {
|
|||||||
Field::Id => id = Some(map.next_value()?),
|
Field::Id => id = Some(map.next_value()?),
|
||||||
Field::Alg => alg = Some(map.next_value()?),
|
Field::Alg => alg = Some(map.next_value()?),
|
||||||
Field::Other(i) => {
|
Field::Other(i) => {
|
||||||
parameters.insert(i, map.next_value()?);
|
let _ = parameters.insert(i, map.next_value()?);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -769,9 +768,7 @@ impl<'a, 'de> Deserialize<'de> for AuthenticatorOptions<'a> {
|
|||||||
where
|
where
|
||||||
E: de::Error,
|
E: de::Error,
|
||||||
{
|
{
|
||||||
match value {
|
Ok(Field::Other(value.into()))
|
||||||
other => Ok(Field::Other(other.into())),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -796,7 +793,7 @@ impl<'a, 'de> Deserialize<'de> for AuthenticatorOptions<'a> {
|
|||||||
while let Some(k) = map.next_key()? {
|
while let Some(k) = map.next_key()? {
|
||||||
match k {
|
match k {
|
||||||
Field::Other(i) => {
|
Field::Other(i) => {
|
||||||
options.insert(Cow::Owned(i), map.next_value()?);
|
let _ = options.insert(Cow::Owned(i), map.next_value()?);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -893,8 +890,8 @@ mod test {
|
|||||||
let mut cbor = bytes;
|
let mut cbor = bytes;
|
||||||
match T::deserialize_cbor(&mut bytes) {
|
match T::deserialize_cbor(&mut bytes) {
|
||||||
e @ Err(_) => {
|
e @ Err(_) => {
|
||||||
dbg!(serde_cbor::value::Value::deserialize_cbor(&mut cbor));
|
dbg!(serde_cbor::value::Value::deserialize_cbor(&mut cbor).unwrap());
|
||||||
dbg!(e).unwrap();
|
let _ = dbg!(e);
|
||||||
unreachable!()
|
unreachable!()
|
||||||
}
|
}
|
||||||
Ok(ok) => return ok,
|
Ok(ok) => return ok,
|
||||||
@ -966,14 +963,7 @@ mod test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn test_response(mut resp: &[u8]) {
|
fn test_response(mut resp: &[u8]) {
|
||||||
let res = GetClientPinResponse::deserialize_cbor(&mut resp).unwrap();
|
let _ = GetClientPinResponse::deserialize_cbor(&mut resp).unwrap();
|
||||||
//let cose = res.key_agreement;
|
|
||||||
//dbg!(cose.alg);
|
|
||||||
//assert_ne!(cose.alg, PublicKeyCredentialAlgorithm::Unknown);
|
|
||||||
/*let mut buf = Vec::new();
|
|
||||||
cose.serialize_cbor(&mut buf).unwrap();
|
|
||||||
let mut buf_slice = &buf[..];
|
|
||||||
assert_eq!(cose, CoseKey::deserialize_cbor(&mut buf_slice).unwrap())*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -1130,7 +1120,7 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_make_credential_request() {
|
fn test_make_credential_request() {
|
||||||
assert_decodes::<MakeCredentialRequest<'_>>(&[
|
let _ = assert_decodes::<MakeCredentialRequest<'_>>(&[
|
||||||
166, 1, 88, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
166, 1, 88, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 162, 98, 105, 100, 105, 99, 116, 97, 112, 95, 100,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 162, 98, 105, 100, 105, 99, 116, 97, 112, 95, 100,
|
||||||
101, 109, 111, 100, 110, 97, 109, 101, 111, 99, 116, 97, 112, 95, 104, 109, 97, 99,
|
101, 109, 111, 100, 110, 97, 109, 101, 111, 99, 116, 97, 112, 95, 104, 109, 97, 99,
|
||||||
@ -1143,7 +1133,7 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_make_credential_response_yubikey() {
|
fn test_make_credential_response_yubikey() {
|
||||||
assert_decodes::<MakeCredentialResponse<'_>>(&[
|
let _ = assert_decodes::<MakeCredentialResponse<'_>>(&[
|
||||||
163, 1, 102, 112, 97, 99, 107, 101, 100, 2, 88, 162, 171, 147, 255, 145, 49, 113,
|
163, 1, 102, 112, 97, 99, 107, 101, 100, 2, 88, 162, 171, 147, 255, 145, 49, 113,
|
||||||
135, 145, 80, 61, 246, 246, 160, 31, 189, 65, 0, 129, 154, 207, 25, 28, 121, 3,
|
135, 145, 80, 61, 246, 246, 160, 31, 189, 65, 0, 129, 154, 207, 25, 28, 121, 3,
|
||||||
211, 79, 224, 82, 111, 17, 229, 163, 193, 0, 0, 0, 1, 185, 44, 63, 154, 192, 20,
|
211, 79, 224, 82, 111, 17, 229, 163, 193, 0, 0, 0, 1, 185, 44, 63, 154, 192, 20,
|
||||||
@ -1201,8 +1191,8 @@ mod test {
|
|||||||
//#[test]
|
//#[test]
|
||||||
fn test_make_credential_requestt() {
|
fn test_make_credential_requestt() {
|
||||||
let mut buf = Vec::new();
|
let mut buf = Vec::new();
|
||||||
make_credential_request().serialize_cbor(&mut buf);
|
let _ = make_credential_request().serialize_cbor(&mut buf);
|
||||||
dbg!(serde_cbor::value::Value::deserialize_cbor(&mut (&buf[..])));
|
let _ = dbg!(serde_cbor::value::Value::deserialize_cbor(&mut (&buf[..])));
|
||||||
panic!()
|
panic!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1230,7 +1220,7 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_get_assertion_request() {
|
fn test_get_assertion_request() {
|
||||||
assert_decodes::<GetAssertionRequest<'_>>(&[
|
let _ = assert_decodes::<GetAssertionRequest<'_>>(&[
|
||||||
164, 1, 105, 99, 116, 97, 112, 95, 100, 101, 109, 111, 2, 88, 32, 0, 0, 0, 0, 0, 0,
|
164, 1, 105, 99, 116, 97, 112, 95, 100, 101, 109, 111, 2, 88, 32, 0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
|
||||||
129, 162, 98, 105, 100, 80, 188, 116, 69, 227, 50, 124, 140, 13, 30, 132, 51, 122,
|
129, 162, 98, 105, 100, 80, 188, 116, 69, 227, 50, 124, 140, 13, 30, 132, 51, 122,
|
||||||
@ -1249,7 +1239,7 @@ mod test {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_get_assertion_response_yubikey() {
|
fn test_get_assertion_response_yubikey() {
|
||||||
assert_decodes::<GetAssertionResponse<'_>>(&[
|
let _ = assert_decodes::<GetAssertionResponse<'_>>(&[
|
||||||
164, 1, 162, 98, 105, 100, 80, 14, 2, 90, 14, 176, 127, 23, 26, 112, 189, 7, 253,
|
164, 1, 162, 98, 105, 100, 80, 14, 2, 90, 14, 176, 127, 23, 26, 112, 189, 7, 253,
|
||||||
218, 142, 157, 153, 100, 116, 121, 112, 101, 106, 112, 117, 98, 108, 105, 99, 45,
|
218, 142, 157, 153, 100, 116, 121, 112, 101, 106, 112, 117, 98, 108, 105, 99, 45,
|
||||||
107, 101, 121, 2, 88, 84, 171, 147, 255, 145, 49, 113, 135, 145, 80, 61, 246, 246,
|
107, 101, 121, 2, 88, 84, 171, 147, 255, 145, 49, 113, 135, 145, 80, 61, 246, 246,
|
||||||
@ -1266,7 +1256,7 @@ mod test {
|
|||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn test_get_assertion_response_solokey() {
|
fn test_get_assertion_response_solokey() {
|
||||||
assert_decodes::<GetAssertionResponse<'_>>(&[
|
let _ = assert_decodes::<GetAssertionResponse<'_>>(&[
|
||||||
163, 1, 162, 98, 105, 100, 88, 70, 178, 60, 31, 172, 224, 56, 238, 158, 64, 8, 252,
|
163, 1, 162, 98, 105, 100, 88, 70, 178, 60, 31, 172, 224, 56, 238, 158, 64, 8, 252,
|
||||||
234, 231, 234, 32, 67, 42, 251, 118, 141, 152, 72, 220, 19, 42, 24, 149, 131, 4,
|
234, 231, 234, 32, 67, 42, 251, 118, 141, 152, 72, 220, 19, 42, 24, 149, 131, 4,
|
||||||
78, 50, 46, 88, 99, 171, 147, 255, 145, 49, 113, 135, 145, 80, 61, 246, 246, 160,
|
78, 50, 46, 88, 99, 171, 147, 255, 145, 49, 113, 135, 145, 80, 61, 246, 246, 160,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user