Made message signing in Cryptography use SHA512 as the message content for... #1

Closed
netkas wants to merge 421 commits from master into dev
2 changed files with 169 additions and 147 deletions
Showing only changes of commit c85ca908f0 - Show all commits

View file

@ -2,6 +2,7 @@
<module type="WEB_MODULE" version="4"> <module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager"> <component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/.idea/dataSources" /> <excludeFolder url="file://$MODULE_DIR$/.idea/dataSources" />
<excludeFolder url="file://$MODULE_DIR$/build" /> <excludeFolder url="file://$MODULE_DIR$/build" />
</content> </content>

View file

@ -1,18 +1,18 @@
<?php <?php
namespace Socialbox\Objects\Database; namespace Socialbox\Objects\Database;
use DateTime; use DateTime;
use Socialbox\Classes\Configuration; use Socialbox\Classes\Configuration;
use Socialbox\Classes\Logger; use Socialbox\Enums\Flags\PeerFlags;
use Socialbox\Enums\Flags\PeerFlags; use Socialbox\Interfaces\SerializableInterface;
use Socialbox\Interfaces\SerializableInterface; use Socialbox\Objects\Standard\SelfUser;
use Socialbox\Objects\Standard\SelfUser;
class RegisteredPeerRecord implements SerializableInterface class RegisteredPeerRecord implements SerializableInterface
{ {
private string $uuid; private string $uuid;
private string $username; private string $username;
private string $server;
private ?string $displayName; private ?string $displayName;
/** /**
* @var PeerFlags[] * @var PeerFlags[]
@ -31,6 +31,7 @@ class RegisteredPeerRecord implements SerializableInterface
{ {
$this->uuid = $data['uuid']; $this->uuid = $data['uuid'];
$this->username = $data['username']; $this->username = $data['username'];
$this->server = $data['server'];
$this->displayName = $data['display_name'] ?? null; $this->displayName = $data['display_name'] ?? null;
if($data['flags']) if($data['flags'])
@ -74,6 +75,16 @@ class RegisteredPeerRecord implements SerializableInterface
return $this->username; return $this->username;
} }
/**
* Retrieves the server.
*
* @return string The server.
*/
public function getServer(): string
{
return $this->server;
}
/** /**
* Constructs and retrieves the peer address using the current instance's username and the domain from the configuration. * Constructs and retrieves the peer address using the current instance's username and the domain from the configuration.
* *
@ -133,6 +144,16 @@ class RegisteredPeerRecord implements SerializableInterface
return $this->created; return $this->created;
} }
/**
* Determines if the server is external.
*
* @return bool True if the server is external, false otherwise.
*/
public function isExternal(): bool
{
return $this->server === 'host';
}
/** /**
* Converts the current instance to a SelfUser object. * Converts the current instance to a SelfUser object.
* *
@ -165,4 +186,4 @@ class RegisteredPeerRecord implements SerializableInterface
'created' => $this->created 'created' => $this->created
]; ];
} }
} }