Nextcloud Circles API

RemoteStreamService extends NCSignature
in package
Uses TDeserialize, TNCLocalSignatory, TStringTools, TNCWellKnown

Class RemoteStreamService

Table of Contents

DATE_HEADER  = 'D, d M Y H:i:s T'
DATE_OBJECT  = 'Y-m-d\\TH:i:s\\Z'
DATE_TTL  = 300
UPDATE_DATA  = 'data'
UPDATE_HREF  = 'href'
UPDATE_INSTANCE  = 'instance'
UPDATE_ITEM  = 'item'
UPDATE_TYPE  = 'type'
$SIGNATORIES_APP  : mixed
$WEBFINGER  : mixed
$configService  : ConfigService
$dateHeader  : mixed
$interfaceService  : InterfaceService
$remoteRequest  : RemoteRequest
$ttl  : int
$urlGenerator  : IURLGenerator
__construct()  : mixed
RemoteStreamService constructor.
addRemoteInstance()  : void
Add a remote instance, based on the address
confirmValidRemote()  : void
TODO: confirm if method is really needed
createSimpleSignatory()  : void
deserialize()  : IDeserializable
deserializeArray()  : array<string|int, IDeserializable>
deserializeJson()  : IDeserializable
deserializeList()  : array<string|int, IDeserializable>
downloadSignatory()  : void
extractLink()  : NCWellKnownLink
fillSimpleSignatory()  : void
generateKeys()  : mixed
generateRandomSentence()  : string
generateRandomWord()  : string
getAppSignatory()  : RemoteInstance
Returns the Signatory model for the Circles app.
getCachedRemoteInstance()  : RemoteInstance
get RemoteInstance with confirmed and known identity from database.
getDateDiff()  : string
getKeyOrigin()  : string
getLink()  : NCWellKnownLink
getOpenSSLAlgo()  : int
getRemoteInstanceFromAddress()  : RemoteInstance
getResourceData()  : SimpleDataStore
getWebfinger()  : NCWebfinger
humanReadable()  : string
incomingSignedRequest()  : NCSignedRequest
isFromSameInstance()  : bool
removeSimpleSignatory()  : void
resetAppSignatory()  : void
Reset the Signatory (and the Identity) for the Circles app.
resultRequestRemoteInstance()  : array<string|int, mixed>
shortcut to requestRemoteInstance that return result if available, or exception.
retrieveRemoteInstance()  : RemoteInstance
Add a remote instance, based on the address
retrieveSignatory()  : RemoteInstance
retrieve Signatory.
serialize()  : array<string|int, mixed>
serializeArray()  : array<string|int, mixed>
signOutgoingRequest()  : NCSignedRequest
signString()  : string
update()  : void
TODO: check if this method is not useless
updateSignatory()  : void
verifyString()  : mixed
commonPart()  : string
cut()  : string
feedStringWithParams()  : string
isUuid()  : bool
token()  : string
uuid()  : string
Generate uuid: 2b5a7a87-8db1-445f-a17b-405790f91c80
confirmAuth()  : void
Confirm the Auth of a RemoteInstance, based on the result from a request
confirmFederatedItemExceptionFromClass()  : void
getChosenEncryption()  : string
getFederatedItemExceptionFromResult()  : FederatedItemException
getFederatedItemExceptionFromStatus()  : string
getRemoteInstanceEntry()  : string
get the value of an entry from the Signatory of the RemoteInstance.
getUsedEncryption()  : string
parseIncomingSignatureHeader()  : void
requestRemoteInstance()  : NCSignedRequest
Send a request to a remote instance, based on: - instance: address as saved in database, - item: the item to request (incoming, event, ...) - type: GET, POST - data: Serializable to be send if needed
setIncomingClearSignature()  : void
setIncomingSignatureHeader()  : void
setOutgoingClearSignature()  : void
setOutgoingSignatureHeader()  : void
setOutgoingSignedSignature()  : void
signingOutgoingRequest()  : void
verifyIncomingRequestContent()  : void
verifyIncomingRequestSignature()  : mixed
verifyIncomingRequestTime()  : void
verifySignedRequest()  : mixed

Constants

DATE_HEADER

public mixed DATE_HEADER = 'D, d M Y H:i:s T'

DATE_OBJECT

public mixed DATE_OBJECT = 'Y-m-d\\TH:i:s\\Z'

Properties

$WEBFINGER

public static mixed $WEBFINGER = '/.well-known/webfinger'

$dateHeader

private mixed $dateHeader = self::DATE_HEADER

Methods

addRemoteInstance()

Add a remote instance, based on the address

public addRemoteInstance(string $instance[, string $type = RemoteInstance::TYPE_EXTERNAL ][, int $iface = InterfaceService::IFACE_FRONTAL ][, bool $overwrite = false ]) : void
Parameters
$instance : string
$type : string = RemoteInstance::TYPE_EXTERNAL
$iface : int = InterfaceService::IFACE_FRONTAL
$overwrite : bool = false
Tags
throws
RemoteAlreadyExistsException
throws
RemoteUidException
throws
RequestNetworkException
throws
SignatoryException
throws
SignatureException
throws
WellKnownLinkNotFoundException
Return values
void

deserializeArray()

