|
1 | | -# Acuant JavaScript Web SDK v11.4.4 |
| 1 | +# Acuant JavaScript Web SDK v11.4.5 |
2 | 2 |
|
3 | 3 |
|
4 | | -**March 2021** |
| 4 | +**June 2021** |
5 | 5 |
|
6 | 6 | See [https://github.com/Acuant/JavascriptWebSDKV11/releases](https://github.com/Acuant/JavascriptWebSDKV11/releases) for release notes. |
7 | 7 |
|
@@ -76,12 +76,19 @@ The SDK includes the following modules: |
76 | 76 |
|
77 | 77 | AcuantJavascriptWebSdk.start(); |
78 | 78 | |
79 | | -1. Set the token credentials and ACAS endpoint required to initialize the Worker. |
| 79 | +1. Set the credentials (either bearer token or basic auth format in base64) and ACAS endpoint required to initialize the Worker. |
80 | 80 |
|
81 | 81 | function initialize( |
82 | 82 | token : string, //Acuant credentials in base64 (basic auth format id:pass) |
83 | 83 | endpoint : string, //endpoint for Acuant's ACAS server |
84 | 84 | callback: object); //callback shown below |
| 85 | + |
| 86 | + //or |
| 87 | + |
| 88 | + function initializeWithToken( |
| 89 | + token : string, //bearer token |
| 90 | + endpoint : string, //endpoint for Acuant's ACAS server |
| 91 | + callback: object); //callback shown below |
85 | 92 |
|
86 | 93 | var callback = { |
87 | 94 | onSuccess:function(){ |
@@ -505,8 +512,48 @@ The following may significantly increase errors or false results: |
505 | 512 | "NotFound" |
506 | 513 | } |
507 | 514 | }) |
508 | | - |
509 | | -### Known Issues: |
| 515 | + |
| 516 | + |
| 517 | +---------- |
| 518 | + |
| 519 | +## Use of CDNs (Content Delivery Networks) |
| 520 | + |
| 521 | +Web Workers/WASM and CDNs can be used together with workarounds. The following changes would need to be added to your code to host the Web Workers/WASM through a CDN: |
| 522 | + |
| 523 | +1. Add the following code to point to the Worker: |
| 524 | + |
| 525 | + <script id="AcuantWebWorkerSource" type="worker"> |
| 526 | + importScripts("https://your.CDN.URL/AcuantImageProcessingWorker.min.js"); |
| 527 | + </script> |
| 528 | + |
| 529 | +1. Add the following function in your code: |
| 530 | + |
| 531 | + function getURL() { |
| 532 | + const txt = document.getElementById( 'AcuantWebWorkerSource' ).textContent; |
| 533 | + return URL.createObjectURL( new Blob( [ txt ] ) ); |
| 534 | + } |
| 535 | + |
| 536 | +1. Before calling initialize, replace the path in acuantConfig with result of the getURL(): |
| 537 | + |
| 538 | + acuantConfig.path = getURL(); |
| 539 | + |
| 540 | +1. The initialize function contains a fourth variable that is set to 0 by default. Change this value to 1. |
| 541 | + |
| 542 | + AcuantJavascriptWebSdk.initialize(base64Token, acas_endpoint, callback, 1); |
| 543 | + //or |
| 544 | + AcuantJavascriptWebSdk.initializeWithToken(oauthToken, acas_endpoint, callback, 1); |
| 545 | + |
| 546 | +1. Web Workers running from CDNs have issues with relative URLs. In order for the Web Worker to be able to find the associated .wasm file you will need to provide it with the absolute URL of the wasm file. |
| 547 | + |
| 548 | +- Acuant provides a script within the repo called convert_for_cdn.sh. Run this script by giving it the path to the AcuantImageProcessingWorker.min.js and the full URL for the .wasm file and it will modify AcuantImageProcessingWorker.min.js for you. Please note the script conducts limited sanity checks and if given the wrong parameters might behave unexpectedly. |
| 549 | + |
| 550 | + bash convert_for_cdn.sh webSdk/dist/AcuantImageProcessingWorker.min.js https://your.CDN.URL/AcuantImageProcessingWorker.wasm |
| 551 | + |
| 552 | +- If the script doesn't provide the desired outcome, or if you prefer to manually edit the file, open the AcuantImageProcessingWorker.min.js file with your preferred text editor. Find the section of code that reads: wasmBinaryFile="AcuantImageProcessingWorker.wasm"; and replace the value of the string with the absolute URL for the .wasm file. |
| 553 | + |
| 554 | +---------- |
| 555 | + |
| 556 | +## Known Issues |
510 | 557 |
|
511 | 558 | 1. When using Passive Liveness camera on Google Chrome for Android, the camera defaults to the back facing instead of the front facing camera. Users can tap to switch to the front facing camera. |
512 | 559 |
|
|
0 commit comments