Yoti Ruby SDK

Build Status Coverage Bugs Code Smells Vulnerabilities

Welcome to the Yoti Ruby SDK. This repository contains the tools you need to quickly integrate your Ruby back-end with Yoti so that your users can share their identity details with your application in a secure and trusted way.

Table of Contents

  1. Requirements - Everything you need to get started

  2. Installing the SDK - How to install our SDK

  3. Setup - Setup required before using the Yoti services

  4. Products - Links to more information about the products offered by the Yoti SDK

  5. Support - Please feel free to reach out

Requirements

The Yoti gem requires at least Ruby 2.4.0. If you're using a version of Ruby lower than 2.2.2 you might encounter issues when Bundler tries to install the Active Support gem. This can be avoided by manually requiring activesupport 4.2.

gem activesupport '~> 4.2'

Versions of Bundler > 1.13 will sort this dependency issue automatically. More info in this comment by André Arko.

Installing the SDK

To import the Yoti SDK inside your project, add this line to your application's Gemfile:

gem 'yoti'

And then execute:

bundle install

Or simply run the following command from your terminal:

gem install yoti

SDK Project Import

The gem provides a generator for the initialization file:

rails generate yoti:install

The generated initialisation file can be found in config/initializers/yoti.rb.

Setup

For each service you will need:

  • Your Client SDK ID, generated by Yoti Hub when you create (and then publish) your app.
  • Your .pem file. This is your own unique private key which your browser generates from the Yoti Hub when you create an application.

A minimal Yoti client initialisation looks like this:

Yoti.configure do |config|
  config.client_sdk_id = ENV['YOTI_CLIENT_SDK_ID']
  config.key_file_path = ENV['YOTI_KEY_FILE_PATH']
end

Make sure the following environment variables can be accessed by your app:

  • YOTI_CLIENT_SDK_ID
  • YOTI_KEY_FILE_PATH

The following options are available:

Config Required Default Note
client_sdk_id Yes SDK identifier generated by when you publish your app
key_file_path Yes Path to the pem file generated when you create your app
api_url No https://api.yoti.com Path to Yoti URL used for debugging purposes
api_port No 443 Path to Yoti port used for debugging purposes

Keeping your settings and access keys outside your repository is highly recommended. You can use gems like dotenv to manage environment variables more easily.

Deploying to Heroku / AWS Elastic Beanstalk

Although we recommend using a pem file to store your secret key, and take advantage of the UNIX file permissions, your hosting provider might not allow access to the file system outside the deployment process.

If you're using Heroku or other alternative services, you can store the content of the secret key in an environment variable.

Your configuration should look like this:

Yoti.configure do |config|
  config.client_sdk_id = ENV['YOTI_CLIENT_SDK_ID']
  config.key = ENV['YOTI_KEY']
end

Where YOTI_KEY is an environment variable with the following format: YOTI_KEY="-----BEGIN RSA PRIVATE KEY-----\nMIIEp..."

An easier way of setting this on Heroku would be to use the Heroku Command Line

heroku config:add YOTI_KEY ="$(cat your-access-security.pem)"

Products

The Yoti SDK can be used for the following products, follow the links for more information about each: 1) Yoti app integration - Connect with already-verified customers. 1) Yoti Doc Scan - Identity verification embedded in your website or app.

Support

For any questions or support please email [email protected]. Please provide the following to get you up and working as quickly as possible:

  • Computer type
  • OS version
  • Version of Ruby being used
  • Screenshot

Once we have answered your question we may contact you again to discuss Yoti products and services. If you’d prefer us not to do this, please let us know when you e-mail.