public deserializeArray(array<string|int, mixed> $data, string $class[, bool $associative = false ]) : array<string|int, IDeserializable>
Parameters
$data : array<string|int, mixed>
$class : string
$associative : bool = false
Return values
array<string|int, IDeserializable>

downloadSignatory()

public downloadSignatory(NCSignatory $signatory[, string $keyId = '' ][, array<string|int, mixed> $params = [] ][, NCRequest|null $request = null ]) : void
Parameters
$signatory : NCSignatory
$keyId : string = ''
$params : array<string|int, mixed> = []
$request : NCRequest|null = null
Tags
throws
SignatoryException
Return values
void

generateKeys()

public generateKeys(NCSignatory $signatory[, string $digest = 'rsa' ][, int $bits = 2048 ][, int $type = OPENSSL_KEYTYPE_RSA ]) : mixed
Parameters
$signatory : NCSignatory
$digest : string = 'rsa'
$bits : int = 2048
$type : int = OPENSSL_KEYTYPE_RSA
Return values
mixed

generateRandomSentence()

public generateRandomSentence([int $words = 5 ]) : string
Parameters
$words : int = 5
Return values
string

generateRandomWord()

public generateRandomWord([int $length = 8 ]) : string
Parameters
$length : int = 8
Return values
string

getDateDiff()

public getDateDiff(int $first, int $second[, bool $short = false ][, array<string|int, mixed> $words = [] ]) : string
Parameters
$first : int
$second : int
$short : bool = false
$words : array<string|int, mixed> = []
Tags
throws
Exception
Return values
string

humanReadable()

public humanReadable(int $bytes) : string
Parameters
$bytes : int
Return values
string

resetAppSignatory()

Reset the Signatory (and the Identity) for the Circles app.

public resetAppSignatory() : void
Return values
void

resultRequestRemoteInstance()

shortcut to requestRemoteInstance that return result if available, or exception.

public resultRequestRemoteInstance(string $instance, string $item[, int $type = Request::TYPE_GET ][, JsonSerializable|null $object = null ][, array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$instance : string
$item : string
$type : int = Request::TYPE_GET
$object : JsonSerializable|null = null
$params : array<string|int, mixed> = []
Tags
throws
RemoteInstanceException
throws
RemoteNotFoundException
throws
RemoteResourceNotFoundException
throws
UnknownRemoteException
throws
FederatedItemException
Return values
array<string|int, mixed>

serialize()

public serialize(JsonSerializable $model) : array<string|int, mixed>
Parameters
$model : JsonSerializable
Return values
array<string|int, mixed>

serializeArray()

public serializeArray(array<string|int, mixed> $data) : array<string|int, mixed>
Parameters
$data : array<string|int, mixed>
Return values
array<string|int, mixed>

updateSignatory()

public updateSignatory(NCSignatory $signatory, array<string|int, mixed> $json[, string $keyId = '' ]) : void
Parameters
$signatory : NCSignatory
$json : array<string|int, mixed>
$keyId : string = ''
Tags
throws
SignatoryException
Return values
void

verifyString()

public verifyString(string $clear, string $signed, string $publicKey[, string $algo = NCSignatory::SHA256 ]) : mixed
Parameters
$clear : string
$signed : string
$publicKey : string
$algo : string = NCSignatory::SHA256
Tags
throws
SignatureException
Return values
mixed

commonPart()

protected commonPart(string $str1, string $str2[, bool $cs = true ]) : string
Parameters
$str1 : string
$str2 : string
$cs : bool = true

case sensitive ?

Return values
string

cut()

protected cut(string $line, int $length) : string
Parameters
$line : string
$length : int
Return values
string

feedStringWithParams()

protected feedStringWithParams(string $line, array<string|int, mixed> $params) : string
Parameters
$line : string
$params : array<string|int, mixed>
Return values
string

isUuid()

protected isUuid(string $uuid) : bool
Parameters
$uuid : string
Return values
bool

token()

protected token([int $length = 15 ]) : string
Parameters
$length : int = 15
Return values
string

uuid()

Generate uuid: 2b5a7a87-8db1-445f-a17b-405790f91c80

protected uuid(int $length) : string
Parameters
$length : int
Return values
string

confirmFederatedItemExceptionFromClass()

private confirmFederatedItemExceptionFromClass(ReflectionClass $class) : void
Parameters
$class : ReflectionClass
Tags
throws
FederatedItemException
Return values
void

getFederatedItemExceptionFromStatus()

private getFederatedItemExceptionFromStatus(int $statusCode) : string
Parameters
$statusCode : int
Return values
string

requestRemoteInstance()

Send a request to a remote instance, based on: - instance: address as saved in database, - item: the item to request (incoming, event, ...) - type: GET, POST - data: Serializable to be send if needed

private requestRemoteInstance(string $instance, string $item[, int $type = Request::TYPE_GET ][, JsonSerializable|null $object = null ][, array<string|int, mixed> $params = [] ]) : NCSignedRequest
Parameters
$instance : string
$item : string
$type : int = Request::TYPE_GET
$object : JsonSerializable|null = null
$params : array<string|int, mixed> = []
Tags
throws
RemoteNotFoundException
throws
RemoteResourceNotFoundException
throws
UnknownRemoteException
throws
RemoteInstanceException
throws
UnknownInterfaceException
Return values
NCSignedRequest

Search results