utils::encode_param now encodes data without padding

This commit is contained in:
shockrah 2020-05-19 21:46:17 -07:00
parent 84ccfff2aa
commit f12048b49b

View File

@ -1,11 +1,13 @@
// 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 std::str;
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> {