diff --git a/.travis.yml b/.travis.yml index 4f856616..87099880 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,6 +37,10 @@ jobs: node_js: "11" - <<: *test-compatibility node_js: "12" + - <<: *test-compatibility + node_js: "13" + - <<: *test-compatibility + node_js: "14" - &test-compatibility-osx <<: *test-compatibility os: osx diff --git a/examples/aml-check/package-lock.json b/examples/aml-check/package-lock.json index 631c9bc8..14f7dd32 100644 --- a/examples/aml-check/package-lock.json +++ b/examples/aml-check/package-lock.json @@ -848,9 +848,9 @@ } }, "lodash": { - "version": "4.17.17", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.17.tgz", - "integrity": "sha512-/B2DjOphAoqi5BX4Gg2oh4UR0Gy/A7xYAMh3aSECEKzwS3eCDEpS0Cals1Ktvxwlal3bBJNc+5W9kNIcADdw5Q==", + "version": "4.17.19", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz", + "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==", "dev": true }, "lru-cache": { diff --git a/examples/doc-scan/package.json b/examples/doc-scan/package.json index 0ae40f7d..15b18577 100755 --- a/examples/doc-scan/package.json +++ b/examples/doc-scan/package.json @@ -16,7 +16,6 @@ "ejs": "^3.0.1", "express": "^4.17.1", "express-session": "^1.17.0", - "file-type": "^14.1.4", "yoti": "file:../.." }, "devDependencies": { diff --git a/examples/doc-scan/src/controllers/index.controller.js b/examples/doc-scan/src/controllers/index.controller.js index 3e4eb816..d8b52d2c 100644 --- a/examples/doc-scan/src/controllers/index.controller.js +++ b/examples/doc-scan/src/controllers/index.controller.js @@ -8,6 +8,9 @@ const { RequestedTextExtractionTaskBuilder, RequestedFaceMatchCheckBuilder, SdkConfigBuilder, + RequiredIdDocumentBuilder, + OrthogonalRestrictionsFilterBuilder, + RequestedIdDocumentComparisonCheckBuilder, } = require('yoti'); /** @@ -37,6 +40,10 @@ async function createSession() { .withManualCheckNever() .build() ) + .withRequestedCheck( + new RequestedIdDocumentComparisonCheckBuilder() + .build() + ) .withRequestedTask( new RequestedTextExtractionTaskBuilder() .withManualCheckNever() @@ -55,6 +62,24 @@ async function createSession() { .withErrorUrl(`${config.YOTI_APP_BASE_URL}/error`) .build() ) + .withRequiredDocument( + (new RequiredIdDocumentBuilder()) + .withFilter( + (new OrthogonalRestrictionsFilterBuilder()) + .withWhitelistedDocumentTypes(['PASSPORT']) + .build() + ) + .build() + ) + .withRequiredDocument( + (new RequiredIdDocumentBuilder()) + .withFilter( + (new OrthogonalRestrictionsFilterBuilder()) + .withWhitelistedDocumentTypes(['DRIVING_LICENCE']) + .build() + ) + .build() + ) .build(); return docScanClient.createSession(sessionSpec); diff --git a/examples/doc-scan/src/controllers/media.controller.js b/examples/doc-scan/src/controllers/media.controller.js index 690f9e9e..da51aa1a 100644 --- a/examples/doc-scan/src/controllers/media.controller.js +++ b/examples/doc-scan/src/controllers/media.controller.js @@ -1,5 +1,4 @@ const config = require('../../config'); -const FileType = require('file-type'); const { DocScanClient, @@ -17,18 +16,8 @@ module.exports = async (req, res) => { req.query.mediaId ); - let contentType = media.getMimeType(); - let buffer = media.getContent().toBuffer(); - - // If the media is base64 encoded, decode and detect the mime type. - if (req.query.base64 === '1' && contentType === 'application/octet-stream') { - buffer = Buffer.from(buffer.toString('utf8'), 'base64'); - const fileInfo = await FileType.fromBuffer(buffer); - contentType = fileInfo.mime || contentType; - } - - res.set('Content-Type', contentType); - res.status(200).end(buffer); + res.set('Content-Type', media.getMimeType()); + res.status(200).end(media.getContent().toBuffer()); } catch (error) { res.render('pages/error', { error }); } diff --git a/examples/doc-scan/views/pages/success.ejs b/examples/doc-scan/views/pages/success.ejs index a14b38ff..aa294fc3 100644 --- a/examples/doc-scan/views/pages/success.ejs +++ b/examples/doc-scan/views/pages/success.ejs @@ -35,6 +35,14 @@
ID | -- - <%= livenessResource.getFaceMap().getMedia().getId() %> - - | -