Documentation
¶
Index ¶
- func SignTokenWithHMAC(headers, payload map[string]interface{}, secret string) (string, error)
- type AccessToken
- func (token *AccessToken) AddGrant(grant BaseGrant)
- func (token *AccessToken) FromJwt(jwtStr string, key string) (*AccessToken, error)
- func (token *AccessToken) GeneratePayload() map[string]interface{}
- func (token *AccessToken) Headers() map[string]interface{}
- func (token *AccessToken) Payload() map[string]interface{}
- func (token *AccessToken) ToJwt() (string, error)
- type AccessTokenParams
- type BaseGrant
- type ChatGrant
- type ConversationsGrant
- type Incoming
- type IpMessagingGrant
- type Jwt
- type Outgoing
- type PlaybackGrant
- type SyncGrant
- type TaskRouterGrant
- type TokenType
- type VideoGrant
- type VoiceGrant
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AccessToken ¶
type AccessToken struct {
// List of permissions that the token grants
Grants []BaseGrant `json:"grants,omitempty"`
// Twilio Account SID
AccountSid string `json:"account_sid,omitempty"`
// API key
SigningKeySid string `json:"signing_key_sid,omitempty"`
// User's identity
Identity string `json:"identity,omitempty"`
// User's region
Region interface{} `json:"region,omitempty"`
// contains filtered or unexported fields
}
func CreateAccessToken ¶
func CreateAccessToken(params AccessTokenParams) AccessToken
func (*AccessToken) AddGrant ¶
func (token *AccessToken) AddGrant(grant BaseGrant)
func (*AccessToken) FromJwt ¶
func (token *AccessToken) FromJwt(jwtStr string, key string) (*AccessToken, error)
Decode a JWT string into a Jwt struct. jwt - JWT string key - string key used to verify the JWT signature; if not provided, then validation is skipped
func (*AccessToken) GeneratePayload ¶
func (token *AccessToken) GeneratePayload() map[string]interface{}
func (*AccessToken) Headers ¶
func (token *AccessToken) Headers() map[string]interface{}
func (*AccessToken) Payload ¶
func (token *AccessToken) Payload() map[string]interface{}
func (*AccessToken) ToJwt ¶
func (token *AccessToken) ToJwt() (string, error)
Encode this JWT struct into a string. algorithm - algorithm used to encode the JWT that overrides the default ttl - specify ttl to override the default
type AccessTokenParams ¶
type AccessTokenParams struct {
// Twilio Account sid
AccountSid string
// The issuer of the token
SigningKeySid string
// The secret used to sign the token
Secret string
// Identity of the token issuer
Identity string
// User's Region
Region string
// Time in secs since epoch before which this JWT is invalid, defaults to now
Nbf float64
// Time to live of the JWT in seconds, defaults to 1 hour
Ttl float64
// Time in secs since epoch this JWT is valid for. Overrides ttl if provided.
ValidUntil float64
// Access permissions granted to this token
Grants []BaseGrant
}
type ChatGrant ¶
type ConversationsGrant ¶
type ConversationsGrant struct {
ConfigurationProfileSid string `json:"configuration_profile_sid"`
}
func (*ConversationsGrant) Key ¶
func (conversationsGrant *ConversationsGrant) Key() string
func (*ConversationsGrant) ToPayload ¶
func (conversationsGrant *ConversationsGrant) ToPayload() map[string]interface{}
func (*ConversationsGrant) ToString ¶
func (conversationsGrant *ConversationsGrant) ToString() string
type IpMessagingGrant ¶
type IpMessagingGrant struct {
ServiceSid string `json:"service_sid"`
EndpointID string `json:"endpoint_id"`
DeploymentRoleSid string `json:"deployment_role_sid"`
PushCredentialSid string `json:"push_credential_sid"`
}
func (*IpMessagingGrant) Key ¶
func (ipMessagingGrant *IpMessagingGrant) Key() string
func (*IpMessagingGrant) ToPayload ¶
func (ipMessagingGrant *IpMessagingGrant) ToPayload() map[string]interface{}
func (*IpMessagingGrant) ToString ¶
func (ipMessagingGrant *IpMessagingGrant) ToString() string
type Jwt ¶
type Jwt struct {
// The secret used to encode the JWT token.
SecretKey string
// The issuer of the JWT token.
Issuer string
// The subject of this JWT, omitted from the payload by default.
Subject string
// The algorithm used to encode the JWT token, defaults to 'HS256'.
Algorithm string
// Time in seconds before the JWT token is invalid. Defaults to now.
Nbf float64
// Time to live of the JWT in seconds; defaults to 1 hour.
Ttl float64
// Time in seconds since epoch this JWT is valid for. Override ttl if provided.
ValidUntil float64
DecodedHeaders map[string]interface{}
DecodedPayload map[string]interface{}
}
type PlaybackGrant ¶ added in v0.17.0
type PlaybackGrant map[string]interface{}
func (*PlaybackGrant) Key ¶ added in v0.17.0
func (playbackGrant *PlaybackGrant) Key() string
func (*PlaybackGrant) ToPayload ¶ added in v0.17.0
func (playbackGrant *PlaybackGrant) ToPayload() map[string]interface{}
func (*PlaybackGrant) ToString ¶ added in v0.17.0
func (playbackGrant *PlaybackGrant) ToString() string
type SyncGrant ¶
type TaskRouterGrant ¶
type TaskRouterGrant struct {
WorkspaceSid string `json:"workspace_sid"`
WorkerSid string `json:"worker_sid"`
Role string `json:"role"`
}
func (*TaskRouterGrant) Key ¶
func (taskRouterGrant *TaskRouterGrant) Key() string
func (*TaskRouterGrant) ToPayload ¶
func (taskRouterGrant *TaskRouterGrant) ToPayload() map[string]interface{}
func (*TaskRouterGrant) ToString ¶
func (taskRouterGrant *TaskRouterGrant) ToString() string
type VideoGrant ¶
type VideoGrant struct {
Room string `json:"room"`
}
func (*VideoGrant) Key ¶
func (videoGrant *VideoGrant) Key() string
func (*VideoGrant) ToPayload ¶
func (videoGrant *VideoGrant) ToPayload() map[string]interface{}
func (*VideoGrant) ToString ¶
func (videoGrant *VideoGrant) ToString() string
type VoiceGrant ¶
type VoiceGrant struct {
Incoming Incoming `json:"incoming"`
Outgoing Outgoing `json:"outgoing"`
PushCredentialSid string `json:"push_credential_sid"`
EndpointID string `json:"endpoint_id"`
}
func (*VoiceGrant) Key ¶
func (voiceGrant *VoiceGrant) Key() string
func (*VoiceGrant) ToPayload ¶
func (voiceGrant *VoiceGrant) ToPayload() map[string]interface{}
func (*VoiceGrant) ToString ¶
func (voiceGrant *VoiceGrant) ToString() string
Source Files
¶
Click to show internal directories.
Click to hide internal directories.