From 2ba814f9b495bbf6507325e626070c28ad6dde73 Mon Sep 17 00:00:00 2001 From: netkas Date: Fri, 31 Jan 2025 13:05:31 -0500 Subject: [PATCH] Peer resolution for a contact isn't needed, reference is found in 'address' which could be resolved at a later time --- src/Socialbox/Managers/ContactManager.php | 10 ------- .../Objects/Standard/ContactRecord.php | 28 ------------------- 2 files changed, 38 deletions(-) diff --git a/src/Socialbox/Managers/ContactManager.php b/src/Socialbox/Managers/ContactManager.php index f05c42b..a8e1004 100644 --- a/src/Socialbox/Managers/ContactManager.php +++ b/src/Socialbox/Managers/ContactManager.php @@ -564,18 +564,8 @@ return null; } - try - { - $peer = Socialbox::resolvePeer($contactAddress); - } - catch (StandardRpcException $e) - { - $peer = null; - } - return new ContactRecord([ 'address' => $contact->getContactPeerAddress(), - 'peer' => $peer, 'relationship' => $contact->getRelationship(), 'known_keys' => self::contactGetSigningKeys($contact), 'added_timestamp' => $contact->getCreated()->getTimestamp() diff --git a/src/Socialbox/Objects/Standard/ContactRecord.php b/src/Socialbox/Objects/Standard/ContactRecord.php index 841ef9f..8b4cabd 100644 --- a/src/Socialbox/Objects/Standard/ContactRecord.php +++ b/src/Socialbox/Objects/Standard/ContactRecord.php @@ -10,7 +10,6 @@ class ContactRecord implements SerializableInterface { private PeerAddress $address; - private ?Peer $peer; private ContactRelationshipType $relationship; /** * @var KnownSigningKey[] @@ -26,22 +25,6 @@ public function __construct(array $data) { $this->address = PeerAddress::fromAddress($data['address']); - if(is_array($data['peer'])) - { - $this->peer = Peer::fromArray($data['peer']); - } - elseif($data['peer'] instanceof Peer) - { - $this->peer = $data['peer']; - } - elseif(is_null($data['peer'])) - { - $this->peer = null; - } - else - { - throw new InvalidArgumentException('Invalid peer data'); - } if($data['relationship'] instanceof ContactRelationshipType) { @@ -86,16 +69,6 @@ return $this->address; } - /** - * Retrieves the peer of the contact. - * - * @return Peer|null Returns the peer of the contact. If the peer is not known, null is returned. - */ - public function getPeer(): ?Peer - { - return $this->peer; - } - /** * Retrieves the relationship of the contact. * @@ -141,7 +114,6 @@ { return [ 'address' => $this->address->getAddress(), - 'peer' => $this->peer?->toArray(), 'relationship' => $this->relationship->value, 'known_keys' => array_map(function($key) {return $key->toArray();}, $this->knownKeys), 'added_timestamp' => $this->addedTimestamp