Last active
November 7, 2018 14:10
-
-
Save eaponiente/eba9011ce74f245117f7a31285232042 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
public function webhook(Request $request) | |
{ | |
$http_body = file_get_contents("php://input"); | |
$headers = getallheaders(); | |
$key_from_configuration = | |
"D079ADB4A1EE4FD9CF02034C76EEDC86707F86296DE010A6332848DFD086139B"; | |
$iv_from_http_header = $headers["X-Initialization-Vector"]; | |
$auth_tag_from_http_header = $headers["X-Authentication-Tag"]; | |
$key = hex2bin($key_from_configuration); | |
$iv = hex2bin($iv_from_http_header); | |
$cipher_text = hex2bin($http_body.$auth_tag_from_http_header); | |
$result = \Sodium\crypto_aead_aes256gcm_decrypt( | |
$cipher_text, NULL, $iv, $key); | |
return response('Hello World', 200) | |
->header('Content-Type', 'text/plain'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment