Skip to content

Instantly share code, notes, and snippets.

@nickray
Last active December 30, 2019 22:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickray/284deae46aa1432a0ff89300f97dba94 to your computer and use it in GitHub Desktop.
Save nickray/284deae46aa1432a0ff89300f97dba94 to your computer and use it in GitHub Desktop.
fn serialize() {
// status: 0 = success;
self.buffer[0] = 0;
// actual payload
let writer = serde_cbor::ser::SliceWrite::new(&mut self.buffer[1..]);
let mut ser = serde_cbor::Serializer::new(writer)
.packed_format()
.pack_starting_with(1)
.pack_to_depth(1)
;
}
pub struct AuthenticatorInfo {
pub(crate) versions: Vec<String<consts::U8>, consts::U2>,
#[serde(skip_serializing_if = "Option::is_none")]
pub(crate) extensions: Option<Vec<String<consts::U11>, consts::U1>>,
// #[serde(with = "serde_bytes")]
// #[serde(serialize_with = "serde_bytes::serialize", deserialize_with = "serde_bytes::deserialize")]
// #[serde(serialize_with = "serde_bytes::serialize")]
// pub(crate) aaguid: Vec<u8, consts::U16>,
pub(crate) aaguid: ByteVec<consts::U16>,
#[serde(skip_serializing_if = "Option::is_none")]
pub(crate) options: Option<CtapOptions>,
//
// TODO: this is actually the constant MESSAGE_SIZE
#[serde(skip_serializing_if = "Option::is_none")]
pub(crate) max_msg_size: Option<usize>,
#[serde(skip_serializing_if = "Option::is_none")]
pub(crate) pin_protocols: Option<Vec<u8, consts::U1>>,
// not in the CTAP spec, but see https://git.io/JeNxG
#[serde(skip_serializing_if = "Option::is_none")]
pub(crate) max_creds_in_list: Option<usize>,
#[serde(skip_serializing_if = "Option::is_none")]
pub(crate) max_cred_id_length: Option<usize>,
// #[serde(skip_serializing_if = "Option::is_none")]
// pub(crate) transports: Option<&'l[u8]>,
// #[serde(skip_serializing_if = "Option::is_none")]
// pub(crate) algorithms: Option<&'l[u8]>,
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment