Add client metadata to session creation and enforce TOS/PP
This commit is contained in:
parent
d2119df824
commit
756297671f
10 changed files with 414 additions and 206 deletions
|
@ -4,12 +4,18 @@
|
|||
|
||||
enum SessionFlags : string
|
||||
{
|
||||
// Session states
|
||||
case REGISTRATION_REQUIRED = 'REGISTRATION_REQUIRED'; // Peer has to register
|
||||
case AUTHENTICATION_REQUIRED = 'AUTHENTICATION_REQUIRED'; // Peer has to authenticate
|
||||
|
||||
// Verification, require fields
|
||||
case SET_PASSWORD = 'SET_PASSWORD'; // Peer has to set a password
|
||||
case SET_OTP = 'SET_OTP'; // Peer has to set an OTP
|
||||
case SET_DISPLAY_NAME = 'SET_DISPLAY_NAME'; // Peer has to set a display name
|
||||
|
||||
// Verification, verification requirements
|
||||
case VER_PRIVACY_POLICY = 'VER_PRIVACY_POLICY'; // Peer has to accept the privacy policy
|
||||
case VER_TERMS_OF_SERVICE = 'VER_TERMS_OF_SERVICE'; // Peer has to accept the terms of service
|
||||
case VER_EMAIL = 'VER_EMAIL'; // Peer has to verify their email
|
||||
case VER_SMS = 'VER_SMS'; // Peer has to verify their phone number
|
||||
case VER_PHONE_CALL = 'VER_PHONE_CALL'; // Peer has to verify their phone number via a phone call
|
||||
|
|
|
@ -1,35 +1,31 @@
|
|||
<?php
|
||||
|
||||
namespace Socialbox\Enums;
|
||||
namespace Socialbox\Enums;
|
||||
|
||||
use Socialbox\Classes\StandardMethods\CreateSession;
|
||||
use Socialbox\Classes\StandardMethods\Identify;
|
||||
use Socialbox\Classes\StandardMethods\VerificationAnswerImageCaptcha;
|
||||
use Socialbox\Classes\StandardMethods\VerificationGetImageCaptcha;
|
||||
use Socialbox\Classes\StandardMethods\GetMe;
|
||||
use Socialbox\Classes\StandardMethods\Ping;
|
||||
use Socialbox\Classes\StandardMethods\Register;
|
||||
use Socialbox\Exceptions\StandardException;
|
||||
use Socialbox\Interfaces\SerializableInterface;
|
||||
use Socialbox\Objects\ClientRequest;
|
||||
use Socialbox\Objects\ClientRequestOld;
|
||||
use Socialbox\Objects\RpcRequest;
|
||||
use Socialbox\Classes\StandardMethods\GetSessionState;
|
||||
use Socialbox\Classes\StandardMethods\Ping;
|
||||
use Socialbox\Exceptions\StandardException;
|
||||
use Socialbox\Interfaces\SerializableInterface;
|
||||
use Socialbox\Objects\ClientRequest;
|
||||
use Socialbox\Objects\RpcRequest;
|
||||
|
||||
enum StandardMethods : string
|
||||
{
|
||||
case PING = 'ping';
|
||||
|
||||
/**
|
||||
* @param ClientRequest $request
|
||||
* @param RpcRequest $rpcRequest
|
||||
* @return SerializableInterface|null
|
||||
* @throws StandardException
|
||||
*/
|
||||
public function execute(ClientRequest $request, RpcRequest $rpcRequest): ?SerializableInterface
|
||||
enum StandardMethods : string
|
||||
{
|
||||
return match ($this)
|
||||
case PING = 'ping';
|
||||
case GET_SESSION_STATE = 'getSessionState';
|
||||
|
||||
/**
|
||||
* @param ClientRequest $request
|
||||
* @param RpcRequest $rpcRequest
|
||||
* @return SerializableInterface|null
|
||||
* @throws StandardException
|
||||
*/
|
||||
public function execute(ClientRequest $request, RpcRequest $rpcRequest): ?SerializableInterface
|
||||
{
|
||||
self::PING => Ping::execute($request, $rpcRequest),
|
||||
};
|
||||
}
|
||||
}
|
||||
return match ($this)
|
||||
{
|
||||
self::PING => Ping::execute($request, $rpcRequest),
|
||||
self::GET_SESSION_STATE => GetSessionState::execute($request, $rpcRequest),
|
||||
};
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue