X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FOwa.php;h=ca4eec47ffad0f2cfd94624b15cd9d638ef47ac7;hb=d01d69b9e72360b0b19c2618b3c3504704ea83da;hp=a1dbfa2f315ea3aa8b31d9f2f12e5ae99854f5b9;hpb=c6ce9ddaa41a59496cbe5cd93ace9bc552478ccd;p=friendica.git diff --git a/src/Module/Owa.php b/src/Module/Owa.php index a1dbfa2f31..ca4eec47ff 100644 --- a/src/Module/Owa.php +++ b/src/Module/Owa.php @@ -11,6 +11,7 @@ use Friendica\Database\DBA; use Friendica\Model\Contact; use Friendica\Model\OpenWebAuthToken; use Friendica\Util\HTTPSignature; +use Friendica\Util\Strings; /** * @brief OpenWebAuth verifier and token generator @@ -26,7 +27,7 @@ use Friendica\Util\HTTPSignature; */ class Owa extends BaseModule { - public static function init() + public static function init(array $parameters = []) { $ret = [ 'success' => false ]; @@ -62,7 +63,7 @@ class Owa extends BaseModule Logger::log('OWA success: ' . $contact['addr'], Logger::DATA); $ret['success'] = true; - $token = random_string(32); + $token = Strings::getRandomHex(32); // Store the generated token in the databe. OpenWebAuthToken::create('owt', 0, $token, $contact['addr']); @@ -74,7 +75,7 @@ class Owa extends BaseModule // At a later time, we will compare weather the token we're getting // is really the same token we have stored in the database. openssl_public_encrypt($token, $result, $contact['pubkey']); - $ret['encrypted_token'] = base64url_encode($result); + $ret['encrypted_token'] = Strings::base64UrlEncode($result); } else { Logger::log('OWA fail: ' . $contact['id'] . ' ' . $contact['addr'] . ' ' . $contact['url'], Logger::DEBUG); } @@ -85,6 +86,6 @@ class Owa extends BaseModule } } } - System::jsonExit($ret, 'application/x-dfrn+json'); + System::jsonExit($ret, 'application/x-zot+json'); } }