Getting Started

There are just a few basic steps that are required to begin using Keystroke DNA:

  1. Identify the appropriate input fields to be verified with Keystroke DNA.
  2. Include KeystokeDNA.js into your HTML.
  3. Set up input fields using HTML attributes.

Identifying Input Fields

You can choose as many fields as you would like to be validated by Keystroke DNA and any text input field is acceptable. Initially, we recommend that either the username or email input field on your home login screen is used. This input field also serves as the user identifier for Keystroke DNA's validation process. The most important criterion is that the text input field is sufficiently long and contains at least 8 characters.

Using a phone number or other numeric identifier is also possible.

Password input fields can also be used by with a specific grant_type to make sure that the password itself is not recorded and remains confidential.

Let's define what a UserID is ...

Any unique identifier of a user can be used as the UserID with Keystroke DNA including username, email address, phone number, or any other unique user identifier. As its sole purpose is to identify and distinguish users, a depersonalized identifier generated by your system may also be used.

Code changes

There are few changes you will have to make in your client side and server side code.

Client-side changes

Loading Keystroke API code Libraries

To start using Keystroke DNA, you will need to include a loading script at the bottom of the body section of your webpage to asynchronously load the plugin:

You will require your API Key and Secret, which can be obtained by Joining Beta Program.

The KSDNA_SDK_URL variable contains a version number v0.4.1 that indicates the latest major release of the API and your {{your_api_key}} that is obtained through our Beta Program

Setting Up Input Fields

There can be one or more fields that are validated with Keystroke DNA and each of these input fields should be marked with the ksdna attribute. However, there should only be a single user identifier input field, which must be marked with the ksdna-uid attribute.

email and phrase fields will be will be analyzed with Keystroke DNA

Initializing the library

After all the input fields are set up, the following script should be added to signal that all the necessary fields have been created and are set up with Keystroke DNA tags:

Sign-in handler

Next you have to modify your login form handler and add KSDNA required data to your request.

You can choose your own names for fields e.g. signature and value and then operate with these on the server-side.

Submitting of your form

Next you have to modify your login form handler and add the required KSDNA data to your request.

You can select your own names for fields e.g. signature and value and then operate with these on the server-side.

Server-side changes

Configuration extension

If you have already have a configuration for your web application, then you have to include the two additional constants below:

YOUR_KSDNA_APP_ID and YOUR_KSDNA_APP_SECRET as noted above are obtained through Our Beta Program.

Getting a Bearer token

Next, you have to obtain a Bearer token to authorize all your calls to our API.

cURL

The response from us will be a standard JWT token.

Scoring the signature

At this point, you are fully equipped to begin receiving Keystroke DNA signature scores of your users' typing patterns through our service.

The code below illustrates how to extend your log-in process with KeystrokeDNA but you can implement it like an additional authentication checks.

cURL

There are a few key points to keep in mind when integrating Keystroke DNA into your web application:

  1. The username value can be read from any single field of your form (e.g. in a listing) or it can be assigned explicitly (e.g. an email hashed with a salt, or a UUID4 from a loaded by email user, etc.) but it must be unique for our system.
  2. You have to proxy a real User-Agent of your client to us because this field is mandatory and is used by our service.
  3. Fields value and signature are already prepared on the client-side so you can just proxy those.
  4. You have to usse your Bearer token to authenticate yourself for this call.

If the process was successful, you will receive a response similar to below:

Please note that a Keystroke DNA signature score of -1.0 is returned on the first call for every user.

A -1.0 score is also returned if a userId is not recognized. The user with such unrecognized userId will be automatically created in the system.