dwn
- Description:
- The name of the javascript variable that will be used when invoking profiling, defaults to dwn.
The name can be changed in journey.
Example
// create a profiling handle when page loaded
handle = dwn.start(config);
// collect fingerprint data blob, collect() is a promise
handle.collect().then(
(fp_data) => {
// if be sure profiling all done, stop profiling
// otherwise not need to stop it
handle.stop()
// processing FP data blob, send it to API server ...
},
(error) => {
// handle the error
}
);
// collect fingerprint data blob, tryCollect() is NOT a promise will return a fingerprint data blob immediately
fp_data = handle.tryCollect()
// processing FP data blob, send it to API server ...
Methods
(static) collect()
- Description:
- Collecting fingerprint data blob, it returns a Promise
Example
// create a profiling handle when page loaded
handle = dwn.start(config);
// collect fingerprint data blob, collect() is a promise
handle.collect().then(
(fp_data) => {
// fp_data is base64 fingerprint data string
// processing fingerprint data blob, send it to API server ...
},
(error) => {
// handle the error
}
);
(static) start(config)
- Description:
- Collecting fingerprint data blob, it returns a Promise
Parameters:
Name |
Type |
Description |
config |
Map.<string, any>
|
{
// when geo is true, some browsers may pop up a window to ask permission
"geo": true,
// when use_deep_query_selector = true, profiling will try to allocate key input field within shodow DOM
"use_deep_query_selector": true,
// profiling_debug will send back some useful details about excepted profiling behaviours
// very good for investigating some profiling issues
"profiling_debug": false,
// applying keyboard biometrics on selected key input fields
"key_bm": [
{
// locate the input field
"selector": "form input[name='username']",
// apply the darwinim context on it, see context list Contexts
"context": "username",
},
{
"selector": "form input[name='password']",
"context": "password",
}
],
}
|
(static) stop()
- Description:
- Stopping profiling, only call it when collect() called and be sure all profiling done
It will stop all biometrics event listeners
It's ok if you don't call stop() at all
Example
// create a profiling handle when page loaded
handle = dwn.start(config);
// if sure all profiling done
handle.stop();
let fp_data = handle.tryCollect();
// processing fingerprint data blob, send it to API server ...
(static) tryCollect()
- Description:
- Collecting fingerprint data blob, it returns fingerprint data string immediately
Example
// create a profiling handle when page loaded
handle = dwn.start(config);
// collect fingerprint data blob
let fp_data = handle.tryCollect();
// processing fingerprint data blob, send it to API server ...