Created
October 27, 2022 09:54
-
-
Save dkomanov/dd808754a6ff7df7d047a6493740422d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[no_mangle] | |
pub extern "system" fn decodeConfigUrlSafe2( | |
env: JNIEnv, | |
_class: JClass, | |
payload: jbyteArray, | |
) -> jbyteArray { | |
let arr = env.get_byte_array_elements( | |
payload, | |
ReleaseMode::NoCopyBack, | |
).unwrap(); | |
let sl = unsafe { | |
from_raw_parts(arr.as_ptr() as *mut u8, arr.size().unwrap() as usize) | |
}; | |
let result = base64::decode_config(sl, base64::URL_SAFE_NO_PAD).unwrap(); | |
return env.byte_array_from_slice(&result).unwrap(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment