Made message signing in Cryptography use SHA512 as the message content for... #1
2 changed files with 169 additions and 147 deletions
1
.idea/socialbox-php.iml
generated
1
.idea/socialbox-php.iml
generated
|
@ -2,6 +2,7 @@
|
|||
<module type="WEB_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<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$/build" />
|
||||
</content>
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace Socialbox\Objects\Database;
|
||||
namespace Socialbox\Objects\Database;
|
||||
|
||||
use DateTime;
|
||||
use Socialbox\Classes\Configuration;
|
||||
use Socialbox\Classes\Logger;
|
||||
use Socialbox\Enums\Flags\PeerFlags;
|
||||
use Socialbox\Interfaces\SerializableInterface;
|
||||
use Socialbox\Objects\Standard\SelfUser;
|
||||
use DateTime;
|
||||
use Socialbox\Classes\Configuration;
|
||||
use Socialbox\Enums\Flags\PeerFlags;
|
||||
use Socialbox\Interfaces\SerializableInterface;
|
||||
use Socialbox\Objects\Standard\SelfUser;
|
||||
|
||||
class RegisteredPeerRecord implements SerializableInterface
|
||||
{
|
||||
class RegisteredPeerRecord implements SerializableInterface
|
||||
{
|
||||
private string $uuid;
|
||||
private string $username;
|
||||
private string $server;
|
||||
private ?string $displayName;
|
||||
/**
|
||||
* @var PeerFlags[]
|
||||
|
@ -31,6 +31,7 @@ class RegisteredPeerRecord implements SerializableInterface
|
|||
{
|
||||
$this->uuid = $data['uuid'];
|
||||
$this->username = $data['username'];
|
||||
$this->server = $data['server'];
|
||||
$this->displayName = $data['display_name'] ?? null;
|
||||
|
||||
if($data['flags'])
|
||||
|
@ -74,6 +75,16 @@ class RegisteredPeerRecord implements SerializableInterface
|
|||
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.
|
||||
*
|
||||
|
@ -133,6 +144,16 @@ class RegisteredPeerRecord implements SerializableInterface
|
|||
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.
|
||||
*
|
||||
|
@ -165,4 +186,4 @@ class RegisteredPeerRecord implements SerializableInterface
|
|||
'created' => $this->created
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue