Installation and usage

This project depends on the rbnacl gem, which requires the libsodium cryptographic library.

Before going further, please follow instructions to install libsodium.

Then, add this line to your application's Gemfile:

gem 'tanker-identity', git: 'https://github.com/TankerHQ/identity-ruby' #, tag: 'vX.Y.Z'

Create identity

Create a new Tanker identity. This identity is secret and must only be given to a user who has been authenticated by your application. This identity is used by the Tanker client SDK to open a Tanker session.

def create_identity(app_id, app_secret, user_id)
Parameters
app_id: string The app ID, you can access it from the Tanker dashboard
app_secret: string The app secret, secret that you have saved right after the creation of your app
user_id: string The unique ID of a user in your application
Returns
string An identity

Provisional identity

Create a Tanker provisional identity. It allows you to share a resource with a user who does not have an account in your application yet. It must be served to an authenticated user, and attached client-side to access the resource. You will need to verifiy the associated email.

def create_provisional_identity(app_id, email)
Parameters
app_id: string The app ID, you can access it from the Tanker dashboard
email: string The email associated with the provisional identity
Returns
string A provisional identity

Public identity

Return the public identity from an identity or a provisional identity. This public identity can be used by the Tanker client SDK to share encrypted resource.

def get_public_identity(identity)
Parameters
identity: string An identity or a provisional identity
Returns
string A public identity

Upgrade user token

Return a Tanker identity from Tanker v1 user Token. Tanker v1 used a user token, when migrating to Tanker v2 you should use this function to migrate you used tokens to identities.

def upgrade_user_token(app_id, user_id, user_token)
Parameters
app_id: string The app ID, you can access it from the Tanker dashboard
user_id: string The unique ID of a user in your application
user_token: string The Tanker v1 user token
Returns
string An identity