fn decrypt_url_safe(input: &str, config: &Config) -> Result<Vec<u8>, Error> {
    let cipher = ChaCha20Poly1305::new(&config.encryption_key);

    let mut ciphertext = base64::decode_config(input, base64::URL_SAFE_NO_PAD)?;
    let ciphertext_nonce = ciphertext.split_off(ciphertext.len() - NONCE_LEN);
    let ciphertext_nonce = ChaCha20Poly1305Nonce::from_slice(&ciphertext_nonce);

    cipher
        .decrypt(ciphertext_nonce, ciphertext.as_ref())
        .map_err(Error::from)
}
// Decrypts the given string assuming it's a url safe base64 encoded ChaCha20Poly1305 cipher.
Decrypts the given string assuming it's a url safe base64 encoded ChaCha20Poly1305 cipher.
Decrypts the given string assuming it ' s a url safe base64 encoded ChaCha20Poly1305 cipher .
fn decrypt_url_safe(input: &str, config: &Config) -> Result<Vec<u8>, Error> {
    let cipher = ChaCha20Poly1305::new(&config.encryption_key);
    let mut ciphertext = base64::decode_config(input, base64::URL_SAFE_NO_PAD)?;
    let ciphertext_nonce = ciphertext.split_off(ciphertext.len() - NONCE_LEN);
    let ciphertext_nonce = ChaCha20Poly1305Nonce::from_slice(&ciphertext_nonce);
    cipher
        .decrypt(ciphertext_nonce, ciphertext.as_ref())
        .map_err(Error::from)
}
fn decrypt_url_safe ( input : & str , config : & Config ) -> Result < Vec < u8 > , Error > { let cipher = ChaCha20Poly1305 :: new ( & config . encryption_key ) ; let mut ciphertext = base64 :: decode_config ( input , base64 :: URL_SAFE_NO_PAD ) ? ; let ciphertext_nonce = ciphertext . split_off ( ciphertext . len ( ) - NONCE_LEN ) ; let ciphertext_nonce = ChaCha20Poly1305Nonce :: from_slice ( & ciphertext_nonce ) ; cipher . decrypt ( ciphertext_nonce , ciphertext . as_ref ( ) ) . map_err ( Error :: from ) }
Decrypts the given string assuming it's a url safe base64 encoded ChaCha20Poly1305 cipher.
Decrypts the given string assuming it ' s a url safe base64 encoded ChaCha20Poly1305 cipher .
input
&str
config
&Config
input
&str
config
&Config