usso 0.2.1

The usso provides a universal single sign-on (SSO) integration for microservices, making it easy to add secure, scalable authentication across different frameworks. This client simplifies the process of connecting any microservice to the USSO service.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use base64::{engine::general_purpose::URL_SAFE, Engine as _};
use uuid::Uuid;

pub fn b64_encode_uuid(uuid: Uuid) -> String {
    URL_SAFE.encode(uuid.as_bytes())
}

pub fn b64_encode_uuid_strip(uuid: Uuid) -> String {
    b64_encode_uuid(uuid).trim_end_matches('=').to_string()
}

pub fn b64_decode_uuid(encoded: &str) -> Result<Uuid, base64::DecodeError> {
    let decoded = URL_SAFE.decode(encoded)?;
    Ok(Uuid::from_slice(&decoded).expect("base64 is invalid!"))
}