utils::encode_param now encodes data without padding
This commit is contained in:
parent
84ccfff2aa
commit
f12048b49b
@ -1,11 +1,13 @@
|
|||||||
// Generic functions used by pretty much everyone
|
// Generic functions used by pretty much everyone
|
||||||
use base64::{encode_config, decode_config, URL_SAFE};
|
use base64::{self, encode_config, decode_config, URL_SAFE};
|
||||||
use getrandom::getrandom;
|
use getrandom::getrandom;
|
||||||
use std::str;
|
use std::str;
|
||||||
|
|
||||||
|
|
||||||
pub fn encode_param(raw: &str) -> String {
|
pub fn encode_param(raw: &str) -> String {
|
||||||
encode_config(raw, URL_SAFE)
|
URL_SAFE.pad(false);
|
||||||
|
let cfg = base64::Config::new(base64::CharacterSet::UrlSafe, false);
|
||||||
|
encode_config(raw, cfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn decode_param(enc: &str) -> Result<String, i32> {
|
pub fn decode_param(enc: &str) -> Result<String, i32> {
|
||||||
|
Loading…
Reference in New Issue
Block a user