106 lines
2.9 KiB
PHP
106 lines
2.9 KiB
PHP
<?php
|
|
/**
|
|
* SPDX-FileCopyrightText: 2024 Sascha Nitsch (grumpydeveloper) https://contentnation.net/@grumpydevelop
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
*
|
|
* @author Sascha Nitsch (grumpydeveloper)
|
|
**/
|
|
|
|
namespace Federator\Cache;
|
|
|
|
/**
|
|
* base class for remote authentication
|
|
*/
|
|
interface Cache extends \Federator\Connector\Connector
|
|
{
|
|
/**
|
|
* save remote followers of user
|
|
*
|
|
* @param string $user user name
|
|
* @param \Federator\Data\FedUser[]|false $followers user followers
|
|
* @return void
|
|
*/
|
|
public function saveRemoteFollowersOfUser($user, $followers);
|
|
|
|
/**
|
|
* save remote following for user
|
|
*
|
|
* @param string $user user name
|
|
* @param \Federator\Data\FedUser[]|false $following user following
|
|
* @return void
|
|
*/
|
|
public function saveRemoteFollowingForUser($user, $following);
|
|
|
|
/**
|
|
* save remote posts by user
|
|
*
|
|
* @param string $user user name
|
|
* @param int $min min timestamp
|
|
* @param int $max max timestamp
|
|
* @param int $limit limit results
|
|
* @param \Federator\Data\ActivityPub\Common\APObject[]|false $posts user posts
|
|
* @return void
|
|
*/
|
|
public function saveRemotePostsByUser($user, $min, $max, $limit, $posts);
|
|
|
|
/**
|
|
* save remote stats
|
|
*
|
|
* @param \Federator\Data\Stats $stats stats to save
|
|
* @return void
|
|
*/
|
|
public function saveRemoteStats($stats);
|
|
|
|
/**
|
|
* save remote user by given name
|
|
*
|
|
* @param string $_name user/profile name
|
|
* @param \Federator\Data\User $user user data
|
|
* @return void
|
|
*/
|
|
public function saveRemoteUserByName($_name, $user);
|
|
|
|
/**
|
|
* save remote federation user by given name
|
|
*
|
|
* @param string $_name user/profile name
|
|
* @param \Federator\Data\FedUser $user user data
|
|
* @return void
|
|
*/
|
|
public function saveRemoteFedUserByName(string $_name, \Federator\Data\FedUser $user);
|
|
|
|
/**
|
|
* save remote user by given session
|
|
*
|
|
* @param string $_session session id
|
|
* @param string $_user user/profile name
|
|
* @param \Federator\Data\User $user user data
|
|
* @return void
|
|
*/
|
|
public function saveRemoteUserBySession($_session, $_user, $user);
|
|
|
|
/**
|
|
* Save the public key for a given keyId
|
|
*
|
|
* @param string $keyId The keyId (e.g., actor URL + #main-key)
|
|
* @param string $publicKeyPem The public key PEM to cache
|
|
* @return void
|
|
*/
|
|
public function savePublicKey(string $keyId, string $publicKeyPem);
|
|
|
|
/**
|
|
* get remote federation user by given name
|
|
*
|
|
* @param string $_name user/profile name
|
|
* @return \Federator\Data\FedUser | false
|
|
*/
|
|
public function getRemoteFedUserByName(string $_name);
|
|
|
|
/**
|
|
* Retrieve the public key for a given keyId
|
|
*
|
|
* @param string $keyId The keyId (e.g., actor URL + #main-key)
|
|
* @return string|false The cached public key PEM or false if not found
|
|
*/
|
|
public function getPublicKey(string $keyId);
|
|
}
|