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' => [
2019-02-21 01:28:52 +05:30
api\components\ReCaptcha\Validator :: class => function () {
return new class ( new GuzzleHttp\Client ()) extends api\components\ReCaptcha\Validator {
2017-05-18 04:39:26 +05:30
protected function validateValue ( $value ) {
return null ;
}
};
},
2019-12-29 20:25:21 +05:30
common\components\SkinsSystemApi :: class => function () {
2021-03-04 10:28:07 +05:30
return new class ( 'http://chrly.ely.by' ) extends common\components\SkinsSystemApi {
2019-05-13 22:09:11 +05:30
public function textures ( string $username ) : ? array {
return [
'SKIN' => [
'url' => 'http://localhost/skin.png' ,
],
];
}
2021-03-03 19:34:42 +05:30
2024-06-11 07:20:10 +05:30
public function profile ( string $username , bool $signed = false , ? string $fallbackUuid = null ) : ? array {
2022-12-06 03:20:22 +05:30
if ( $username === 'NotSynchronized' ) {
2024-06-11 07:20:10 +05:30
if ( $fallbackUuid === null ) {
return null ;
}
$profile = [
'name' => $username ,
'id' => $fallbackUuid ,
'properties' => [
[
'name' => 'textures' ,
'value' => base64_encode ( json_encode ([
'timestamp' => Carbon\Carbon :: now () -> getPreciseTimestamp ( 3 ),
'profileId' => $fallbackUuid ,
'profileName' => $username ,
'textures' => new ArrayObject (),
])),
],
[
'name' => 'ely' ,
'value' => 'but why are you asking?' ,
],
],
];
if ( $signed ) {
$profile [ 'properties' ][ 0 ][ 'signature' ] = 'signature' ;
}
return $profile ;
2022-12-06 03:20:22 +05:30
}
2021-03-03 19:34:42 +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' ;
}
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
];