1.0.3 • Published 4 years ago

@au10tix/websdk v1.0.3

Weekly downloads
-
License
See license in LI...
Repository
-
Last release
4 years ago

AU10TIX WebSDK

Au10tix SDK helps user to find the most suitable image for Au10tix api usage.

The SDK’s main features are:

  • Uploading image files from the file dialog box
  • Cropping images
  • Taking pictures of documents or selfies.
  • Generating json or FormData objects for the relevant images

Audience

This SDK is designed for people familiar with JavaScript programming and object-oriented programming concepts, and wants to use Au10tix api.

Installation

Loading using a <script> tag

To load the SDK use a script tag like the one in the following example:

<script src="PATH_TO_SCRIPT/AU10TIXSdk.js"></script>

Using npm

npm install @AU10TIX/websdk

Usage

Using <script> tag

const sdk = sdk();

Using npm

import Sdk from '@AU10TIX/websdk';
const sdk = Sdk();

API

The SDK Object exposes the following functions: 1. identifyBySelfie 2. identifyByDocument 3. changeCamera 4. takePhoto 5. closeCamera 6. uploadImage 7. cropImage 8. jsonGenerator 9. formDataGenerator

Identification by selfie or document

The identifyBySelfie and the identifyByDocument functions are responsible for capturing a selfie and a document image.

The functions accept the following arguments:

  • videoElement - an html video DOM element which consumes the camera stream. For security reasons, a camera stream does not start without it and will not work.
  • options - an object that determines which camera to open ("front" or "back"). Note: Default is "front".

Functions usage example:

sdk.identifyBySelfie(videoElement, { facingMode: "front" });

Change camera

Switch between the device cameras if possible.
Function usage example:

sdk.changeCamera() 

Take photo

Take photo from camera’s stream.
Returns a promise that resolves to the base64 encoded image.

Function usage example:

sdk.takePhoto().then((base64 Image) => {
 // do something with the photo
}) 

Close camera

Closes all camera related sessions (server communication, camera stream, etc…)
Function usage example:

sdk.closeCamera()

Upload Image

Automatically opens the mobile device’s library / camera or the file dialog on desktop computers and returns a Promise that resolves to the selected base64 encoded image

sdk.uploadImage().then((base64Image) => {
    // do something with the photo
});

Crop Image

Crops the image by coordinates and measurements.
The function returns a Promise that resolves to the cropped image. The function accepts the following arguments:
The function accept the following arguments:

  • dx - the top-left x-axis coordinate corner of the source image on which to start cropping.
  • dy - the top-left y-axis coordinate corner of the source image on which to start cropping.
  • height - the height for which to end the cropping.
  • width - the width for which to end the cropping.

Function usage example:

sdk.cropImage(img.src, 0, 0, 100, 200).then((base64Image) => {
   // do something with the cropped image
});

JSON Generator

Generates an object that is suitable for the AU10TIX API (see AU10TIX BOS REST API 2.3). The function accepts an array with two possible values: “front”,“back”. The jsonGenerator function is invoked by the formDataGenerator function and returns a corresponding JSON object that will be added to the FormData object. Function usage example:

const json = sdk.jsonGenerator (['front', 'back']);

The result would look like:

