Ruby helper

The Ruby helper library is used to generate the capability token. The capability token is used by Sift Javascript library.

Installation Instructions

To install the Sift ruby helper library, use the following command.

gem install gridspace


Before installing the gem, makes sure ruby and gem are installed. Debian users may also need to install rvm.

Helper Library Functions

class Gridspace::Sift::Capability

The Capability token is a token that encodes the permissions granted to a Gridspace relying-party client (e.g., your client).

classmethod Capability.initialize()

Creates a capability token.

account_id is the account id to which this token is granted access.

auth_token is the secret key used to sign the token. Note, this auth token is not visible to the user of the token.

This method returns a new Capability with zero permissions.

classmethod Capability.allow_client_incoming(client_name)

Allows the user of this token to accept incoming connections at the given client name. This function grants the Capability the permission to allow incoming connections.

client_name is the client name to accept calls from. This should be unique among all clients using capability tokens generated from a given API account.

classmethod Capability.allow_client_outgoing(app_id, params={})

Allows the user of this token to make outgoing connections. Keyword arguments are passed to the application. This function grants the Capability the permission to allow outgoing connections.

app_id is the id of the Application to contact.

params are the extra parameters that will be passed to Application

classmethod Capability.generate(expires = 3600)

Generates a capability token with an expiration date.

expires is the token lifetime, in seconds. Default to 1 hour (3600)


require 'gridspace'
# replace ACCOUNT_ID and AUTH_TOKEN with your API account's information
capability =, AUTH_TOKEN)
# Replace APP_ID with the id of an application object
# Replace CLIENT_NAME with the unique client handle
token = capability.generate
# token now contains the capability token, which can be used by Sift Javascript library

The above example shows how to generate a Capability token. APP_ID is the id of an Application. CLIENT_NAME is the unique handle used by CallClient to connect to the client’s user agent.

See Calling a WebRTC endpoint for a detailed example on how to use the capability token.