base64url calls

implement base64UrlEncode and base64UrlDecode functions
This commit is contained in:
Adam Magness 2018-11-08 10:37:08 -05:00
parent 0efcbe5d15
commit 6fc9c6de3b
13 changed files with 64 additions and 59 deletions

View file

@ -95,7 +95,7 @@ class Magic extends BaseModule
if ($j['encrypted_token']) {
// The token is encrypted. If the local user is really the one the other instance
// thinks he/she is, the token can be decrypted with the local users public key.
openssl_private_decrypt(base64url_decode($j['encrypted_token']), $token, $user['prvkey']);
openssl_private_decrypt(Strings::base64UrlDecode($j['encrypted_token']), $token, $user['prvkey']);
} else {
$token = $j['token'];
}

View file

@ -4,6 +4,7 @@ namespace Friendica\Module;
use Friendica\BaseModule;
use Friendica\Content;
use Friendica\Util\Strings;
/**
* Oembed module
@ -36,7 +37,7 @@ class Oembed extends BaseModule
if ($a->argc == 2) {
echo '<html><body>';
$url = base64url_decode($a->argv[1]);
$url = Strings::base64UrlDecode($a->argv[1]);
$j = Content\OEmbed::fetchURL($url);
// workaround for media.ccc.de (and any other endpoint that return size 0)

View file

@ -75,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);
}