{
    identityDocumentProcessingRequest: {
            imageSource: "Au10tixWebSdkFile",
            documentPages: [
                { documentImages: [{ imageUri: "documentImage_Page0" }] },            
                { documentImages: [{ imageUri: "documentImage_Page1" }] }            
            ]
}

FormData Generator

Generates object that is suitable to send to AU10TIX API, The function accepts the following arguments:

  • frontPageDocumentImage - suitable image for AU10TIX identification by document front page
  • backPageDocumentImage - suitable image for AU10TIX identification by document back page
  • photoForFaceComparison - suitable image for AU10TIX identification by selfie

The function calls the jsonGenerator function for generating the suitable JSON object and returns the matching FormData object. The images can be passed as either Blob or as a base64 encoded string.

The resulting object (FormData) contains the binary data of the images (Blob). In case a base64 encoded string is passed, it is converted to a Blob.

Function usage example:

sdk.formDataGenerator(frontPageDocumentImage, backPageDocumentImage, photoForFaceComparison)
        .then (formData => {
            //do something with the formData object            
        });

License

AU10TIX WEB SDK OPEN SOURCE LICENCE VERSION 1.O Copyright 2020 AU10TIX LIMITED

Please read this License carefully before downloading or using this software. By downloading or using this software, you are agreeing to be bound by the terms of this License. If you do not or cannot agree to the terms of this License, please do not download or use the software. 1. General; Definitions. This License applies to any program or other work which Au10tix Limited and/or any its subsidiaries ("Au10tix") makes publicly available and which contains a notice placed by Au10tix identifying such program or work as "Original Code" and stating that it is subject to the terms of this Au10tix Open Source License ("License"). As used in this License: 1.1 "Covered Software" means the "AU10TIX Web SDK" Source Code as released under this License by Au10tix Limited, including any Modifications and/or portions thereof. 1.2 "Distribution" means: (a) to sublicense, distribute or otherwise make Covered Software available, directly or indirectly, to anyone other than You; and/or (b) to use Covered Software, alone or as part of a Larger Work, in any way to provide a service, including but not limited to submission of content, through electronic communication with a client other than You. 1.3 "Larger Work" means a work, which combines Covered Software or portions thereof with code not governed by the terms of this License. 1.4 "Modifications" means any addition to or deletion from the substance or structure of either the Original Code or any previous Modifications. When Covered Software is released as a series of files, a Modification is: (a) Any addition to or deletion from the contents of a file containing Original Code or previous Modifications. (b) Any new file that contains any part of the Original Code or previous Modifications. 1.5 "Original Code" means the original version of the Covered Software accompanying this Agreement as released by Au10tix, including source code, object code and documentation, if any. 1.6 "You" or "Your" means a person or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" or "Your" includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition "control" means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of fifty percent (50%) or more of the outstanding shares or beneficial ownership of such entity. 2. Permitted Uses; Conditions & Restrictions. Subject to the terms and conditions of this License, Au10tix hereby grants You, effective on the date You accept this License and download the Original Software, a world-wide, royalty-free, non-exclusive license, to the extent of Au10tix's Applicable Patent Rights and copyrights covering the Original Software, to use, reproduce, display, perform, internally distribute within Your organization, and/or externally Distribute, unmodified copies of the Original Code, for commercial or non-commercial purposes, provided that in each instance: a. You must retain and reproduce in all copies of Original Code proprietary notices and disclaimers of Au10tix as they appear in the Original Code, and keep intact all notices in the Original Code that refer to this License; and b. You must include a copy of this License with every copy of Covered Software and documentation You Distribute, and You may not offer or impose any terms on such Covered Software that alter or restrict this License or the rights granted hereunder, except as permitted under Section 5. 3. Larger Works. You may create a Larger Work by combining Covered Software with other code not governed by the terms of this License and distribute the Larger Work as a single product. In each such instance, You must make sure the requirements of this License are fulfilled for the Covered Software or any portion thereof. 4. Patent License Limitations. Except as expressly set forth herein, Au10tix does not grant other intellectual property rights, either express or implied. Patent Licensing of Larger Works may require additional licenses from Au10tix, to be granted under its sole discretion. 5. Additional Terms. In Distributing the Covered Software, alone or as part of Larger Works, You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations and/or other rights consistent with the scope of the license granted herein ("Additional Terms"). However, You may do so only on Your own behalf and under Your sole responsibility, and not on behalf of Au10tix. You must obtain the recipient's agreement and acknowledgement that any such Additional Terms are offered by You alone, and You hereby agree to indemnify, defend and hold Au10tix harmless for any liability incurred by or claims asserted against Au10tix in relation to any such Additional Terms. 6. Versions of the License. Au10tix may publish revised and/or new versions of this License from time to time. Each version will be given a distinguishing version number. Once Covered Software has been published under a certain version of this License, You may continue using it under the terms of that version. You may also choose to use such Covered Software under the terms of any later version of this License published by Au10tix. Au10tix alone and no one else has the right to modify the terms applicable to Covered Software. 7. EXCEPT AS OTHERWISE SET OUT IN AN AGREEMENT BETWEEN YOU AND AU10TIX, AU10TIX LTD AND ITS LICENSORS MAKE NO REPRESENTATION, WARRANTY, OR GUARANTY AS TO THE RELIABILITY, TIMELINESS, QUALITY, SUITABILITY, TRUTH, AVAILABILITY, ACCURACY OR COMPLETENESS OF THE COVERED SOFTWARE. AU10TIX LTD AND ITS LICENSORS DO NOT REPRESENT OR WARRANT THAT (A) THE USE OF THE COVERED SOFTWARE WILL BE TIMELY, UNINTERRUPTED OR ERROR-FREE OR OPERATE IN COMBINATION WITH ANY OTHER HARDWARE, SOFTWARE, SYSTEM OR DATA, (B) THE COVERED SOFTWARE WILL MEET YOUR REQUIREMENTS OR EXPECTATIONS, OR (C) ANY STORED DATA WILL BE ACCURATE OR RELIABLE, (D) THE QUALITY OF ANY PRODUCTS, SERVICES, INFORMATION, OR OTHER MATERIAL PURCHASED OR OBTAINED BY YOU THROUGH THE COVERED SOFTWARE WILL MEET YOUR REQUIREMENTS OR EXPECTATIONS. THE COVERED SOFTWARE IS PROVIDED TO YOU STRICTLY ON AN “AS IS” BASIS. ALL CONDITIONS, REPRESENTATIONS AND WARRANTIES, WHETHER EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT OF THIRD-PARTY RIGHTS, ARE HEREBY DISCLAIMED TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW BY AU10TIX LTD AND ITS LICENSORS. NO ORAL OR WRITTEN INFORMATION OR ADVICE GIVEN BY AU10TIX, AN AU10TIX AUTHORIZED REPRESENTATIVE SHALL CREATE A WARRANTY. 8. LIMITATION OF LIABILITY. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT SHALL AU10TIX BE LIABLE FOR ANY INCIDENTAL, SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO THIS LICENSE OR YOUR USE OR INABILITY TO USE THE COVERED SOFTWARE, OR ANY PORTION THEREOF, DAMAGES FOR LOSS OF DATA, OR SOFTWARE RESTORATION, WHETHER UNDER A THEORY OF CONTRACT, WARRANTY, TORT (INCLUDING NEGLIGENCE), PRODUCTS LIABILITY OR OTHERWISE, EVEN IF AU10TIX HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOTWITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE OF ANY REMEDY. IN NO EVENT SHALL AU10TIX'S TOTAL LIABILITY TO YOU FOR ALL DAMAGES (SAVE THAN SUCH THAT MAY NOT BE RESTRICTED BY APPLICABLE LAW) UNDER THIS LICENSE EXCEED THE AMOUNT OF FIFTY DOLLARS ($50.00). 9. Trademarks. This License does not grant any rights to use Au10tix’s trademarks or trade names or any other trademarks, service marks, logos or trade names belonging to Au10tix. 10. Ownership. Subject to the licenses granted under this License, Au10tix retains all rights, title and interest in and to the Covered Software and to any Modifications made by or on behalf of Au10tix. Au10tix may, at its sole discretion, choose to license such Modifications under this License, or on different terms from those contained in this License or may choose not to license them at all. 11. Third Party Open Source Software. The Covered Software includes certain third-party open source software developed and licensed under a MIT License (MIT) by Jacob Seidelin. Accordingly, the use of the Covered Software is further subject to the license terms and conditions required under the MIT License (MIT) agreement as set forth and located at: https://github.com/exif-js/exif-js/blob/master/LICENSE.md, as may be amended from to time. You are always required and assume the obligation herein and part of this SDK license to adhere to such license terms. 12. Termination. This License and the rights granted hereunder will terminate automatically without notice from Au10tix if You fail to comply with any term(s) of this License and fail to cure such breach within 30 days of becoming aware of such breach; 12.1 Effect of Termination. Upon termination, You agree to immediately stop any further use, reproduction, modification, sublicensing and Distribution of the Covered Software. All sublicenses to the Covered Software which have been properly granted prior to termination shall survive any termination of this License. Provisions which, by their nature, should remain in effect beyond the termination of this License shall survive, including but not limited to Sections 2, 5, 7, 8, 9, 10, 12, 13. Miscellaneous. 13.1 Relationship of Parties. This License will not be construed as creating an agency, partnership, joint venture or any other form of legal association between or among You and Au10tix, and You will not represent to the contrary, whether expressly, by implication, appearance or otherwise. 13.2 Independent Development. Nothing in this License will impair Au10tix's right to acquire, license, develop, have others develop for it, market and/or distribute technology or products that perform the same or similar functions as, or otherwise compete with Larger Works, technology or products that You may develop, produce, market or distribute. 13.3 Waiver; Construction. Failure to enforce at any time any of the provisions of this License f shall in no way be construed to be a waiver of such provisions or to affect the validity of this License, or any Party hereof, or the right of either Party thereafter to enforce each and every such provision in accordance with the terms of this License. 13.4 Severability. If any provision of this License is inconsistent or contrary to any applicable law, rule or regulation, then said provisions shall be deemed to be modified to the extent required to comply with said law, rule or regulation and as so modified, said provision and this License shall continue in full force and effect. 13.5 Entire Agreement; Governing Law. This License represents the complete agreement concerning subject matter hereof. This License shall be governed by the laws of England and Wales, without giving effect to its choice of law provisions. The exclusive jurisdiction for the resolution of any and all disputes arising out of or in connection with this Agreement shall be a court of appropriate jurisdiction located in London, England. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded.

EXHIBIT A.

"The contents of this file are subject to the Au10tix Web SDK License Version 1.0 (the "License"); you may not use this file except in compliance with the License.

The Original Code and all software distributed under the License are distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND AU10TIX HEREBY DISCLAIM ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. See the License for the specific language governing rights and limitations under the License"

BROWSER SUPPORT

ChromeSafariFirefoxEdgeIENative Browser (Samsung)
Desktop--
Mobile Device Android--
Mobile Device IOS-----