Add padding to the base64 string
This commit is contained in:
parent
b6f809a92b
commit
d55a6c181b
1 changed files with 3 additions and 3 deletions
|
|
@ -33,7 +33,7 @@ impl std::fmt::Debug for Base64 {
|
||||||
write!(
|
write!(
|
||||||
f,
|
f,
|
||||||
r#"b64"{}""#,
|
r#"b64"{}""#,
|
||||||
&general_purpose::STANDARD_NO_PAD.encode(self.0.to_bytes())
|
&general_purpose::STANDARD.encode(self.0.to_bytes())
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -43,7 +43,7 @@ impl Serialize for Base64 {
|
||||||
where
|
where
|
||||||
S: Serializer,
|
S: Serializer,
|
||||||
{
|
{
|
||||||
ser.serialize_str(&general_purpose::STANDARD_NO_PAD.encode(self.0.to_bytes()))
|
ser.serialize_str(&general_purpose::STANDARD.encode(self.0.to_bytes()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -66,7 +66,7 @@ impl<'de> Deserialize<'de> for Base64 {
|
||||||
where
|
where
|
||||||
E: serde::de::Error,
|
E: serde::de::Error,
|
||||||
{
|
{
|
||||||
general_purpose::STANDARD_NO_PAD
|
general_purpose::STANDARD
|
||||||
.decode(v)
|
.decode(v)
|
||||||
.map_err(E::custom)
|
.map_err(E::custom)
|
||||||
.map(|b| HS256Key::from_bytes(&b))
|
.map(|b| HS256Key::from_bytes(&b))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue