fn decrypt_onion_request_payload(
    payload: OnionRequestPayload,
) -> Result<(Vec<u8>, Vec<u8>), Rejection> {
    let ephemeral_key = hex::decode(payload.metadata.ephemeral_key).unwrap(); // Safe because it was validated in the parsing step
    let symmetric_key = crypto::get_x25519_symmetric_key(&ephemeral_key, &crypto::PRIVATE_KEY)?;
    let plaintext = crypto::decrypt_aes_gcm(&payload.ciphertext, &symmetric_key)?;
    return Ok((plaintext, symmetric_key));
}
/// Returns the decrypted `payload.ciphertext` plus the `symmetric_key` that was used for
/// decryption if successful.
Returns the decrypted `payload.ciphertext` plus the `symmetric_key` that was used for
decryption if successful.
Returns the decrypted ` payload . ciphertext ` plus the ` symmetric_key ` that was used for decryption if successful .
fn decrypt_onion_request_payload(
    payload: OnionRequestPayload,
) -> Result<(Vec<u8>, Vec<u8>), Rejection> {
    let ephemeral_key = hex::decode(payload.metadata.ephemeral_key).unwrap(); // Safe because it was validated in the parsing step
    let symmetric_key = crypto::get_x25519_symmetric_key(&ephemeral_key, &crypto::PRIVATE_KEY)?;
    let plaintext = crypto::decrypt_aes_gcm(&payload.ciphertext, &symmetric_key)?;
    return Ok((plaintext, symmetric_key));
}
fn decrypt_onion_request_payload ( payload : OnionRequestPayload , ) -> Result < ( Vec < u8 > , Vec < u8 > ) , Rejection > { let ephemeral_key = hex :: decode ( payload . metadata . ephemeral_key ) . unwrap ( ) ; // Safe because it was validated in the parsing step let symmetric_key = crypto :: get_x25519_symmetric_key ( & ephemeral_key , & crypto :: PRIVATE_KEY ) ? ; let plaintext = crypto :: decrypt_aes_gcm ( & payload . ciphertext , & symmetric_key ) ? ; return Ok ( ( plaintext , symmetric_key ) ) ; }
Returns the decrypted `payload.ciphertext` plus the `symmetric_key` that was used for
decryption if successful.
Returns the decrypted ` payload . ciphertext ` plus the ` symmetric_key ` that was used for decryption if successful .
payload
OnionRequestPayload
payload
OnionRequestPayload