Twilio capability token generator

author Aleksey Korzun
package Library
subpackage Twilio\Utility

 Methods

Create a new TwilioCapability with zero permissions.

__construct(string $identifier, string $token) 

Next steps are to grant access to resources by configuring this token through the functions allowXXXX.

Parameters

$identifier

string

the account secure identifier to which this token is granted access

$token

string

the secret key used to sign the token.

If the user of this token should be allowed to accept incoming connections then configure the TwilioCapability through this method and specify the client name.

allowClientIncoming(string $name) 

Parameters

$name

string

Exceptions

\InvalidArgumentException

Allow the user of this token to make outgoing connections.

allowClientOutgoing(int $applicationSid, array $parameters) 

Parameters

$applicationSid

int

the application to which this token grants access

$parameters

string[]

signed parameters that the user of this token cannot overwrite.

Allow the user of this token to access their event stream.

allowEventStream(array $filters) 

Parameters

$filters

array

key/value filters to apply to the event stream

Generates a new token based on the credentials and permissions that previously has been granted to this token.

generateToken(int $ttl) : string

Parameters

$ttl

int

the expiration time of the token (in seconds).

Returns

stringthe newly generated token that is valid for specified number of seconds

Create a new scope

allow(string $service, string $privilege, string[] $parameters) 

Parameters

$service

string

$privilege

string

$parameters

string[]

 Properties

 

$clientName : string
 

$identifier : string
 

$scopes : string[]
 

$token : string

 Constants

 

Default time to live

DEFAULT_TTL : int