Persistence bugfixing
This commit is contained in:
parent
7437cf2c94
commit
fdea2863fa
2 changed files with 11 additions and 2 deletions
|
@ -100,7 +100,9 @@ impl ToTLV for KeyPair {
|
|||
tw.str16(TagType::Anonymous, &buf[..size])?;
|
||||
|
||||
let size = self.get_private_key(&mut buf)?;
|
||||
tw.str16(TagType::Anonymous, &buf[..size])
|
||||
tw.str16(TagType::Anonymous, &buf[..size])?;
|
||||
|
||||
tw.end_container()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ pub trait FromTLV<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, T: FromTLV<'a>, const N: usize> FromTLV<'a> for [T; N] {
|
||||
impl<'a, T: FromTLV<'a> + Default, const N: usize> FromTLV<'a> for [T; N] {
|
||||
fn from_tlv(t: &TLVElement<'a>) -> Result<Self, Error>
|
||||
where
|
||||
Self: Sized,
|
||||
|
@ -49,6 +49,13 @@ impl<'a, T: FromTLV<'a>, const N: usize> FromTLV<'a> for [T; N] {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: This was the old behavior before rebasing the
|
||||
// implementation on top of heapless::Vec (to avoid requiring Copy)
|
||||
// Not sure why we actually need that yet, but without it unit tests fail
|
||||
while a.len() < N {
|
||||
a.push(Default::default()).map_err(|_| Error::NoSpace)?;
|
||||
}
|
||||
|
||||
a.into_array().map_err(|_| Error::Invalid)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue