Skip to content

Commit

Permalink
Merge pull request #235 from getyoti/release/3.12.0
Browse files Browse the repository at this point in the history
Release 3.12.0
  • Loading branch information
davidgrayston authored Oct 5, 2020
2 parents 3318840 + 0df8601 commit c495105
Show file tree
Hide file tree
Showing 29 changed files with 469 additions and 167 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions examples/aml-check/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion examples/doc-scan/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
25 changes: 25 additions & 0 deletions examples/doc-scan/src/controllers/index.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ const {
RequestedTextExtractionTaskBuilder,
RequestedFaceMatchCheckBuilder,
SdkConfigBuilder,
RequiredIdDocumentBuilder,
OrthogonalRestrictionsFilterBuilder,
RequestedIdDocumentComparisonCheckBuilder,
} = require('yoti');

/**
Expand Down Expand Up @@ -37,6 +40,10 @@ async function createSession() {
.withManualCheckNever()
.build()
)
.withRequestedCheck(
new RequestedIdDocumentComparisonCheckBuilder()
.build()
)
.withRequestedTask(
new RequestedTextExtractionTaskBuilder()
.withManualCheckNever()
Expand All @@ -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);
Expand Down
15 changes: 2 additions & 13 deletions examples/doc-scan/src/controllers/media.controller.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const config = require('../../config');
const FileType = require('file-type');

const {
DocScanClient,
Expand All @@ -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 });
}
Expand Down
63 changes: 30 additions & 33 deletions examples/doc-scan/views/pages/success.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@
<td>User Tracking ID</td>
<td><%= sessionResult.getUserTrackingId() %></td>
</tr>
<% if (sessionResult.getBiometricConsentTimestamp()) { %>
<tr>
<td>Biometric Consent Timestamp</td>
<td>
<%= sessionResult.getBiometricConsentTimestamp() %>
</td>
</tr>
<% } %>
</tbody>
</table>
</div>
Expand Down Expand Up @@ -138,6 +146,28 @@
</div>
</div>
<% } %>
<% if (sessionResult.getIdDocumentComparisonChecks().length > 0) { %>
<div class="card">
<div class="card-header" id="comparison-checks">
<h3 class="mb-0">
<button class="btn btn-link" type="button" data-toggle="collapse"
data-target="#collapse-comparison-checks" aria-expanded="true"
aria-controls="collapse-comparison-checks">
ID Document Comparison Checks
</button>
</h3>
</div>
<div id="collapse-comparison-checks" class="collapse" aria-labelledby="comparison-checks">
<div class="card-body">
<% sessionResult.getIdDocumentComparisonChecks().forEach(function(check){ %>
<%- include('partials/check', { check }); %>
<% }); %>
</div>
</div>
</div>
<% } %>
</div>
</div>
</div>
Expand Down Expand Up @@ -339,39 +369,6 @@
<div class="accordion mt-3">
<% if (livenessResource.getFaceMap()) { %>
<div class="card">
<div class="card-header" id="liveness-<%= livenessNum %>-facemap">
<h3 class="mb-0">
<button class="btn btn-link" type="button" data-toggle="collapse"
data-target="#collapse-liveness-<%= livenessNum %>-facemap" aria-expanded="true"
aria-controls="collapse-liveness-<%= livenessNum %>-facemap">
Face Map
</button>
</h3>
</div>
<div id="collapse-liveness-<%= livenessNum %>-facemap" class="collapse" aria-labelledby="liveness-<%= livenessNum %>-facemap">
<div class="card-body">
<% if (livenessResource.getFaceMap().getMedia()) { %>
<h4>Media</h4>
<table class="table table-striped">
<tbody>
<tr>
<td>ID</td>
<td>
<a href="/media?mediaId=<%= livenessResource.getFaceMap().getMedia().getId() %>&base64=1">
<%= livenessResource.getFaceMap().getMedia().getId() %>
</a>
</td>
</tr>
</tbody>
</table>
<% } %>
</div>
</div>
</div>
<% } %>
<% if (livenessResource.getFrames().length > 0){ %>
<div class="card">
<div class="card-header" id="liveness-<%= livenessNum %>-frames">
Expand Down
6 changes: 3 additions & 3 deletions examples/profile/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const {
NotificationConfigBuilder,
SdkConfigBuilder,
RequestedDocumentAuthenticityCheckBuilder,
RequestedIdDocumentComparisonCheckBuilder,
RequestedFaceMatchCheckBuilder,
RequestedLivenessCheckBuilder,
RequestedTextExtractionTaskBuilder,
Expand Down Expand Up @@ -59,6 +60,7 @@ module.exports = {
NotificationConfigBuilder,
SdkConfigBuilder,
RequestedDocumentAuthenticityCheckBuilder,
RequestedIdDocumentComparisonCheckBuilder,
RequestedFaceMatchCheckBuilder,
RequestedLivenessCheckBuilder,
RequestedTextExtractionTaskBuilder,
Expand Down
Loading

0 comments on commit c495105

Please sign in to comment.