From ee48456f2ffeed14c88476e8a50eadfe5dfc171a Mon Sep 17 00:00:00 2001 From: netkas Date: Mon, 10 Feb 2025 15:40:20 -0500 Subject: [PATCH] Renamed SigningKey to Signature --- .../Encryption/EncryptionCreateChannel.php | 10 +++++----- src/Socialbox/Managers/ContactManager.php | 6 +++--- src/Socialbox/Objects/Database/SigningKeyRecord.php | 8 ++++---- .../Objects/Standard/{SigningKey.php => Signature.php} | 8 ++++---- src/Socialbox/Socialbox.php | 6 +++--- 5 files changed, 19 insertions(+), 19 deletions(-) rename src/Socialbox/Objects/Standard/{SigningKey.php => Signature.php} (95%) diff --git a/src/Socialbox/Classes/StandardMethods/Encryption/EncryptionCreateChannel.php b/src/Socialbox/Classes/StandardMethods/Encryption/EncryptionCreateChannel.php index f690365..b4eb8a5 100644 --- a/src/Socialbox/Classes/StandardMethods/Encryption/EncryptionCreateChannel.php +++ b/src/Socialbox/Classes/StandardMethods/Encryption/EncryptionCreateChannel.php @@ -20,7 +20,7 @@ use Socialbox\Objects\ClientRequest; use Socialbox\Objects\PeerAddress; use Socialbox\Objects\RpcRequest; - use Socialbox\Objects\Standard\SigningKey; + use Socialbox\Objects\Standard\Signature; use Socialbox\Socialbox; class EncryptionCreateChannel extends Method @@ -150,12 +150,12 @@ * * @param PeerAddress $callingPeer The calling peer * @param RpcRequest $rpcRequest The focused RPC request - * @return SigningKey The resolved signing key + * @return Signature The resolved signing key * @throws InvalidRpcArgumentException If one or more RPC parameters are invalid * @throws MissingRpcArgumentException If one or more RPC parameters are missing * @throws StandardRpcException If the calling signature cannot be resolved */ - private static function getCallingSignature(PeerAddress $callingPeer, RpcRequest $rpcRequest): SigningKey + private static function getCallingSignature(PeerAddress $callingPeer, RpcRequest $rpcRequest): Signature { // Caller signature verification if(!$rpcRequest->containsParameter('calling_signature_uuid')) @@ -238,12 +238,12 @@ /** * @param PeerAddress $receivingPeer * @param RpcRequest $rpcRequest - * @return SigningKey + * @return Signature * @throws InvalidRpcArgumentException * @throws MissingRpcArgumentException * @throws StandardRpcException */ - private static function getReceivingSignature(PeerAddress $receivingPeer, RpcRequest $rpcRequest): SigningKey + private static function getReceivingSignature(PeerAddress $receivingPeer, RpcRequest $rpcRequest): Signature { // Receiving signature verification if(!$rpcRequest->containsParameter('receiving_signature_uuid')) diff --git a/src/Socialbox/Managers/ContactManager.php b/src/Socialbox/Managers/ContactManager.php index 5462e75..29941f9 100644 --- a/src/Socialbox/Managers/ContactManager.php +++ b/src/Socialbox/Managers/ContactManager.php @@ -12,7 +12,7 @@ use Socialbox\Objects\Database\ContactKnownKeyRecord; use Socialbox\Objects\PeerAddress; use Socialbox\Objects\Standard\Contact; - use Socialbox\Objects\Standard\SigningKey; + use Socialbox\Objects\Standard\Signature; class ContactManager { @@ -334,11 +334,11 @@ * Adds a signing key to a contact in the database. * * @param string|ContactDatabaseRecord $contactUuid The unique identifier of the contact to add the signing key to. - * @param SigningKey $signingKey The signing key to add to the contact. + * @param Signature $signingKey The signing key to add to the contact. * @return void * @throws DatabaseOperationException If the database query fails. */ - public static function addContactSigningKey(string|ContactDatabaseRecord $contactUuid, SigningKey $signingKey): void + public static function addContactSigningKey(string|ContactDatabaseRecord $contactUuid, Signature $signingKey): void { if($contactUuid instanceof ContactDatabaseRecord) { diff --git a/src/Socialbox/Objects/Database/SigningKeyRecord.php b/src/Socialbox/Objects/Database/SigningKeyRecord.php index 2ca95f5..c3f100d 100644 --- a/src/Socialbox/Objects/Database/SigningKeyRecord.php +++ b/src/Socialbox/Objects/Database/SigningKeyRecord.php @@ -6,7 +6,7 @@ use InvalidArgumentException; use Socialbox\Enums\SigningKeyState; use Socialbox\Interfaces\SerializableInterface; - use Socialbox\Objects\Standard\SigningKey; + use Socialbox\Objects\Standard\Signature; class SigningKeyRecord implements SerializableInterface { @@ -188,10 +188,10 @@ /** * Converts the current signing key record to its standard format. * - * @return SigningKey The signing key in its standard format. + * @return Signature The signing key in its standard format. */ - public function toStandard(): SigningKey + public function toStandard(): Signature { - return SigningKey::fromSigningKeyRecord($this); + return Signature::fromSigningKeyRecord($this); } } \ No newline at end of file diff --git a/src/Socialbox/Objects/Standard/SigningKey.php b/src/Socialbox/Objects/Standard/Signature.php similarity index 95% rename from src/Socialbox/Objects/Standard/SigningKey.php rename to src/Socialbox/Objects/Standard/Signature.php index cfc216e..4092cf6 100644 --- a/src/Socialbox/Objects/Standard/SigningKey.php +++ b/src/Socialbox/Objects/Standard/Signature.php @@ -8,7 +8,7 @@ use Socialbox\Interfaces\SerializableInterface; use Socialbox\Objects\Database\SigningKeyRecord; - class SigningKey implements SerializableInterface + class Signature implements SerializableInterface { private string $uuid; private string $name; @@ -135,9 +135,9 @@ * Creates a new SigningKey instance from a SigningKeyRecord. * * @param SigningKeyRecord $record The record containing the signing key data. - * @return SigningKey An instance of SigningKey populated with data from the provided record. + * @return Signature An instance of SigningKey populated with data from the provided record. */ - public static function fromSigningKeyRecord(SigningKeyRecord $record): SigningKey + public static function fromSigningKeyRecord(SigningKeyRecord $record): Signature { return new self([ 'uuid' => $record->getUuid(), @@ -152,7 +152,7 @@ /** * @inheritDoc */ - public static function fromArray(array $data): SigningKey + public static function fromArray(array $data): Signature { return new self($data); } diff --git a/src/Socialbox/Socialbox.php b/src/Socialbox/Socialbox.php index d47f1b3..4c5cee8 100644 --- a/src/Socialbox/Socialbox.php +++ b/src/Socialbox/Socialbox.php @@ -39,7 +39,7 @@ use Socialbox\Objects\Standard\InformationField; use Socialbox\Objects\Standard\Peer; use Socialbox\Objects\Standard\ServerInformation; - use Socialbox\Objects\Standard\SigningKey; + use Socialbox\Objects\Standard\Signature; use Throwable; class Socialbox @@ -903,10 +903,10 @@ * * @param PeerAddress|string $peerAddress The peer address or string identifier to be resolved. * @param string $signatureUuid The UUID of the signature key to be resolved. - * @return SigningKey|null The resolved signing key for the peer. Null if not found + * @return Signature|null The resolved signing key for the peer. Null if not found * @throws StandardRpcException If there was an error while resolving the peer signature key. */ - public static function resolvePeerSignature(PeerAddress|string $peerAddress, string $signatureUuid): ?SigningKey + public static function resolvePeerSignature(PeerAddress|string $peerAddress, string $signatureUuid): ?Signature { // Convert string peer address to object PeerAddress if(is_string($peerAddress))