mirror of
https://github.com/BitskiCo/jwk-rs
synced 2024-11-21 19:49:20 +00:00
Don't pad base64, as per spec
This commit is contained in:
parent
0d890ca6d7
commit
c8a05d3360
@ -61,7 +61,7 @@ mod tests {
|
||||
use generic_array::typenum::*;
|
||||
|
||||
static BYTES: &[u8] = &[1, 2, 3, 4, 5, 6, 7];
|
||||
static BASE64_JSON: &str = "\"AQIDBAUGBw==\"";
|
||||
static BASE64_JSON: &str = "\"AQIDBAUGBw\"";
|
||||
|
||||
fn get_de() -> serde_json::Deserializer<serde_json::de::StrRead<'static>> {
|
||||
serde_json::Deserializer::from_str(&BASE64_JSON)
|
||||
|
@ -24,7 +24,7 @@ mod tests {
|
||||
use super::*;
|
||||
|
||||
static BYTES: &[u8] = &[1, 2, 3, 4, 5, 6, 7];
|
||||
static BASE64_JSON: &str = "\"AQIDBAUGBw==\"";
|
||||
static BASE64_JSON: &str = "\"AQIDBAUGBw\"";
|
||||
|
||||
#[test]
|
||||
fn test_serde_byte_vec() {
|
||||
|
@ -87,7 +87,7 @@ fn serialize_es256() {
|
||||
};
|
||||
assert_eq!(
|
||||
jwk.to_string(),
|
||||
r#"{"kty":"EC","crv":"P-256","x":"AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQE=","y":"AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgI="}"#
|
||||
r#"{"kty":"EC","crv":"P-256","x":"AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQE","y":"AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgI"}"#
|
||||
);
|
||||
}
|
||||
|
||||
@ -156,7 +156,7 @@ fn serialize_hs256() {
|
||||
};
|
||||
assert_eq!(
|
||||
jwk.to_string(),
|
||||
r#"{"kty":"oct","k":"KioqKioqKioqKioqKioqKg=="}"#
|
||||
r#"{"kty":"oct","k":"KioqKioqKioqKioqKioqKg"}"#
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@ use serde::{
|
||||
use zeroize::Zeroizing;
|
||||
|
||||
fn base64_config() -> base64::Config {
|
||||
base64::Config::new(base64::CharacterSet::UrlSafe, true /* pad */)
|
||||
base64::Config::new(base64::CharacterSet::UrlSafe, false /* pad */)
|
||||
}
|
||||
|
||||
fn base64_encode(bytes: impl AsRef<[u8]>) -> String {
|
||||
|
Loading…
Reference in New Issue
Block a user