From 9f493357f4b8507012bb1ad03c98f51bb667352b Mon Sep 17 00:00:00 2001 From: rabuzarus Date: Wed, 20 Jun 2018 20:11:26 +0200 Subject: [PATCH] port hubzillas OpenWebAuth - fix wrong table name + fix wrong method name --- src/Model/OpenWebAuthToken.php | 14 +++++++------- src/Util/Crypto.php | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Model/OpenWebAuthToken.php b/src/Model/OpenWebAuthToken.php index f295fc3703..5c405b27d3 100644 --- a/src/Model/OpenWebAuthToken.php +++ b/src/Model/OpenWebAuthToken.php @@ -10,12 +10,12 @@ use Friendica\Util\DateTimeFormat; use dba; /** - * Methods to deal with entries of the 'openwebauth_token' table. + * Methods to deal with entries of the 'openwebauth-token' table. */ class OpenWebAuthToken { /** - * Create an entry in the 'openwebauth_token' table. + * Create an entry in the 'openwebauth-token' table. * * @param string $type Verify type. * @param int $uid The user ID. @@ -33,11 +33,11 @@ class OpenWebAuthToken "meta" => $meta, "created" => DateTimeFormat::utcNow() ]; - return dba::insert("openwebauth_token", $fields); + return dba::insert("openwebauth-token", $fields); } /** - * Get the "meta" field of an entry in the openwebauth_token table. + * Get the "meta" field of an entry in the openwebauth-token table. * * @param string $type Verify type. * @param int $uid The user ID. @@ -49,9 +49,9 @@ class OpenWebAuthToken { $condition = ["type" => $type, "uid" => $uid, "token" => $token]; - $entry = dba::selectFirst("openwebauth_token", ["id", "meta"], $condition); + $entry = dba::selectFirst("openwebauth-token", ["id", "meta"], $condition); if (DBM::is_result($entry)) { - dba::delete("openwebauth_token", ["id" => $entry["id"]]); + dba::delete("openwebauth-token", ["id" => $entry["id"]]); return $entry["meta"]; } @@ -67,7 +67,7 @@ class OpenWebAuthToken public static function purge($type, $interval) { $condition = ["`type` = ? AND `created` < ?", $type, DateTimeFormat::utcNow() . " - INTERVAL " . $interval]; - dba::delete("openwebauth_token", $condition); + dba::delete("openwebauth-token", $condition); } } diff --git a/src/Util/Crypto.php b/src/Util/Crypto.php index ad2a6fb2cb..6a49626bd2 100644 --- a/src/Util/Crypto.php +++ b/src/Util/Crypto.php @@ -394,7 +394,7 @@ class Crypto $key = random_bytes(32); $iv = random_bytes(16); $result = ['encrypted' => true]; - $result['data'] = base64url_encode(self::AES256CBC_encrypt($data, $key, $iv), true); + $result['data'] = base64url_encode(self::encryptAES256CBC($data, $key, $iv), true); // log the offending call so we can track it down if (!openssl_public_encrypt($key, $k, $pubkey)) {