Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/aml-check/package-lock.json

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

2 changes: 1 addition & 1 deletion examples/digital-identity/package-lock.json

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

2 changes: 1 addition & 1 deletion examples/idv-identity-checks/package-lock.json

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

6 changes: 6 additions & 0 deletions examples/idv-identity-checks/views/pages/partials/check.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ formatString = function (value) {
<td><%= breakdown.getResult(); %></td>
<% } %>
</tr>
<tr>
<% if (breakdown.getProcess()) { %>
<td>Process</td>
<td><%= breakdown.getProcess(); %></td>
<% } %>
</tr>
<% if (breakdown.getDetails() && breakdown.getDetails().length > 0) { %>
<tr>
<td>Details</td>
Expand Down
32 changes: 16 additions & 16 deletions examples/idv/package-lock.json

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

2 changes: 1 addition & 1 deletion examples/idv/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"dotenv": "16.0.2",
"ejs": "3.1.10",
"express": "4.21.2",
"express-session": "1.18.1",
"express-session": "1.18.2",
"yoti": "file:../.."
},
"devDependencies": {
Expand Down
2 changes: 2 additions & 0 deletions examples/idv/src/controllers/use-cases/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const allowExpiredDocumentCheckController = require('./allow.expired.document.ch
const faceComparisonCheckController = require('./face.comparison.check.controller');
const faceMatchCheckController = require('./face.match.check.controller');
const watchlistCheckController = require('./watchlist.check.controller');
const suppressedScreensCheckController = require('./suppressed.screens.check.controller');

module.exports = {
authenticityAndIdentityCheckController,
Expand All @@ -14,4 +15,5 @@ module.exports = {
faceComparisonCheckController,
faceMatchCheckController,
watchlistCheckController,
suppressedScreensCheckController,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
const {
IDVClient,
SessionSpecificationBuilder,
SdkConfigBuilder,
RequiredIdDocumentBuilder,
RequestedDocumentAuthenticityCheckBuilder,
RequestedTextExtractionTaskBuilder,
} = require('yoti');
const config = require('../../../config');

/**
* Create an IDV session.
*/
async function createSession() {
const idvClient = new IDVClient(
config.YOTI_CLIENT_SDK_ID,
config.YOTI_PEM
);

const sessionSpec = new SessionSpecificationBuilder()
.withClientSessionTokenTtl(600) // 10 minutes
.withResourcesTtl(90000) // session TTL(10 minutes) + 24 hours(minimum required)
.withUserTrackingId('some-user-tracking-id')
.withRequestedCheck(
new RequestedDocumentAuthenticityCheckBuilder()
.withManualCheckFallback()
.build()
)
.withRequestedTask(
new RequestedTextExtractionTaskBuilder()
.withManualCheckFallback()
.withChipDataDesired()
.withCreateExpandedDocumentFields(true) // default is false
.build()
)
.withSdkConfig(
new SdkConfigBuilder()
.withAllowsCameraAndUpload()
.withPrimaryColour('#2d9fff')
.withSecondaryColour('#FFFFFF')
.withFontColour('#FFFFFF')
.withLocale('en-GB')
.withPresetIssuingCountry('GBR')
.withSuccessUrl(`${config.YOTI_APP_BASE_URL}/success`)
.withErrorUrl(`${config.YOTI_APP_BASE_URL}/error`)
.withAllowHandoff(true)
.withIdDocumentTextExtractionGenericRetries(3)
.withIdDocumentTextExtractionReclassificationRetries(3)
.withSuppressedScreens([
'ID_DOCUMENT_EDUCATION',
'ID_DOCUMENT_REQUIREMENTS',
])
.build()
)
.withRequiredDocument(
(new RequiredIdDocumentBuilder()).build()
)
.build();

return idvClient.createSession(sessionSpec);
}

module.exports = async (req, res) => {
try {
const session = await createSession();

req.session.IDV_SESSION_ID = session.getSessionId();
req.session.IDV_SESSION_TOKEN = session.getClientSessionToken();

res.render('pages/session', {
sessionId: req.session.IDV_SESSION_ID,
iframeUrl: `${config.YOTI_IDV_IFRAME_URL}?sessionID=${req.session.IDV_SESSION_ID}&sessionToken=${req.session.IDV_SESSION_TOKEN}`,
});
} catch (error) {
res.render('pages/error', { error });
}
};
2 changes: 2 additions & 0 deletions examples/idv/src/routes/use-cases-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const {
faceComparisonCheckController,
faceMatchCheckController,
watchlistCheckController,
suppressedScreensCheckController,
} = controllers.useCasesControllers;

const caseIdToControllerMapping = {
Expand All @@ -24,6 +25,7 @@ const caseIdToControllerMapping = {
[Cases.FACE_COMPARISON]: faceComparisonCheckController,
[Cases.FACE_MATCH]: faceMatchCheckController,
[Cases.WATCHLIST]: watchlistCheckController,
[Cases.SUPPRESSED_SCREENS]: suppressedScreensCheckController,
};

const casesEntries = [...CasesMap.entries()];
Expand Down
5 changes: 5 additions & 0 deletions examples/idv/src/useCases.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const Cases = {
FACE_COMPARISON: 'faceComparison',
FACE_MATCH: 'faceMatch',
WATCHLIST: 'watchlist',
SUPPRESSED_SCREENS: 'suppressedScreens',
};

const CasesMap = new Map([
Expand Down Expand Up @@ -37,6 +38,10 @@ const CasesMap = new Map([
name: 'Watchlist check',
path: '/watchlist-check',
}],
[Cases.SUPPRESSED_SCREENS, {
name: 'Suppressed screens check',
path: '/suppressed-screens-check',
}],
]);

module.exports = {
Expand Down
6 changes: 6 additions & 0 deletions examples/idv/views/pages/partials/check.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ formatString = function (value) {
<td><%= breakdown.getResult(); %></td>
<% } %>
</tr>
<tr>
<% if (breakdown.getProcess()) { %>
<td>Process</td>
<td><%= breakdown.getProcess(); %></td>
<% } %>
</tr>
<% if (breakdown.getDetails() && breakdown.getDetails().length > 0) { %>
<tr>
<td>Details</td>
Expand Down
2 changes: 1 addition & 1 deletion examples/profile-identity-checks/package-lock.json

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

2 changes: 1 addition & 1 deletion examples/profile/package-lock.json

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

4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yoti",
"version": "4.11.1",
"version": "4.12.0",
"description": "Yoti NodeJS SDK for back-end integration",
"author": "Yoti LTD <[email protected]> (https://www.yoti.com/developers)",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ sonar.organization = getyoti

sonar.projectKey = getyoti:node
sonar.projectName = Node SDK
sonar.projectVersion = 4.11.0
sonar.projectVersion = 4.12.0
sonar.exclusions=tests/**,examples/**,node_modules/**,coverage/**
sonar.javascript.lcov.reportPaths=coverage/lcov.info
sonar.verbose = true
Expand Down
17 changes: 16 additions & 1 deletion src/idv_service/session/create/sdk.config.builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,20 @@ class SdkConfigBuilder {
return this;
}

/**
* Sets the suppressed screens on the builder
*
* @param {string[]} screens
*
* @returns {this}
*/
withSuppressedScreens(screens) {
Validation.notNullOrEmpty(screens, 'suppressedScreens');
Validation.isArrayOfStrings(screens, 'suppressedScreens');
this.suppressedScreens = screens;
return this;
}

/**
* Builds the {@link SdkConfig} using the values supplied to the builder
*
Expand All @@ -283,7 +297,8 @@ class SdkConfigBuilder {
this.biometricConsentFlow,
this.allowHandoff,
this.attemptsConfiguration,
this.brandId
this.brandId,
this.suppressedScreens
);
}
}
Expand Down
13 changes: 12 additions & 1 deletion src/idv_service/session/create/sdk.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class SdkConfig {
* The attempts configuration
* @param {string} brandId
* The brandID for the client
* @param {string[]} suppressedScreens
* The list of suppressed screens
*/
constructor(
allowedCaptureMethods,
Expand All @@ -44,7 +46,8 @@ class SdkConfig {
biometricConsentFlow,
allowHandoff,
attemptsConfiguration,
brandId
brandId,
suppressedScreens
) {
Validation.isString(allowedCaptureMethods, 'allowedCaptureMethods', true);
/** @private */
Expand Down Expand Up @@ -99,6 +102,13 @@ class SdkConfig {
Validation.isString(brandId, 'brandId', true);
/** @private */
this.brandId = brandId;

if (suppressedScreens) {
Validation.notNullOrEmpty(suppressedScreens, 'suppressedScreens');
Validation.isArrayOfStrings(suppressedScreens, 'suppressedScreens');
/** @private */
this.suppressedScreens = suppressedScreens;
}
}

/**
Expand All @@ -119,6 +129,7 @@ class SdkConfig {
allow_handoff: this.allowHandoff,
attempts_configuration: this.attemptsConfiguration,
brand_id: this.brandId,
suppressed_screens: this.suppressedScreens,
};
}
}
Expand Down
Loading
Loading