Skip to content

Commit f599ca1

Browse files
added v11.4.5
1 parent 1024f91 commit f599ca1

File tree

8 files changed

+128
-17
lines changed

8 files changed

+128
-17
lines changed

SimpleHTMLApp/README.md

Lines changed: 52 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# Acuant JavaScript Web SDK v11.4.4
1+
# Acuant JavaScript Web SDK v11.4.5
22

33

4-
**March 2021**
4+
**June 2021**
55

66
See [https://github.com/Acuant/JavascriptWebSDKV11/releases](https://github.com/Acuant/JavascriptWebSDKV11/releases) for release notes.
77

@@ -76,12 +76,19 @@ The SDK includes the following modules:
7676

7777
AcuantJavascriptWebSdk.start();
7878
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.
8080

8181
function initialize(
8282
token : string, //Acuant credentials in base64 (basic auth format id:pass)
8383
endpoint : string, //endpoint for Acuant's ACAS server
8484
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
8592

8693
var callback = {
8794
onSuccess:function(){
@@ -505,8 +512,48 @@ The following may significantly increase errors or false results:
505512
"NotFound"
506513
}
507514
})
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
510557

511558
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.
512559

SimpleHTMLApp/app/index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<html>
2-
<header>
2+
<head>
33
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
44
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
55

@@ -84,7 +84,7 @@
8484
cursor: pointer;
8585
}
8686
</style>
87-
</header>
87+
</head>
8888

8989
<body>
9090
<p id="desc"></p>
@@ -199,6 +199,7 @@ <h3>Live Camera failed to open. Start manual capture</h3>
199199

200200
function init() {
201201
let base64Token = btoa(Credential.id_username + ':' + Credential.id_password);
202+
//alternatively AcuantJavascriptWebSdk.initializeWithToken replacing base64Token with the oauth token leaving the rest the same
202203
AcuantJavascriptWebSdk.initialize(base64Token, Credential.acas_endpoint, {
203204
onSuccess: function () {
204205
showCameraButton();

SimpleHTMLApp/convert_for_cdn.sh

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash
2+
3+
#Convert to absolute url for use with CDNs
4+
#$1=file location
5+
#$2=absolute url
6+
#$3=optional regex override
7+
#Sergey Maltsev
8+
9+
10+
if [ -z "$1" ]
11+
then
12+
echo "Specify File Location."
13+
exit 1
14+
else
15+
if ! [[ -f "$1" ]]
16+
then
17+
echo "Param 1 was not a file."
18+
exit 1
19+
fi
20+
fi
21+
22+
if [ -z "$2" ]
23+
then
24+
echo "Specify Absolute Url."
25+
exit 1
26+
fi
27+
28+
if [ "$3" != "-f" ]
29+
then
30+
if ! [[ "$2" =~ ^https://.+/AcuantImageProcessingWorker\.wasm$ ]]
31+
then
32+
echo "URL did not match regex, double check and add -f to override."
33+
exit 1
34+
fi
35+
else
36+
echo "Bypassing URL checks."
37+
fi
38+
39+
if [ -n "$4" ]
40+
then
41+
echo "Too Many Params."
42+
exit 1
43+
fi
44+
45+
FILE="$1"
46+
URL="$2"
47+
48+
sed -i.backup 's|wasmBinaryFile="AcuantImageProcessingWorker.wasm"|wasmBinaryFile="'"${URL}"'"|g' "$FILE"
49+
50+
echo "Done"
51+
exit 0
-112 Bytes
Binary file not shown.

SimpleHTMLApp/webSdk/dist/AcuantImageProcessingWorker.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
1.41 KB
Binary file not shown.

SimpleHTMLApp/webSdk/dist/AcuantJavascriptWebSdk.js

Lines changed: 20 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SimpleHTMLApp/webSdk/dist/AcuantJavascriptWebSdk.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)