2016-01-02 19:13:18 +05:30
< ? php
2016-05-30 05:14:17 +05:30
return [
'components' => [
2019-08-01 14:47:12 +05:30
'tokens' => [
'privateKeyPath' => codecept_data_dir ( 'certs/private.pem' ),
'privateKeyPass' => null ,
2019-12-05 22:07:46 +05:30
'encryptionKey' => 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' ,
2016-05-30 05:14:17 +05:30
],
2016-08-03 18:26:08 +05:30
'reCaptcha' => [
'public' => 'public-key' ,
'secret' => 'private-key' ,
],
2016-05-30 05:14:17 +05:30
],
2016-09-08 21:36:44 +05:30
'params' => [
2019-02-21 01:28:52 +05:30
'authserverHost' => 'localhost' ,
2016-09-08 21:36:44 +05:30
],
2017-05-18 04:39:26 +05:30
'container' => [
2021-03-03 19:34:42 +05:30
'singletons' => [
2024-12-02 15:40:55 +05:30
api\components\ReCaptcha\Validator :: class => fn () : api\components\ReCaptcha\Validator => new class ( new GuzzleHttp\Client ()) extends api\components\ReCaptcha\Validator {
protected function validateValue ( $value ) : ? array {
return null ;
}
2017-05-18 04:39:26 +05:30
},
2024-12-02 15:40:55 +05:30
common\components\SkinsSystemApi :: class => fn () : common\components\SkinsSystemApi => new class ( 'http://chrly.ely.by' ) extends common\components\SkinsSystemApi {
public function textures ( string $username ) : ? array {
return [
'SKIN' => [
'url' => 'http://localhost/skin.png' ,
],
];
}
2024-06-11 07:20:10 +05:30
2024-12-02 15:40:55 +05:30
public function profile ( string $username , bool $signed = false , ? string $fallbackUuid = null ) : ? array {
if ( $username === 'NotSynchronized' ) {
if ( $fallbackUuid === null ) {
return null ;
2022-12-06 03:20:22 +05:30
}
2021-03-03 19:34:42 +05:30
$profile = [
'name' => $username ,
2024-12-02 15:40:55 +05:30
'id' => $fallbackUuid ,
2021-03-03 19:34:42 +05:30
'properties' => [
[
'name' => 'textures' ,
'value' => base64_encode ( json_encode ([
'timestamp' => Carbon\Carbon :: now () -> getPreciseTimestamp ( 3 ),
2024-12-02 15:40:55 +05:30
'profileId' => $fallbackUuid ,
2021-03-03 19:34:42 +05:30
'profileName' => $username ,
2024-12-02 15:40:55 +05:30
'textures' => new ArrayObject (),
2021-03-03 19:34:42 +05:30
])),
],
[
'name' => 'ely' ,
'value' => 'but why are you asking?' ,
],
],
];
if ( $signed ) {
$profile [ 'properties' ][ 0 ][ 'signature' ] = 'signature' ;
}
return $profile ;
}
2024-12-02 15:40:55 +05:30
$account = common\models\Account :: findOne ([ 'username' => $username ]);
$uuid = $account ? str_replace ( '-' , '' , $account -> uuid ) : '00000000000000000000000000000000' ;
$profile = [
'name' => $username ,
'id' => $uuid ,
'properties' => [
[
'name' => 'textures' ,
'value' => base64_encode ( json_encode ([
'timestamp' => Carbon\Carbon :: now () -> getPreciseTimestamp ( 3 ),
'profileId' => $uuid ,
'profileName' => $username ,
'textures' => [
'SKIN' => [
'url' => 'http://ely.by/skin.png' ,
],
],
])),
],
[
'name' => 'ely' ,
'value' => 'but why are you asking?' ,
],
],
];
if ( $signed ) {
$profile [ 'properties' ][ 0 ][ 'signature' ] = 'signature' ;
2021-03-03 19:34:42 +05:30
}
2024-12-02 15:40:55 +05:30
return $profile ;
}
public function getSignatureVerificationKey ( string $format = 'pem' ) : string {
return " -----BEGIN PUBLIC KEY----- \n MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANbUpVCZkMKpfvYZ08W3lumdAaYxLBnm \n UDlzHBQH3DpYef5WCO32TDU6feIJ58A0lAywgtZ4wwi2dGHOz/1hAvcCAwEAAQ== \n -----END PUBLIC KEY----- " ;
}
2019-05-13 22:09:11 +05:30
},
2017-05-18 04:39:26 +05:30
],
],
2016-05-30 05:14:17 +05:30
];