Skip to content

Commit 40aee14

Browse files
committed
README.md updated
1 parent 3d69678 commit 40aee14

1 file changed

Lines changed: 83 additions & 3 deletions

File tree

README.md

Lines changed: 83 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,84 @@
1-
# Typing-Biometrics-JSAPI
2-
JavaScript API for recording typing biometrics information/typing patterns for any text
1+
# TypingDNA JavaScript recorder
2+
##### A simple way to record typing patterns
3+
Full documentation at [api.typingdna.com](https://api.typingdna.com)*
34

4-
[Find out more](http://typingdna.com) about TypingDNA and typing biometrics/keystroke dynamics.
5+
### Usage and description
6+
First create an instance of the TypingDNA class. Once it's done, the user typing starts being recorded (as a history of strokes). Whenever you want to get the user's typing pattern you have to invoke .getTypingPattern method described in detail below.
7+
**Returns**: Returns the instance of the TypingDNA class (singleton)
8+
**Example**
9+
```js
10+
var tdna = new TypingDNA();
11+
```
12+
Here are the functions available in the TypingDNA class:
13+
* Main:
14+
* .getTypingPattern(optionsObject) ⇒ `String`
15+
* Optional:
16+
* .addTarget()
17+
* .removeTarget()
18+
* .start() *Automatically called by default*
19+
* .stop()
20+
* .reset()
21+
* .getQuality(typingPattern) ⇒ `Number`
22+
23+
24+
### TypingDNA.getTypingPattern(optionsObject) ⇒ `String`
25+
This is the main function that outputs the user's typing pattern as a String
26+
27+
**Returns**: A typing pattern in String form
28+
**optionsObject**: An object of the following form {type:Number, text:String, textId:Number, length: Number, extended:Boolean}. Detail table below.
29+
30+
| Param | Type | Description |
31+
| --- | --- | --- |
32+
| **type** | `Number` | `0 for anytext pattern` (when you compare random typed texts of usually 120-180 chars long) <br> `1 for diagram pattern` (recommended in most cases, for emails, passwords, phone numbers, credit cards, short texts) |
33+
| **text** | `String` | (Only for type 1) a typed string that you want the typing pattern for |
34+
| **textId** | `Number` | (Optional, only for type 1) a personalized id for the typed text |
35+
| **length** | `Number` | (Optional) the length of the text in the history for which you want the typing pattern, for type 0 is usually 140 or more |
36+
| **extended** | `Boolean` | (Only for type 1) specifies if full information about what was typed is produced, including the actual key pressed, if false, only the order of pressed keys is kept (no actual content) |
37+
38+
**Examples**
39+
```js
40+
var diagramPattern = tdna.getTypingPattern({type=1, text="Hello5g21?*", extedend=false});
41+
var extendedDiagramPattern = tdna.getTypingPattern({type=1, length=160, extended=true});
42+
var generalPattern = tdna.getTypingPattern({type=0, length=160});
43+
```
44+
45+
### TypingDNA.addTarget(element_id)
46+
(Optional) Adds a target to the targetIds array. It has to be a text input or text area or any other HTML DOM element that has the .value property. You can add multiple targets (such as username and password fields).
47+
48+
If you omit adding targets the typing patterns will be outputed for the entire typing session.
49+
50+
**Example**
51+
```js
52+
TypingDNA.addTarget(emailaddr_id)
53+
TypingDNA.addTarget(password_id)
54+
```
55+
56+
### TypingDNA.removeTarget(element_id)
57+
Remove a target from the targetIds array.
58+
59+
### TypingDNA.reset()
60+
Resets the history stack of recorded typing events.
61+
62+
### TypingDNA.start()
63+
Automatically called at initilization. It starts the recording of typing events. You only have to call .start() to resume recording after a .stop()
64+
65+
### TypingDNA.stop()
66+
Ends the recording of further typing events.
67+
68+
### TypingDNA.getQuality(typingPattern) ⇒ `Number`
69+
Checks the quality of a general typing pattern (type 0), how well it is revelated, how useful the
70+
information will be for matching applications.
71+
72+
**Returns**: `Number` - A real number between `0` and `1`. Values over `0.3` are acceptable, however a value over `0.7` shows good pattern strength.
73+
74+
| Param | Type | Description |
75+
| --- | --- | --- |
76+
| typingPattern | `String` | The type `0` pattern string returned by the getTypingPattern() function. |
77+
78+
**Example**
79+
```js
80+
var patternQuality = tdna.getQuality(typingPattern);
81+
```
82+
83+
### License
84+
Apache License, [Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)

0 commit comments

Comments
 (0)