mirror of
https://github.com/bs-community/blessing-skin-plugins.git
synced 2025-01-08 11:37:27 +08:00
Revert "[yggdrasil-api] implement Mojang publickeys API (#193)"
This reverts commit a48965743d
.
This commit is contained in:
parent
addddec71c
commit
ed46a1df2d
@ -18,11 +18,6 @@ Route::prefix('authserver')
|
||||
Route::post('invalidate', 'AuthController@invalidate');
|
||||
});
|
||||
|
||||
Route::prefix('minecraftservices')
|
||||
->group(function () {
|
||||
Route::get('publickeys', 'ServicesController@getPublicKeys');
|
||||
});
|
||||
|
||||
Route::prefix('sessionserver/session/minecraft')->group(function () {
|
||||
Route::post('join', 'SessionController@joinServer');
|
||||
Route::get('hasJoined', 'SessionController@hasJoinedServer');
|
||||
|
@ -10,7 +10,7 @@ use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Option;
|
||||
use Yggdrasil\Utils\Key;
|
||||
use Yggdrasil\Exceptions\IllegalArgumentException;
|
||||
|
||||
class ConfigController extends Controller
|
||||
{
|
||||
@ -77,7 +77,17 @@ class ConfigController extends Controller
|
||||
$request->getHost(),
|
||||
]))));
|
||||
|
||||
$privateKey = Key::getPrivateKey(config('ygg_private_key'));
|
||||
$privateKey = openssl_pkey_get_private(option('ygg_private_key'));
|
||||
|
||||
if (!$privateKey) {
|
||||
throw new IllegalArgumentException(trans('Yggdrasil::config.rsa.invalid'));
|
||||
}
|
||||
|
||||
$keyData = openssl_pkey_get_details($privateKey);
|
||||
|
||||
if ($keyData['bits'] < 4096) {
|
||||
throw new IllegalArgumentException(trans('Yggdrasil::config.rsa.length'));
|
||||
}
|
||||
|
||||
$result = [
|
||||
'meta' => [
|
||||
@ -90,7 +100,7 @@ class ConfigController extends Controller
|
||||
'feature.non_email_login' => true,
|
||||
],
|
||||
'skinDomains' => $skinDomains,
|
||||
'signaturePublickey' => Key::getPublicKey($privateKey),
|
||||
'signaturePublickey' => $keyData['key'],
|
||||
];
|
||||
|
||||
if (!optional($pluginManager->get('disable-registration'))->isEnabled()) {
|
||||
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Yggdrasil\Controllers;
|
||||
|
||||
use Illuminate\Routing\Controller;
|
||||
use Yggdrasil\Utils\Key;
|
||||
|
||||
class ServicesController extends Controller
|
||||
{
|
||||
public function getPublicKeys()
|
||||
{
|
||||
$privateKey = Key::getPrivateKey(config('ygg_private_key'));
|
||||
|
||||
$result = [
|
||||
'profilePropertyKeys' => [
|
||||
[
|
||||
'publicKey' => Key::getPublicKey($privateKey),
|
||||
],
|
||||
],
|
||||
'playerCertificateKeys' => [
|
||||
[
|
||||
'pulicKey' => Key::getPublicKey($privateKey),
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
return json($result);
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@ use Illuminate\Support\Facades\Http;
|
||||
use Log;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Schema;
|
||||
use Yggdrasil\Utils\Key;
|
||||
use Yggdrasil\Exceptions\IllegalArgumentException;
|
||||
|
||||
class Profile
|
||||
{
|
||||
@ -46,7 +46,11 @@ class Profile
|
||||
|
||||
// 检查 RSA 私钥
|
||||
if ($unsigned === false) {
|
||||
$key = Key::getPrivateKey(config('ygg_private_key'));
|
||||
$key = openssl_pkey_get_private(option('ygg_private_key'));
|
||||
|
||||
if (!$key) {
|
||||
throw new IllegalArgumentException(trans('Yggdrasil::config.rsa.invalid'));
|
||||
}
|
||||
|
||||
$textures['signatureRequired'] = true;
|
||||
}
|
||||
|
@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Yggdrasil\Utils;
|
||||
|
||||
use Yggdrasil\Exceptions\IllegalArgumentException;
|
||||
|
||||
class Key
|
||||
{
|
||||
public static function getPrivateKey($key)
|
||||
{
|
||||
$privateKey = openssl_pkey_get_private(option('ygg_private_key'));
|
||||
|
||||
if (!$privateKey) {
|
||||
throw new IllegalArgumentException(trans('Yggdrasil::config.rsa.invalid'));
|
||||
}
|
||||
|
||||
return $privateKey;
|
||||
}
|
||||
|
||||
public static function getPublicKey($key)
|
||||
{
|
||||
$keyData = openssl_pkey_get_details($key);
|
||||
|
||||
if ($keyData['bits'] < 4096) {
|
||||
throw new IllegalArgumentException(trans('Yggdrasil::config.rsa.length'));
|
||||
}
|
||||
|
||||
return $keyData['key'];
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user