Add external session management and support for remote servers

This commit is contained in:
netkas 2025-01-10 14:58:24 -05:00
parent da3fe9c5a7
commit fde3ccfc68
7 changed files with 272 additions and 47 deletions

View file

@ -9,6 +9,7 @@
use Socialbox\Classes\Utilities;
use Socialbox\Enums\StandardMethods;
use Socialbox\Exceptions\CryptographyException;
use Socialbox\Exceptions\DatabaseOperationException;
use Socialbox\Exceptions\ResolutionException;
use Socialbox\Exceptions\RpcException;
use Socialbox\Objects\ExportedSession;
@ -22,15 +23,17 @@
/**
* Constructs the object from an array of data.
*
* @param string|PeerAddress $peerAddress The address of the peer to connect to.
* @param string|PeerAddress $identifiedAs The address of the peer to connect to.
* @param string|null $server Optional. The domain of the server to connect to if different from the identified
* @param ExportedSession|null $exportedSession Optional. The exported session to use for communication.
* @throws CryptographyException If the public key is invalid.
* @throws DatabaseOperationException If the database operation fails.
* @throws ResolutionException If the domain cannot be resolved.
* @throws RpcException If the RPC request fails.
*/
public function __construct(string|PeerAddress $peerAddress, ?ExportedSession $exportedSession=null)
public function __construct(string|PeerAddress $identifiedAs, ?string $server=null, ?ExportedSession $exportedSession=null)
{
parent::__construct($peerAddress, $exportedSession);
parent::__construct($identifiedAs, $server, $exportedSession);
}
/**