Add pagination support for encryption channel retrieval methods
https://github.com/nosial/Socialbox-PHP/issues/14
This commit is contained in:
parent
83a8217b26
commit
fa248abdbf
1 changed files with 62 additions and 2 deletions
|
@ -86,6 +86,7 @@
|
||||||
* @param PeerAddress|string $receivingPeer The address of the peer to create the channel with
|
* @param PeerAddress|string $receivingPeer The address of the peer to create the channel with
|
||||||
* @return string The UUID of the encryption channel
|
* @return string The UUID of the encryption channel
|
||||||
* @throws CryptographyException Thrown if there was an error while generating the encryption key pair
|
* @throws CryptographyException Thrown if there was an error while generating the encryption key pair
|
||||||
|
* @throws RpcException Thrown if there was an error with the RPC request
|
||||||
*/
|
*/
|
||||||
public function newEncryptionChannel(string|PeerAddress $receivingPeer): string
|
public function newEncryptionChannel(string|PeerAddress $receivingPeer): string
|
||||||
{
|
{
|
||||||
|
@ -497,14 +498,13 @@
|
||||||
*
|
*
|
||||||
* @param PeerAddress|string $peer The address of the peer to verify the signature for
|
* @param PeerAddress|string $peer The address of the peer to verify the signature for
|
||||||
* @param string $signatureUuid The UUID of the signature to verify
|
* @param string $signatureUuid The UUID of the signature to verify
|
||||||
* @param string $signaturePublicKey The public key that was used to create the signature
|
|
||||||
* @param string $signature The signature to verify
|
* @param string $signature The signature to verify
|
||||||
* @param string $sha512 The SHA512 hash of the data that was signed
|
* @param string $sha512 The SHA512 hash of the data that was signed
|
||||||
* @param int|null $signatureTime Optional. The timestamp of the signature creation time
|
* @param int|null $signatureTime Optional. The timestamp of the signature creation time
|
||||||
* @return SignatureVerificationStatus the status of the verification
|
* @return SignatureVerificationStatus the status of the verification
|
||||||
* @throws RpcException Thrown if there was an error with the RPC request
|
* @throws RpcException Thrown if there was an error with the RPC request
|
||||||
*/
|
*/
|
||||||
public function verifySignature(PeerAddress|string $peer, string $signatureUuid, string $signaturePublicKey, string $signature, string $sha512, ?int $signatureTime=null): SignatureVerificationStatus
|
public function verifySignature(PeerAddress|string $peer, string $signatureUuid, string $signature, string $sha512, ?int $signatureTime=null): SignatureVerificationStatus
|
||||||
{
|
{
|
||||||
if($peer instanceof PeerAddress)
|
if($peer instanceof PeerAddress)
|
||||||
{
|
{
|
||||||
|
@ -775,6 +775,66 @@
|
||||||
)->getResponse()->getResult());
|
)->getResponse()->getResult());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves encrypted channel requests with pagination support.
|
||||||
|
*
|
||||||
|
* This method fetches channel requests that have encryption enabled.
|
||||||
|
*
|
||||||
|
* @param int|null $page The page number to retrieve (defaults to 1)
|
||||||
|
* @param int|null $limit The maximum number of items per page (null means use default system limit)
|
||||||
|
* @return EncryptionChannel[] An array containing encryption channels
|
||||||
|
* @throws RpcException Thrown if there was an error with the RPC request
|
||||||
|
*/
|
||||||
|
public function encryptionGetChannelRequests(?int $page=1, ?int $limit=null): array
|
||||||
|
{
|
||||||
|
return array_map(fn($channel) => new EncryptionChannel($channel),
|
||||||
|
$this->sendRequest(new RpcRequest(StandardMethods::ENCRYPTION_GET_CHANNEL_REQUESTS, parameters: [
|
||||||
|
'page' => $page,
|
||||||
|
'limit' => $limit
|
||||||
|
]))->getResponse()->getResult()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves incoming encryption channels with pagination support.
|
||||||
|
*
|
||||||
|
* This method fetches channels that are incoming to the authenticated peer.
|
||||||
|
*
|
||||||
|
* @param int|null $page The page number to retrieve (defaults to 1)
|
||||||
|
* @param int|null $limit The maximum number of items per page (null means use default system limit)
|
||||||
|
* @return EncryptionChannel[] An array containing encryption channels
|
||||||
|
* @throws RpcException Thrown if there was an error with the RPC request
|
||||||
|
*/
|
||||||
|
public function encryptionGetIncomingChannels(?int $page=1, ?int $limit=null): array
|
||||||
|
{
|
||||||
|
return array_map(fn($channel) => new EncryptionChannel($channel),
|
||||||
|
$this->sendRequest(new RpcRequest(StandardMethods::ENCRYPTION_GET_INCOMING_CHANNELS, parameters: [
|
||||||
|
'page' => $page,
|
||||||
|
'limit' => $limit
|
||||||
|
]))->getResponse()->getResult()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves outgoing encryption channels with pagination support.
|
||||||
|
*
|
||||||
|
* This method fetches channels that are outgoing from the authenticated peer.
|
||||||
|
*
|
||||||
|
* @param int|null $page The page number to retrieve (defaults to 1)
|
||||||
|
* @param int|null $limit The maximum number of items per page (null means use default system limit)
|
||||||
|
* @return EncryptionChannel[] An array containing encryption channels
|
||||||
|
* @throws RpcException Thrown if there was an error with the RPC request
|
||||||
|
*/
|
||||||
|
public function getOutgoingChannels(?int $page=1, ?int $limit=null): array
|
||||||
|
{
|
||||||
|
return array_map(fn($channel) => new EncryptionChannel($channel),
|
||||||
|
$this->sendRequest(new RpcRequest(StandardMethods::ENCRYPTION_GET_OUTGOING_CHANNELS, parameters: [
|
||||||
|
'page' => $page,
|
||||||
|
'limit' => $limit
|
||||||
|
]))->getResponse()->getResult()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Accepts the community guidelines, returns True if the guidelines were accepted.
|
* Accepts the community guidelines, returns True if the guidelines were accepted.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue