Skip to main content

ToBase64Url

Trait ToBase64Url 

Source
pub trait ToBase64Url {
    // Required methods
    fn to_base64url(&self) -> String;
    fn to_base64url_zeroizing(&self) -> EncodedSecret;
}
Expand description

Extension trait for encoding byte data as URL-safe base64 strings (no padding).

Requires feature encoding-base64.

Blanket-implemented for all AsRef<[u8]> types. Uses the RFC 4648 URL-safe alphabet without = padding. To encode a secret wrapper, call the inherent to_base64url() method directly (ergonomically safest for single operations), or use with_secret(|b| b.to_base64url()) for multi-step operations or when audit-greppability matters.

Required Methods§

Source

fn to_base64url(&self) -> String

Encode bytes as URL-safe base64 (no padding).

Source

fn to_base64url_zeroizing(&self) -> EncodedSecret

Encode bytes as URL-safe base64 and wrap the result in crate::EncodedSecret.

Implementors§

Source§

impl<T: AsRef<[u8]> + ?Sized> ToBase64Url for T

Available on crate features encoding-base64 and alloc only.