Skip to content

Instantly share code, notes, and snippets.

@eaponiente
Last active November 7, 2018 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eaponiente/eba9011ce74f245117f7a31285232042 to your computer and use it in GitHub Desktop.
Save eaponiente/eba9011ce74f245117f7a31285232042 to your computer and use it in GitHub Desktop.
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