diff --git a/.eslintignore b/.eslintignore index cf7098890..fb80416d5 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1 +1,2 @@ **/node_modules +types diff --git a/.eslintrc.js b/.eslintrc.js index e0c32f965..303bc57b7 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,31 +1,41 @@ module.exports = { - "plugins": ["node", "jest"], - "extends": ["plugin:node/recommended", "airbnb-base"], + plugins: ['node', 'jest'], + extends: ['plugin:node/recommended', 'airbnb-base'], rules: { - "node/exports-style": ["error", "module.exports"], - "prefer-destructuring": ["error", {"object": false, "array": false}], - "strict": 0, - "comma-dangle": ["error", { - "arrays": "always-multiline", - "exports": "always-multiline", - "functions": "never", - "imports": "always-multiline", - "objects": "always-multiline" + 'node/exports-style': ['error', 'module.exports'], + 'prefer-destructuring': ['error', { object: false, array: false }], + strict: 0, + 'comma-dangle': ['error', { + arrays: 'always-multiline', + exports: 'always-multiline', + functions: 'never', + imports: 'always-multiline', + objects: 'always-multiline', + }], + 'no-console': 0, + 'prefer-object-spread': 0, + 'default-param-last': 'off', + 'prefer-regex-literals': 'off', + 'max-len': ['error', { + code: 100, + tabWidth: 2, + ignoreUrls: true, + ignoreComments: false, + ignoreRegExpLiterals: true, + ignoreStrings: true, + ignoreTemplateLiterals: true, + ignorePattern: '\\* @typedef \\{import', }], - "no-console": 0, - "prefer-object-spread": 0, - "default-param-last": "off", - "prefer-regex-literals": "off" }, env: { - "node": true, - "jest/globals": true + node: true, + 'jest/globals': true, }, - "overrides": [{ - "files": "\"./tests/**/*.spec.js\"", - "rules": { - "node/no-unpublished-require": 0, - "node/no-missing-require": 0 - } - }] + overrides: [{ + files: '"./tests/**/*.spec.js"', + rules: { + 'node/no-unpublished-require': 0, + 'node/no-missing-require': 0, + }, + }], }; diff --git a/index.js b/index.js index 33f4805b2..f01dfc977 100644 --- a/index.js +++ b/index.js @@ -53,9 +53,20 @@ const { RequestedTypeListSourcesBuilder, CreateFaceCaptureResourcePayloadBuilder, UploadFaceCaptureImagePayloadBuilder, + IDVService, } = require('./src/idv_service'); +const YotiCommon = require('./src/yoti_common'); +const { YotiRequest } = require('./src/request/request'); +const IDVError = require('./src/idv_service/idv.error'); + module.exports = { + internals: { + IDVService, + YotiCommon, + YotiRequest, + IDVError, + }, Client: YotiClient, IDVClient, DigitalIdentityClient, diff --git a/package-lock.json b/package-lock.json index 7e57bb042..732d7bc5d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,8 @@ "eslint-plugin-node": "11.1.0", "husky": "8.0.3", "jest": "29.5.0", - "nock": "13.2.9" + "nock": "13.2.9", + "typescript": "5.3.3" }, "engines": { "node": ">=14" @@ -6122,11 +6123,10 @@ } }, "node_modules/typescript": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", - "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", + "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", "dev": true, - "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -10907,11 +10907,10 @@ } }, "typescript": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.6.tgz", - "integrity": "sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==", - "dev": true, - "peer": true + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", + "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", + "dev": true }, "unbox-primitive": { "version": "1.0.2", diff --git a/package.json b/package.json index f084f6a7f..d0d9a3bba 100644 --- a/package.json +++ b/package.json @@ -11,11 +11,14 @@ "engines": { "node": ">=14" }, + "types": "./types/index.d.ts", "scripts": { "lint": "npx eslint *.js './src/**/*.js' './tests/**/*.spec.js' config/*.js", "test": "jest", "audit": "audit-ci --config ./audit-ci.jsonc", - "pre-commit": "npm run test" + "types:generate": "tsc index.js --declaration --allowJs --checkJs --resolveJsonModule --emitDeclarationOnly --skipLibCheck --outDir types", + "types:refresh": "rm -rf types && npm run types:generate && git add types", + "pre-commit": "npm run test && npm run types:refresh" }, "jest": { "verbose": true, @@ -46,6 +49,7 @@ "eslint-plugin-node": "11.1.0", "husky": "8.0.3", "jest": "29.5.0", - "nock": "13.2.9" + "nock": "13.2.9", + "typescript": "5.3.3" } } diff --git a/src/aml_service/index.js b/src/aml_service/index.js index 64041c05b..d535edd49 100644 --- a/src/aml_service/index.js +++ b/src/aml_service/index.js @@ -44,15 +44,17 @@ class AmlService { /** * @param {string} sdkId * @param {string|Buffer} pem - * @param {Object} options - * @param {string} options.apiUrl + * @param {{apiUrl?: string}} options */ constructor(sdkId, pem, { apiUrl = DEFAULT_API_URL } = {}) { Validation.isString(sdkId, 'sdkId'); Validation.notNullOrEmpty(pem, 'pem'); + /** @private */ this.sdkId = sdkId; + /** @private */ this.pem = pem; + /** @private */ this.apiUrl = apiUrl; } @@ -65,7 +67,7 @@ class AmlService { const requestBuilder = new RequestBuilder() .withBaseUrl(this.apiUrl) - .withPemString(this.pem) + .withPemString(this.pem.toString()) .withEndpoint('/aml-check') .withQueryParam('appId', this.sdkId) .withMethod('POST') diff --git a/src/aml_type/aml.address.js b/src/aml_type/aml.address.js index a0b4e33e4..1defd195e 100644 --- a/src/aml_type/aml.address.js +++ b/src/aml_type/aml.address.js @@ -52,7 +52,6 @@ module.exports.AmlAddress = class AmlAddress { } /** - * @param countryCode * * @deprecated Replaced by Validation.notNullOrEmpty() */ diff --git a/src/client/digital.identity.client.js b/src/client/digital.identity.client.js index 772e76114..d4c03872c 100644 --- a/src/client/digital.identity.client.js +++ b/src/client/digital.identity.client.js @@ -7,20 +7,24 @@ class DigitalIdentityClient { /** * @param {string} sdkId * @param {string|Buffer} pem - * @param {Object} options - * @param {string} options.apiUrl + * @param {{apiUrl?: string}} options */ constructor(sdkId, pem, { apiUrl } = {}) { const options = { apiUrl: apiUrl || config.yoti.digitalIdentityApi, }; + /** @private */ this.digitalIdentityService = new DigitalIdentityService(sdkId, pem, options); } /** + * @typedef {import('../digital_identity_service/share.session.configuration.js')} ShareSessionConfig + * + * @param {ShareSessionConfig} shareSessionConfig + * + * @typedef {import('../digital_identity_service/create.share.session.result.js')} CreateShareSessionResult * - * @param shareSessionConfig * @returns {Promise} */ async createShareSession(shareSessionConfig) { @@ -28,8 +32,10 @@ class DigitalIdentityClient { } /** + * @param {string} sessionId + * + * @typedef {import('../digital_identity_service/get.share.session.result.js')} GetShareSessionResult * - * @param sessionId * @returns {Promise} */ async getShareSession(sessionId) { @@ -37,8 +43,10 @@ class DigitalIdentityClient { } /** + * @param {string} sessionId + * + * @typedef {import('../digital_identity_service/create.share.qr.code.result.js')} CreateShareQrCodeResult * - * @param sessionId * @returns {Promise} */ async createShareQrCode(sessionId) { @@ -46,8 +54,10 @@ class DigitalIdentityClient { } /** + * @param {string} qrCodeId + * + * @typedef {import('../digital_identity_service/get.share.qr.code.result.js')} GetShareQrCodeResult * - * @param qrCodeId * @returns {Promise} */ async getShareQrCode(qrCodeId) { @@ -55,8 +65,10 @@ class DigitalIdentityClient { } /** - * * @param {string} receiptId + * + * @typedef {import('../digital_identity_service/get.share.receipt.result.js')} GetShareReceiptResult + * * @returns {Promise} */ async getShareReceipt(receiptId) { diff --git a/src/client/idv.client.js b/src/client/idv.client.js index afae93ec3..ba593b8c6 100644 --- a/src/client/idv.client.js +++ b/src/client/idv.client.js @@ -14,21 +14,25 @@ class IDVClient { /** * @param {string} sdkId * @param {string|Buffer} pem - * @param {Object} options - * @param {string} options.apiUrl + * @param {{apiUrl?: string}} options */ constructor(sdkId, pem, { apiUrl } = {}) { const options = { apiUrl: apiUrl || config.yoti.idvApi, }; + /** @private */ this.idvService = new IDVService(sdkId, pem, options); } /** * Creates a IDV session using the supplied session specification * + * @typedef {import('../idv_service/session/create/session.specification.js')} SessionSpecification + * * @param {SessionSpecification} sessionSpecification * + * @typedef {import('../idv_service/session/create/create.session.result')} CreateSessionResult + * * @returns {Promise} */ createSession(sessionSpecification) { @@ -40,6 +44,8 @@ class IDVClient { * * @param {string} sessionId * + * @typedef {import('../idv_service/session/retrieve/get.session.result.js')} GetSessionResult + * * @returns {Promise} */ getSession(sessionId) { @@ -52,7 +58,7 @@ class IDVClient { * * @param {string} sessionId * - * @returns {Promise} + * @returns {Promise} */ deleteSession(sessionId) { return this.idvService.deleteSession(sessionId); @@ -65,6 +71,8 @@ class IDVClient { * @param {string} sessionId * @param {string} mediaId * + * @typedef {import('../data_type/media.js')} Media + * * @returns {Promise} */ getMediaContent(sessionId, mediaId) { @@ -78,7 +86,7 @@ class IDVClient { * @param {string} sessionId * @param {string} mediaId * - * @returns {Promise} + * @returns {Promise} */ deleteMediaContent(sessionId, mediaId) { return this.idvService.deleteMediaContent(sessionId, mediaId); @@ -89,6 +97,8 @@ class IDVClient { * * @param {boolean} includeNonLatin * + * @typedef {import('../idv_service/support/supported.documents.response.js')} SupportedDocumentsResponse + * * @returns {Promise} */ getSupportedDocuments(includeNonLatin) { @@ -98,8 +108,13 @@ class IDVClient { /** * Creates a face capture resource * @param {string} sessionId + * + * @typedef {import('../idv_service/session/create/face_capture/create.face.capture.resource.payload.js')} CreateFaceCaptureResourcePayload + * * @param {CreateFaceCaptureResourcePayload} createFaceCaptureResourcePayload * + * @typedef {import('../idv_service/session/retrieve/create.face.capture.resource.response.js')} CreateFaceCaptureResourceResponse + * * @returns {Promise} */ createFaceCaptureResource(sessionId, createFaceCaptureResourcePayload) { @@ -113,9 +128,12 @@ class IDVClient { * Uploads a face capture image * @param {string} sessionId * @param {string} resourceId + * + * @typedef {import('../idv_service/session/create/face_capture/upload.face.capture.image.payload.js')} UploadFaceCaptureImagePayload + * * @param {UploadFaceCaptureImagePayload} uploadFaceCaptureImagePayload * - * @returns {Promise} + * @returns {Promise} */ uploadFaceCaptureImage(sessionId, resourceId, uploadFaceCaptureImagePayload) { return this.idvService.uploadFaceCaptureImage( @@ -130,6 +148,8 @@ class IDVClient { * * @param {string} sessionId * + * @typedef {import('../idv_service/session/retrieve/configuration/session.configuration.response.js')} SessionConfigurationResponse + * * @returns {Promise} */ getSessionConfiguration(sessionId) { diff --git a/src/client/yoti.client.js b/src/client/yoti.client.js index d4104771f..dbebba32d 100644 --- a/src/client/yoti.client.js +++ b/src/client/yoti.client.js @@ -32,19 +32,23 @@ class YotiClient { /** * @param {string} sdkId * @param {string} pem - * @param {Object} options - * @param {string} options.apiUrl + * @param {{apiUrl?: string}} options */ constructor(sdkId, pem, { apiUrl } = {}) { + /** @private */ this.sdkId = sdkId; + /** @private */ this.pem = pem; const options = { apiUrl: apiUrl || config.yoti.connectApi, }; + /** @private */ this.amlService = new AmlService(sdkId, pem, options); + /** @private */ this.profileService = new ProfileService(sdkId, pem, options); + /** @private */ this.dynamicShareService = new DynamicShareService(sdkId, pem, options); /** @deprecated replaced by this.sdkId */ @@ -67,7 +71,7 @@ class YotiClient { getActivityDetails(encryptedConnectToken) { let decryptedToken; try { - decryptedToken = decryptToken(encryptedConnectToken, this.pem); + decryptedToken = decryptToken(encryptedConnectToken, this.pem.toString()); } catch (err) { return Promise.reject(err); } @@ -90,9 +94,12 @@ class YotiClient { * Given a dynamic scenario, get a custom QR code denoted by the dynamic policy * provided in the request. * + * @typedef {import('./../dynamic_sharing_service/dynamic.scenario')} DynamicScenario + * @typedef {import('./../dynamic_sharing_service/share.url.result')} ShareUrlResult + * * @param {DynamicScenario} dynamicScenario - defines the wanted attribute list * - * @returns {Promise} containing a ShareUrlResult + * @returns {Promise} */ createShareUrl(dynamicScenario) { return this.dynamicShareService.createShareUrl(dynamicScenario); diff --git a/src/data_type/age.verification.js b/src/data_type/age.verification.js index cf36be1f9..052d092be 100644 --- a/src/data_type/age.verification.js +++ b/src/data_type/age.verification.js @@ -21,9 +21,12 @@ class AgeVerification { Validation.matchesPattern(name, /^[^:]+:(?!.*:)[0-9]+$/, 'attribute.name'); const split = name.split(':'); + /** @private */ this.checkType = split[0]; + /** @private */ this.age = parseInt(split[1], 10); + /** @private */ this.result = value === 'true'; } @@ -41,7 +44,7 @@ class AgeVerification { /** * The age that was that checked, as specified on Yoti Hub. * - * @returns {integer} + * @returns {number} */ getAge() { return this.age; @@ -55,17 +58,6 @@ class AgeVerification { getResult() { return this.result; } - - /** - * The wrapped profile attribute. - * - * Use this if you need access to the underlying List of Anchors. - * - * @returns {Attribute} - */ - getAttribute() { - return this.attribute; - } } module.exports = { diff --git a/src/data_type/anchor.js b/src/data_type/anchor.js index 99422c0e8..cfe700fca 100644 --- a/src/data_type/anchor.js +++ b/src/data_type/anchor.js @@ -1,5 +1,9 @@ 'use strict'; +/** + * @typedef {import("./../data_type/signed.timestamp").YotiSignedTimeStamp} YotiSignedTimeStamp + */ + /** * A class to represent a Yoti anchor. Anchors are metadata associated * to the attribute, which describe how an attribute has been provided @@ -11,6 +15,7 @@ * * @class YotiAnchor */ + class YotiAnchor { /** * @param {string} type @@ -20,10 +25,15 @@ class YotiAnchor { * @param {Object[]} originServerCerts */ constructor(type, value, subType, signedTimeStamp, originServerCerts) { + /** @private */ this.type = type; + /** @private */ this.value = value; + /** @private */ this.subType = subType; + /** @private */ this.signedTimeStamp = signedTimeStamp; + /** @private */ this.originServerCerts = originServerCerts; } @@ -71,7 +81,7 @@ class YotiAnchor { * Certificate chain generated when this Anchor was created (attribute value was * sourced or verified). Securely encodes the Anchor type and value. * - * @param {Object[]} originServerCerts + * @returns {Object[]} */ getOriginServerCerts() { return this.originServerCerts; } } diff --git a/src/data_type/attribute.definition.js b/src/data_type/attribute.definition.js index 6ac60093c..c050add99 100644 --- a/src/data_type/attribute.definition.js +++ b/src/data_type/attribute.definition.js @@ -6,6 +6,7 @@ class AttributeDefinition { constructor(name) { Validation.isString(name, 'name'); + /** @private */ this.name = name; } diff --git a/src/data_type/attribute.issuance.details.js b/src/data_type/attribute.issuance.details.js index 4902431fa..0e7b1523c 100644 --- a/src/data_type/attribute.issuance.details.js +++ b/src/data_type/attribute.issuance.details.js @@ -6,19 +6,22 @@ const AttributeDefinition = require('./attribute.definition'); class AttributeIssuanceDetails { /** * @param {string} token - * @param {Date|undefined} expiryDate - * @param {string[]} issuingAttributes + * @param {Date} [expiryDate] + * @param {AttributeDefinition[]} [issuingAttributes] */ constructor(token, expiryDate, issuingAttributes = []) { Validation.isString(token, 'token'); + /** @private */ this.token = token; if (expiryDate !== undefined) { Validation.instanceOf(expiryDate, Date, 'expiryDate'); } + /** @private */ this.expiryDate = expiryDate; Validation.isArrayOfType(issuingAttributes, AttributeDefinition, 'issuingAttributes'); + /** @private */ this.issuingAttributes = issuingAttributes; } diff --git a/src/data_type/attribute.js b/src/data_type/attribute.js index 3ef320b61..d6c0c8de9 100644 --- a/src/data_type/attribute.js +++ b/src/data_type/attribute.js @@ -1,5 +1,9 @@ 'use strict'; +/** + * @typedef {import("./anchor").YotiAnchor} YotiAnchor + */ + /** * A class to represent a Yoti attribute. * @@ -11,15 +15,22 @@ */ class Attribute { constructor(attrObj) { + /** @private */ this.value = attrObj.value; + /** @private */ this.name = attrObj.name; + /** @private */ this.sources = attrObj.sources; + /** @private */ this.verifiers = attrObj.verifiers; + /** @private */ this.id = attrObj.id; + /** @private */ this.anchors = []; if (attrObj.anchors) { Object.keys(attrObj.anchors).forEach((key) => { + /** @private */ this.anchors = this.anchors.concat(attrObj.anchors[key]); }); } diff --git a/src/data_type/date.js b/src/data_type/date.js index 440406341..8cbf0770e 100644 --- a/src/data_type/date.js +++ b/src/data_type/date.js @@ -77,9 +77,11 @@ class YotiDate extends Date { * @param {number} timestamp */ constructor(timestamp) { - Validation.isNumber(timestamp); + Validation.isNumber(timestamp, 'timestamp'); super(Math.floor(timestamp / 1000)); + /** @private */ this.microseconds = extractMicrosecondsFromTimestamp(timestamp); + /** @private */ this.microsecondUnixTimestamp = timestamp; } @@ -152,7 +154,7 @@ class YotiDate extends Date { /** * Returns Unix timestamp with microseconds. * - * @returns {int} + * @returns {number} */ getMicrosecondUnixTimestamp() { return this.microsecondUnixTimestamp; diff --git a/src/data_type/media.js b/src/data_type/media.js index c94e1eff1..38759421c 100644 --- a/src/data_type/media.js +++ b/src/data_type/media.js @@ -9,12 +9,14 @@ class Media { */ constructor(content, mimeType) { if (Buffer.isBuffer(content)) { + /** @private */ this.content = content; } else { throw new TypeError('content must be of type Buffer'); } Validation.isString(mimeType, 'mimeType'); + /** @private */ this.mimeType = mimeType; } diff --git a/src/data_type/multi.value.js b/src/data_type/multi.value.js index 922022890..17d51781a 100644 --- a/src/data_type/multi.value.js +++ b/src/data_type/multi.value.js @@ -1,15 +1,19 @@ 'use strict'; -module.exports = class MultiValue { +class MultiValue { /** * MultiValue constructor. * * @param {array} items */ constructor(items) { + /** @private */ this.originalItems = items; + /** @private */ this.items = items; + /** @private */ this.allowedInstances = []; + /** @private */ this.allowedTypes = []; } @@ -93,10 +97,12 @@ module.exports = class MultiValue { } /** - * @returns {Array} List of filtered items. + * @returns {Readonly} List of filtered items. */ getItems() { this.applyFilters(); return Object.freeze(this.items); } -}; +} + +module.exports = MultiValue; diff --git a/src/data_type/signed.timestamp.js b/src/data_type/signed.timestamp.js index f3e5cc0ac..812e66d5f 100644 --- a/src/data_type/signed.timestamp.js +++ b/src/data_type/signed.timestamp.js @@ -14,11 +14,13 @@ class YotiSignedTimeStamp { * @param {YotiDate} timestamp */ constructor(version, timestamp) { + /** @private */ this.version = version; if (!(timestamp instanceof YotiDate)) { throw new TypeError('timestamp must be instance of YotiDate'); } + /** @private */ this.timestamp = timestamp; } diff --git a/src/digital_identity_service/create.share.qr.code.result.js b/src/digital_identity_service/create.share.qr.code.result.js index dd5980bc0..fe81c17dd 100644 --- a/src/digital_identity_service/create.share.qr.code.result.js +++ b/src/digital_identity_service/create.share.qr.code.result.js @@ -13,10 +13,12 @@ module.exports = class CreateShareQrCodeResult { */ constructor(response) { Validation.isString(response.id, 'QR code ID'); + /** @private */ this.id = response.id; if (response.uri) { Validation.isString(response.uri, 'URI'); + /** @private */ this.uri = response.uri; } } diff --git a/src/digital_identity_service/create.share.session.result.js b/src/digital_identity_service/create.share.session.result.js index 846ab5a75..2b0e26671 100644 --- a/src/digital_identity_service/create.share.session.result.js +++ b/src/digital_identity_service/create.share.session.result.js @@ -13,12 +13,15 @@ module.exports = class CreateShareSessionResult { */ constructor(response) { Validation.isString(response.id, 'Session ID'); + /** @private */ this.id = response.id; Validation.isString(response.status, 'Status'); + /** @private */ this.status = response.status; Validation.isStringDate(response.expiry, 'Expiry'); + /** @private */ this.expiry = new Date(response.expiry); } diff --git a/src/digital_identity_service/digital.identity.service.error.js b/src/digital_identity_service/digital.identity.service.error.js index 79f19fc50..a87bdd134 100644 --- a/src/digital_identity_service/digital.identity.service.error.js +++ b/src/digital_identity_service/digital.identity.service.error.js @@ -1,12 +1,21 @@ 'use strict'; /** + * @typedef {Object} ResponseBody + * @property {string} [message] + * @property {string} [error] + * + * @typedef {Object} Response + * @property {number} status + * @property {string} text + * @property {ResponseBody} [body] + * * @param {Response} response - * @returns {string} + * @returns {{status: number, reason: string, code:string|number}} */ function extractDetailsFromResponse(response) { const { status, text = '', body = {} } = response; - const { message, error } = body; + const { message, error } = /** @type {{ message: string, error: string }} */ (body); const reason = message || text; return { diff --git a/src/digital_identity_service/extension/device.location.js b/src/digital_identity_service/extension/device.location.js index 9c996ece0..ce4bac8c9 100644 --- a/src/digital_identity_service/extension/device.location.js +++ b/src/digital_identity_service/extension/device.location.js @@ -16,15 +16,19 @@ class DeviceLocation { */ constructor(latitude, longitude, radius = 150, maxUncertainty = 150) { Validation.withinRange(latitude, -90, 90, 'latitude'); + /** @private */ this.latitude = latitude; Validation.withinRange(longitude, -180, 180, 'longitude'); + /** @private */ this.longitude = longitude; Validation.notLessThan(radius, 0, 'radius'); + /** @private */ this.radius = radius; Validation.notLessThan(maxUncertainty, 0, 'maxUncertainty'); + /** @private */ this.maxUncertainty = maxUncertainty; } diff --git a/src/digital_identity_service/extension/extension.js b/src/digital_identity_service/extension/extension.js index a938d1390..f3360fa29 100644 --- a/src/digital_identity_service/extension/extension.js +++ b/src/digital_identity_service/extension/extension.js @@ -14,9 +14,11 @@ module.exports = class Extension { */ constructor(type, content) { Validation.isString(type, 'type'); + /** @private */ this.type = type; Validation.notNull(content, 'content'); + /** @private */ this.content = content; } @@ -35,7 +37,7 @@ module.exports = class Extension { } /** - * @returns {Object} data for JSON.stringify() + * Returns serialized data for JSON.stringify() */ toJSON() { return { diff --git a/src/digital_identity_service/extension/location.constraint.extension.content.js b/src/digital_identity_service/extension/location.constraint.extension.content.js index 399bd9a20..36c29b81d 100644 --- a/src/digital_identity_service/extension/location.constraint.extension.content.js +++ b/src/digital_identity_service/extension/location.constraint.extension.content.js @@ -9,6 +9,7 @@ const DeviceLocation = require('./device.location'); */ module.exports = class LocationConstraintContent { constructor(latitude, longitude, radius, maxUncertainty) { + /** @private */ this.expectedDeviceLocation = new DeviceLocation(latitude, longitude, radius, maxUncertainty); } @@ -20,7 +21,7 @@ module.exports = class LocationConstraintContent { } /** - * @returns {Object} data for JSON.stringify() + * Returns serialized data for JSON.stringify() */ toJSON() { return { diff --git a/src/digital_identity_service/extension/third.party.attribute.extension.builder.js b/src/digital_identity_service/extension/third.party.attribute.extension.builder.js index f315886ce..602513028 100644 --- a/src/digital_identity_service/extension/third.party.attribute.extension.builder.js +++ b/src/digital_identity_service/extension/third.party.attribute.extension.builder.js @@ -14,6 +14,7 @@ const THIRD_PARTY_ATTRIBUTE_EXTENSION_TYPE = 'THIRD_PARTY_ATTRIBUTE'; */ class ThirdPartyAttributeExtensionBuilder { constructor() { + /** @private */ this.definitions = []; } diff --git a/src/digital_identity_service/extension/third.party.attribute.extension.content.js b/src/digital_identity_service/extension/third.party.attribute.extension.content.js index 18d902397..d708e0f98 100644 --- a/src/digital_identity_service/extension/third.party.attribute.extension.content.js +++ b/src/digital_identity_service/extension/third.party.attribute.extension.content.js @@ -7,7 +7,9 @@ */ class ThirdPartyAttributeExtensionContent { constructor(expiryDate, definitions) { + /** @private */ this.expiryDate = expiryDate; + /** @private */ this.definitions = definitions; } @@ -19,6 +21,9 @@ class ThirdPartyAttributeExtensionContent { return this.definitions; } + /** + * Returns serialized data for JSON.stringify() + */ toJSON() { return { expiry_date: this.expiryDate.toISOString(), diff --git a/src/digital_identity_service/extension/transactional.flow.extension.builder.js b/src/digital_identity_service/extension/transactional.flow.extension.builder.js index 864ce4e12..00596d6af 100644 --- a/src/digital_identity_service/extension/transactional.flow.extension.builder.js +++ b/src/digital_identity_service/extension/transactional.flow.extension.builder.js @@ -19,7 +19,7 @@ module.exports = class TransactionalFlowExtensionBuilder { */ withContent(content) { Validation.notNull(content, 'content'); - Validation.instanceOf(content, Object); + Validation.instanceOf(content, Object, 'content'); this.content = content; return this; } diff --git a/src/digital_identity_service/get.share.qr.code.result.js b/src/digital_identity_service/get.share.qr.code.result.js index 3ca20c72f..3c96b5f5d 100644 --- a/src/digital_identity_service/get.share.qr.code.result.js +++ b/src/digital_identity_service/get.share.qr.code.result.js @@ -13,16 +13,20 @@ module.exports = class GetShareQrCodeResult { */ constructor(response) { Validation.isString(response.id, 'QR code ID'); + /** @private */ this.id = response.id; Validation.isStringDate(response.expiry, 'Expiry'); + /** @private */ this.expiry = new Date(response.expiry); Validation.isPlainObject(response.session, 'Session'); Validation.isString(response.session.id, 'Session ID'); + /** @private */ this.sessionId = response.session.id; Validation.isString(response.redirectUri, 'Redirect URI'); + /** @private */ this.redirectUri = response.redirectUri; } diff --git a/src/digital_identity_service/get.share.receipt.result.js b/src/digital_identity_service/get.share.receipt.result.js index db7515451..dd33995bf 100644 --- a/src/digital_identity_service/get.share.receipt.result.js +++ b/src/digital_identity_service/get.share.receipt.result.js @@ -11,7 +11,7 @@ const Validation = require('../yoti_common/validation'); */ module.exports = class GetShareReceiptResult { /** - * @param {ReceiptResponse} receiptResponse + * @param {import ('./receipts/receipt.response')} receiptResponse * Parsed ReceiptResponse. * @param {UserContent} userContent * The user content, including profile and extra data @@ -23,17 +23,25 @@ module.exports = class GetShareReceiptResult { userContent = new UserContent(), applicationContent = new ApplicationContent() ) { - this.sessionId = receiptResponse.sessionId; - this.rememberMeId = receiptResponse.rememberMeId; - this.parentRememberMeId = receiptResponse.parentRememberMeId; - this.timestamp = receiptResponse.timestamp; - this.error = receiptResponse.error; - this.id = receiptResponse.id; + /** @private */ + this.sessionId = receiptResponse.getSessionId(); + /** @private */ + this.rememberMeId = receiptResponse.getRememberMeId(); + /** @private */ + this.parentRememberMeId = receiptResponse.getParentRememberMeId(); + /** @private */ + this.timestamp = receiptResponse.getTimestamp(); + /** @private */ + this.error = receiptResponse.getError(); + /** @private */ + this.id = receiptResponse.getId(); if (userContent) Validation.instanceOf(userContent, UserContent, 'userContent'); if (applicationContent) Validation.instanceOf(applicationContent, ApplicationContent, 'applicationContent'); + /** @private */ this.userContent = userContent; + /** @private */ this.applicationContent = applicationContent; } @@ -94,7 +102,7 @@ module.exports = class GetShareReceiptResult { * The user profile with shared attributes and anchor information, returned * by Yoti if the request was successful. * - * @returns {UserProfile} + * @returns {import('./receipts/user.profile')} */ getProfile() { return this.userContent && this.userContent.getProfile(); @@ -103,6 +111,7 @@ module.exports = class GetShareReceiptResult { /** * Extra data associated with the user content * + * @typedef {import('./receipts/extra.data')} ExtraData * @returns {ExtraData} */ getExtraData() { diff --git a/src/digital_identity_service/get.share.session.result.js b/src/digital_identity_service/get.share.session.result.js index 08f0373b4..311e12aae 100644 --- a/src/digital_identity_service/get.share.session.result.js +++ b/src/digital_identity_service/get.share.session.result.js @@ -13,31 +13,38 @@ module.exports = class GetShareSessionResult { */ constructor(response) { Validation.isString(response.id, 'Session ID'); + /** @private */ this.id = response.id; Validation.isString(response.status, 'Status'); + /** @private */ this.status = response.status; Validation.isStringDate(response.created, 'Created'); + /** @private */ this.created = new Date(response.created); Validation.isStringDate(response.updated, 'Updated'); + /** @private */ this.updated = new Date(response.updated); if (response.expiry) { Validation.isStringDate(response.expiry, 'Expiry'); + /** @private */ this.expiry = new Date(response.expiry); } if (response.qrCode) { Validation.isString(response.qrCode.id, 'QrCode ID'); + /** @private */ this.scannedQrCodeId = response.qrCode.id; } if (response.receipt) { Validation.isString(response.receipt.id, 'Receipt ID'); + /** @private */ this.receiptId = response.receipt.id; } } diff --git a/src/digital_identity_service/index.js b/src/digital_identity_service/index.js index 76740d306..51fe41ae2 100644 --- a/src/digital_identity_service/index.js +++ b/src/digital_identity_service/index.js @@ -45,14 +45,17 @@ class DigitalIdentityService { Validation.isString(sdkId, 'sdkId'); Validation.notNullOrEmpty(pem, 'pem'); + /** @private */ this.sdkId = sdkId; + /** @private */ this.pem = pem; + /** @private */ this.apiUrl = apiUrl; } /** + * @param {ShareSessionConfiguration} shareSessionConfig * - * @param shareSessionConfig * @returns {Promise} */ async createShareSession(shareSessionConfig) { @@ -63,7 +66,7 @@ class DigitalIdentityService { const requestBuilder = new RequestBuilder() .withBaseUrl(this.apiUrl) .withHeader('X-Yoti-Auth-Id', this.sdkId) - .withPemString(this.pem) + .withPemString(this.pem.toString()) .withEndpoint('/v2/sessions') .withQueryParam('appId', this.sdkId) .withMethod('POST') @@ -92,8 +95,8 @@ class DigitalIdentityService { } /** + * @param {string} sessionId * - * @param sessionId * @returns {Promise} */ async getShareSession(sessionId) { @@ -102,7 +105,7 @@ class DigitalIdentityService { const requestBuilder = new RequestBuilder() .withBaseUrl(this.apiUrl) .withHeader('X-Yoti-Auth-Id', this.sdkId) - .withPemString(this.pem) + .withPemString(this.pem.toString()) .withEndpoint(`/v2/sessions/${sessionId}`) .withQueryParam('appId', this.sdkId) .withMethod('GET'); @@ -132,7 +135,7 @@ class DigitalIdentityService { /** * - * @param sessionId + * @param {string} sessionId * @returns {Promise} */ async createShareQrCode(sessionId) { @@ -143,7 +146,7 @@ class DigitalIdentityService { const requestBuilder = new RequestBuilder() .withBaseUrl(this.apiUrl) .withHeader('X-Yoti-Auth-Id', this.sdkId) - .withPemString(this.pem) + .withPemString(this.pem.toString()) .withEndpoint(`/v2/sessions/${sessionId}/qr-codes`) .withQueryParam('appId', this.sdkId) .withMethod('POST') @@ -173,7 +176,7 @@ class DigitalIdentityService { /** * - * @param qrCodeId + * @param {string} qrCodeId * @returns {Promise} */ async getShareQrCode(qrCodeId) { @@ -182,7 +185,7 @@ class DigitalIdentityService { const requestBuilder = new RequestBuilder() .withBaseUrl(this.apiUrl) .withHeader('X-Yoti-Auth-Id', this.sdkId) - .withPemString(this.pem) + .withPemString(this.pem.toString()) .withEndpoint(`/v2/qr-codes/${qrCodeId}`) .withQueryParam('appId', this.sdkId) .withMethod('GET'); @@ -220,7 +223,7 @@ class DigitalIdentityService { const request = new RequestBuilder() .withBaseUrl(this.apiUrl) .withHeader('X-Yoti-Auth-Id', this.sdkId) - .withPemString(this.pem) + .withPemString(this.pem.toString()) .withEndpoint(`/v2/receipts/${receiptIdUrl}`) .withQueryParam('appId', this.sdkId) .withMethod('GET') @@ -245,7 +248,7 @@ class DigitalIdentityService { const request = new RequestBuilder() .withBaseUrl(this.apiUrl) .withHeader('X-Yoti-Auth-Id', this.sdkId) - .withPemString(this.pem) + .withPemString(this.pem.toString()) .withEndpoint(`/v2/wrapped-item-keys/${receiptItemKeyId}`) .withQueryParam('appId', this.sdkId) .withMethod('GET') diff --git a/src/digital_identity_service/policy/constraints.builder.js b/src/digital_identity_service/policy/constraints.builder.js index 2f8dac752..aadc0bec2 100644 --- a/src/digital_identity_service/policy/constraints.builder.js +++ b/src/digital_identity_service/policy/constraints.builder.js @@ -14,11 +14,13 @@ module.exports = class ConstraintsBuilder { * Set default properties. */ constructor() { + /** @private */ this.constraints = []; } /** * @param {SourceConstraint} sourceConstraint + * @returns this */ withSourceConstraint(sourceConstraint) { Validation.instanceOf(sourceConstraint, SourceConstraint, 'constraint'); diff --git a/src/digital_identity_service/policy/constraints.js b/src/digital_identity_service/policy/constraints.js index e5c5e2a00..9bccc8088 100644 --- a/src/digital_identity_service/policy/constraints.js +++ b/src/digital_identity_service/policy/constraints.js @@ -14,11 +14,12 @@ module.exports = class Constraints { */ constructor(constraints) { Validation.isArrayOfTypes(constraints, [SourceConstraint], 'constraints'); + /** @private */ this.constraints = constraints; } /** - * @returns {Array} for JSON.stringify() + * Returns serialized data for JSON.stringify() */ toJSON() { return this.constraints; diff --git a/src/digital_identity_service/policy/policy.builder.js b/src/digital_identity_service/policy/policy.builder.js index 6ac8447b1..d028fffd8 100644 --- a/src/digital_identity_service/policy/policy.builder.js +++ b/src/digital_identity_service/policy/policy.builder.js @@ -11,6 +11,10 @@ const Validation = require('../../yoti_common/validation'); const SELFIE_AUTH_TYPE = 1; const PIN_AUTH_TYPE = 2; +/** + * @typedef {import('./constraints')} Constraints + */ + /** * Builder for Policy. * @@ -18,12 +22,15 @@ const PIN_AUTH_TYPE = 2; */ module.exports = class PolicyBuilder { constructor() { + /** @private */ this.wantedAttributes = {}; + /** @private */ this.wantedAuthTypes = []; } /** * @param {WantedAttribute} wantedAttribute + * @returns this */ withWantedAttribute(wantedAttribute) { Validation.instanceOf(wantedAttribute, WantedAttribute, 'wantedAttribute'); @@ -48,10 +55,11 @@ module.exports = class PolicyBuilder { /** * @param {string} name - * @param {Constraints} constraints - * @param {boolean} acceptSelfAsserted + * @param {Constraints} [constraints] + * @param {boolean} [acceptSelfAsserted] + * @returns this */ - withWantedAttributeByName(name, constraints = null, acceptSelfAsserted = null) { + withWantedAttributeByName(name, constraints = null, acceptSelfAsserted = undefined) { const wantedAttributeBuilder = new WantedAttributeBuilder() .withName(name); @@ -59,7 +67,7 @@ module.exports = class PolicyBuilder { wantedAttributeBuilder.withConstraints(constraints); } - if (acceptSelfAsserted !== null) { + if (acceptSelfAsserted !== undefined) { wantedAttributeBuilder.withAcceptSelfAsserted(acceptSelfAsserted); } @@ -67,10 +75,11 @@ module.exports = class PolicyBuilder { } /** - * @param {Constraints} constraints - * @param {boolean} acceptSelfAsserted + * @param {Constraints} [constraints] + * @param {boolean} [acceptSelfAsserted] + * @returns this */ - withFamilyName(constraints = null, acceptSelfAsserted = null) { + withFamilyName(constraints = null, acceptSelfAsserted = undefined) { return this.withWantedAttributeByName( constants.ATTR_FAMILY_NAME, constraints, @@ -79,10 +88,11 @@ module.exports = class PolicyBuilder { } /** - * @param {Constraints} constraints - * @param {boolean} acceptSelfAsserted + * @param {Constraints} [constraints] + * @param {boolean} [acceptSelfAsserted] + * @returns this */ - withGivenNames(constraints = null, acceptSelfAsserted = null) { + withGivenNames(constraints = null, acceptSelfAsserted = undefined) { return this.withWantedAttributeByName( constants.ATTR_GIVEN_NAMES, constraints, @@ -91,10 +101,11 @@ module.exports = class PolicyBuilder { } /** - * @param {Constraints} constraints - * @param {boolean} acceptSelfAsserted + * @param {Constraints} [constraints] + * @param {boolean} [acceptSelfAsserted] + * @returns this */ - withFullName(constraints = null, acceptSelfAsserted = null) { + withFullName(constraints = null, acceptSelfAsserted = undefined) { return this.withWantedAttributeByName( constants.ATTR_FULL_NAME, constraints, @@ -103,10 +114,11 @@ module.exports = class PolicyBuilder { } /** - * @param {Constraints} constraints - * @param {boolean} acceptSelfAsserted + * @param {Constraints} [constraints] + * @param {boolean} [acceptSelfAsserted] + * @returns this */ - withDateOfBirth(constraints = null, acceptSelfAsserted = null) { + withDateOfBirth(constraints = null, acceptSelfAsserted = undefined) { return this.withWantedAttributeByName( constants.ATTR_DATE_OF_BIRTH, constraints, @@ -115,11 +127,12 @@ module.exports = class PolicyBuilder { } /** - * @param {int} age - * @param {Constraints} constraints - * @param {boolean} acceptSelfAsserted + * @param {number} age + * @param {Constraints} [constraints] + * @param {boolean} [acceptSelfAsserted] + * @returns this */ - withAgeOver(age, constraints = null, acceptSelfAsserted = null) { + withAgeOver(age, constraints = null, acceptSelfAsserted = undefined) { Validation.isInteger(age, 'age'); return this.withAgeDerivedAttribute( constants.ATTR_AGE_OVER + age, @@ -129,11 +142,12 @@ module.exports = class PolicyBuilder { } /** - * @param {int} age - * @param {Constraints} constraints - * @param {boolean} acceptSelfAsserted + * @param {number} age + * @param {Constraints} [constraints] + * @param {boolean} [acceptSelfAsserted] + * @returns this */ - withAgeUnder(age, constraints = null, acceptSelfAsserted = null) { + withAgeUnder(age, constraints = null, acceptSelfAsserted = undefined) { Validation.isInteger(age, 'age'); return this.withAgeDerivedAttribute( constants.ATTR_AGE_UNDER + age, @@ -144,27 +158,32 @@ module.exports = class PolicyBuilder { /** * @param {string} derivation - * @param {Constraints} constraints - * @param {boolean} acceptSelfAsserted + * @param {Constraints} [constraints] + * @param {boolean} [acceptSelfAsserted] + * @returns this */ - withAgeDerivedAttribute(derivation, constraints = null, acceptSelfAsserted = null) { + withAgeDerivedAttribute(derivation, constraints = null, acceptSelfAsserted = undefined) { const wantedAttributeBuilder = new WantedAttributeBuilder() .withName(constants.ATTR_DATE_OF_BIRTH) - .withDerivation(derivation) - .withAcceptSelfAsserted(acceptSelfAsserted); + .withDerivation(derivation); if (constraints !== null) { wantedAttributeBuilder.withConstraints(constraints); } + if (acceptSelfAsserted !== undefined) { + wantedAttributeBuilder.withAcceptSelfAsserted(acceptSelfAsserted); + } + return this.withWantedAttribute(wantedAttributeBuilder.build()); } /** - * @param {Constraints} constraints - * @param {boolean} acceptSelfAsserted + * @param {Constraints} [constraints] + * @param {boolean} [acceptSelfAsserted] + * @returns this */ - withGender(constraints = null, acceptSelfAsserted = null) { + withGender(constraints = null, acceptSelfAsserted = undefined) { return this.withWantedAttributeByName( constants.ATTR_GENDER, constraints, @@ -173,10 +192,11 @@ module.exports = class PolicyBuilder { } /** - * @param {Constraints} constraints - * @param {boolean} acceptSelfAsserted + * @param {Constraints} [constraints] + * @param {boolean} [acceptSelfAsserted] + * @returns this */ - withPostalAddress(constraints = null, acceptSelfAsserted = null) { + withPostalAddress(constraints = null, acceptSelfAsserted = undefined) { return this.withWantedAttributeByName( constants.ATTR_POSTAL_ADDRESS, constraints, @@ -185,10 +205,11 @@ module.exports = class PolicyBuilder { } /** - * @param {Constraints} constraints - * @param {boolean} acceptSelfAsserted + * @param {Constraints} [constraints] + * @param {boolean} [acceptSelfAsserted] + * @returns this */ - withStructuredPostalAddress(constraints = null, acceptSelfAsserted = null) { + withStructuredPostalAddress(constraints = null, acceptSelfAsserted = undefined) { return this.withWantedAttributeByName( constants.ATTR_STRUCTURED_POSTAL_ADDRESS, constraints, @@ -197,10 +218,11 @@ module.exports = class PolicyBuilder { } /** - * @param {Constraints} constraints - * @param {boolean} acceptSelfAsserted + * @param {Constraints} [constraints] + * @param {boolean} [acceptSelfAsserted] + * @returns this */ - withNationality(constraints = null, acceptSelfAsserted = null) { + withNationality(constraints = null, acceptSelfAsserted = undefined) { return this.withWantedAttributeByName( constants.ATTR_NATIONALITY, constraints, @@ -209,10 +231,11 @@ module.exports = class PolicyBuilder { } /** - * @param {Constraints} constraints - * @param {boolean} acceptSelfAsserted + * @param {Constraints} [constraints] + * @param {boolean} [acceptSelfAsserted] + * @returns this */ - withPhoneNumber(constraints = null, acceptSelfAsserted = null) { + withPhoneNumber(constraints = null, acceptSelfAsserted = undefined) { return this.withWantedAttributeByName( constants.ATTR_PHONE_NUMBER, constraints, @@ -221,10 +244,11 @@ module.exports = class PolicyBuilder { } /** - * @param {Constraints} constraints - * @param {boolean} acceptSelfAsserted + * @param {Constraints} [constraints] + * @param {boolean} [acceptSelfAsserted] + * @returns this */ - withSelfie(constraints = null, acceptSelfAsserted = null) { + withSelfie(constraints = null, acceptSelfAsserted = undefined) { return this.withWantedAttributeByName( constants.ATTR_SELFIE, constraints, @@ -233,10 +257,11 @@ module.exports = class PolicyBuilder { } /** - * @param {Constraints} constraints - * @param {boolean} acceptSelfAsserted + * @param {Constraints} [constraints] + * @param {boolean} [acceptSelfAsserted] + * @returns this */ - withDocumentDetails(constraints = null, acceptSelfAsserted = null) { + withDocumentDetails(constraints = null, acceptSelfAsserted = undefined) { return this.withWantedAttributeByName( constants.ATTR_DOCUMENT_DETAILS, constraints, @@ -245,10 +270,11 @@ module.exports = class PolicyBuilder { } /** - * @param {Constraints} constraints - * @param {boolean} acceptSelfAsserted + * @param {Constraints} [constraints] + * @param {boolean} [acceptSelfAsserted] + * @returns this */ - withDocumentImages(constraints = null, acceptSelfAsserted = null) { + withDocumentImages(constraints = null, acceptSelfAsserted = undefined) { return this.withWantedAttributeByName( constants.ATTR_DOCUMENT_IMAGES, constraints, @@ -257,10 +283,11 @@ module.exports = class PolicyBuilder { } /** - * @param {Constraints} constraints - * @param {boolean} acceptSelfAsserted + * @param {Constraints} [constraints] + * @param {boolean} [acceptSelfAsserted] + * @returns this */ - withEmail(constraints = null, acceptSelfAsserted = null) { + withEmail(constraints = null, acceptSelfAsserted = undefined) { return this.withWantedAttributeByName( constants.ATTR_EMAIL_ADDRESS, constraints, @@ -269,22 +296,25 @@ module.exports = class PolicyBuilder { } /** - * @param {boolean} enabled + * @param {boolean} [enabled=true] + * @returns this */ withSelfieAuthentication(enabled = true) { return this.withWantedAuthType(SELFIE_AUTH_TYPE, enabled); } /** - * @param {boolean} enabled + * @param {boolean} [enabled=true] + * @returns this */ withPinAuthentication(enabled = true) { return this.withWantedAuthType(PIN_AUTH_TYPE, enabled); } /** - * @param {integer} wantedAuthType - * @param {boolean} enabled + * @param {number} wantedAuthType + * @param {boolean} [enabled=true] + * @returns this */ withWantedAuthType(wantedAuthType, enabled = true) { if (enabled) { @@ -297,7 +327,8 @@ module.exports = class PolicyBuilder { } /** - * @param {boolean} wantedRememberMe + * @param {boolean} [wantedRememberMe=true] + * @returns this */ withWantedRememberMe(wantedRememberMe = true) { this.wantedRememberMe = wantedRememberMe; @@ -306,6 +337,7 @@ module.exports = class PolicyBuilder { /** * @param {object} identityProfileRequirements + * @returns this */ withIdentityProfileRequirements(identityProfileRequirements) { this.identityProfileRequirements = identityProfileRequirements; diff --git a/src/digital_identity_service/policy/policy.js b/src/digital_identity_service/policy/policy.js index 09480523b..669193696 100644 --- a/src/digital_identity_service/policy/policy.js +++ b/src/digital_identity_service/policy/policy.js @@ -11,7 +11,7 @@ const Validation = require('../../yoti_common/validation'); module.exports = class Policy { /** * @param {WantedAttribute[]} wantedAttributes - array of attributes to be requested. - * @param {integer[]} wantedAuthTypes - auth types represents the authentication type to be used. + * @param {number[]} wantedAuthTypes - auth types represents the authentication type to be used. * @param {boolean} wantedRememberMe * @param {object} identityProfileRequirements */ @@ -22,20 +22,25 @@ module.exports = class Policy { identityProfileRequirements = null ) { Validation.isArrayOfType(wantedAttributes, WantedAttribute, 'wantedAttribute'); + /** @private */ this.wantedAttributes = wantedAttributes; if (wantedAuthTypes) { Validation.isArrayOfIntegers(wantedAuthTypes, 'wantedAuthTypes'); + /** @private */ this.wantedAuthTypes = wantedAuthTypes; } else { + /** @private */ this.wantedAuthTypes = []; } Validation.isBoolean(wantedRememberMe, 'wantedRememberMe'); + /** @private */ this.wantedRememberMe = wantedRememberMe; if (identityProfileRequirements) { Validation.isPlainObject(identityProfileRequirements, 'identityProfileRequirements'); + /** @private */ this.identityProfileRequirements = identityProfileRequirements; } } @@ -48,7 +53,7 @@ module.exports = class Policy { } /** - * @returns {integer[]} auth types represents the authentication type to be used. + * @returns {number[]} auth types represents the authentication type to be used. */ getWantedAuthTypes() { return this.wantedAuthTypes; diff --git a/src/digital_identity_service/policy/source.constraint.builder.js b/src/digital_identity_service/policy/source.constraint.builder.js index d470003ff..fb65ed71f 100644 --- a/src/digital_identity_service/policy/source.constraint.builder.js +++ b/src/digital_identity_service/policy/source.constraint.builder.js @@ -18,12 +18,16 @@ module.exports = class SourceConstraintBuilder { * Set default properties. */ constructor() { + /** @private */ this.anchors = []; + /** @private */ this.softPreference = false; } /** + * @typedef {import('./wanted.anchor')} WantedAnchor * @param {WantedAnchor} anchor + * @returns this */ withAnchor(anchor) { this.anchors.push(anchor); @@ -32,6 +36,7 @@ module.exports = class SourceConstraintBuilder { /** * @param {boolean} softPreference + * @returns this */ withSoftPreference(softPreference = true) { this.softPreference = softPreference; @@ -41,6 +46,7 @@ module.exports = class SourceConstraintBuilder { /** * @param {string} value * @param {string} subType + * @returns this */ withAnchorByValue(value, subType = '') { const anchor = new WantedAnchorBuilder() @@ -53,6 +59,7 @@ module.exports = class SourceConstraintBuilder { /** * @param {string} subType + * @returns this */ withPassport(subType = '') { return this.withAnchorByValue(ANCHOR_VALUE_PASSPORT, subType); @@ -60,6 +67,7 @@ module.exports = class SourceConstraintBuilder { /** * @param {string} subType + * @returns this */ withDrivingLicence(subType = '') { return this.withAnchorByValue(ANCHOR_VALUE_DRIVING_LICENSE, subType); @@ -67,6 +75,7 @@ module.exports = class SourceConstraintBuilder { /** * @param {string} subType + * @returns this */ withNationalId(subType = '') { return this.withAnchorByValue(ANCHOR_VALUE_NATIONAL_ID, subType); @@ -74,6 +83,7 @@ module.exports = class SourceConstraintBuilder { /** * @param {string} subType + * @returns this */ withPasscard(subType = '') { return this.withAnchorByValue(ANCHOR_VALUE_PASSCARD, subType); diff --git a/src/digital_identity_service/policy/source.constraint.js b/src/digital_identity_service/policy/source.constraint.js index 0607ac3d1..c02038c46 100644 --- a/src/digital_identity_service/policy/source.constraint.js +++ b/src/digital_identity_service/policy/source.constraint.js @@ -17,14 +17,16 @@ module.exports = class SourceConstraint { */ constructor(anchors, softPreference = false) { Validation.isArrayOfType(anchors, WantedAnchor, 'anchors'); + /** @private */ this.anchors = anchors; Validation.isBoolean(softPreference, 'softPreference'); + /** @private */ this.softPreference = softPreference; } /** - * @returns {Object} data for JSON.stringify() + * Returns serialized data for JSON.stringify() */ toJSON() { return { diff --git a/src/digital_identity_service/policy/wanted.anchor.builder.js b/src/digital_identity_service/policy/wanted.anchor.builder.js index b098b14b3..27ccfdeec 100644 --- a/src/digital_identity_service/policy/wanted.anchor.builder.js +++ b/src/digital_identity_service/policy/wanted.anchor.builder.js @@ -10,6 +10,7 @@ const WantedAnchor = require('./wanted.anchor'); module.exports = class WantedAnchorBuilder { /** * @param {string} value + * @returns this */ withValue(value) { this.value = value; @@ -18,6 +19,7 @@ module.exports = class WantedAnchorBuilder { /** * @param {string} subType + * @returns this */ withSubType(subType) { this.subType = subType; diff --git a/src/digital_identity_service/policy/wanted.anchor.js b/src/digital_identity_service/policy/wanted.anchor.js index ce3a25ec0..5d213f134 100644 --- a/src/digital_identity_service/policy/wanted.anchor.js +++ b/src/digital_identity_service/policy/wanted.anchor.js @@ -14,14 +14,16 @@ module.exports = class WantedAnchor { */ constructor(value, subType = '') { Validation.isString(value, 'value'); + /** @private */ this.value = value; Validation.isString(subType, 'subType'); + /** @private */ this.subType = subType; } /** - * @returns {Object} data for JSON.stringify() + * Returns serialized data for JSON.stringify() */ toJSON() { return { diff --git a/src/digital_identity_service/policy/wanted.attribute.builder.js b/src/digital_identity_service/policy/wanted.attribute.builder.js index b49e700fe..38ac35b3d 100644 --- a/src/digital_identity_service/policy/wanted.attribute.builder.js +++ b/src/digital_identity_service/policy/wanted.attribute.builder.js @@ -10,6 +10,7 @@ const WantedAttribute = require('./wanted.attribute'); module.exports = class WantedAttributeBuilder { /** * @param {string} name + * @returns this */ withName(name) { this.name = name; @@ -18,6 +19,7 @@ module.exports = class WantedAttributeBuilder { /** * @param {string} derivation + * @returns this */ withDerivation(derivation) { this.derivation = derivation; @@ -25,7 +27,9 @@ module.exports = class WantedAttributeBuilder { } /** + * @typedef {import('./constraints')} Constraints * @param {Constraints} constraints + * @returns this */ withConstraints(constraints) { this.constraints = constraints; @@ -33,7 +37,8 @@ module.exports = class WantedAttributeBuilder { } /** - * @param {Array} acceptSelfAsserted + * @param {boolean} [acceptSelfAsserted=true] + * @returns this */ withAcceptSelfAsserted(acceptSelfAsserted = true) { this.acceptSelfAsserted = acceptSelfAsserted; diff --git a/src/digital_identity_service/policy/wanted.attribute.js b/src/digital_identity_service/policy/wanted.attribute.js index 4e746825e..d7d4c6f67 100644 --- a/src/digital_identity_service/policy/wanted.attribute.js +++ b/src/digital_identity_service/policy/wanted.attribute.js @@ -11,28 +11,32 @@ const Constraints = require('./constraints'); module.exports = class WantedAttribute { /** * @param {string} name - * @param {string} derivation - * @param {boolean} acceptSelfAsserted - * @param {Constraints} constraints + * @param {string|null} derivation + * @param {boolean|null} acceptSelfAsserted + * @param {Constraints|null} constraints */ constructor(name, derivation = null, acceptSelfAsserted = null, constraints = null) { Validation.isString(name, 'name'); Validation.notNullOrEmpty(name, 'name'); + /** @private */ this.name = name; if (derivation !== null) { Validation.isString(derivation, 'derivation'); } + /** @private */ this.derivation = derivation; if (acceptSelfAsserted !== null) { Validation.isBoolean(acceptSelfAsserted, 'acceptSelfAsserted'); } + /** @private */ this.acceptSelfAsserted = acceptSelfAsserted; if (constraints !== null) { Validation.instanceOf(constraints, Constraints, 'constraints'); } + /** @private */ this.constraints = constraints; } @@ -78,7 +82,7 @@ module.exports = class WantedAttribute { } /** - * @returns {Object} data for JSON.stringify() + * Returns serialized data for JSON.stringify() */ toJSON() { const json = { diff --git a/src/digital_identity_service/receipts/application.content.js b/src/digital_identity_service/receipts/application.content.js index 352c1356f..d9c8db657 100644 --- a/src/digital_identity_service/receipts/application.content.js +++ b/src/digital_identity_service/receipts/application.content.js @@ -5,11 +5,12 @@ const ApplicationProfile = require('./application.profile'); class ApplicationContent extends BaseContent { /** - * @param {[]} attributes - * @param {[]} extraData + * @param {{ [k: string]: any }[]} attributes + * @param {{ [k: string]: any }[]} extraData */ constructor(attributes = [], extraData = []) { super(extraData); + /** @private */ this.profile = new ApplicationProfile(attributes); } diff --git a/src/digital_identity_service/receipts/application.profile.js b/src/digital_identity_service/receipts/application.profile.js index 962ca5e23..0fb65d524 100644 --- a/src/digital_identity_service/receipts/application.profile.js +++ b/src/digital_identity_service/receipts/application.profile.js @@ -3,10 +3,15 @@ const constants = require('../../yoti_common/constants'); const BaseProfile = require('./base.profile'); +/** + * @typedef {import('../../data_type/attribute').Attribute} Attribute + */ + /** * Profile of a human user with convenience methods to access well-known attributes. * * @class Profile + * */ class ApplicationProfile extends BaseProfile { getName() { diff --git a/src/digital_identity_service/receipts/base.content.js b/src/digital_identity_service/receipts/base.content.js index fcc835efd..45047d236 100644 --- a/src/digital_identity_service/receipts/base.content.js +++ b/src/digital_identity_service/receipts/base.content.js @@ -4,13 +4,14 @@ const ExtraData = require('./extra.data'); class BaseContent { /** - * @param {[]} extraData + * @param {{ [k: string]: any }[]} extraData */ constructor(extraData = []) { const currentClass = new.target; if (currentClass === BaseContent) { throw new Error('BaseContent can not be instantiated'); } + /** @private */ this.extraData = new ExtraData(extraData); } diff --git a/src/digital_identity_service/receipts/base.profile.js b/src/digital_identity_service/receipts/base.profile.js index 902c28561..aa9bbf6d6 100644 --- a/src/digital_identity_service/receipts/base.profile.js +++ b/src/digital_identity_service/receipts/base.profile.js @@ -7,10 +7,12 @@ class BaseProfile { * @param {Array} attributes */ constructor(attributes = []) { + /** @protected */ this.attributes = attributes .filter((attribute) => !!attribute) .map((attribute) => new Attribute(attribute)); + /** @private */ this.attributesMap = this.attributes.reduce((acc, current) => { const name = current.getName(); acc[name] = acc[name] || []; diff --git a/src/digital_identity_service/receipts/content.factory.js b/src/digital_identity_service/receipts/content.factory.js index ff23d80dc..76b2b1aca 100644 --- a/src/digital_identity_service/receipts/content.factory.js +++ b/src/digital_identity_service/receipts/content.factory.js @@ -1,14 +1,22 @@ 'use strict'; const { decryptReceiptContent } = require('./decryption.utils'); -const { AttributeList } = require('../../proto/types'); +const { decodeAttributeList } = require('../../proto/messages'); const { AttributeListConverter } = require('../../yoti_common/converters/attribute.list.converter'); const ApplicationContent = require('./application.content'); const UserContent = require('./user.content'); const ExtraDataConverter = require('../../yoti_common/converters/extra.data.converter'); +/** + * + * @param {Object} contentData + * @param {string} contentData.profile + * @param {string} contentData.extraData + * @param {Buffer} receiptContentKey + * @returns {{extraData: (*), attributes: { [k: string]: any }[]}} + */ function decryptAndExtractContentData( - { profile, extraData } = {}, + { profile, extraData } = { profile: '', extraData: '' }, receiptContentKey ) { const decryptedProfile = decryptReceiptContent(profile, receiptContentKey); @@ -18,7 +26,7 @@ function decryptAndExtractContentData( let extractedExtraData; if (decryptedProfile) { - const { attributes: decodedProfileAttributes } = AttributeList.decode(decryptedProfile); + const { attributes: decodedProfileAttributes } = decodeAttributeList(decryptedProfile); attributes = AttributeListConverter.convertAttributeList(decodedProfileAttributes); } @@ -34,11 +42,11 @@ function decryptAndExtractContentData( /** * - * @param content {profile, extraData} encrypted profile content + * @param {{profile, extraData}} content encrypted profile content * @param receiptContentKey * @returns {ApplicationContent} */ -function buildApplicationContentFromEncryptedContent(content = {}, receiptContentKey) { +function buildApplicationContentFromEncryptedContent(content = { profile: '', extraData: '' }, receiptContentKey) { const { attributes, extraData } = decryptAndExtractContentData( content, receiptContentKey @@ -48,11 +56,11 @@ function buildApplicationContentFromEncryptedContent(content = {}, receiptConten /** * - * @param content {profile, extraData} encrypted profile content + * @param {{profile, extraData}} content encrypted profile content * @param receiptContentKey * @returns {UserContent} */ -function buildUserContentFromEncryptedContent(content = {}, receiptContentKey) { +function buildUserContentFromEncryptedContent(content = { profile: '', extraData: '' }, receiptContentKey) { const { attributes, extraData } = decryptAndExtractContentData( content, receiptContentKey diff --git a/src/digital_identity_service/receipts/extra.data.js b/src/digital_identity_service/receipts/extra.data.js index 53d7bb434..70fa6925c 100644 --- a/src/digital_identity_service/receipts/extra.data.js +++ b/src/digital_identity_service/receipts/extra.data.js @@ -4,7 +4,7 @@ const AttributeIssuanceDetails = require('../../data_type/attribute.issuance.det /** * - * @param {[]} dataEntries + * @param {Object[]} dataEntries * @returns {AttributeIssuanceDetails} */ function getAttributeIssuanceDetails(dataEntries) { @@ -16,6 +16,7 @@ class ExtraData { * @param {Object[]} dataEntries */ constructor(dataEntries = []) { + /** @private */ this.attributeIssuanceDetails = getAttributeIssuanceDetails(dataEntries); } diff --git a/src/digital_identity_service/receipts/receipt.item.key.response.js b/src/digital_identity_service/receipts/receipt.item.key.response.js index 747b9a19e..b38580a1d 100644 --- a/src/digital_identity_service/receipts/receipt.item.key.response.js +++ b/src/digital_identity_service/receipts/receipt.item.key.response.js @@ -10,12 +10,15 @@ const Validation = require('../../yoti_common/validation'); class ReceiptItemKeyResponse { constructor(response) { Validation.isString(response.id, 'Receipt wrapped item key ID'); + /** @private */ this.id = response.id; Validation.isString(response.iv, 'Receipt wrapped item key iv'); + /** @private */ this.iv = response.iv; Validation.isString(response.value, 'Receipt wrapped item key value'); + /** @private */ this.value = response.value; } diff --git a/src/digital_identity_service/receipts/receipt.response.js b/src/digital_identity_service/receipts/receipt.response.js index 7d0486ca0..116366d0c 100644 --- a/src/digital_identity_service/receipts/receipt.response.js +++ b/src/digital_identity_service/receipts/receipt.response.js @@ -10,45 +10,55 @@ const Validation = require('../../yoti_common/validation'); class ReceiptResponse { constructor(response) { Validation.isString(response.id, 'Receipt ID'); + /** @private */ this.id = response.id; Validation.isString(response.sessionId, 'Session ID'); + /** @private */ this.sessionId = response.sessionId; Validation.isStringDate(response.timestamp, 'timestamp'); + /** @private */ this.timestamp = new Date(response.timestamp); if (response.error) { + /** @private */ this.error = response.error; } if (response.rememberMeId) { Validation.isString(response.rememberMeId, 'Remember Me Id'); + /** @private */ this.rememberMeId = response.rememberMeId; } if (response.parentRememberMeId) { Validation.isString(response.parentRememberMeId, 'Parent Remember Me Id'); + /** @private */ this.parentRememberMeId = response.parentRememberMeId; } if (response.content) { Validation.isPlainObject(response.content, 'Content'); + /** @private */ this.content = response.content; } if (response.otherPartyContent) { Validation.isPlainObject(response.otherPartyContent, 'Other Party Content'); + /** @private */ this.otherPartyContent = response.otherPartyContent; } if (response.wrappedItemKeyId) { Validation.isString(response.wrappedItemKeyId, 'Wrapped Item Key Id'); + /** @private */ this.wrappedItemKeyId = response.wrappedItemKeyId; } if (response.wrappedKey) { Validation.isString(response.wrappedKey, 'Wrapped Key'); + /** @private */ this.wrappedKey = response.wrappedKey; } } diff --git a/src/digital_identity_service/receipts/user.content.js b/src/digital_identity_service/receipts/user.content.js index c5ee3d04a..b891fafa8 100644 --- a/src/digital_identity_service/receipts/user.content.js +++ b/src/digital_identity_service/receipts/user.content.js @@ -5,11 +5,12 @@ const UserProfile = require('./user.profile'); class UserContent extends BaseContent { /** - * @param {[]} attributes - * @param {[]} extraData + * @param {{ [k: string]: any }[]} attributes + * @param {{ [k: string]: any }[]} extraData */ constructor(attributes = [], extraData = []) { super(extraData); + /** @private */ this.profile = new UserProfile(attributes); } diff --git a/src/digital_identity_service/receipts/user.profile.js b/src/digital_identity_service/receipts/user.profile.js index 438ce0f51..1b87fcc35 100644 --- a/src/digital_identity_service/receipts/user.profile.js +++ b/src/digital_identity_service/receipts/user.profile.js @@ -15,6 +15,7 @@ class UserProfile extends BaseProfile { constructor(attributes = []) { super(attributes); + /** @private */ this.ageVerifications = this.attributes .filter((attribute) => attribute.getValue() instanceof AgeVerification) .reduce((acc, attribute) => ({ @@ -72,7 +73,7 @@ class UserProfile extends BaseProfile { /** * Searches for an AgeVerification corresponding to an 'Age Over' check for the given age * - * @param {int} age + * @param {number} age * * @returns {AgeVerification|null} */ @@ -83,7 +84,7 @@ class UserProfile extends BaseProfile { /** * Searches for an AgeVerification corresponding to an 'Age Under' check for the given age. * - * @param {int} age + * @param {number} age * * @returns {AgeVerification|null} */ @@ -95,13 +96,13 @@ class UserProfile extends BaseProfile { * Searches for an AgeVerification corresponding to provided type and age. * * @param {string} type - * @param {int} age + * @param {number} age * * @returns {AgeVerification|null} */ findAgeVerification(type, age) { - Validation.isString(type); - Validation.isInteger(age); + Validation.isString(type, 'type'); + Validation.isInteger(age, 'age'); return this.ageVerifications[type + age] || null; } @@ -118,7 +119,7 @@ class UserProfile extends BaseProfile { /** * Corresponds to the nationality in the passport. * - * @returns {Attribute|main} + * @returns {Attribute|null} */ getNationality() { return this.getAttribute(constants.ATTR_NATIONALITY); @@ -137,7 +138,7 @@ class UserProfile extends BaseProfile { /** * Photograph of user, encoded as a JPEG image. * - * @returns {Attribute|main} + * @returns {Attribute|null} */ getSelfie() { return this.getAttribute(constants.ATTR_SELFIE); @@ -169,7 +170,7 @@ class UserProfile extends BaseProfile { return new Attribute({ ...structuredPostalAddress, name: constants.ATTR_POSTAL_ADDRESS, - value: structuredPostalAddress.value.formatted_address, + value: structuredPostalAddress.getValue().formatted_address, }); } @@ -179,7 +180,7 @@ class UserProfile extends BaseProfile { /** * The user's structured postal address as a Json. * - * @returns {null|*} + * @returns {null|Attribute} */ getStructuredPostalAddress() { return this.getAttribute(constants.ATTR_STRUCTURED_POSTAL_ADDRESS); @@ -188,7 +189,7 @@ class UserProfile extends BaseProfile { /** * Document details. * - * @returns {null|DocumentDetails} + * @returns {null|Attribute} */ getDocumentDetails() { return this.getAttribute(constants.ATTR_DOCUMENT_DETAILS); diff --git a/src/digital_identity_service/share.session.configuration.builder.js b/src/digital_identity_service/share.session.configuration.builder.js index d93ad541e..c4ec5fe1e 100644 --- a/src/digital_identity_service/share.session.configuration.builder.js +++ b/src/digital_identity_service/share.session.configuration.builder.js @@ -2,6 +2,12 @@ const ShareSessionConfiguration = require('./share.session.configuration'); +/** + * @typedef {import('./policy/policy')} Policy + * @typedef {import('./share.session.notification')} ShareSessionNotification + * @typedef {import('./extension/extension')} Extension + */ + /** * Builder for Share sessions. * @@ -9,6 +15,7 @@ const ShareSessionConfiguration = require('./share.session.configuration'); */ module.exports = class ShareSessionBuilder { constructor() { + /** @private */ this.extensions = []; } @@ -53,7 +60,7 @@ module.exports = class ShareSessionBuilder { } /** - * @returns {ShareSession} + * @returns {ShareSessionConfiguration} */ build() { return new ShareSessionConfiguration( diff --git a/src/digital_identity_service/share.session.configuration.js b/src/digital_identity_service/share.session.configuration.js index 897a25630..eb1db6a38 100644 --- a/src/digital_identity_service/share.session.configuration.js +++ b/src/digital_identity_service/share.session.configuration.js @@ -20,21 +20,26 @@ module.exports = class ShareSession { */ constructor(policy, extensions, subject, redirectUri, notification) { Validation.instanceOf(policy, Policy, 'policy'); + /** @private */ this.policy = policy; Validation.isArrayOfType(extensions, Extension, 'extensions'); + /** @private */ this.extensions = extensions; Validation.isString(redirectUri, 'redirectUri'); + /** @private */ this.redirectUri = redirectUri; if (subject) { Validation.isPlainObject(subject, 'subject'); + /** @private */ this.subject = subject; } if (notification) { Validation.instanceOf(notification, ShareSessionNotification, 'notification'); + /** @private */ this.notification = notification; } } @@ -75,7 +80,7 @@ module.exports = class ShareSession { } /** - * @returns {Object} data for JSON.stringify() + * Returns serialized data for JSON.stringify() */ toJSON() { return { diff --git a/src/digital_identity_service/share.session.notification.builder.js b/src/digital_identity_service/share.session.notification.builder.js index 1637c5ed3..7da5daabf 100644 --- a/src/digital_identity_service/share.session.notification.builder.js +++ b/src/digital_identity_service/share.session.notification.builder.js @@ -9,6 +9,7 @@ const ShareSessionNotification = require('./share.session.notification'); */ module.exports = class ShareSessionNotificationBuilder { constructor() { + /** @private */ this.headers = {}; } diff --git a/src/digital_identity_service/share.session.notification.js b/src/digital_identity_service/share.session.notification.js index b47f0939a..3b4235fba 100644 --- a/src/digital_identity_service/share.session.notification.js +++ b/src/digital_identity_service/share.session.notification.js @@ -16,20 +16,24 @@ module.exports = class ShareSessionNotification { */ constructor(url, method, headers, verifyTls) { Validation.isString(url, 'Notification Url'); + /** @private */ this.url = url; if (method) { Validation.isString(method, 'Notification Method'); + /** @private */ this.method = method; } if (headers) { Validation.isPlainObject(headers, 'Notification Headers'); + /** @private */ this.headers = headers; } if (verifyTls) { Validation.isBoolean(verifyTls, 'Notification Verify TLS'); + /** @private */ this.verifyTls = verifyTls; } } @@ -62,6 +66,9 @@ module.exports = class ShareSessionNotification { return this.verifyTls; } + /** + * Returns serialized data for JSON.stringify() + */ toJSON() { return { url: this.url, diff --git a/src/dynamic_sharing_service/dynamic.scenario.builder.js b/src/dynamic_sharing_service/dynamic.scenario.builder.js index bc6f54119..eb9a3d0ad 100644 --- a/src/dynamic_sharing_service/dynamic.scenario.builder.js +++ b/src/dynamic_sharing_service/dynamic.scenario.builder.js @@ -9,6 +9,7 @@ const DynamicScenario = require('./dynamic.scenario'); */ module.exports = class DynamicScenarioBuilder { constructor() { + /** @private */ this.extensions = []; } @@ -21,6 +22,7 @@ module.exports = class DynamicScenarioBuilder { } /** + * @typedef {import('./policy/dynamic.policy.js')} DynamicPolicy * @param {DynamicPolicy} dynamicPolicy */ withPolicy(dynamicPolicy) { @@ -29,6 +31,8 @@ module.exports = class DynamicScenarioBuilder { } /** + * @typedef {import('./extension/extension.js')} Extension + * * @param {Extension} extension */ withExtension(extension) { diff --git a/src/dynamic_sharing_service/dynamic.scenario.js b/src/dynamic_sharing_service/dynamic.scenario.js index 33af9a1fd..17126e66a 100644 --- a/src/dynamic_sharing_service/dynamic.scenario.js +++ b/src/dynamic_sharing_service/dynamic.scenario.js @@ -24,16 +24,20 @@ module.exports = class DynamicScenario { */ constructor(callbackEndpoint, dynamicPolicy, extensions, subject) { Validation.isString(callbackEndpoint, 'callbackEndpoint'); + /** @private */ this.callbackEndpoint = callbackEndpoint; Validation.instanceOf(dynamicPolicy, DynamicPolicy, 'dynamicPolicy'); + /** @private */ this.dynamicPolicy = dynamicPolicy; Validation.isArrayOfType(extensions, Extension, 'extensions'); + /** @private */ this.extensions = extensions; if (subject) { Validation.isPlainObject(subject, 'subject'); + /** @private */ this.subject = subject; } } diff --git a/src/dynamic_sharing_service/extension/device.location.js b/src/dynamic_sharing_service/extension/device.location.js index 9c996ece0..ce4bac8c9 100644 --- a/src/dynamic_sharing_service/extension/device.location.js +++ b/src/dynamic_sharing_service/extension/device.location.js @@ -16,15 +16,19 @@ class DeviceLocation { */ constructor(latitude, longitude, radius = 150, maxUncertainty = 150) { Validation.withinRange(latitude, -90, 90, 'latitude'); + /** @private */ this.latitude = latitude; Validation.withinRange(longitude, -180, 180, 'longitude'); + /** @private */ this.longitude = longitude; Validation.notLessThan(radius, 0, 'radius'); + /** @private */ this.radius = radius; Validation.notLessThan(maxUncertainty, 0, 'maxUncertainty'); + /** @private */ this.maxUncertainty = maxUncertainty; } diff --git a/src/dynamic_sharing_service/extension/extension.js b/src/dynamic_sharing_service/extension/extension.js index 8f8707186..e6cc23d08 100644 --- a/src/dynamic_sharing_service/extension/extension.js +++ b/src/dynamic_sharing_service/extension/extension.js @@ -14,9 +14,11 @@ module.exports = class Extension { */ constructor(type, content) { Validation.isString(type, 'type'); + /** @private */ this.type = type; Validation.notNull(content, 'content'); + /** @private */ this.content = content; } diff --git a/src/dynamic_sharing_service/extension/location.constraint.extension.content.js b/src/dynamic_sharing_service/extension/location.constraint.extension.content.js index 399bd9a20..7510399e6 100644 --- a/src/dynamic_sharing_service/extension/location.constraint.extension.content.js +++ b/src/dynamic_sharing_service/extension/location.constraint.extension.content.js @@ -9,6 +9,7 @@ const DeviceLocation = require('./device.location'); */ module.exports = class LocationConstraintContent { constructor(latitude, longitude, radius, maxUncertainty) { + /** @private */ this.expectedDeviceLocation = new DeviceLocation(latitude, longitude, radius, maxUncertainty); } diff --git a/src/dynamic_sharing_service/extension/third.party.attribute.extension.builder.js b/src/dynamic_sharing_service/extension/third.party.attribute.extension.builder.js index 0b87df9dd..b6d524ee8 100644 --- a/src/dynamic_sharing_service/extension/third.party.attribute.extension.builder.js +++ b/src/dynamic_sharing_service/extension/third.party.attribute.extension.builder.js @@ -9,6 +9,7 @@ const THIRD_PARTY_ATTRIBUTE_EXTENSION_TYPE = 'THIRD_PARTY_ATTRIBUTE'; class ThirdPartyAttributeExtensionBuilder { constructor() { + /** @private */ this.definitions = []; } diff --git a/src/dynamic_sharing_service/extension/third.party.attribute.extension.content.js b/src/dynamic_sharing_service/extension/third.party.attribute.extension.content.js index 4958c3358..3212ce652 100644 --- a/src/dynamic_sharing_service/extension/third.party.attribute.extension.content.js +++ b/src/dynamic_sharing_service/extension/third.party.attribute.extension.content.js @@ -2,7 +2,9 @@ class ThirdPartyAttributeExtensionContent { constructor(expiryDate, definitions) { + /** @private */ this.expiryDate = expiryDate; + /** @private */ this.definitions = definitions; } diff --git a/src/dynamic_sharing_service/extension/transactional.flow.extension.builder.js b/src/dynamic_sharing_service/extension/transactional.flow.extension.builder.js index 864ce4e12..00596d6af 100644 --- a/src/dynamic_sharing_service/extension/transactional.flow.extension.builder.js +++ b/src/dynamic_sharing_service/extension/transactional.flow.extension.builder.js @@ -19,7 +19,7 @@ module.exports = class TransactionalFlowExtensionBuilder { */ withContent(content) { Validation.notNull(content, 'content'); - Validation.instanceOf(content, Object); + Validation.instanceOf(content, Object, 'content'); this.content = content; return this; } diff --git a/src/dynamic_sharing_service/index.js b/src/dynamic_sharing_service/index.js index 0c18d1b70..4d6a0ff12 100644 --- a/src/dynamic_sharing_service/index.js +++ b/src/dynamic_sharing_service/index.js @@ -29,15 +29,17 @@ class DynamicShareService { /** * @param {string} sdkId * @param {string|Buffer} pem - * @param {Object} options - * @param {string} options.apiUrl + * @param {{apiUrl?: string}} options */ constructor(sdkId, pem, { apiUrl = DEFAULT_API_URL } = {}) { Validation.isString(sdkId, 'sdkId'); Validation.notNullOrEmpty(pem, 'pem'); + /** @private */ this.sdkId = sdkId; + /** @private */ this.pem = pem; + /** @private */ this.apiUrl = apiUrl; } @@ -48,7 +50,7 @@ class DynamicShareService { const requestBuilder = new RequestBuilder() .withBaseUrl(this.apiUrl) - .withPemString(this.pem) + .withPemString(this.pem.toString()) .withEndpoint(`/qrcodes/apps/${this.sdkId}`) .withQueryParam('appId', this.sdkId) .withMethod('POST'); diff --git a/src/dynamic_sharing_service/policy/constraints.builder.js b/src/dynamic_sharing_service/policy/constraints.builder.js index 2f8dac752..a6e897714 100644 --- a/src/dynamic_sharing_service/policy/constraints.builder.js +++ b/src/dynamic_sharing_service/policy/constraints.builder.js @@ -14,6 +14,7 @@ module.exports = class ConstraintsBuilder { * Set default properties. */ constructor() { + /** @private */ this.constraints = []; } diff --git a/src/dynamic_sharing_service/policy/constraints.js b/src/dynamic_sharing_service/policy/constraints.js index e5c5e2a00..618ceffd0 100644 --- a/src/dynamic_sharing_service/policy/constraints.js +++ b/src/dynamic_sharing_service/policy/constraints.js @@ -8,12 +8,13 @@ const SourceConstraint = require('./source.constraint'); * * @class Constraints */ -module.exports = class Constraints { +class Constraints { /** * Set default properties. */ constructor(constraints) { Validation.isArrayOfTypes(constraints, [SourceConstraint], 'constraints'); + /** @private */ this.constraints = constraints; } @@ -23,4 +24,6 @@ module.exports = class Constraints { toJSON() { return this.constraints; } -}; +} + +module.exports = Constraints; diff --git a/src/dynamic_sharing_service/policy/dynamic.policy.builder.js b/src/dynamic_sharing_service/policy/dynamic.policy.builder.js index d724f8f69..e4c1de1bc 100644 --- a/src/dynamic_sharing_service/policy/dynamic.policy.builder.js +++ b/src/dynamic_sharing_service/policy/dynamic.policy.builder.js @@ -11,6 +11,10 @@ const Validation = require('../../yoti_common/validation'); const SELFIE_AUTH_TYPE = 1; const PIN_AUTH_TYPE = 2; +/** + * @typedef {import('./constraints')} Constraints + */ + /** * Builder for DynamicPolicy. * @@ -18,7 +22,9 @@ const PIN_AUTH_TYPE = 2; */ module.exports = class DynamicPolicyBuilder { constructor() { + /** @private */ this.wantedAttributes = {}; + /** @private */ this.wantedAuthTypes = []; } @@ -49,7 +55,7 @@ module.exports = class DynamicPolicyBuilder { /** * @param {string} name * @param {Constraints} constraints - * @param {boolean} acceptSelfAsserted + * @param {boolean|null} acceptSelfAsserted */ withWantedAttributeByName(name, constraints = null, acceptSelfAsserted = null) { const wantedAttributeBuilder = new WantedAttributeBuilder() @@ -115,7 +121,7 @@ module.exports = class DynamicPolicyBuilder { } /** - * @param {int} age + * @param {number} age * @param {Constraints} constraints * @param {boolean} acceptSelfAsserted */ @@ -129,7 +135,7 @@ module.exports = class DynamicPolicyBuilder { } /** - * @param {int} age + * @param {number} age * @param {Constraints} constraints * @param {boolean} acceptSelfAsserted */ @@ -283,7 +289,7 @@ module.exports = class DynamicPolicyBuilder { } /** - * @param {integer} wantedAuthType + * @param {number} wantedAuthType * @param {boolean} enabled */ withWantedAuthType(wantedAuthType, enabled = true) { diff --git a/src/dynamic_sharing_service/policy/dynamic.policy.js b/src/dynamic_sharing_service/policy/dynamic.policy.js index 85f6ed80f..dbb4cf76e 100644 --- a/src/dynamic_sharing_service/policy/dynamic.policy.js +++ b/src/dynamic_sharing_service/policy/dynamic.policy.js @@ -11,7 +11,7 @@ const Validation = require('../../yoti_common/validation'); module.exports = class DynamicPolicy { /** * @param {WantedAttribute[]} wantedAttributes - array of attributes to be requested. - * @param {integer[]} wantedAuthTypes - auth types represents the authentication type to be used. + * @param {number[]} wantedAuthTypes - auth types represents the authentication type to be used. * @param {boolean} wantedRememberMe * @param {object} identityProfileRequirements */ @@ -22,20 +22,25 @@ module.exports = class DynamicPolicy { identityProfileRequirements = null ) { Validation.isArrayOfType(wantedAttributes, WantedAttribute, 'wantedAttribute'); + /** @private */ this.wantedAttributes = wantedAttributes; if (wantedAuthTypes) { Validation.isArrayOfIntegers(wantedAuthTypes, 'wantedAuthTypes'); + /** @private */ this.wantedAuthTypes = wantedAuthTypes; } else { + /** @private */ this.wantedAuthTypes = []; } Validation.isBoolean(wantedRememberMe, 'wantedRememberMe'); + /** @private */ this.wantedRememberMe = wantedRememberMe; if (identityProfileRequirements) { Validation.isPlainObject(identityProfileRequirements, 'identityProfileRequirements'); + /** @private */ this.identityProfileRequirements = identityProfileRequirements; } } @@ -48,7 +53,7 @@ module.exports = class DynamicPolicy { } /** - * @returns {integer[]} auth types represents the authentication type to be used. + * @returns {number[]} auth types represents the authentication type to be used. */ getWantedAuthTypes() { return this.wantedAuthTypes; diff --git a/src/dynamic_sharing_service/policy/source.constraint.builder.js b/src/dynamic_sharing_service/policy/source.constraint.builder.js index d470003ff..775ae4ad6 100644 --- a/src/dynamic_sharing_service/policy/source.constraint.builder.js +++ b/src/dynamic_sharing_service/policy/source.constraint.builder.js @@ -18,11 +18,15 @@ module.exports = class SourceConstraintBuilder { * Set default properties. */ constructor() { + /** @private */ this.anchors = []; + /** @private */ this.softPreference = false; } /** + * @typedef {import('./wanted.anchor')} WantedAnchor + * * @param {WantedAnchor} anchor */ withAnchor(anchor) { diff --git a/src/dynamic_sharing_service/policy/source.constraint.js b/src/dynamic_sharing_service/policy/source.constraint.js index f9ccd25fd..856d18c28 100644 --- a/src/dynamic_sharing_service/policy/source.constraint.js +++ b/src/dynamic_sharing_service/policy/source.constraint.js @@ -17,9 +17,11 @@ module.exports = class SourceConstraint { */ constructor(anchors, softPreference = false) { Validation.isArrayOfType(anchors, WantedAnchor, 'anchors'); + /** @private */ this.anchors = anchors; Validation.isBoolean(softPreference, 'softPreference'); + /** @private */ this.softPreference = softPreference; } diff --git a/src/dynamic_sharing_service/policy/wanted.anchor.js b/src/dynamic_sharing_service/policy/wanted.anchor.js index 21b0ffdf4..8390d089e 100644 --- a/src/dynamic_sharing_service/policy/wanted.anchor.js +++ b/src/dynamic_sharing_service/policy/wanted.anchor.js @@ -14,9 +14,11 @@ module.exports = class WantedAnchor { */ constructor(value, subType = '') { Validation.isString(value, 'value'); + /** @private */ this.value = value; Validation.isString(subType, 'subType'); + /** @private */ this.subType = subType; } diff --git a/src/dynamic_sharing_service/policy/wanted.attribute.builder.js b/src/dynamic_sharing_service/policy/wanted.attribute.builder.js index b49e700fe..feca3cd4f 100644 --- a/src/dynamic_sharing_service/policy/wanted.attribute.builder.js +++ b/src/dynamic_sharing_service/policy/wanted.attribute.builder.js @@ -25,6 +25,8 @@ module.exports = class WantedAttributeBuilder { } /** + * @typedef {import('./constraints')} Constraints + * * @param {Constraints} constraints */ withConstraints(constraints) { @@ -33,7 +35,7 @@ module.exports = class WantedAttributeBuilder { } /** - * @param {Array} acceptSelfAsserted + * @param {boolean} acceptSelfAsserted */ withAcceptSelfAsserted(acceptSelfAsserted = true) { this.acceptSelfAsserted = acceptSelfAsserted; diff --git a/src/dynamic_sharing_service/policy/wanted.attribute.js b/src/dynamic_sharing_service/policy/wanted.attribute.js index 4e746825e..370a30481 100644 --- a/src/dynamic_sharing_service/policy/wanted.attribute.js +++ b/src/dynamic_sharing_service/policy/wanted.attribute.js @@ -11,28 +11,32 @@ const Constraints = require('./constraints'); module.exports = class WantedAttribute { /** * @param {string} name - * @param {string} derivation - * @param {boolean} acceptSelfAsserted - * @param {Constraints} constraints + * @param {string|null} derivation + * @param {boolean|null} acceptSelfAsserted + * @param {Constraints|null} constraints */ constructor(name, derivation = null, acceptSelfAsserted = null, constraints = null) { Validation.isString(name, 'name'); Validation.notNullOrEmpty(name, 'name'); + /** @private */ this.name = name; if (derivation !== null) { Validation.isString(derivation, 'derivation'); } + /** @private */ this.derivation = derivation; if (acceptSelfAsserted !== null) { Validation.isBoolean(acceptSelfAsserted, 'acceptSelfAsserted'); } + /** @private */ this.acceptSelfAsserted = acceptSelfAsserted; if (constraints !== null) { Validation.instanceOf(constraints, Constraints, 'constraints'); } + /** @private */ this.constraints = constraints; } diff --git a/src/dynamic_sharing_service/share.url.result.js b/src/dynamic_sharing_service/share.url.result.js index 80336efd4..632cf03e1 100644 --- a/src/dynamic_sharing_service/share.url.result.js +++ b/src/dynamic_sharing_service/share.url.result.js @@ -14,9 +14,11 @@ module.exports = class ShareUrlResult { */ constructor(response) { Validation.isString(response.qrcode, 'QR Code URL'); + /** @private */ this.shareUrl = response.qrcode; Validation.isString(response.ref_id, 'Ref ID'); + /** @private */ this.refId = response.ref_id; } diff --git a/src/idv_service/idv.error.js b/src/idv_service/idv.error.js index 4dcfb21f9..0f8a83193 100644 --- a/src/idv_service/idv.error.js +++ b/src/idv_service/idv.error.js @@ -1,7 +1,23 @@ 'use strict'; /** - * @param {Error} error + * @typedef {Object} ResponseBody + * @property {string} [message] + * @property {string} [code] + * @property {Array} [errors] + * + * @typedef {Object} Response + * @property {ResponseBody} [body] + * + * @typedef {Object} APIError + * @property {Response} [response] + * @property {string} [message] + */ + +/** + * @param {APIError} error + * + * @returns {string|undefined} */ function errorMessage(error) { if ( @@ -45,11 +61,12 @@ class IDVError extends Error { super(errorMessage(error)); this.name = this.constructor.name; + /** @private */ this.response = error.response || null; } /** - * @returns {int} + * @returns {number|null} */ getResponseStatusCode() { if (this.response && this.response.statusCode) { @@ -59,7 +76,7 @@ class IDVError extends Error { } /** - * @returns {*} The parsed response body. + * @returns {string|object|null} The parsed response body. */ getResponseBody() { if (this.response && this.response.body) { diff --git a/src/idv_service/idv.service.js b/src/idv_service/idv.service.js index 73ac0eb10..895f1981a 100644 --- a/src/idv_service/idv.service.js +++ b/src/idv_service/idv.service.js @@ -42,15 +42,17 @@ class IDVService { /** * @param {string} sdkId * @param {string|Buffer} pem - * @param {Object} options - * @param {string} options.apiUrl + * @param {{apiUrl?: string}} options */ constructor(sdkId, pem, { apiUrl = DEFAULT_API_URL } = {}) { Validation.isString(sdkId, 'sdkId'); Validation.notNullOrEmpty(pem, 'pem'); + /** @protected */ this.sdkId = sdkId; + /** @protected */ this.pem = pem; + /** @protected */ this.apiUrl = apiUrl; } @@ -65,7 +67,7 @@ class IDVService { Validation.instanceOf(sessionSpecification, SessionSpecification, 'sessionSpecification'); const request = new RequestBuilder() - .withPemString(this.pem) + .withPemString(this.pem.toString()) .withBaseUrl(this.apiUrl) .withEndpoint('/sessions') .withQueryParam('sdkId', this.sdkId) @@ -98,7 +100,7 @@ class IDVService { Validation.isString(sessionId, 'sessionId'); const request = new RequestBuilder() - .withPemString(this.pem) + .withPemString(this.pem.toString()) .withBaseUrl(this.apiUrl) .withEndpoint(sessionPath(sessionId)) .withQueryParam('sdkId', this.sdkId) @@ -129,7 +131,7 @@ class IDVService { Validation.isString(sessionId, 'sessionId'); const request = new RequestBuilder() - .withPemString(this.pem) + .withPemString(this.pem.toString()) .withBaseUrl(this.apiUrl) .withEndpoint(sessionPath(sessionId)) .withQueryParam('sdkId', this.sdkId) @@ -156,7 +158,7 @@ class IDVService { Validation.isString(mediaId, 'mediaId'); const request = new RequestBuilder() - .withPemString(this.pem) + .withPemString(this.pem.toString()) .withBaseUrl(this.apiUrl) .withEndpoint(mediaContentPath(sessionId, mediaId)) .withQueryParam('sdkId', this.sdkId) @@ -199,7 +201,7 @@ class IDVService { Validation.isString(mediaId, 'mediaId'); const request = new RequestBuilder() - .withPemString(this.pem) + .withPemString(this.pem.toString()) .withBaseUrl(this.apiUrl) .withEndpoint(mediaContentPath(sessionId, mediaId)) .withQueryParam('sdkId', this.sdkId) @@ -222,7 +224,7 @@ class IDVService { */ getSupportedDocuments(includeNonLatin) { const requestBuilder = new RequestBuilder() - .withPemString(this.pem) + .withPemString(this.pem.toString()) .withBaseUrl(this.apiUrl) .withEndpoint('/supported-documents') .withGet(); @@ -252,7 +254,7 @@ class IDVService { Validation.instanceOf(createFaceCaptureResourcePayload, CreateFaceCaptureResourcePayload, 'createFaceCaptureResourcePayload'); const request = new RequestBuilder() - .withPemString(this.pem) + .withPemString(this.pem.toString()) .withBaseUrl(this.apiUrl) .withEndpoint(`sessions/${sessionId}/resources/face-capture`) .withQueryParam('sdkId', this.sdkId) @@ -286,7 +288,7 @@ class IDVService { Validation.instanceOf(uploadFaceCaptureImagePayload, UploadFaceCaptureImagePayload, 'uploadFaceCaptureImagePayload'); const request = new RequestBuilder() - .withPemString(this.pem) + .withPemString(this.pem.toString()) .withBaseUrl(this.apiUrl) .withEndpoint(`/sessions/${sessionId}/resources/face-capture/${resourceId}/image`) .withQueryParam('sdkId', this.sdkId) @@ -308,7 +310,7 @@ class IDVService { */ getSessionConfiguration(sessionId) { const request = new RequestBuilder() - .withPemString(this.pem) + .withPemString(this.pem.toString()) .withBaseUrl(this.apiUrl) .withEndpoint(`/sessions/${sessionId}/configuration`) .withQueryParam('sdkId', this.sdkId) diff --git a/src/idv_service/session/create/check/requested.ca.matching.strategy.js b/src/idv_service/session/create/check/requested.ca.matching.strategy.js index 78057c619..3a46a5ca0 100644 --- a/src/idv_service/session/create/check/requested.ca.matching.strategy.js +++ b/src/idv_service/session/create/check/requested.ca.matching.strategy.js @@ -13,6 +13,7 @@ class RequestedCaMatchingStrategy { Validation.notNullOrEmpty(type, 'type'); Validation.isString(type, 'type'); + /** @protected */ this.type = type; } } diff --git a/src/idv_service/session/create/check/requested.ca.sources.js b/src/idv_service/session/create/check/requested.ca.sources.js index 86c901e4f..2224f2e30 100644 --- a/src/idv_service/session/create/check/requested.ca.sources.js +++ b/src/idv_service/session/create/check/requested.ca.sources.js @@ -13,6 +13,7 @@ class RequestedCaSources { Validation.notNullOrEmpty(type, 'type'); Validation.isString(type, 'type'); + /** @protected */ this.type = type; } } diff --git a/src/idv_service/session/create/check/requested.check.js b/src/idv_service/session/create/check/requested.check.js index 204a56433..3cb825a7e 100644 --- a/src/idv_service/session/create/check/requested.check.js +++ b/src/idv_service/session/create/check/requested.check.js @@ -20,9 +20,11 @@ class RequestedCheck { } Validation.isString(type, 'type'); + /** @private */ this.type = type; Validation.notNullOrEmpty(config, 'config'); + /** @private */ this.config = config; } diff --git a/src/idv_service/session/create/check/requested.custom.account.watchlist.advanced.ca.config.js b/src/idv_service/session/create/check/requested.custom.account.watchlist.advanced.ca.config.js index b4760b3f3..9ed89f39e 100644 --- a/src/idv_service/session/create/check/requested.custom.account.watchlist.advanced.ca.config.js +++ b/src/idv_service/session/create/check/requested.custom.account.watchlist.advanced.ca.config.js @@ -4,6 +4,12 @@ const Validation = require('../../../../yoti_common/validation'); const { WITH_CUSTOM_ACCOUNT } = require('../../../idv.constants'); const RequestedWatchlistAdvancedCaConfig = require('./requested.watchlist.advanced.ca.config'); +/** + * @typedef {import('./requested.watchlist.advanced.ca.check')} RequestedWatchlistAdvancedCaCheck + * @typedef {import('./requested.ca.sources')} RequestedCaSources + * @typedef {import('./requested.ca.matching.strategy')} RequestedCaMatchingStrategy + */ + /** * The configuration applied when creating a {@link RequestedWatchlistAdvancedCaCheck} * with custom account @@ -35,9 +41,11 @@ class RequestedCustomAccountWatchlistAdvancedCaConfig extends RequestedWatchlist super(removeDeceased, shareUrl, sources, matchingStrategy); Validation.isString(apiKey, 'apiKey'); Validation.notNullOrEmpty(apiKey, 'apiKey'); + /** @private */ this.apiKey = apiKey; Validation.isBoolean(monitoring, 'monitoring'); + /** @private */ this.monitoring = monitoring; if (tags) { @@ -46,11 +54,13 @@ class RequestedCustomAccountWatchlistAdvancedCaConfig extends RequestedWatchlist Object.keys(tags).forEach((key) => { Validation.notNull(tags[key], `tags.${key}`); }); + /** @private */ this.tags = tags; } Validation.isString(clientRef, 'clientRef'); Validation.notNullOrEmpty(clientRef, 'clientRef'); + /** @private */ this.clientRef = clientRef; } diff --git a/src/idv_service/session/create/check/requested.document.authenticity.config.js b/src/idv_service/session/create/check/requested.document.authenticity.config.js index 2372716ba..9f16c6aa3 100644 --- a/src/idv_service/session/create/check/requested.document.authenticity.config.js +++ b/src/idv_service/session/create/check/requested.document.authenticity.config.js @@ -13,6 +13,7 @@ class RequestedDocumentAuthenticityConfig { */ constructor(manualCheck) { Validation.isString(manualCheck, 'manualCheck', true); + /** @private */ this.manualCheck = manualCheck; } diff --git a/src/idv_service/session/create/check/requested.face.comparison.config.js b/src/idv_service/session/create/check/requested.face.comparison.config.js index 221972c7c..1dfed34af 100644 --- a/src/idv_service/session/create/check/requested.face.comparison.config.js +++ b/src/idv_service/session/create/check/requested.face.comparison.config.js @@ -14,6 +14,7 @@ class RequestedFaceComparisonConfig { */ constructor(manualCheck) { Validation.isString(manualCheck, 'manualCheck'); + /** @private */ this.manualCheck = manualCheck; } diff --git a/src/idv_service/session/create/check/requested.face.match.config.js b/src/idv_service/session/create/check/requested.face.match.config.js index 99e5d42df..37a9ce621 100644 --- a/src/idv_service/session/create/check/requested.face.match.config.js +++ b/src/idv_service/session/create/check/requested.face.match.config.js @@ -14,6 +14,7 @@ class RequestedFaceMatchConfig { */ constructor(manualCheck) { Validation.isString(manualCheck, 'manualCheck'); + /** @private */ this.manualCheck = manualCheck; } diff --git a/src/idv_service/session/create/check/requested.fuzzy.matching.strategy.js b/src/idv_service/session/create/check/requested.fuzzy.matching.strategy.js index 4abea6580..8e6e95f6a 100644 --- a/src/idv_service/session/create/check/requested.fuzzy.matching.strategy.js +++ b/src/idv_service/session/create/check/requested.fuzzy.matching.strategy.js @@ -13,6 +13,7 @@ class RequestedFuzzyMatchingStrategy extends RequestedCaMatchingStrategy { super(FUZZY); Validation.isNumber(fuzziness, 'fuzziness'); Validation.withinRange(fuzziness, 0, 1, 'fuzziness'); + /** @private */ this.fuzziness = fuzziness; } diff --git a/src/idv_service/session/create/check/requested.liveness.check.builder.js b/src/idv_service/session/create/check/requested.liveness.check.builder.js index ac639e26d..aa246c277 100644 --- a/src/idv_service/session/create/check/requested.liveness.check.builder.js +++ b/src/idv_service/session/create/check/requested.liveness.check.builder.js @@ -10,6 +10,7 @@ const Validation = require('../../../../yoti_common/validation'); */ class RequestedLivenessCheckBuilder { constructor() { + /** @private */ this.maxRetries = 1; } @@ -48,7 +49,7 @@ class RequestedLivenessCheckBuilder { /** * Sets the maximum number of retries allowed by the user * - * @param {int} maxRetries + * @param {number} maxRetries * The maximum number of retries * * @returns {this} diff --git a/src/idv_service/session/create/check/requested.liveness.config.js b/src/idv_service/session/create/check/requested.liveness.config.js index 124a1bde7..a887ef5a0 100644 --- a/src/idv_service/session/create/check/requested.liveness.config.js +++ b/src/idv_service/session/create/check/requested.liveness.config.js @@ -9,7 +9,7 @@ const Validation = require('../../../../yoti_common/validation'); */ class RequestedLivenessConfig { /** - * @param {int} maxRetries + * @param {number} maxRetries * The maximum number of retries allowed by the user * for a given liveness check * @param {string} livenessType @@ -17,9 +17,11 @@ class RequestedLivenessConfig { */ constructor(maxRetries, livenessType) { Validation.isInteger(maxRetries, 'maxRetries'); + /** @private */ this.maxRetries = maxRetries; Validation.isString(livenessType, 'livenessType'); + /** @private */ this.livenessType = livenessType; } diff --git a/src/idv_service/session/create/check/requested.search.profile.sources.js b/src/idv_service/session/create/check/requested.search.profile.sources.js index 85abd389d..dad6fa456 100644 --- a/src/idv_service/session/create/check/requested.search.profile.sources.js +++ b/src/idv_service/session/create/check/requested.search.profile.sources.js @@ -17,6 +17,7 @@ class RequestedSearchProfileSources extends RequestedCaSources { super(PROFILE); Validation.notNullOrEmpty(searchProfile, 'searchProfile'); Validation.isString(searchProfile, 'searchProfile'); + /** @private */ this.searchProfile = searchProfile; } diff --git a/src/idv_service/session/create/check/requested.type.list.sources.js b/src/idv_service/session/create/check/requested.type.list.sources.js index efa048624..4e5695dc2 100644 --- a/src/idv_service/session/create/check/requested.type.list.sources.js +++ b/src/idv_service/session/create/check/requested.type.list.sources.js @@ -16,6 +16,7 @@ class RequestedTypeListSources extends RequestedCaSources { constructor(types = []) { super(TYPE_LIST); Validation.isArrayOfStrings(types, 'types'); + /** @private */ this.types = types; } diff --git a/src/idv_service/session/create/check/requested.watchlist.advanced.ca.config.builder.js b/src/idv_service/session/create/check/requested.watchlist.advanced.ca.config.builder.js index 0971f82a1..b0deba5ee 100644 --- a/src/idv_service/session/create/check/requested.watchlist.advanced.ca.config.builder.js +++ b/src/idv_service/session/create/check/requested.watchlist.advanced.ca.config.builder.js @@ -4,6 +4,10 @@ const Validation = require('../../../../yoti_common/validation'); const RequestedCaSources = require('./requested.ca.sources'); const RequestedCaMatchingStrategy = require('./requested.ca.matching.strategy'); +/** + * @typedef {import('./requested.watchlist.advanced.ca.config')} RequestedWatchlistAdvancedCaConfig + */ + /** * The base Builder to assist the creation of {@link RequestedWatchlistAdvancedCaConfig}. * diff --git a/src/idv_service/session/create/check/requested.watchlist.advanced.ca.config.js b/src/idv_service/session/create/check/requested.watchlist.advanced.ca.config.js index 7c0e64afd..9f68234de 100644 --- a/src/idv_service/session/create/check/requested.watchlist.advanced.ca.config.js +++ b/src/idv_service/session/create/check/requested.watchlist.advanced.ca.config.js @@ -6,6 +6,10 @@ const RequestedCaMatchingStrategy = require('./requested.ca.matching.strategy'); const RequestedTypeListSources = require('./requested.type.list.sources'); const RequestedExactMatchingStrategy = require('./requested.exact.matching.strategy'); +/** + * @typedef {import('./requested.watchlist.advanced.ca.check')} RequestedWatchlistAdvancedCaCheck + */ + /** * The base configuration applied when creating a {@link RequestedWatchlistAdvancedCaCheck} * @@ -26,22 +30,28 @@ class RequestedWatchlistAdvancedCaConfig { } Validation.isBoolean(removeDeceased, 'removeDeceased'); + /** @private */ this.removeDeceased = removeDeceased; Validation.isBoolean(shareUrl, 'shareUrl'); + /** @private */ this.shareUrl = shareUrl; if (sources) { Validation.instanceOf(sources, RequestedCaSources, 'sources'); + /** @private */ this.sources = sources; } else { + /** @private */ this.sources = new RequestedTypeListSources(); } if (matchingStrategy) { Validation.instanceOf(matchingStrategy, RequestedCaMatchingStrategy, 'matchingStrategy'); + /** @private */ this.matchingStrategy = matchingStrategy; } else { + /** @private */ this.matchingStrategy = new RequestedExactMatchingStrategy(); } } diff --git a/src/idv_service/session/create/check/requested.watchlist.screening.check.builder.js b/src/idv_service/session/create/check/requested.watchlist.screening.check.builder.js index d9035e0f2..9c0ec8f4a 100644 --- a/src/idv_service/session/create/check/requested.watchlist.screening.check.builder.js +++ b/src/idv_service/session/create/check/requested.watchlist.screening.check.builder.js @@ -13,6 +13,7 @@ const Validation = require('../../../../yoti_common/validation'); /* eslint class-methods-use-this: ["error", { "exceptMethods": ["build"] }] */ class RequestedWatchlistScreeningCheckBuilder { constructor() { + /** @private */ this.categories = []; } diff --git a/src/idv_service/session/create/check/requested.watchlist.screening.config.js b/src/idv_service/session/create/check/requested.watchlist.screening.config.js index e170e416f..13feed916 100644 --- a/src/idv_service/session/create/check/requested.watchlist.screening.config.js +++ b/src/idv_service/session/create/check/requested.watchlist.screening.config.js @@ -14,6 +14,7 @@ class RequestedWatchlistScreeningConfig { constructor(categories) { if (categories) { Validation.isArrayOfStrings(categories, 'categories'); + /** @private */ this.categories = categories.filter((elem, pos) => categories.indexOf(elem) === pos); } } diff --git a/src/idv_service/session/create/check/requested.yoti.account.watchlist.advanced.ca.config.js b/src/idv_service/session/create/check/requested.yoti.account.watchlist.advanced.ca.config.js index 5e4c8b2b9..ed10db6dc 100644 --- a/src/idv_service/session/create/check/requested.yoti.account.watchlist.advanced.ca.config.js +++ b/src/idv_service/session/create/check/requested.yoti.account.watchlist.advanced.ca.config.js @@ -3,6 +3,10 @@ const { WITH_YOTI_ACCOUNT } = require('../../../idv.constants'); const RequestedWatchlistAdvancedCaConfig = require('./requested.watchlist.advanced.ca.config'); +/** + * @typedef {import('./requested.watchlist.advanced.ca.check')} RequestedWatchlistAdvancedCaCheck + */ + /** * The configuration applied when creating a {@link RequestedWatchlistAdvancedCaCheck} * with Yoti account diff --git a/src/idv_service/session/create/create.session.result.js b/src/idv_service/session/create/create.session.result.js index 8368157b5..a82a001d9 100644 --- a/src/idv_service/session/create/create.session.result.js +++ b/src/idv_service/session/create/create.session.result.js @@ -14,12 +14,15 @@ class CreateSessionResult { */ constructor(response) { Validation.isInteger(response.client_session_token_ttl, 'client_session_token_ttl', true); + /** @private */ this.clientSessionTokenTtl = response.client_session_token_ttl; Validation.isString(response.client_session_token, 'client_session_token', true); + /** @private */ this.clientSessionToken = response.client_session_token; Validation.isString(response.session_id, 'session_id', true); + /** @private */ this.sessionId = response.session_id; } @@ -27,7 +30,7 @@ class CreateSessionResult { * Returns the time-to-live (TTL) for the client session * token for the created session * - * @returns {int} the client session token TTL + * @returns {number} the client session token TTL */ getClientSessionTokenTtl() { return this.clientSessionTokenTtl; diff --git a/src/idv_service/session/create/face_capture/create.face.capture.resource.payload.js b/src/idv_service/session/create/face_capture/create.face.capture.resource.payload.js index 95cb4c40b..b33258943 100644 --- a/src/idv_service/session/create/face_capture/create.face.capture.resource.payload.js +++ b/src/idv_service/session/create/face_capture/create.face.capture.resource.payload.js @@ -12,9 +12,13 @@ class CreateFaceCaptureResourcePayload { */ constructor(requirementId) { Validation.isString(requirementId, 'requirement_id'); + /** @private */ this.requirementId = requirementId; } + /** + * Returns serialized data for JSON.stringify() + */ toJSON() { return { requirement_id: this.requirementId, diff --git a/src/idv_service/session/create/face_capture/upload.face.capture.image.payload.js b/src/idv_service/session/create/face_capture/upload.face.capture.image.payload.js index 8c7263899..ed19dc087 100644 --- a/src/idv_service/session/create/face_capture/upload.face.capture.image.payload.js +++ b/src/idv_service/session/create/face_capture/upload.face.capture.image.payload.js @@ -13,9 +13,11 @@ class UploadFaceCaptureImagePayload { */ constructor(imageContentType, imageContents) { Validation.isString(imageContentType, 'image_content_type'); + /** @private */ this.imageContentType = imageContentType; Validation.instanceOf(imageContents, Buffer, 'image_contents'); + /** @private */ this.imageContents = imageContents; } diff --git a/src/idv_service/session/create/filters/document.filter.js b/src/idv_service/session/create/filters/document.filter.js index 8cad1647a..874ef24ec 100644 --- a/src/idv_service/session/create/filters/document.filter.js +++ b/src/idv_service/session/create/filters/document.filter.js @@ -12,6 +12,7 @@ class DocumentFilter { } Validation.isString(type, 'type'); + /** @private */ this.type = type; } diff --git a/src/idv_service/session/create/filters/document/document.restriction.js b/src/idv_service/session/create/filters/document/document.restriction.js index 51ebe5d56..adb173e84 100644 --- a/src/idv_service/session/create/filters/document/document.restriction.js +++ b/src/idv_service/session/create/filters/document/document.restriction.js @@ -10,11 +10,13 @@ class DocumentRestriction { constructor(countryCodes, documentTypes) { if (countryCodes) { Validation.isArrayOfStrings(countryCodes, 'countryCodes'); + /** @private */ this.countryCodes = countryCodes; } if (documentTypes) { Validation.isArrayOfStrings(documentTypes, 'documentTypes'); + /** @private */ this.documentTypes = documentTypes; } } diff --git a/src/idv_service/session/create/filters/document/document.restrictions.filter.builder.js b/src/idv_service/session/create/filters/document/document.restrictions.filter.builder.js index 27fb3f00d..a71e52832 100644 --- a/src/idv_service/session/create/filters/document/document.restrictions.filter.builder.js +++ b/src/idv_service/session/create/filters/document/document.restrictions.filter.builder.js @@ -7,6 +7,7 @@ const IDVConstants = require('../../../../idv.constants'); class DocumentRestrictionsFilterBuilder { constructor() { + /** @private */ this.documents = []; } diff --git a/src/idv_service/session/create/filters/document/document.restrictions.filter.js b/src/idv_service/session/create/filters/document/document.restrictions.filter.js index edd19bf35..7474d1a87 100644 --- a/src/idv_service/session/create/filters/document/document.restrictions.filter.js +++ b/src/idv_service/session/create/filters/document/document.restrictions.filter.js @@ -16,15 +16,19 @@ class DocumentRestrictionsFilter extends DocumentFilter { super(IDVConstants.DOCUMENT_RESTRICTIONS); Validation.isString(inclusion, 'inclusion'); + /** @private */ this.inclusion = inclusion; Validation.isArrayOfType(documents, DocumentRestriction, 'documents'); + /** @private */ this.documents = documents; Validation.isBoolean(allowExpiredDocuments, 'allowExpiredDocuments', true); + /** @private */ this.allowExpiredDocuments = allowExpiredDocuments; Validation.isBoolean(allowNonLatinDocuments, 'allowNonLatinDocuments', true); + /** @private */ this.allowNonLatinDocuments = allowNonLatinDocuments; } diff --git a/src/idv_service/session/create/filters/orthogonal/country.restriction.js b/src/idv_service/session/create/filters/orthogonal/country.restriction.js index 805ec17a4..748057e05 100644 --- a/src/idv_service/session/create/filters/orthogonal/country.restriction.js +++ b/src/idv_service/session/create/filters/orthogonal/country.restriction.js @@ -10,9 +10,11 @@ class CountryRestriction { constructor(inclusion, countryCodes) { Validation.notNullOrEmpty(inclusion, 'inclusion'); Validation.isString(inclusion, 'inclusion'); + /** @private */ this.inclusion = inclusion; Validation.isArrayOfStrings(countryCodes, 'countryCodes'); + /** @private */ this.countryCodes = countryCodes; } diff --git a/src/idv_service/session/create/filters/orthogonal/orthogonal.restrictions.filter.js b/src/idv_service/session/create/filters/orthogonal/orthogonal.restrictions.filter.js index 496f72cba..7cec54ec6 100644 --- a/src/idv_service/session/create/filters/orthogonal/orthogonal.restrictions.filter.js +++ b/src/idv_service/session/create/filters/orthogonal/orthogonal.restrictions.filter.js @@ -18,18 +18,22 @@ class OrthogonalRestrictionsFilter extends DocumentFilter { if (countryRestriction) { Validation.instanceOf(countryRestriction, CountryRestriction, 'countryRestriction'); + /** @private */ this.countryRestriction = countryRestriction; } if (typeRestriction) { Validation.instanceOf(typeRestriction, TypeRestriction, 'typeRestriction'); + /** @private */ this.typeRestriction = typeRestriction; } Validation.isBoolean(allowExpiredDocuments, 'allowExpiredDocuments', true); + /** @private */ this.allowExpiredDocuments = allowExpiredDocuments; Validation.isBoolean(allowNonLatinDocuments, 'allowNonLatinDocuments', true); + /** @private */ this.allowNonLatinDocuments = allowNonLatinDocuments; } diff --git a/src/idv_service/session/create/filters/orthogonal/type.restriction.js b/src/idv_service/session/create/filters/orthogonal/type.restriction.js index 6032c3cc0..9db67ffda 100644 --- a/src/idv_service/session/create/filters/orthogonal/type.restriction.js +++ b/src/idv_service/session/create/filters/orthogonal/type.restriction.js @@ -10,9 +10,11 @@ class TypeRestriction { constructor(inclusion, documentTypes) { Validation.notNullOrEmpty(inclusion, 'inclusion'); Validation.isString(inclusion, 'inclusion'); + /** @private */ this.inclusion = inclusion; Validation.isArrayOfStrings(documentTypes, 'documentTypes'); + /** @private */ this.documentTypes = documentTypes; } diff --git a/src/idv_service/session/create/filters/required.document.js b/src/idv_service/session/create/filters/required.document.js index 04904f563..bc3265f18 100644 --- a/src/idv_service/session/create/filters/required.document.js +++ b/src/idv_service/session/create/filters/required.document.js @@ -12,6 +12,7 @@ class RequiredDocument { } Validation.isString(type, 'type'); + /** @private */ this.type = type; } diff --git a/src/idv_service/session/create/filters/required.id.document.js b/src/idv_service/session/create/filters/required.id.document.js index 8912f0c5c..1198fae25 100644 --- a/src/idv_service/session/create/filters/required.id.document.js +++ b/src/idv_service/session/create/filters/required.id.document.js @@ -14,6 +14,7 @@ class RequiredIdDocument extends RequiredDocument { if (filter) { Validation.instanceOf(filter, DocumentFilter, 'filter'); + /** @private */ this.filter = filter; } } diff --git a/src/idv_service/session/create/filters/required.supplementary.document.js b/src/idv_service/session/create/filters/required.supplementary.document.js index 07349ed64..8d5ead4d4 100644 --- a/src/idv_service/session/create/filters/required.supplementary.document.js +++ b/src/idv_service/session/create/filters/required.supplementary.document.js @@ -15,15 +15,18 @@ class RequiredSupplementaryDocument extends RequiredDocument { super(IDVConstants.SUPPLEMENTARY_DOCUMENT); Validation.instanceOf(objective, Objective, 'objective'); + /** @private */ this.objective = objective; if (documentTypes) { Validation.isArrayOfStrings(documentTypes, 'documentTypes'); + /** @private */ this.documentTypes = documentTypes; } if (countryCodes) { Validation.isArrayOfStrings(countryCodes, 'countryCodes'); + /** @private */ this.countryCodes = countryCodes; } } diff --git a/src/idv_service/session/create/notification.config.builder.js b/src/idv_service/session/create/notification.config.builder.js index ae76b2590..a28fcd8f7 100644 --- a/src/idv_service/session/create/notification.config.builder.js +++ b/src/idv_service/session/create/notification.config.builder.js @@ -14,6 +14,7 @@ class NotificationConfigBuilder { * Setup default builder properties */ constructor() { + /** @private */ this.topics = []; } diff --git a/src/idv_service/session/create/notification.config.js b/src/idv_service/session/create/notification.config.js index a79a75f98..61821e0c3 100644 --- a/src/idv_service/session/create/notification.config.js +++ b/src/idv_service/session/create/notification.config.js @@ -27,25 +27,29 @@ class NotificationConfig { */ constructor(authToken, endpoint, topics, authType) { Validation.isString(authToken, 'authToken', true); + /** @private */ this.authToken = authToken; Validation.isString(endpoint, 'endpoint', true); + /** @private */ this.endpoint = endpoint; if (topics) { Validation.isArrayOfStrings(topics, 'topics'); + /** @private */ this.topics = topics.filter((elem, pos) => topics.indexOf(elem) === pos); } Validation.isString(authType, 'authType', true); if (authType) { Validation.oneOf(authType, acceptedAuthTypes, 'authType'); + /** @private */ this.authType = authType; } } /** - * @returns {Object} data for JSON.stringify() + * Returns serialized data for JSON.stringify() */ toJSON() { return { diff --git a/src/idv_service/session/create/objective/objective.js b/src/idv_service/session/create/objective/objective.js index 467fe7003..5d6052240 100644 --- a/src/idv_service/session/create/objective/objective.js +++ b/src/idv_service/session/create/objective/objective.js @@ -12,6 +12,7 @@ class Objective { } Validation.isString(type, 'type'); + /** @private */ this.type = type; } diff --git a/src/idv_service/session/create/sdk.config.js b/src/idv_service/session/create/sdk.config.js index cb0135f07..f7e0163ff 100644 --- a/src/idv_service/session/create/sdk.config.js +++ b/src/idv_service/session/create/sdk.config.js @@ -22,8 +22,10 @@ class SdkConfig { * The error URL * @param {string} privacyPolicyUrl * The privacy policy URL + * @param {string} biometricConsentFlow + * Specifies the biometric consent in flow * @param {boolean} allowHandoff - * Allow user to handoff to mobile during session + * Allows user to handoff to mobile during session * @param {object} attemptsConfiguration * The attempts configuration */ @@ -42,46 +44,58 @@ class SdkConfig { attemptsConfiguration ) { Validation.isString(allowedCaptureMethods, 'allowedCaptureMethods', true); + /** @private */ this.allowedCaptureMethods = allowedCaptureMethods; Validation.isString(primaryColour, 'primaryColour', true); + /** @private */ this.primaryColour = primaryColour; Validation.isString(secondaryColour, 'secondaryColour', true); + /** @private */ this.secondaryColour = secondaryColour; Validation.isString(fontColour, 'fontColour', true); + /** @private */ this.fontColour = fontColour; Validation.isString(locale, 'locale', true); + /** @private */ this.locale = locale; Validation.isString(presetIssuingCountry, 'presetIssuingCountry', true); + /** @private */ this.presetIssuingCountry = presetIssuingCountry; Validation.isString(successUrl, 'successUrl', true); + /** @private */ this.successUrl = successUrl; Validation.isString(errorUrl, 'errorUrl', true); + /** @private */ this.errorUrl = errorUrl; Validation.isString(privacyPolicyUrl, 'privacyPolicyUrl', true); + /** @private */ this.privacyPolicyUrl = privacyPolicyUrl; Validation.isString(biometricConsentFlow, 'biometricConsentFlow', true); + /** @private */ this.biometricConsentFlow = biometricConsentFlow; Validation.isBoolean(allowHandoff, 'allowHandoff', true); + /** @private */ this.allowHandoff = allowHandoff; if (attemptsConfiguration) { Validation.isPlainObject(attemptsConfiguration, 'attemptsConfiguration'); + /** @private */ this.attemptsConfiguration = attemptsConfiguration; } } /** - * @returns {Object} data for JSON.stringify() + * Returns serialized data for JSON.stringify() */ toJSON() { return { diff --git a/src/idv_service/session/create/session.specification.builder.js b/src/idv_service/session/create/session.specification.builder.js index fd95c79e9..79becf0c9 100644 --- a/src/idv_service/session/create/session.specification.builder.js +++ b/src/idv_service/session/create/session.specification.builder.js @@ -15,15 +15,18 @@ const Validation = require('../../../yoti_common/validation'); */ class SessionSpecificationBuilder { constructor() { + /** @private */ this.requestedChecks = []; + /** @private */ this.requestedTasks = []; + /** @private */ this.requiredDocuments = []; } /** * Sets the client session token TTL (time-to-live) * - * @param {int} clientSessionTokenTtl + * @param {number} clientSessionTokenTtl * The client session token TTL * * @returns {this} @@ -51,7 +54,7 @@ class SessionSpecificationBuilder { /** * Sets the resources TTL (time-to-live) * - * @param {int} resourcesTtl + * @param {number} resourcesTtl * The resources TTL * * @returns {this} @@ -105,9 +108,9 @@ class SessionSpecificationBuilder { /** * Adds a {@link RequestedTask} to the list * - * @param {RequestedTask} requestedTasks + * @param {RequestedTask} requestedTask * - * @return + * @returns {this} */ withRequestedTask(requestedTask) { Validation.instanceOf(requestedTask, RequestedTask, 'requestedTask'); @@ -144,7 +147,7 @@ class SessionSpecificationBuilder { /** * Sets whether or not to block the collection of biometric consent * - * @param {bool} blockBiometricConsent + * @param {boolean} blockBiometricConsent * * @return {this} */ @@ -167,9 +170,9 @@ class SessionSpecificationBuilder { } /** - * Builds the {@link SessionSpec} based on the values supplied to the builder + * Builds the {@link SessionSpecification} based on the values supplied to the builder * - * @returns {SessionSpec} + * @returns {SessionSpecification} */ build() { return new SessionSpecification( diff --git a/src/idv_service/session/create/session.specification.js b/src/idv_service/session/create/session.specification.js index 3e1d0d6af..b332c453e 100644 --- a/src/idv_service/session/create/session.specification.js +++ b/src/idv_service/session/create/session.specification.js @@ -14,9 +14,9 @@ const RequiredDocument = require('./filters/required.document'); */ class SessionSpecification { /** - * @param {int} clientSessionTokenTtl + * @param {number} clientSessionTokenTtl * Client-session-token time-to-live to apply to the created session - * @param {int} resourcesTtl + * @param {number} resourcesTtl * Time-to-live used for all Resources created in the course of the session * @param {string} userTrackingId * User tracking id, for the Relying Business to track returning users @@ -30,7 +30,7 @@ class SessionSpecification { * The SDK configuration set on the session specification * @param {RequiredDocument[]} requiredDocuments * List of RequiredDocument defining the documents required from the client - * @param {bool} blockBiometricConsent + * @param {boolean} blockBiometricConsent * Sets whether or not to block the collection of biometric consent * @param {Date} sessionDeadline * The deadline that the session needs to be completed by @@ -53,56 +53,68 @@ class SessionSpecification { subject ) { Validation.isInteger(clientSessionTokenTtl, 'clientSessionTokenTtl', true); + /** @private */ this.clientSessionTokenTtl = clientSessionTokenTtl; if (sessionDeadline) { Validation.instanceOf(sessionDeadline, Date, 'sessionDeadline'); + /** @private */ this.sessionDeadline = sessionDeadline; } Validation.isInteger(resourcesTtl, 'resourcesTtl', true); + /** @private */ this.resourcesTtl = resourcesTtl; Validation.isString(userTrackingId, 'userTrackingId', true); + /** @private */ this.userTrackingId = userTrackingId; if (notifications) { Validation.instanceOf(notifications, NotificationConfig, 'notifications'); + /** @private */ this.notifications = notifications; } if (sdkConfig) { Validation.instanceOf(sdkConfig, SdkConfig, 'sdkConfig'); + /** @private */ this.sdkConfig = sdkConfig; } if (identityProfileRequirements) { Validation.isPlainObject(identityProfileRequirements, 'identityProfileRequirements'); + /** @private */ this.identityProfileRequirements = identityProfileRequirements; } if (subject) { Validation.isPlainObject(subject, 'subject'); + /** @private */ this.subject = subject; } Validation.isArrayOfType(requestedChecks, RequestedCheck, 'requestedChecks'); + /** @private */ this.requestedChecks = requestedChecks; Validation.isArrayOfType(requestedTasks, RequestedTask, 'requestedTasks'); + /** @private */ this.requestedTasks = requestedTasks; if (requiredDocuments) { Validation.isArrayOfType(requiredDocuments, RequiredDocument, 'requiredDocuments'); + /** @private */ this.requiredDocuments = requiredDocuments; } Validation.isBoolean(blockBiometricConsent, 'blockBiometricConsent', true); + /** @private */ this.blockBiometricConsent = blockBiometricConsent; } /** - * @returns {Object} data for JSON.stringify() + * Returns serialized data for JSON.stringify() */ toJSON() { return { diff --git a/src/idv_service/session/create/task/requested.supplementary.doc.text.extraction.config.js b/src/idv_service/session/create/task/requested.supplementary.doc.text.extraction.config.js index 8c7feb513..a07343398 100644 --- a/src/idv_service/session/create/task/requested.supplementary.doc.text.extraction.config.js +++ b/src/idv_service/session/create/task/requested.supplementary.doc.text.extraction.config.js @@ -14,6 +14,7 @@ class RequestedSupplementaryDocTextExtractionConfig { */ constructor(manualCheck) { Validation.isString(manualCheck, 'manualCheck'); + /** @private */ this.manualCheck = manualCheck; } diff --git a/src/idv_service/session/create/task/requested.task.js b/src/idv_service/session/create/task/requested.task.js index 940eba88a..04f6ae0d2 100644 --- a/src/idv_service/session/create/task/requested.task.js +++ b/src/idv_service/session/create/task/requested.task.js @@ -20,8 +20,10 @@ class RequestedTask { } Validation.isString(type, 'type'); + /** @private */ this.type = type; + /** @private */ this.config = config; } diff --git a/src/idv_service/session/create/task/requested.text.extraction.config.js b/src/idv_service/session/create/task/requested.text.extraction.config.js index ca80dd9dc..37e96a27c 100644 --- a/src/idv_service/session/create/task/requested.text.extraction.config.js +++ b/src/idv_service/session/create/task/requested.text.extraction.config.js @@ -13,15 +13,20 @@ class RequestedTextExtractionConfig { * Describes the manual fallback behaviour applied to each Task * @param {string} chipData * Describes the chip data requirement for each Task + * @param {boolean} createExpandedDocumentFields + * Enables additional information */ constructor(manualCheck, chipData, createExpandedDocumentFields) { Validation.isString(manualCheck, 'manualCheck'); + /** @private */ this.manualCheck = manualCheck; Validation.isString(chipData, 'chipData', true); + /** @private */ this.chipData = chipData; Validation.isBoolean(createExpandedDocumentFields, 'createExpandedDocumentFields', true); + /** @private */ this.createExpandedDocumentFields = createExpandedDocumentFields; } diff --git a/src/idv_service/session/retrieve/breakdown.response.js b/src/idv_service/session/retrieve/breakdown.response.js index 0fe2b890e..7f32d547d 100644 --- a/src/idv_service/session/retrieve/breakdown.response.js +++ b/src/idv_service/session/retrieve/breakdown.response.js @@ -6,15 +6,19 @@ const Validation = require('../../../yoti_common/validation'); class BreakdownResponse { constructor(breakdown) { Validation.isString(breakdown.sub_check, 'sub_check', true); + /** @private */ this.subCheck = breakdown.sub_check; Validation.isString(breakdown.result, 'result', true); + /** @private */ this.result = breakdown.result; if (breakdown.details) { Validation.isArrayOfType(breakdown.details, Object, 'details'); + /** @private */ this.details = breakdown.details.map((details) => new DetailsResponse(details)); } else { + /** @private */ this.details = []; } } diff --git a/src/idv_service/session/retrieve/ca.matching.strategy.response.js b/src/idv_service/session/retrieve/ca.matching.strategy.response.js index 671500592..c98d28b89 100644 --- a/src/idv_service/session/retrieve/ca.matching.strategy.response.js +++ b/src/idv_service/session/retrieve/ca.matching.strategy.response.js @@ -17,6 +17,7 @@ class CaMatchingStrategyResponse { Validation.isString(matchingStrategy.type, 'type'); Validation.oneOf(matchingStrategy.type, Object.keys(types), 'type'); + /** @private */ this.type = matchingStrategy.type; } diff --git a/src/idv_service/session/retrieve/ca.sources.response.js b/src/idv_service/session/retrieve/ca.sources.response.js index 32af68707..05a787189 100644 --- a/src/idv_service/session/retrieve/ca.sources.response.js +++ b/src/idv_service/session/retrieve/ca.sources.response.js @@ -17,6 +17,7 @@ class CaSourcesResponse { Validation.isString(sources.type, 'type'); Validation.oneOf(sources.type, Object.keys(types), 'type'); + /** @private */ this.type = sources.type; } diff --git a/src/idv_service/session/retrieve/check.response.js b/src/idv_service/session/retrieve/check.response.js index 9f3db9c8e..b3a7ea245 100644 --- a/src/idv_service/session/retrieve/check.response.js +++ b/src/idv_service/session/retrieve/check.response.js @@ -8,39 +8,49 @@ const { YotiDate } = require('../../../data_type/date'); class CheckResponse { constructor(check) { Validation.isString(check.type, 'type', true); + /** @private */ this.type = check.type; Validation.isString(check.id, 'id', true); + /** @private */ this.id = check.id; Validation.isString(check.state, 'state', true); + /** @private */ this.state = check.state; if (check.resources_used) { Validation.isArrayOfStrings(check.resources_used, 'resources_used'); + /** @private */ this.resourcesUsed = check.resources_used; } else { + /** @private */ this.resourcesUsed = []; } if (check.generated_media) { Validation.isArray(check.generated_media, 'generated_media'); + /** @private */ this.generatedMedia = check.generated_media.map((media) => new GeneratedMedia(media)); } else { + /** @private */ this.generatedMedia = []; } if (check.report) { + /** @protected */ this.report = new ReportResponse(check.report); } if (check.created) { Validation.isString(check.created, 'created'); + /** @private */ this.created = YotiDate.fromDateString(check.created); } if (check.last_updated) { Validation.isString(check.last_updated, 'last_updated'); + /** @private */ this.lastUpdated = YotiDate.fromDateString(check.last_updated); } } diff --git a/src/idv_service/session/retrieve/configuration/capture/capture.response.js b/src/idv_service/session/retrieve/configuration/capture/capture.response.js index 5b7941af6..d5211b92d 100644 --- a/src/idv_service/session/retrieve/configuration/capture/capture.response.js +++ b/src/idv_service/session/retrieve/configuration/capture/capture.response.js @@ -12,6 +12,9 @@ const IDVConstants = require('../../../../idv.constants'); /** * @param {object} requiredResource + * + * @typedef {import('./required.resource.response')} RequiredResourceResponse + * * @return {RequiredResourceResponse} */ function createRequiredResourcesArray(requiredResource) { @@ -37,10 +40,12 @@ class CaptureResponse { */ constructor(capture) { Validation.isString(capture.biometric_consent, 'biometric_consent'); + /** @private */ this.biometricConsent = capture.biometric_consent; if (capture.required_resources) { Validation.isArray(capture.required_resources, 'required_resources'); + /** @private */ this.requiredResources = capture.required_resources.map( (requiredResource) => createRequiredResourcesArray(requiredResource) ); diff --git a/src/idv_service/session/retrieve/configuration/capture/document/objective.response.js b/src/idv_service/session/retrieve/configuration/capture/document/objective.response.js index 073180cb2..5c5502b45 100644 --- a/src/idv_service/session/retrieve/configuration/capture/document/objective.response.js +++ b/src/idv_service/session/retrieve/configuration/capture/document/objective.response.js @@ -8,6 +8,7 @@ class ObjectiveResponse { */ constructor(objective) { Validation.isString(objective.type, 'type'); + /** @private */ this.type = objective.type; } diff --git a/src/idv_service/session/retrieve/configuration/capture/document/required.document.resource.response.js b/src/idv_service/session/retrieve/configuration/capture/document/required.document.resource.response.js index 88b69b2fd..6bdcbe563 100644 --- a/src/idv_service/session/retrieve/configuration/capture/document/required.document.resource.response.js +++ b/src/idv_service/session/retrieve/configuration/capture/document/required.document.resource.response.js @@ -8,6 +8,10 @@ const UnknownRequestedTaskResponse = require('../task/unknown.requested.task.res const Validation = require('../../../../../../yoti_common/validation'); const IDVConstants = require('../../../../../idv.constants'); +/** + * @typedef {import('../task/requested.task.response')} RequestedTaskResponse + */ + /** * @param {object} requestedTask * @return {RequestedTaskResponse} @@ -15,10 +19,13 @@ const IDVConstants = require('../../../../../idv.constants'); function createTaskFromArray(requestedTask) { switch (requestedTask.type) { case IDVConstants.ID_DOCUMENT_TEXT_DATA_EXTRACTION: + /** @returns RequestedTaskResponse */ return new RequestedIdDocTaskResponse(requestedTask); case IDVConstants.SUPPLEMENTARY_DOCUMENT_TEXT_DATA_EXTRACTION: + /** @returns RequestedTaskResponse */ return new RequestedSupplementaryDocTaskResponse(requestedTask); default: + /** @returns RequestedTaskResponse */ return new UnknownRequestedTaskResponse(); } } @@ -32,6 +39,7 @@ class RequiredDocumentResourceResponse extends RequiredResourceResponse { if (requiredResource.requested_tasks) { Validation.isArray(requiredResource.requested_tasks, 'requested_tasks'); + /** @private */ this.requestedTasks = requiredResource.requested_tasks.map( (requestedTask) => createTaskFromArray(requestedTask) ); diff --git a/src/idv_service/session/retrieve/configuration/capture/document/required.id.document.resource.response.js b/src/idv_service/session/retrieve/configuration/capture/document/required.id.document.resource.response.js index e70eb936b..afee2a448 100644 --- a/src/idv_service/session/retrieve/configuration/capture/document/required.id.document.resource.response.js +++ b/src/idv_service/session/retrieve/configuration/capture/document/required.id.document.resource.response.js @@ -13,15 +13,18 @@ class RequiredIdDocumentResourceResponse extends RequiredDocumentResourceRespons if (requiredResource.supported_countries) { Validation.isArray(requiredResource.supported_countries, 'supported_countries'); + /** @private */ this.supportedCountries = requiredResource.supported_countries.map( (supportedCountry) => new SupportedCountryResponse(supportedCountry) ); } Validation.isString(requiredResource.allowed_capture_methods, 'allowed_capture_methods'); + /** @private */ this.allowedCaptureMethods = requiredResource.allowed_capture_methods; Validation.isPlainObject(requiredResource.attempts_remaining, 'attempts_remaining'); + /** @private */ this.attemptsRemaining = requiredResource.attempts_remaining; } diff --git a/src/idv_service/session/retrieve/configuration/capture/document/required.supplementary.document.resource.response.js b/src/idv_service/session/retrieve/configuration/capture/document/required.supplementary.document.resource.response.js index 1a88f5651..162331361 100644 --- a/src/idv_service/session/retrieve/configuration/capture/document/required.supplementary.document.resource.response.js +++ b/src/idv_service/session/retrieve/configuration/capture/document/required.supplementary.document.resource.response.js @@ -12,13 +12,16 @@ class RequiredSupplementaryDocumentResourceResponse extends RequiredDocumentReso super(requiredResource); Validation.isArrayOfStrings(requiredResource.document_types, 'document_types'); + /** @private */ this.documentTypes = requiredResource.document_types; Validation.isArrayOfStrings(requiredResource.country_codes, 'country_codes'); + /** @private */ this.countryCodes = requiredResource.country_codes; if (requiredResource.objective) { Validation.isPlainObject(requiredResource.objective, 'objective'); + /** @private */ this.objective = new ObjectiveResponse(requiredResource.objective); } } diff --git a/src/idv_service/session/retrieve/configuration/capture/document/supported.country.response.js b/src/idv_service/session/retrieve/configuration/capture/document/supported.country.response.js index 99573c80e..0f0ef23bc 100644 --- a/src/idv_service/session/retrieve/configuration/capture/document/supported.country.response.js +++ b/src/idv_service/session/retrieve/configuration/capture/document/supported.country.response.js @@ -9,10 +9,12 @@ class SupportedCountryResponse { */ constructor(supportedCountry) { Validation.isString(supportedCountry.code, 'code'); + /** @private */ this.code = supportedCountry.code; if (supportedCountry.supported_documents) { Validation.isArray(supportedCountry.supported_documents, 'supported_documents'); + /** @private */ this.supportedDocuments = supportedCountry.supported_documents.map( (supportedDocument) => new SupportedDocumentResponse(supportedDocument) ); diff --git a/src/idv_service/session/retrieve/configuration/capture/document/supported.document.response.js b/src/idv_service/session/retrieve/configuration/capture/document/supported.document.response.js index dea0edf24..efa373a48 100644 --- a/src/idv_service/session/retrieve/configuration/capture/document/supported.document.response.js +++ b/src/idv_service/session/retrieve/configuration/capture/document/supported.document.response.js @@ -8,6 +8,7 @@ class SupportedDocumentResponse { */ constructor(supportedDocument) { Validation.isString(supportedDocument.type, 'type'); + /** @private */ this.type = supportedDocument.type; } diff --git a/src/idv_service/session/retrieve/configuration/capture/liveness/required.liveness.resource.response.js b/src/idv_service/session/retrieve/configuration/capture/liveness/required.liveness.resource.response.js index 42a5b3588..507908509 100644 --- a/src/idv_service/session/retrieve/configuration/capture/liveness/required.liveness.resource.response.js +++ b/src/idv_service/session/retrieve/configuration/capture/liveness/required.liveness.resource.response.js @@ -11,6 +11,7 @@ class RequiredLivenessResourceResponse extends RequiredResourceResponse { super(requiredResource); Validation.isString(requiredResource.liveness_type, 'liveness_type'); + /** @private */ this.livenessType = requiredResource.liveness_type; } diff --git a/src/idv_service/session/retrieve/configuration/capture/required.resource.response.js b/src/idv_service/session/retrieve/configuration/capture/required.resource.response.js index 455ba1a27..469f0ee54 100644 --- a/src/idv_service/session/retrieve/configuration/capture/required.resource.response.js +++ b/src/idv_service/session/retrieve/configuration/capture/required.resource.response.js @@ -8,7 +8,11 @@ const UnknownAllowedSourceResponse = require('./source/unknown.allowed.source.re const IDVConstants = require('../../../../idv.constants'); /** - * @param {array} source + * @typedef {import('./source/allowed.source.response')} AllowedSourceResponse + */ + +/** + * @param {{type: string}} source * @return {AllowedSourceResponse} */ function createAllowedSourceFromArray(source) { @@ -30,16 +34,20 @@ class RequiredResourceResponse { */ constructor(requiredResource) { Validation.isString(requiredResource.type, 'type'); + /** @private */ this.type = requiredResource.type; Validation.isString(requiredResource.id, 'id'); + /** @private */ this.id = requiredResource.id; Validation.isString(requiredResource.state, 'state'); + /** @private */ this.state = requiredResource.state; if (requiredResource.allowed_sources) { Validation.isArray(requiredResource.allowed_sources, 'allowed_sources'); + /** @private */ this.allowedSources = requiredResource.allowed_sources.map( (allowedSource) => createAllowedSourceFromArray(allowedSource) ); diff --git a/src/idv_service/session/retrieve/configuration/capture/source/allowed.source.response.js b/src/idv_service/session/retrieve/configuration/capture/source/allowed.source.response.js index c627898b6..4837419ff 100644 --- a/src/idv_service/session/retrieve/configuration/capture/source/allowed.source.response.js +++ b/src/idv_service/session/retrieve/configuration/capture/source/allowed.source.response.js @@ -8,6 +8,7 @@ class AllowedSourceResponse { } Validation.isString(type, 'type'); + /** @private */ this.type = type; } diff --git a/src/idv_service/session/retrieve/configuration/capture/task/requested.task.response.js b/src/idv_service/session/retrieve/configuration/capture/task/requested.task.response.js index 406f0d98b..472e3098a 100644 --- a/src/idv_service/session/retrieve/configuration/capture/task/requested.task.response.js +++ b/src/idv_service/session/retrieve/configuration/capture/task/requested.task.response.js @@ -1,4 +1,11 @@ class RequestedTaskResponse { + constructor() { + /** @protected {string|null} */ + this.type = null; + /** @protected {string|null} */ + this.state = null; + } + /** * Returns the type of the {@link RequestedTaskResponse} * diff --git a/src/idv_service/session/retrieve/configuration/session.configuration.response.js b/src/idv_service/session/retrieve/configuration/session.configuration.response.js index f57b5ee6b..a94f35d81 100644 --- a/src/idv_service/session/retrieve/configuration/session.configuration.response.js +++ b/src/idv_service/session/retrieve/configuration/session.configuration.response.js @@ -6,15 +6,19 @@ const CaptureResponse = require('./capture/capture.response'); class SessionConfigurationResponse { constructor(payload) { Validation.isNumber(payload.client_session_token_ttl, 'client_session_token_ttl'); + /** @private */ this.clientSessionTokenTtl = payload.client_session_token_ttl; Validation.isString(payload.session_id, 'session_id'); + /** @private */ this.sessionId = payload.session_id; Validation.isArray(payload.requested_checks, 'requested_checks'); + /** @private */ this.requestedChecks = payload.requested_checks; Validation.isPlainObject(payload.capture, 'capture'); + /** @private */ this.capture = new CaptureResponse(payload.capture); } diff --git a/src/idv_service/session/retrieve/create.face.capture.resource.response.js b/src/idv_service/session/retrieve/create.face.capture.resource.response.js index 806142611..6913c098e 100644 --- a/src/idv_service/session/retrieve/create.face.capture.resource.response.js +++ b/src/idv_service/session/retrieve/create.face.capture.resource.response.js @@ -10,7 +10,9 @@ class CreateFaceCaptureResourceResponse { Validation.isPlainObject(resourceData, 'resourceData'); Validation.isString(resourceData.id, 'resourceData.id'); Validation.isNumber(resourceData.frames, 'resourceData.frames'); + /** @private */ this.id = resourceData.id; + /** @private */ this.frames = resourceData.frames; } diff --git a/src/idv_service/session/retrieve/custom.account.watchlist.ca.search.config.response.js b/src/idv_service/session/retrieve/custom.account.watchlist.ca.search.config.response.js index c15e946ca..081f89e6a 100644 --- a/src/idv_service/session/retrieve/custom.account.watchlist.ca.search.config.response.js +++ b/src/idv_service/session/retrieve/custom.account.watchlist.ca.search.config.response.js @@ -1,4 +1,4 @@ -'user strict'; +'use strict'; const WatchlistAdvancedCaSearchConfigResponse = require('./watchlist.advanced.ca.search.config.response'); const Validation = require('../../../yoti_common/validation'); @@ -8,9 +8,11 @@ class CustomAccountWatchlistCaSearchConfigResponse extends WatchlistAdvancedCaSe super(searchConfig); Validation.isString(searchConfig.api_key, 'api_key'); + /** @private */ this.apiKey = searchConfig.api_key; Validation.isBoolean(searchConfig.monitoring, 'monitoring'); + /** @private */ this.monitoring = searchConfig.monitoring; if (searchConfig.tags) { @@ -19,10 +21,12 @@ class CustomAccountWatchlistCaSearchConfigResponse extends WatchlistAdvancedCaSe const values = keys.map((key) => searchConfig.tags[key]); Validation.isArrayOfStrings(keys, 'tags.keys'); Validation.isArrayOfStrings(values, 'tags.values'); + /** @private */ this.tags = searchConfig.tags; } Validation.isString(searchConfig.client_ref, 'client_ref'); + /** @private */ this.clientRef = searchConfig.client_ref; } @@ -44,7 +48,7 @@ class CustomAccountWatchlistCaSearchConfigResponse extends WatchlistAdvancedCaSe /** * - * @return {string:string} + * @return {{[k: string]: string}} */ getTags() { return this.tags; diff --git a/src/idv_service/session/retrieve/details.response.js b/src/idv_service/session/retrieve/details.response.js index 268114e65..a8b81bb9f 100644 --- a/src/idv_service/session/retrieve/details.response.js +++ b/src/idv_service/session/retrieve/details.response.js @@ -5,9 +5,11 @@ const Validation = require('../../../yoti_common/validation'); class DetailsResponse { constructor(details) { Validation.isString(details.name, 'name', true); + /** @private */ this.name = details.name; Validation.isString(details.value, 'value', true); + /** @private */ this.value = details.value; } diff --git a/src/idv_service/session/retrieve/document.fields.response.js b/src/idv_service/session/retrieve/document.fields.response.js index 75ef496a5..a0f833932 100644 --- a/src/idv_service/session/retrieve/document.fields.response.js +++ b/src/idv_service/session/retrieve/document.fields.response.js @@ -5,6 +5,7 @@ const MediaResponse = require('./media.response'); class DocumentFieldsResponse { constructor(documentFields) { if (documentFields.media) { + /** @private */ this.media = new MediaResponse(documentFields.media); } } diff --git a/src/idv_service/session/retrieve/document.id.photo.response.js b/src/idv_service/session/retrieve/document.id.photo.response.js index d95138d4a..01da7f54f 100644 --- a/src/idv_service/session/retrieve/document.id.photo.response.js +++ b/src/idv_service/session/retrieve/document.id.photo.response.js @@ -5,6 +5,7 @@ const MediaResponse = require('./media.response'); class DocumentIdPhotoResponse { constructor(documentFields) { if (documentFields.media) { + /** @private */ this.media = new MediaResponse(documentFields.media); } } diff --git a/src/idv_service/session/retrieve/exact.matching.strategy.response.js b/src/idv_service/session/retrieve/exact.matching.strategy.response.js index b30718ba2..066d988a7 100644 --- a/src/idv_service/session/retrieve/exact.matching.strategy.response.js +++ b/src/idv_service/session/retrieve/exact.matching.strategy.response.js @@ -8,6 +8,7 @@ class ExactMatchingStrategyResponse extends CaMatchingStrategyResponse { super(matchingStrategy); Validation.isBoolean(matchingStrategy.exact_match, 'exact_match'); + /** @private */ this.exactMatch = matchingStrategy.exact_match; } diff --git a/src/idv_service/session/retrieve/expanded.document.fields.response.js b/src/idv_service/session/retrieve/expanded.document.fields.response.js index fe7ad450f..7ac85562f 100644 --- a/src/idv_service/session/retrieve/expanded.document.fields.response.js +++ b/src/idv_service/session/retrieve/expanded.document.fields.response.js @@ -5,6 +5,7 @@ const MediaResponse = require('./media.response'); class ExpandedDocumentFieldsResponse { constructor(expandedDocumentFields) { if (expandedDocumentFields.media) { + /** @private */ this.media = new MediaResponse(expandedDocumentFields.media); } } diff --git a/src/idv_service/session/retrieve/face.capture.image.response.js b/src/idv_service/session/retrieve/face.capture.image.response.js index 1826b4b1e..f7aa66a76 100644 --- a/src/idv_service/session/retrieve/face.capture.image.response.js +++ b/src/idv_service/session/retrieve/face.capture.image.response.js @@ -6,7 +6,8 @@ const MediaResponse = require('./media.response'); class FaceCaptureImageResponse { constructor(image) { if (image.media) { - Validation.isPlainObject(image.media); + Validation.isPlainObject(image.media, 'media'); + /** @private */ this.media = new MediaResponse(image.media); } } diff --git a/src/idv_service/session/retrieve/face.capture.resource.response.js b/src/idv_service/session/retrieve/face.capture.resource.response.js index 85ceb73ff..9e9dee85c 100644 --- a/src/idv_service/session/retrieve/face.capture.resource.response.js +++ b/src/idv_service/session/retrieve/face.capture.resource.response.js @@ -9,7 +9,8 @@ class FaceCaptureResourceResponse extends ResourceResponse { super(resource); if (resource.image) { - Validation.isPlainObject(resource.image); + Validation.isPlainObject(resource.image, 'media'); + /** @private */ this.image = new FaceCaptureImageResponse(resource.image); } } diff --git a/src/idv_service/session/retrieve/face.map.response.js b/src/idv_service/session/retrieve/face.map.response.js index 77be7a5b3..b372aca94 100644 --- a/src/idv_service/session/retrieve/face.map.response.js +++ b/src/idv_service/session/retrieve/face.map.response.js @@ -5,6 +5,7 @@ const MediaResponse = require('./media.response'); class FaceMapResponse { constructor(facemap) { if (facemap.media) { + /** @private */ this.media = new MediaResponse(facemap.media); } } diff --git a/src/idv_service/session/retrieve/file.response.js b/src/idv_service/session/retrieve/file.response.js index 2060ebe37..7c8e32a77 100644 --- a/src/idv_service/session/retrieve/file.response.js +++ b/src/idv_service/session/retrieve/file.response.js @@ -5,6 +5,7 @@ const MediaResponse = require('./media.response'); class FileResponse { constructor(file) { if (file.media) { + /** @private */ this.media = new MediaResponse(file.media); } } diff --git a/src/idv_service/session/retrieve/frame.response.js b/src/idv_service/session/retrieve/frame.response.js index 8a4d458ca..0cee38b81 100644 --- a/src/idv_service/session/retrieve/frame.response.js +++ b/src/idv_service/session/retrieve/frame.response.js @@ -5,6 +5,7 @@ const MediaResponse = require('./media.response'); class FrameResponse { constructor(frame) { if (frame.media) { + /** @private */ this.media = new MediaResponse(frame.media); } } diff --git a/src/idv_service/session/retrieve/fuzzy.matching.strategy.response.js b/src/idv_service/session/retrieve/fuzzy.matching.strategy.response.js index 3eff66264..6b5e04d1a 100644 --- a/src/idv_service/session/retrieve/fuzzy.matching.strategy.response.js +++ b/src/idv_service/session/retrieve/fuzzy.matching.strategy.response.js @@ -8,6 +8,7 @@ class FuzzyMatchingStrategyResponse extends CaMatchingStrategyResponse { super(matchingStrategy); Validation.isNumber(matchingStrategy.fuzziness, 'fuzziness'); + /** @private */ this.fuzziness = matchingStrategy.fuzziness; } diff --git a/src/idv_service/session/retrieve/generated.check.response.js b/src/idv_service/session/retrieve/generated.check.response.js index 1749b034e..84fb77a97 100644 --- a/src/idv_service/session/retrieve/generated.check.response.js +++ b/src/idv_service/session/retrieve/generated.check.response.js @@ -5,9 +5,11 @@ const Validation = require('../../../yoti_common/validation'); class GeneratedCheckResponse { constructor(check) { Validation.isString(check.id, 'id', true); + /** @private */ this.id = check.id; Validation.isString(check.type, 'type', true); + /** @private */ this.type = check.type; } diff --git a/src/idv_service/session/retrieve/generated.media.js b/src/idv_service/session/retrieve/generated.media.js index 5c3468516..8fd1d310c 100644 --- a/src/idv_service/session/retrieve/generated.media.js +++ b/src/idv_service/session/retrieve/generated.media.js @@ -5,9 +5,11 @@ const Validation = require('../../../yoti_common/validation'); class GeneratedMedia { constructor(media) { Validation.isString(media.id, 'id', true); + /** @private */ this.id = media.id; Validation.isString(media.type, 'type', true); + /** @private */ this.type = media.type; } diff --git a/src/idv_service/session/retrieve/generated.profile.response.js b/src/idv_service/session/retrieve/generated.profile.response.js index e7898484b..b4a5d643b 100644 --- a/src/idv_service/session/retrieve/generated.profile.response.js +++ b/src/idv_service/session/retrieve/generated.profile.response.js @@ -5,6 +5,7 @@ const MediaResponse = require('./media.response'); class GeneratedProfileResponse { constructor(generatedProfile) { if (generatedProfile.media) { + /** @private */ this.media = new MediaResponse(generatedProfile.media); } } diff --git a/src/idv_service/session/retrieve/generated.supplementary.document.text.data.check.response.js b/src/idv_service/session/retrieve/generated.supplementary.document.text.data.check.response.js index eb7e35b6b..da3980064 100644 --- a/src/idv_service/session/retrieve/generated.supplementary.document.text.data.check.response.js +++ b/src/idv_service/session/retrieve/generated.supplementary.document.text.data.check.response.js @@ -1,8 +1,8 @@ 'use strict'; -const GeneratedCheckResponse = require('./generated.check.response'); +const GeneratedTextDataCheckResponse = require('./generated.text.data.check.response'); -class GeneratedSupplementaryDocumentTextDataCheckResponse extends GeneratedCheckResponse { +class GeneratedSupplementaryDocumentTextDataCheckResponse extends GeneratedTextDataCheckResponse { } module.exports = GeneratedSupplementaryDocumentTextDataCheckResponse; diff --git a/src/idv_service/session/retrieve/get.session.result.js b/src/idv_service/session/retrieve/get.session.result.js index 7c9611661..ddef7e0fd 100644 --- a/src/idv_service/session/retrieve/get.session.result.js +++ b/src/idv_service/session/retrieve/get.session.result.js @@ -21,22 +21,28 @@ const { YotiDate } = require('../../../data_type/date'); class GetSessionResult { constructor(response) { Validation.isInteger(response.client_session_token_ttl, 'client_session_token_ttl', true); + /** @private */ this.clientSessionTokenTtl = response.client_session_token_ttl; Validation.isString(response.session_id, 'session_id', true); + /** @private */ this.sessionId = response.session_id; Validation.isString(response.user_tracking_id, 'user_tracking_id', true); + /** @private */ this.userTrackingId = response.user_tracking_id; Validation.isString(response.state, 'state', true); + /** @private */ this.state = response.state; Validation.isString(response.client_session_token, 'client_session_token', true); + /** @private */ this.clientSessionToken = response.client_session_token; if (response.checks) { Validation.isArray(response.checks, 'checks'); + /** @private */ this.checks = response .checks .map((check) => { @@ -68,20 +74,24 @@ class GetSessionResult { } }); } else { + /** @private */ this.checks = []; } if (response.resources) { - Validation.instanceOf(response.resources, Object); + Validation.instanceOf(response.resources, Object, 'resources'); + /** @private */ this.resources = new ResourceContainer(response.resources); } if (response.biometric_consent) { + /** @private */ this.biometricConsent = YotiDate.fromDateString(response.biometric_consent); } if (response.identity_profile) { Validation.isPlainObject(response.identity_profile, 'identity_profile'); + /** @private */ this.identityProfile = new IdentityProfileResponse(response.identity_profile); } } @@ -94,7 +104,7 @@ class GetSessionResult { } /** - * @returns {int} + * @returns {number} */ getClientSessionTokenTtl() { return this.clientSessionTokenTtl; @@ -178,34 +188,40 @@ class GetSessionResult { * @returns {ThirdPartyIdentityCheckResponse[]} */ getThirdPartyIdentityChecks() { - return this.getChecks().filter((check) => check instanceof ThirdPartyIdentityCheckResponse); + return /** @type ThirdPartyIdentityCheckResponse[] */ (this.getChecks() + .filter((check) => check instanceof ThirdPartyIdentityCheckResponse)); } /** * @returns {WatchlistScreeningCheckResponse[]} */ getWatchlistScreeningChecks() { - return this.getChecks().filter((check) => check instanceof WatchlistScreeningCheckResponse); + return /** @type WatchlistScreeningCheckResponse[] */ (this.getChecks() + .filter((check) => check instanceof WatchlistScreeningCheckResponse)); } /** * @returns {WatchlistAdvancedCaCheckResponse[]} */ getWatchlistAdvancedCaChecks() { - return this.getChecks().filter((check) => check instanceof WatchlistAdvancedCaCheckResponse); + return /** @type WatchlistAdvancedCaCheckResponse[] */ (this.getChecks() + .filter((check) => check instanceof WatchlistAdvancedCaCheckResponse)); } /** * @returns {ThirdPartyIdentityFraud1CheckResponse[]} */ getThirdPartyIdentityFraud1Checks() { - return this.getChecks() - .filter((check) => check instanceof ThirdPartyIdentityFraud1CheckResponse); + return /** @type ThirdPartyIdentityFraud1CheckResponse[] */ (this.getChecks() + .filter((check) => check instanceof ThirdPartyIdentityFraud1CheckResponse)); } + /** + * @returns {FaceComparisonCheckResponse[]} + */ getFaceComparisonChecks() { - return this.getChecks() - .filter((check) => check instanceof FaceComparisonCheckResponse); + return /** @type FaceComparisonCheckResponse[] */ (this.getChecks() + .filter((check) => check instanceof FaceComparisonCheckResponse)); } /** diff --git a/src/idv_service/session/retrieve/id.document.resource.response.js b/src/idv_service/session/retrieve/id.document.resource.response.js index 2e62bd53a..3de314d4e 100644 --- a/src/idv_service/session/retrieve/id.document.resource.response.js +++ b/src/idv_service/session/retrieve/id.document.resource.response.js @@ -13,27 +13,34 @@ class IdDocumentResourceResponse extends ResourceResponse { super(resource); Validation.isString(resource.document_type, 'document_type', true); + /** @private */ this.documentType = resource.document_type; Validation.isString(resource.issuing_country, 'issuing_country', true); + /** @private */ this.issuingCountry = resource.issuing_country; if (resource.pages) { Validation.isArray(resource.pages, 'pages'); + /** @private */ this.pages = resource.pages.map((page) => new PageResponse(page)); } else { + /** @private */ this.pages = []; } if (resource.document_fields) { + /** @private */ this.documentFields = new DocumentFieldsResponse(resource.document_fields); } if (resource.document_id_photo) { + /** @private */ this.documentIdPhoto = new DocumentIdPhotoResponse(resource.document_id_photo); } if (resource.expanded_document_fields) { + /** @private */ this.expandedDocumentFields = new ExpandedDocumentFieldsResponse( resource.expanded_document_fields ); diff --git a/src/idv_service/session/retrieve/identity.profile.failure.reason.response.js b/src/idv_service/session/retrieve/identity.profile.failure.reason.response.js index db02affaa..dda0fb12a 100644 --- a/src/idv_service/session/retrieve/identity.profile.failure.reason.response.js +++ b/src/idv_service/session/retrieve/identity.profile.failure.reason.response.js @@ -5,6 +5,7 @@ const Validation = require('../../../yoti_common/validation'); class IdentityProfileFailureReasonResponse { constructor(failureReason) { Validation.isString(failureReason.reason_code, 'reason code'); + /** @private */ this.reasonCode = failureReason.reason_code; } diff --git a/src/idv_service/session/retrieve/identity.profile.report.response.js b/src/idv_service/session/retrieve/identity.profile.report.response.js index 71b8775c3..1ea801b6e 100644 --- a/src/idv_service/session/retrieve/identity.profile.report.response.js +++ b/src/idv_service/session/retrieve/identity.profile.report.response.js @@ -7,13 +7,17 @@ const MediaResponse = require('./media.response'); class IdentityProfileReportResponse { constructor(report) { Validation.isString(report.trust_framework, 'trust_framework'); + /** @private */ this.trustFramework = report.trust_framework; Validation.isArray(report.schemes_compliance, 'schemes_compliance'); - // eslint-disable-next-line max-len - this.schemesCompliance = report.schemes_compliance.map((schemeCompliance) => new IdentityProfileReportSchemesComplianceResponse(schemeCompliance)); + /** @private */ + this.schemesCompliance = report.schemes_compliance + // eslint-disable-next-line max-len + .map((schemeCompliance) => new IdentityProfileReportSchemesComplianceResponse(schemeCompliance)); Validation.isPlainObject(report.media, 'media'); + /** @private */ this.media = new MediaResponse(report.media); } diff --git a/src/idv_service/session/retrieve/identity.profile.report.schemes.compliance.response.js b/src/idv_service/session/retrieve/identity.profile.report.schemes.compliance.response.js index 6e1454f83..f7d8f2782 100644 --- a/src/idv_service/session/retrieve/identity.profile.report.schemes.compliance.response.js +++ b/src/idv_service/session/retrieve/identity.profile.report.schemes.compliance.response.js @@ -5,13 +5,16 @@ const Validation = require('../../../yoti_common/validation'); class IdentityProfileReportSchemesComplianceResponse { constructor(schemesCompliance) { Validation.isPlainObject(schemesCompliance.scheme, 'scheme'); + /** @private */ this.scheme = schemesCompliance.scheme; Validation.isBoolean(schemesCompliance.requirements_met, 'requirements_met'); + /** @private */ this.requirementsMet = schemesCompliance.requirements_met; if (schemesCompliance.requirements_not_met_info) { Validation.isString(schemesCompliance.requirements_not_met_info, 'requirements_not_met_info'); + /** @private */ this.requirementsNotMetInfo = schemesCompliance.requirements_not_met_info; } } diff --git a/src/idv_service/session/retrieve/identity.profile.response.js b/src/idv_service/session/retrieve/identity.profile.response.js index a232c2078..b187392f8 100644 --- a/src/idv_service/session/retrieve/identity.profile.response.js +++ b/src/idv_service/session/retrieve/identity.profile.response.js @@ -7,18 +7,22 @@ const IdentityProfileFailureReasonResponse = require('./identity.profile.failure class IdentityProfileResponse { constructor(identityProfile) { Validation.isString(identityProfile.subject_id, 'subject_id', true); + /** @private */ this.subjectId = identityProfile.subject_id; Validation.isString(identityProfile.result, 'result'); + /** @private */ this.result = identityProfile.result; if (identityProfile.failure_reason) { Validation.isPlainObject(identityProfile.failure_reason, 'failure_reason'); + /** @private */ this.failureReason = new IdentityProfileFailureReasonResponse(identityProfile.failure_reason); } if (identityProfile.identity_profile_report) { Validation.isPlainObject(identityProfile.identity_profile_report, 'identity_profile_report'); + /** @private */ this.identityProfileReport = new IdentityProfileReportResponse( identityProfile.identity_profile_report ); diff --git a/src/idv_service/session/retrieve/liveness.resource.response.js b/src/idv_service/session/retrieve/liveness.resource.response.js index 94817cb1f..cebf36bee 100644 --- a/src/idv_service/session/retrieve/liveness.resource.response.js +++ b/src/idv_service/session/retrieve/liveness.resource.response.js @@ -8,6 +8,7 @@ class LivenessResourceResponse extends ResourceResponse { super(resource); Validation.isString(resource.liveness_type, 'liveness_type', true); + /** @private */ this.livenessType = resource.liveness_type; } diff --git a/src/idv_service/session/retrieve/media.response.js b/src/idv_service/session/retrieve/media.response.js index 39052e971..76b5e0a73 100644 --- a/src/idv_service/session/retrieve/media.response.js +++ b/src/idv_service/session/retrieve/media.response.js @@ -6,18 +6,22 @@ const { YotiDate } = require('../../../data_type/date'); class MediaResponse { constructor(media) { Validation.isString(media.id, 'id', true); + /** @private */ this.id = media.id; Validation.isString(media.type, 'type', true); + /** @private */ this.type = media.type; if (media.created) { Validation.isString(media.created, 'created'); + /** @private */ this.created = YotiDate.fromDateString(media.created); } if (media.last_updated) { Validation.isString(media.last_updated, 'last_updated'); + /** @private */ this.lastUpdated = YotiDate.fromDateString(media.last_updated); } } diff --git a/src/idv_service/session/retrieve/page.response.js b/src/idv_service/session/retrieve/page.response.js index 55aa66162..6983df510 100644 --- a/src/idv_service/session/retrieve/page.response.js +++ b/src/idv_service/session/retrieve/page.response.js @@ -7,16 +7,20 @@ const Validation = require('../../../yoti_common/validation'); class PageResponse { constructor(page) { Validation.isString(page.capture_method, 'capture_method', true); + /** @private */ this.captureMethod = page.capture_method; if (page.media) { + /** @private */ this.media = new MediaResponse(page.media); } if (page.frames) { Validation.isArray(page.frames, 'frames'); + /** @private */ this.frames = page.frames.map((frame) => new FrameResponse(frame)); } else { + /** @private */ this.frames = []; } } diff --git a/src/idv_service/session/retrieve/profile.check.response.js b/src/idv_service/session/retrieve/profile.check.response.js index 798feebd9..f2e5000cf 100644 --- a/src/idv_service/session/retrieve/profile.check.response.js +++ b/src/idv_service/session/retrieve/profile.check.response.js @@ -6,6 +6,7 @@ class ProfileCheckResponse extends CheckResponse { super(check); if (check.generated_profile) { + /** @private */ this.generatedProfile = new GeneratedProfileResponse(check.generated_profile); } } diff --git a/src/idv_service/session/retrieve/raw.results.response.js b/src/idv_service/session/retrieve/raw.results.response.js index 9a3dca1bc..f1029722a 100644 --- a/src/idv_service/session/retrieve/raw.results.response.js +++ b/src/idv_service/session/retrieve/raw.results.response.js @@ -5,6 +5,7 @@ const MediaResponse = require('./media.response'); class RawResultsResponse { constructor(rawResults) { if (rawResults.media) { + /** @private */ this.media = new MediaResponse(rawResults.media); } } diff --git a/src/idv_service/session/retrieve/recommendation.response.js b/src/idv_service/session/retrieve/recommendation.response.js index e8de0efac..40e677545 100644 --- a/src/idv_service/session/retrieve/recommendation.response.js +++ b/src/idv_service/session/retrieve/recommendation.response.js @@ -5,12 +5,15 @@ const Validation = require('../../../yoti_common/validation'); class RecommendationResponse { constructor(recommendation) { Validation.isString(recommendation.value, 'value', true); + /** @private */ this.value = recommendation.value; Validation.isString(recommendation.reason, 'reason', true); + /** @private */ this.reason = recommendation.reason; Validation.isString(recommendation.recovery_suggestion, 'recovery_suggestion', true); + /** @private */ this.recoverySuggestion = recommendation.recovery_suggestion; } diff --git a/src/idv_service/session/retrieve/report.response.js b/src/idv_service/session/retrieve/report.response.js index 3f7ada857..b2c00e93b 100644 --- a/src/idv_service/session/retrieve/report.response.js +++ b/src/idv_service/session/retrieve/report.response.js @@ -7,13 +7,16 @@ const Validation = require('../../../yoti_common/validation'); class ReportResponse { constructor(report) { if (report.recommendation) { + /** @private */ this.recommendation = new RecommendationResponse(report.recommendation); } if (report.breakdown) { Validation.isArray(report.breakdown, 'breakdown'); + /** @private */ this.breakdown = report.breakdown.map((breakdown) => new BreakdownResponse(breakdown)); } else { + /** @private */ this.breakdown = []; } } diff --git a/src/idv_service/session/retrieve/resource.container.js b/src/idv_service/session/retrieve/resource.container.js index fb57612af..69b134e18 100644 --- a/src/idv_service/session/retrieve/resource.container.js +++ b/src/idv_service/session/retrieve/resource.container.js @@ -13,24 +13,29 @@ class ResourceContainer { constructor(resources) { if (resources.id_documents) { Validation.isArray(resources.id_documents, 'id_documents'); + /** @private */ this.idDocuments = resources .id_documents .map((resource) => new IdDocumentResourceResponse(resource)); } else { + /** @private */ this.idDocuments = []; } if (resources.supplementary_documents) { Validation.isArray(resources.supplementary_documents, 'supplementary_documents'); + /** @private */ this.supplementaryDocuments = resources .supplementary_documents .map((resource) => new SupplementaryDocumentResourceResponse(resource)); } else { + /** @private */ this.supplementaryDocuments = []; } if (resources.liveness_capture) { Validation.isArray(resources.liveness_capture, 'liveness_capture'); + /** @private */ this.livenessCapture = resources .liveness_capture .map((resource) => { @@ -44,16 +49,19 @@ class ResourceContainer { } }); } else { + /** @private */ this.livenessCapture = []; } if (resources.face_capture) { Validation.isArray(resources.face_capture, 'face_capture'); + /** @private */ this.faceCapture = resources.face_capture.map( (resource) => new FaceCaptureResourceResponse(resource) ); } else { + /** @private */ this.faceCapture = []; } } @@ -93,9 +101,9 @@ class ResourceContainer { * The list of Zoom liveness resources */ getZoomLivenessResources() { - return this + return /** @type ZoomLivenessResourceResponse[] */ (this .getLivenessCapture() - .filter((resource) => resource instanceof ZoomLivenessResourceResponse); + .filter((resource) => resource instanceof ZoomLivenessResourceResponse)); } /** @@ -103,9 +111,9 @@ class ResourceContainer { * The list of Static liveness resources */ getStaticLivenessResources() { - return this + return /** @type StaticLivenessResourceResponse[] */ (this .getLivenessCapture() - .filter((resource) => resource instanceof StaticLivenessResourceResponse); + .filter((resource) => resource instanceof StaticLivenessResourceResponse)); } /** diff --git a/src/idv_service/session/retrieve/resource.response.js b/src/idv_service/session/retrieve/resource.response.js index a9d9440e3..7fae86b33 100644 --- a/src/idv_service/session/retrieve/resource.response.js +++ b/src/idv_service/session/retrieve/resource.response.js @@ -9,9 +9,11 @@ const SupplementaryTextExtractionTaskResponse = require('./supplementary.documen class ResourceResponse { constructor(resource) { Validation.isString(resource.id, 'id', true); + /** @private */ this.id = resource.id; if (resource.tasks) { + /** @private */ this.tasks = resource.tasks .map((task) => { switch (task.type) { @@ -24,6 +26,7 @@ class ResourceResponse { } }); } else { + /** @private */ this.tasks = []; } } @@ -35,13 +38,6 @@ class ResourceResponse { return this.tasks; } - /** - * @return AllowedSourceResponse - */ - getSource() { - return this.source; - } - /** * @returns {string} */ diff --git a/src/idv_service/session/retrieve/search.profile.sources.response.js b/src/idv_service/session/retrieve/search.profile.sources.response.js index 5ab0ea12b..3d4b815a8 100644 --- a/src/idv_service/session/retrieve/search.profile.sources.response.js +++ b/src/idv_service/session/retrieve/search.profile.sources.response.js @@ -8,6 +8,7 @@ class SearchProfileSourcesResponse extends CaSourcesResponse { super(sources); Validation.isString(sources.type, 'search_profile'); + /** @private */ this.searchProfile = sources.search_profile; } diff --git a/src/idv_service/session/retrieve/static.liveness.resource.response.js b/src/idv_service/session/retrieve/static.liveness.resource.response.js index f0b2c932b..87f093fd6 100644 --- a/src/idv_service/session/retrieve/static.liveness.resource.response.js +++ b/src/idv_service/session/retrieve/static.liveness.resource.response.js @@ -15,6 +15,7 @@ class StaticLivenessResourceResponse extends LivenessResourceResponse { Validation.isPlainObject(media, 'media'); + /** @private */ this.image = new MediaResponse(media); } } diff --git a/src/idv_service/session/retrieve/supplementary.document.resource.response.js b/src/idv_service/session/retrieve/supplementary.document.resource.response.js index 6669ffb79..52b86b1e4 100644 --- a/src/idv_service/session/retrieve/supplementary.document.resource.response.js +++ b/src/idv_service/session/retrieve/supplementary.document.resource.response.js @@ -12,23 +12,29 @@ class SupplementaryDocumentResourceResponse extends ResourceResponse { super(resource); Validation.isString(resource.document_type, 'document_type', true); + /** @private */ this.documentType = resource.document_type; Validation.isString(resource.issuing_country, 'issuing_country', true); + /** @private */ this.issuingCountry = resource.issuing_country; if (resource.pages) { Validation.isArray(resource.pages, 'pages'); + /** @private */ this.pages = resource.pages.map((page) => new PageResponse(page)); } else { + /** @private */ this.pages = []; } if (resource.document_fields) { + /** @private */ this.documentFields = new DocumentFieldsResponse(resource.document_fields); } if (resource.file) { + /** @private */ this.file = new FileResponse(resource.file); } } diff --git a/src/idv_service/session/retrieve/task.response.js b/src/idv_service/session/retrieve/task.response.js index c012bb5f6..3718b2b0f 100644 --- a/src/idv_service/session/retrieve/task.response.js +++ b/src/idv_service/session/retrieve/task.response.js @@ -11,26 +11,32 @@ const { YotiDate } = require('../../../data_type/date'); class TaskResponse { constructor(task) { Validation.isString(task.type, 'type', true); + /** @private */ this.type = task.type; Validation.isString(task.id, 'id', true); + /** @private */ this.id = task.id; Validation.isString(task.state, 'state', true); + /** @private */ this.state = task.state; if (task.created) { Validation.isString(task.created, 'created'); + /** @private */ this.created = YotiDate.fromDateString(task.created); } if (task.last_updated) { Validation.isString(task.last_updated, 'last_updated'); + /** @private */ this.lastUpdated = YotiDate.fromDateString(task.last_updated); } if (task.generated_checks) { Validation.isArray(task.generated_checks, 'generated_checks'); + /** @private */ this.generatedChecks = task.generated_checks .map((check) => { switch (check.type) { @@ -43,13 +49,16 @@ class TaskResponse { } }); } else { + /** @private */ this.generatedChecks = []; } if (task.generated_media) { Validation.isArray(task.generated_media, 'generated_media'); + /** @private */ this.generatedMedia = task.generated_media.map((media) => new GeneratedMedia(media)); } else { + /** @private */ this.generatedMedia = []; } } diff --git a/src/idv_service/session/retrieve/type.list.sources.response.js b/src/idv_service/session/retrieve/type.list.sources.response.js index b41a3988a..667da636a 100644 --- a/src/idv_service/session/retrieve/type.list.sources.response.js +++ b/src/idv_service/session/retrieve/type.list.sources.response.js @@ -8,6 +8,7 @@ class TypeListSourcesResponse extends CaSourcesResponse { super(sources); Validation.isArrayOfStrings(sources.types, 'types'); + /** @private */ this.types = sources.types; } diff --git a/src/idv_service/session/retrieve/watchlist.advanced.ca.check.response.js b/src/idv_service/session/retrieve/watchlist.advanced.ca.check.response.js index fe658aa4b..efcd22b87 100644 --- a/src/idv_service/session/retrieve/watchlist.advanced.ca.check.response.js +++ b/src/idv_service/session/retrieve/watchlist.advanced.ca.check.response.js @@ -1,5 +1,9 @@ 'use strict'; +/** + * @typedef {import('./report.response')} ReportResponse + */ + const WatchlistCheckResponse = require('./watchlist.check.response'); const WatchlistAdvancedCaReportResponse = require('./watchlist.advanced.ca.report.response'); @@ -13,7 +17,7 @@ class WatchlistAdvancedCaCheckResponse extends WatchlistCheckResponse { } /** - * @returns {WatchlistAdvancedCaReportResponse} + * @returns {ReportResponse|WatchlistAdvancedCaReportResponse} */ getReport() { return this.report; diff --git a/src/idv_service/session/retrieve/watchlist.advanced.ca.report.response.js b/src/idv_service/session/retrieve/watchlist.advanced.ca.report.response.js index 2db447897..f2dbbf1b6 100644 --- a/src/idv_service/session/retrieve/watchlist.advanced.ca.report.response.js +++ b/src/idv_service/session/retrieve/watchlist.advanced.ca.report.response.js @@ -8,6 +8,7 @@ class WatchlistAdvancedCaReportResponse extends WatchlistReportResponse { super(report); if (report.watchlist_summary) { + /** @private */ this.watchListSummary = new WatchlistAdvancedCaSummaryResponse(report.watchlist_summary); } } diff --git a/src/idv_service/session/retrieve/watchlist.advanced.ca.search.config.response.js b/src/idv_service/session/retrieve/watchlist.advanced.ca.search.config.response.js index 25eaeec01..450c25dbf 100644 --- a/src/idv_service/session/retrieve/watchlist.advanced.ca.search.config.response.js +++ b/src/idv_service/session/retrieve/watchlist.advanced.ca.search.config.response.js @@ -34,17 +34,21 @@ class WatchlistAdvancedCaSearchConfigResponse extends WatchlistSearchConfigRespo super(); Validation.isString(searchConfig.type, 'type'); Validation.oneOf(searchConfig.type, Object.keys(types), 'type'); + /** @private */ this.type = searchConfig.type; Validation.isBoolean(searchConfig.remove_deceased, 'remove_deceased'); + /** @private */ this.removeDeceased = searchConfig.remove_deceased; Validation.isBoolean(searchConfig.share_url, 'share_url'); + /** @private */ this.shareUrl = searchConfig.share_url; if (searchConfig.sources) { const CaSourcesResponseClass = CaSourcesResponseClassesByType[searchConfig.sources.type]; if (CaSourcesResponseClass) { + /** @private */ this.sources = new CaSourcesResponseClass(searchConfig.sources); } } @@ -53,6 +57,7 @@ class WatchlistAdvancedCaSearchConfigResponse extends WatchlistSearchConfigRespo // eslint-disable-next-line max-len const CaMatchingStrategyResponseClass = CaMatchingStrategyResponseClassesByType[searchConfig.matching_strategy.type]; if (CaMatchingStrategyResponseClass) { + /** @private */ this.matchingStrategy = new CaMatchingStrategyResponseClass(searchConfig.matching_strategy); } } @@ -73,7 +78,7 @@ class WatchlistAdvancedCaSearchConfigResponse extends WatchlistSearchConfigRespo } /** - * @returns {shareUrl} + * @returns {boolean} */ isShareUrl() { return this.shareUrl; diff --git a/src/idv_service/session/retrieve/watchlist.advanced.ca.summary.response.js b/src/idv_service/session/retrieve/watchlist.advanced.ca.summary.response.js index e7764bc8c..da0ddacfc 100644 --- a/src/idv_service/session/retrieve/watchlist.advanced.ca.summary.response.js +++ b/src/idv_service/session/retrieve/watchlist.advanced.ca.summary.response.js @@ -20,6 +20,7 @@ class WatchlistAdvancedCaSummaryResponse extends WatchlistSummaryResponse { // eslint-disable-next-line max-len const WatchlistAdvancedCaSearchConfigResponseClass = WatchlistAdvancedCaSearchConfigResponseClassesByType[summary.search_config.type]; if (WatchlistAdvancedCaSearchConfigResponseClass) { + /** @private */ this.searchConfig = new WatchlistAdvancedCaSearchConfigResponseClass(summary.search_config); } } diff --git a/src/idv_service/session/retrieve/watchlist.screening.check.response.js b/src/idv_service/session/retrieve/watchlist.screening.check.response.js index 649e86e8a..92fc08f10 100644 --- a/src/idv_service/session/retrieve/watchlist.screening.check.response.js +++ b/src/idv_service/session/retrieve/watchlist.screening.check.response.js @@ -3,6 +3,10 @@ const WatchlistCheckResponse = require('./watchlist.check.response'); const WatchlistScreeningReportResponse = require('./watchlist.screening.report.response'); +/** + * @typedef {import('./report.response')} ReportResponse + */ + class WatchlistScreeningCheckResponse extends WatchlistCheckResponse { constructor(check) { super(check); @@ -14,7 +18,7 @@ class WatchlistScreeningCheckResponse extends WatchlistCheckResponse { /** * - * @return {WatchlistScreeningReportResponse} + * @return {ReportResponse|WatchlistScreeningReportResponse} */ getReport() { return this.report; diff --git a/src/idv_service/session/retrieve/watchlist.screening.report.response.js b/src/idv_service/session/retrieve/watchlist.screening.report.response.js index 96b6ffde6..e7a6670b6 100644 --- a/src/idv_service/session/retrieve/watchlist.screening.report.response.js +++ b/src/idv_service/session/retrieve/watchlist.screening.report.response.js @@ -8,6 +8,7 @@ class WatchlistScreeningReportResponse extends WatchlistReportResponse { super(report); if (report.watchlist_summary) { + /** @private */ this.watchListSummary = new WatchlistScreeningSummaryResponse(report.watchlist_summary); } } diff --git a/src/idv_service/session/retrieve/watchlist.screening.search.config.response.js b/src/idv_service/session/retrieve/watchlist.screening.search.config.response.js index 1c1166236..db4cf9463 100644 --- a/src/idv_service/session/retrieve/watchlist.screening.search.config.response.js +++ b/src/idv_service/session/retrieve/watchlist.screening.search.config.response.js @@ -9,8 +9,10 @@ class WatchlistScreeningSearchConfigResponse extends WatchlistSearchConfigRespon if (searchConfig.categories) { Validation.isArrayOfStrings(searchConfig.categories, 'categories'); + /** @private */ this.categories = searchConfig.categories; } else { + /** @private */ this.categories = []; } } diff --git a/src/idv_service/session/retrieve/watchlist.screening.summary.response.js b/src/idv_service/session/retrieve/watchlist.screening.summary.response.js index 7d0b23883..be9dbcd66 100644 --- a/src/idv_service/session/retrieve/watchlist.screening.summary.response.js +++ b/src/idv_service/session/retrieve/watchlist.screening.summary.response.js @@ -8,6 +8,7 @@ class WatchlistScreeningSummaryResponse extends WatchlistSummaryResponse { super(summary); if (summary.search_config) { + /** @private */ this.searchConfig = new WatchlistScreeningSearchConfigResponse(summary.search_config); } } diff --git a/src/idv_service/session/retrieve/watchlist.summary.response.js b/src/idv_service/session/retrieve/watchlist.summary.response.js index 1674d0f1a..11f1e5205 100644 --- a/src/idv_service/session/retrieve/watchlist.summary.response.js +++ b/src/idv_service/session/retrieve/watchlist.summary.response.js @@ -12,19 +12,24 @@ class WatchlistSummaryResponse { if (summary.total_hits) { Validation.isNumber(summary.total_hits, 'total_hits'); + /** @private */ this.totalHits = summary.total_hits; } else { + /** @private */ this.totalHits = 0; } if (summary.associated_country_codes) { Validation.isArrayOfStrings(summary.associated_country_codes, 'associated_country_codes'); + /** @private */ this.associatedCountryCodes = summary.associated_country_codes; } else { + /** @private */ this.associatedCountryCodes = []; } if (summary.raw_results) { + /** @private */ this.rawResults = new RawResultsResponse(summary.raw_results); } } diff --git a/src/idv_service/session/retrieve/yoti.account.watchlist.ca.search.config.response.js b/src/idv_service/session/retrieve/yoti.account.watchlist.ca.search.config.response.js index 992cfd869..64de4980f 100644 --- a/src/idv_service/session/retrieve/yoti.account.watchlist.ca.search.config.response.js +++ b/src/idv_service/session/retrieve/yoti.account.watchlist.ca.search.config.response.js @@ -1,4 +1,4 @@ -'user strict'; +'use strict'; const WatchlistAdvancedCaSearchConfigResponse = require('./watchlist.advanced.ca.search.config.response'); diff --git a/src/idv_service/session/retrieve/zoom.liveness.resource.response.js b/src/idv_service/session/retrieve/zoom.liveness.resource.response.js index b1ea8bc77..b34d105ee 100644 --- a/src/idv_service/session/retrieve/zoom.liveness.resource.response.js +++ b/src/idv_service/session/retrieve/zoom.liveness.resource.response.js @@ -10,13 +10,16 @@ class ZoomLivenessResourceResponse extends LivenessResourceResponse { super(resource); if (resource.facemap) { + /** @private */ this.faceMap = new FaceMapResponse(resource.facemap); } if (resource.frames) { Validation.isArray(resource.frames, 'frames'); + /** @private */ this.frames = resource.frames.map((frame) => new FrameResponse(frame)); } else { + /** @private */ this.frames = []; } } diff --git a/src/idv_service/support/supported.country.js b/src/idv_service/support/supported.country.js index 414ad7fed..d708fdef2 100644 --- a/src/idv_service/support/supported.country.js +++ b/src/idv_service/support/supported.country.js @@ -6,12 +6,15 @@ const SupportedDocument = require('./supported.document'); class SupportedCountry { constructor(country) { Validation.isString(country.code, 'code', true); + /** @private */ this.code = country.code; if (country.supported_documents) { + /** @private */ this.supportedDocuments = country.supported_documents .map((document) => new SupportedDocument(document)); } else { + /** @private */ this.supportedDocuments = []; } } diff --git a/src/idv_service/support/supported.document.js b/src/idv_service/support/supported.document.js index 328d0b4f7..374ba3c73 100644 --- a/src/idv_service/support/supported.document.js +++ b/src/idv_service/support/supported.document.js @@ -5,9 +5,11 @@ const Validation = require('../../yoti_common/validation'); class SupportedDocument { constructor(document) { Validation.isString(document.type, 'type', true); + /** @private */ this.type = document.type; Validation.isBoolean(document.is_strictly_latin, 'is_strictly_latin', true); + /** @private */ this.isStrictlyLatin = document.is_strictly_latin; } diff --git a/src/idv_service/support/supported.documents.response.js b/src/idv_service/support/supported.documents.response.js index 14b49d20e..8b3d9a091 100644 --- a/src/idv_service/support/supported.documents.response.js +++ b/src/idv_service/support/supported.documents.response.js @@ -5,9 +5,11 @@ const SupportedCountry = require('./supported.country'); class SupportedDocumentsResponse { constructor(response) { if (response.supported_countries) { + /** @private */ this.supportedCountries = response.supported_countries .map((country) => new SupportedCountry(country)); } else { + /** @private */ this.supportedCountries = []; } } diff --git a/src/profile_service/activity.details.js b/src/profile_service/activity.details.js index 2375dca5a..1c41c5f48 100644 --- a/src/profile_service/activity.details.js +++ b/src/profile_service/activity.details.js @@ -17,17 +17,22 @@ class ActivityDetails { * Decrypted user profile data. * @param {{attributes: Object[]}} applicationProfile * Decrypted application profile data. - * @param {[]} extraData + * @param {*[]} extraData * Decrypted and converted extra data. */ constructor(parsedResponse, userProfile, applicationProfile, extraData) { + /** @private */ this.parsedResponse = parsedResponse; + /** @private */ this.receipt = parsedResponse.receipt; const { attributes: userProfileAttributes } = userProfile || {}; const { attributes: applicationProfileAttributes } = applicationProfile || {}; + /** @private */ this.userProfile = new Profile(userProfileAttributes); + /** @private */ this.applicationProfile = new ApplicationProfile(applicationProfileAttributes); + /** @private */ this.extraData = new ExtraData(extraData); } diff --git a/src/profile_service/application.profile.js b/src/profile_service/application.profile.js index f92cb7e1b..5556017d1 100644 --- a/src/profile_service/application.profile.js +++ b/src/profile_service/application.profile.js @@ -3,10 +3,15 @@ const constants = require('../yoti_common/constants'); const { BaseProfile } = require('./base.profile'); +/** + * @typedef {import('../data_type/attribute').Attribute} Attribute + */ + /** * Profile of an application with convenience methods to access well-known attributes. * * @class ApplicationProfile + * */ class ApplicationProfile extends BaseProfile { /** diff --git a/src/profile_service/base.profile.js b/src/profile_service/base.profile.js index 120ec2a0d..97897fe51 100644 --- a/src/profile_service/base.profile.js +++ b/src/profile_service/base.profile.js @@ -7,10 +7,12 @@ class BaseProfile { * @param {Array} attributes */ constructor(attributes = []) { + /** @protected */ this.attributes = attributes .filter((attribute) => !!attribute) .map((attribute) => new Attribute(attribute)); + /** @private */ this.attributesMap = this.attributes.reduce((acc, current) => { const name = current.getName(); acc[name] = acc[name] || []; diff --git a/src/profile_service/extra.data.js b/src/profile_service/extra.data.js index 07fef7e14..84077b5d9 100644 --- a/src/profile_service/extra.data.js +++ b/src/profile_service/extra.data.js @@ -19,6 +19,7 @@ class ExtraData { * @param {Object[]} dataEntries */ constructor(dataEntries = []) { + /** @private */ this.attributeIssuanceDetails = getAttributeIssuanceDetails(dataEntries); } diff --git a/src/profile_service/index.js b/src/profile_service/index.js index 51a81859d..0d40620ea 100644 --- a/src/profile_service/index.js +++ b/src/profile_service/index.js @@ -17,27 +17,29 @@ class ProfileService { /** * @param {string} sdkId * @param {string|Buffer} pem - * @param {Object} options - * @param {string} options.apiUrl + * @param {{apiUrl?: string}} options */ constructor(sdkId, pem, { apiUrl = DEFAULT_API_URL } = {}) { Validation.isString(sdkId, 'sdkId'); Validation.notNullOrEmpty(pem, 'pem'); + /** @private */ this.sdkId = sdkId; + /** @private */ this.pem = pem; + /** @private */ this.apiUrl = apiUrl; } getReceipt(token) { const requestBuilder = new RequestBuilder() .withBaseUrl(this.apiUrl) - .withPemString(this.pem) + .withPemString(this.pem.toString()) .withEndpoint(`/profile/${token}`) .withQueryParam('appId', this.sdkId) .withMethod('GET'); - requestBuilder.withHeader('X-Yoti-Auth-Key', yotiCommon.getAuthKeyFromPem(this.pem)); + requestBuilder.withHeader('X-Yoti-Auth-Key', yotiCommon.getAuthKeyFromPem(this.pem.toString())); const request = requestBuilder.build(); @@ -47,9 +49,10 @@ class ProfileService { try { const receipt = response.getReceipt(); const parsedResponse = response.getParsedResponse(); - const userProfile = yotiCommon.decryptUserProfile(receipt, this.pem); - const applicationProfile = yotiCommon.decryptApplicationProfile(receipt, this.pem); - const extraData = yotiCommon.parseExtraData(receipt, this.pem); + const userProfile = yotiCommon.decryptUserProfile(receipt, this.pem.toString()); + // eslint-disable-next-line max-len + const applicationProfile = yotiCommon.decryptApplicationProfile(receipt, this.pem.toString()); + const extraData = yotiCommon.parseExtraData(receipt, this.pem.toString()); return resolve(new ActivityDetails( parsedResponse, userProfile, diff --git a/src/profile_service/profile.js b/src/profile_service/profile.js index 6855e3697..66267d5b3 100644 --- a/src/profile_service/profile.js +++ b/src/profile_service/profile.js @@ -15,6 +15,7 @@ class Profile extends BaseProfile { constructor(attributes = []) { super(attributes); + /** @private */ this.ageVerifications = this.attributes .filter((attribute) => attribute.getValue() instanceof AgeVerification) .reduce((acc, attribute) => ({ @@ -72,7 +73,7 @@ class Profile extends BaseProfile { /** * Searches for an AgeVerification corresponding to an 'Age Over' check for the given age * - * @param {int} age + * @param {number} age * * @returns {AgeVerification|null} */ @@ -83,7 +84,7 @@ class Profile extends BaseProfile { /** * Searches for an AgeVerification corresponding to an 'Age Under' check for the given age. * - * @param {int} age + * @param {number} age * * @returns {AgeVerification|null} */ @@ -95,13 +96,13 @@ class Profile extends BaseProfile { * Searches for an AgeVerification corresponding to provided type and age. * * @param {string} type - * @param {int} age + * @param {number} age * * @returns {AgeVerification|null} */ findAgeVerification(type, age) { - Validation.isString(type); - Validation.isInteger(age); + Validation.isString(type, 'type'); + Validation.isInteger(age, 'age'); return this.ageVerifications[type + age] || null; } @@ -118,7 +119,7 @@ class Profile extends BaseProfile { /** * Corresponds to the nationality in the passport. * - * @returns {Attribute|main} + * @returns {Attribute|null} */ getNationality() { return this.getAttribute(constants.ATTR_NATIONALITY); @@ -137,7 +138,7 @@ class Profile extends BaseProfile { /** * Photograph of user, encoded as a JPEG image. * - * @returns {Attribute|main} + * @returns {Attribute} */ getSelfie() { return this.getAttribute(constants.ATTR_SELFIE); @@ -188,7 +189,7 @@ class Profile extends BaseProfile { /** * Document details. * - * @returns {null|DocumentDetails} + * @returns {null|Attribute} */ getDocumentDetails() { return this.getAttribute(constants.ATTR_DOCUMENT_DETAILS); diff --git a/src/proto/messages/proto.attribute.list.js b/src/proto/messages/proto.attribute.list.js index 7ba7f573b..ae6908ee5 100644 --- a/src/proto/messages/proto.attribute.list.js +++ b/src/proto/messages/proto.attribute.list.js @@ -2,15 +2,23 @@ const { AttributeList } = require('../types'); +/** + * @typedef {import('../types').Attribute} Attribute + */ + module.exports = { /** * Decode all attributes. * - * @param {Buffer} binaryData + * @param {Uint8Array} binaryData + * + * @returns {{attributes: Attribute[]}} */ decodeAttributeList(binaryData) { - return AttributeList.decode(binaryData); + const { attributes } = /** @type {{attributes: Attribute[]}} */ ( + /** @type {*} */(AttributeList.decode(binaryData))); + return { attributes }; }, encodeAttributeList(attributesData) { diff --git a/src/proto/messages/proto.common.encrypted-data.js b/src/proto/messages/proto.common.encrypted-data.js index fba6105cf..19597176f 100644 --- a/src/proto/messages/proto.common.encrypted-data.js +++ b/src/proto/messages/proto.common.encrypted-data.js @@ -4,11 +4,17 @@ const { EncryptedData } = require('../types'); module.exports = { + /** + * @param {Uint8Array} binaryData + * @returns {{cipherText: string, iv: string}} + */ decodeEncryptedData(binaryData) { - const decodedData = EncryptedData.decode(binaryData); - decodedData.cipherText = decodedData.cipherText.toString('base64'); - decodedData.iv = decodedData.iv.toString('base64'); - return decodedData; + const decodedData = /** @type {{cipherText: Buffer, iv: Buffer}} */( + /** @type {*} */(EncryptedData.decode(binaryData))); + return { + cipherText: decodedData.cipherText.toString('base64'), + iv: decodedData.iv.toString('base64'), + }; }, encodeEncryptedData(notificationData) { diff --git a/src/proto/messages/proto.multi.value.js b/src/proto/messages/proto.multi.value.js index a55023d02..329ad6fbe 100644 --- a/src/proto/messages/proto.multi.value.js +++ b/src/proto/messages/proto.multi.value.js @@ -3,7 +3,13 @@ const { MultiValue } = require('../types'); module.exports = { + /** + * @typedef {{data: Buffer, contentType: number}} Value + * + * @param {Uint8Array} value + * @returns {{values: Value[]}} + */ decodeMultiValue(value) { - return MultiValue.decode(value); + return /** {{values: Value[]}} */ (/** @type {*} */(MultiValue.decode(value))); }, }; diff --git a/src/proto/messages/proto.share.extra-data.js b/src/proto/messages/proto.share.extra-data.js index 88ec56cbf..48468b2e7 100644 --- a/src/proto/messages/proto.share.extra-data.js +++ b/src/proto/messages/proto.share.extra-data.js @@ -3,7 +3,13 @@ const { ExtraData } = require('../types'); module.exports = { + /** + * @param {*} binaryData + * @returns {{list: Array}} + */ decodeExtraData(binaryData) { - return ExtraData.decode(Buffer.from(binaryData, 'base64')); + const { list } = /** @type {{list: Array}} */ ( + /** @type {*} */ (ExtraData.decode(Buffer.from(binaryData, 'base64')))); + return { list }; }, }; diff --git a/src/proto/messages/proto.share.third-party-attribute.js b/src/proto/messages/proto.share.third-party-attribute.js index 131691f6a..4c77224e3 100644 --- a/src/proto/messages/proto.share.third-party-attribute.js +++ b/src/proto/messages/proto.share.third-party-attribute.js @@ -3,7 +3,21 @@ const { ThirdPartyAttribute } = require('../types'); module.exports = { + + /** + * @typedef {Object} Definition + * @property {string} name + * + * @typedef {Object} IssuingAttributes + * @property {string} expiryDate + * @property {Definition[]} definitions + * + * @returns {{issuanceToken: Buffer, issuingAttributes:IssuingAttributes }} + */ decodeThirdPartyAttribute(binaryData) { - return ThirdPartyAttribute.decode(Buffer.from(binaryData, 'base64')); + // eslint-disable-next-line max-len + const { issuanceToken, issuingAttributes } = /** @type {{issuanceToken: Buffer, issuingAttributes:IssuingAttributes }} */( + /** @type {*} */(ThirdPartyAttribute.decode(Buffer.from(binaryData, 'base64')))); + return { issuanceToken, issuingAttributes }; }, }; diff --git a/src/proto/messages/proto.signed.timestamp.js b/src/proto/messages/proto.signed.timestamp.js index 0cca79ef9..f2512db87 100644 --- a/src/proto/messages/proto.signed.timestamp.js +++ b/src/proto/messages/proto.signed.timestamp.js @@ -3,9 +3,14 @@ const { SignedTimestamp } = require('../types'); module.exports = { - + /** + * @param {Uint8Array} binaryData + * @returns {{version: number, timestamp: number}} + */ decodeSignedTimeStamp(binaryData) { - return SignedTimestamp.decode(binaryData); + const { version, timestamp } = /** @type {{version: number, timestamp: number}} */ ( + /** @type {*} */(SignedTimestamp.decode(binaryData))); + return { version, timestamp }; }, encodeSignedTimeStamp(notificationData) { diff --git a/src/request/payload.js b/src/request/payload.js index e583e7776..48a239411 100644 --- a/src/request/payload.js +++ b/src/request/payload.js @@ -3,7 +3,7 @@ const FormData = require('form-data'); const { ContentType } = require('./constants'); -module.exports.Payload = class Payload { +class Payload { constructor(data, type = ContentType.JSON) { const supportedContentTypes = [ContentType.JSON, ContentType.FORM_DATA]; if (!supportedContentTypes.includes(type)) { @@ -18,10 +18,14 @@ module.exports.Payload = class Payload { formData.append(name, value, options); }); + /** @private */ this.contentType = ContentType.FORM_DATA; + /** @private */ this.data = formData; } else { + /** @private */ this.contentType = ContentType.JSON; + /** @private */ this.data = data; } } @@ -71,4 +75,8 @@ module.exports.Payload = class Payload { getRawData() { return this.data; } +} + +module.exports = { + Payload, }; diff --git a/src/request/request.builder.js b/src/request/request.builder.js index 395106e65..4212dd7fb 100644 --- a/src/request/request.builder.js +++ b/src/request/request.builder.js @@ -14,7 +14,7 @@ const SDK_IDENTIFIER = 'Node'; /** * Build a query string. * - * @param {Object.} queryParams + * @param {Object.} queryParams * * @returns {string} */ @@ -32,7 +32,9 @@ class RequestBuilder { * Set initial properties. */ constructor() { + /** @private */ this.headers = {}; + /** @private */ this.queryParams = {}; } @@ -132,7 +134,7 @@ class RequestBuilder { /** * @param {string} name - * @param {string} value + * @param {string|boolean|number} value * * @returns {RequestBuilder} */ @@ -144,7 +146,7 @@ class RequestBuilder { /** * Default request headers. * - * @param {*} messageSignature + * @param {string} messageSignature */ getDefaultHeaders(messageSignature) { const defaultHeaders = { diff --git a/src/request/request.handler.js b/src/request/request.handler.js index 9451dbd5c..feabdb11c 100644 --- a/src/request/request.handler.js +++ b/src/request/request.handler.js @@ -6,6 +6,7 @@ const yotiCommon = require('../yoti_common'); /** * Default HTTP request handler. + * @typedef {import('./request').YotiRequest} YotiRequest * * @param {YotiRequest} yotiRequest * @param {boolean} buffer Return the response as a Buffer. diff --git a/src/request/request.js b/src/request/request.js index 9a38ba749..815991d4c 100644 --- a/src/request/request.js +++ b/src/request/request.js @@ -17,17 +17,21 @@ class YotiRequest { if (SUPPORTED_METHODS.indexOf(method) === -1) { throw new Error(`HTTP method ${method} is not supported`); } + /** @private */ this.method = method; if (payload !== null) { Validation.instanceOf(payload, Payload, 'payload'); } + /** @private */ this.payload = payload; Validation.isString(url, 'url'); + /** @private */ this.url = url; Validation.hasOnlyStringValues(headers, 'headers'); + /** @private */ this.headers = headers; } diff --git a/src/request/response.js b/src/request/response.js index eec3f7a6b..dd20f0a31 100644 --- a/src/request/response.js +++ b/src/request/response.js @@ -6,16 +6,21 @@ class YotiResponse { /** * @param {*} parsedResponse - * @param {int} statusCode + * @param {number} statusCode * @param {Object|null} receipt * @param {Buffer|string|null} body - * @param {Array|null} headers + * @param {Object.|null} headers */ constructor(parsedResponse, statusCode, receipt = null, body = null, headers = null) { + /** @private */ this.parsedResponse = parsedResponse; + /** @private */ this.statusCode = statusCode; + /** @private */ this.receipt = receipt; + /** @private */ this.body = body; + /** @private */ this.headers = headers; } @@ -41,7 +46,7 @@ class YotiResponse { } /** - * @returns {int} Response status code. + * @returns {number} Response status code. */ getStatusCode() { return this.statusCode; diff --git a/src/yoti_common/anchor.processor.js b/src/yoti_common/anchor.processor.js index 838c36423..17e970709 100644 --- a/src/yoti_common/anchor.processor.js +++ b/src/yoti_common/anchor.processor.js @@ -7,6 +7,18 @@ const { YotiAnchor } = require('../data_type/anchor'); const { YotiSignedTimeStamp } = require('../data_type/signed.timestamp'); const { YotiDate } = require('../data_type/date'); +/** + * @typedef {object} Certificate - defined in forge, see X.509v3 RSA certificate (mocked here) + * @property {number} version + * @property {string} serialNumber + * @property {*[]} extensions + */ + +/** + * @typedef {{sources: [], verifiers: [], unknown: []}} AnchorsGroup + * + */ + /** * Mapping of anchor types. */ @@ -115,7 +127,10 @@ class AnchorProcessor { yotiSignedTimestamp, serverX509Certs ); - anchorsList = this.mergeAnchorsLists(anchorsList, certAnchors); + anchorsList = this.mergeAnchorsLists( + /** @type AnchorsGroup */(anchorsList), + /** @type AnchorsGroup */(certAnchors) + ); } return anchorsList; @@ -217,8 +232,7 @@ class AnchorProcessor { const anchorExtension = extensionsData[oidIndex]; const anchorEncodedValue = anchorExtension.value; // Convert Anchor value from ASN.1 format to an object - const extensionObj = forge.asn1.fromDer(anchorEncodedValue.toString('binary')); - return extensionObj; + return forge.asn1.fromDer(anchorEncodedValue.toString('binary')); } return null; } @@ -232,7 +246,7 @@ class AnchorProcessor { */ static processSignedTimeStamp(signedTimestampBuffer) { let version = 0; - let timestamp = 0; + let timestamp = new YotiDate(0); if (signedTimestampBuffer) { // eslint-disable-next-line max-len @@ -248,9 +262,9 @@ class AnchorProcessor { * * @deprecated no longer in use. * - * @param {Array} targetList - * @param {Array} sourceList - * @returns {Object.} + * @param {AnchorsGroup} targetList + * @param {AnchorsGroup} sourceList + * @returns {AnchorsGroup} */ static mergeAnchorsLists(targetList, sourceList) { this.getAnchorTypes().forEach((anchorType) => { diff --git a/src/yoti_common/converters/attribute.converter.js b/src/yoti_common/converters/attribute.converter.js index ecd48d3d5..a2dece65b 100644 --- a/src/yoti_common/converters/attribute.converter.js +++ b/src/yoti_common/converters/attribute.converter.js @@ -74,7 +74,7 @@ module.exports.AttributeConverter = class AttributeConverter { } static convertMultiValue(value) { - const protoMultiValue = messages.decodeMultiValue(value); + const protoMultiValue = /** @type {any} */ (messages.decodeMultiValue(value)); const items = []; protoMultiValue.values.forEach((item) => { items.push(AttributeConverter.convertValueBasedOnContentType( diff --git a/src/yoti_common/converters/data.entry.converter.js b/src/yoti_common/converters/data.entry.converter.js index 1fe99a6d9..398ce4e6b 100644 --- a/src/yoti_common/converters/data.entry.converter.js +++ b/src/yoti_common/converters/data.entry.converter.js @@ -4,7 +4,16 @@ const ThirdPartyAttributeConverter = require('./third.party.attribute.converter' const DATA_ENTRY_THIRD_PARTY_ATTRIBUTE = 6; +/** + * @typedef {import('./../../data_type/attribute.issuance.details')} AttributeIssuanceDetails + */ + class DataEntryConverter { + /** + * @param type + * @param value + * @returns {AttributeIssuanceDetails|undefined} + */ static convertValue(type, value) { if (!value) { console.log('No value supplied by data entry, skipping'); diff --git a/src/yoti_common/converters/extra.data.converter.js b/src/yoti_common/converters/extra.data.converter.js index ce5b8476c..cb27d7c82 100644 --- a/src/yoti_common/converters/extra.data.converter.js +++ b/src/yoti_common/converters/extra.data.converter.js @@ -3,11 +3,19 @@ const { messages } = require('../../proto'); const DataEntryConverter = require('./data.entry.converter'); +/** + * @typedef {import('./../../data_type/attribute.issuance.details')} AttributeIssuanceDetails + */ + class ExtraDataConverter { + /** + * @param {Buffer} extraDataBytes + * @returns {(AttributeIssuanceDetails|undefined)[]|undefined} + */ static convertExtraData(extraDataBytes) { let extraDataProto; try { - extraDataProto = messages.decodeExtraData(extraDataBytes); + extraDataProto = /** @type {any} */ (messages.decodeExtraData(extraDataBytes)); } catch (err) { console.log(`Failed to parse extra data: ${err}`); return undefined; diff --git a/src/yoti_common/converters/third.party.attribute.converter.js b/src/yoti_common/converters/third.party.attribute.converter.js index ea004b720..72173d690 100644 --- a/src/yoti_common/converters/third.party.attribute.converter.js +++ b/src/yoti_common/converters/third.party.attribute.converter.js @@ -22,6 +22,7 @@ class ThirdPartyAttributeConverter { } const issuingAttributes = thirdPartyProto.issuingAttributes; + let expiryDate; let attributes; diff --git a/src/yoti_common/index.js b/src/yoti_common/index.js index 3ec9005c2..add6eb5a1 100644 --- a/src/yoti_common/index.js +++ b/src/yoti_common/index.js @@ -7,6 +7,10 @@ const { messages } = require('../proto'); const { AttributeListConverter } = require('./converters/attribute.list.converter'); const ExtraDataConverter = require('./converters/extra.data.converter'); +/** + * @typedef {import('./../data_type/attribute.issuance.details')} AttributeIssuanceDetails + */ + // Request methods that can include payload data. const methodsThatIncludePayload = ['POST', 'PUT', 'PATCH']; @@ -83,14 +87,8 @@ function decryptProfileContent(profileContent, wrappedReceiptKey, pem) { * * @returns {boolean} */ -module.exports.requestCanSendPayload = (httpMethod) => { - // Check if the request method can send payload data - if (methodsThatIncludePayload.indexOf(httpMethod) === -1) { - return false; - } - - return true; -}; +// eslint-disable-next-line max-len +module.exports.requestCanSendPayload = (httpMethod) => methodsThatIncludePayload.indexOf(httpMethod) !== -1; /** * @param {string} message @@ -114,8 +112,7 @@ module.exports.getAuthKeyFromPem = (pem) => { const publicKey = forge.pki.setRsaPublicKey(privateKey.n, privateKey.e); const subjectPublicKeyInfo = forge.pki.publicKeyToAsn1(publicKey); const p12Der = forge.asn1.toDer(subjectPublicKeyInfo).getBytes(); - const p12b64 = forge.util.encode64(p12Der); - return p12b64; + return forge.util.encode64(p12Der); }; /** @@ -146,7 +143,7 @@ module.exports.decryptApplicationProfile = (receipt, pem) => decryptProfileConte * @param {Object} receipt * @param {string} pem * - * @returns {[]} + * @returns {(AttributeIssuanceDetails | undefined)[]} */ module.exports.parseExtraData = (receipt, pem) => { const extraDataNotEmpty = receipt.extra_data_content diff --git a/src/yoti_common/validation.js b/src/yoti_common/validation.js index bf1182531..91cd3505a 100644 --- a/src/yoti_common/validation.js +++ b/src/yoti_common/validation.js @@ -17,7 +17,7 @@ module.exports = class Validation { /** * @param {*} value * @param {string} name - * @param {bool} optional the value can be undefined + * @param {boolean} optional the value can be undefined * * @throws {TypeError} */ @@ -33,7 +33,7 @@ module.exports = class Validation { /** * @param {*} value * @param {string} name - * @param {bool} optional the value can be undefined + * @param {boolean} optional the value can be undefined * * @throws {TypeError} */ @@ -52,7 +52,7 @@ module.exports = class Validation { /** * @param {*} value * @param {string} name - * @param {bool} optional the value can be undefined + * @param {boolean} optional the value can be undefined * * @throws {TypeError} */ @@ -72,7 +72,7 @@ module.exports = class Validation { * @throws {TypeError} */ static hasOnlyStringValues(value, name) { - this.instanceOf(value, Object); + this.instanceOf(value, Object, 'value'); Object.keys(value).forEach((key) => { if ((typeof value[key]) !== 'string') { throw TypeError(`all values in ${name} must be a string`); @@ -95,7 +95,7 @@ module.exports = class Validation { /** * @param {*} value * @param {string} name - * @param {bool} optional the value can be undefined + * @param {boolean} optional the value can be undefined * * @throws {TypeError} */ diff --git a/tests/digital_identity_service/extension/third.party.attribute.extension.builder.spec.js b/tests/digital_identity_service/extension/third.party.attribute.extension.builder.spec.js index 928a2725b..d37ce7a25 100644 --- a/tests/digital_identity_service/extension/third.party.attribute.extension.builder.spec.js +++ b/tests/digital_identity_service/extension/third.party.attribute.extension.builder.spec.js @@ -24,7 +24,7 @@ describe('ThirdPartyAttributeExtensionBuilder', () => { const builder = new ThirdPartyAttributeExtensionBuilder() .withExpiryDate(new Date()); - expect(() => builder.withDefinitions(undefined)).toThrow(new TypeError('undefined must be instance of Object')); + expect(() => builder.withDefinitions(undefined)).toThrow(new TypeError('value must be instance of Object')); }); it('should fail for array of non-string definitions', () => { diff --git a/tests/dynamic_sharing_service/extension/third.party.attribute.extension.builder.spec.js b/tests/dynamic_sharing_service/extension/third.party.attribute.extension.builder.spec.js index 77c2c5307..a4da6bde9 100644 --- a/tests/dynamic_sharing_service/extension/third.party.attribute.extension.builder.spec.js +++ b/tests/dynamic_sharing_service/extension/third.party.attribute.extension.builder.spec.js @@ -22,7 +22,7 @@ describe('ThirdPartyAttributeExtensionBuilder', () => { const builder = new ThirdPartyAttributeExtensionBuilder() .withExpiryDate(new Date()); - expect(() => builder.withDefinitions(undefined)).toThrow(new TypeError('undefined must be instance of Object')); + expect(() => builder.withDefinitions(undefined)).toThrow(new TypeError('value must be instance of Object')); }); it('should fail for array of non-string definitions', () => { diff --git a/types/config/index.d.ts b/types/config/index.d.ts new file mode 100644 index 000000000..21bb7de1d --- /dev/null +++ b/types/config/index.d.ts @@ -0,0 +1,5 @@ +export const yoti: { + connectApi: string; + idvApi: string; + digitalIdentityApi: string; +}; diff --git a/types/config/yoti.d.ts b/types/config/yoti.d.ts new file mode 100644 index 000000000..7b06a1571 --- /dev/null +++ b/types/config/yoti.d.ts @@ -0,0 +1,3 @@ +export let connectApi: string; +export let idvApi: string; +export let digitalIdentityApi: string; diff --git a/types/index.d.ts b/types/index.d.ts new file mode 100644 index 000000000..0b9dfa54d --- /dev/null +++ b/types/index.d.ts @@ -0,0 +1,59 @@ +import { IDVService } from "./src/idv_service"; +import YotiCommon = require("./src/yoti_common"); +import { YotiRequest } from "./src/request/request"; +import IDVError = require("./src/idv_service/idv.error"); +import { YotiClient } from "./src/client"; +import { IDVClient } from "./src/client"; +import { DigitalIdentityClient } from "./src/client"; +import { IDVConstants } from "./src/idv_service"; +import { AmlAddress } from "./src/aml_type"; +import { AmlProfile } from "./src/aml_type"; +import { DigitalIdentityBuilders } from "./src/digital_identity_service"; +import { DynamicScenarioBuilder } from "./src/dynamic_sharing_service"; +import { DynamicPolicyBuilder } from "./src/dynamic_sharing_service"; +import { WantedAttributeBuilder } from "./src/dynamic_sharing_service"; +import { ExtensionBuilder } from "./src/dynamic_sharing_service"; +import { LocationConstraintExtensionBuilder } from "./src/dynamic_sharing_service"; +import { ThirdPartyAttributeExtensionBuilder } from "./src/dynamic_sharing_service"; +import { TransactionalFlowExtensionBuilder } from "./src/dynamic_sharing_service"; +import { WantedAnchorBuilder } from "./src/dynamic_sharing_service"; +import { ConstraintsBuilder } from "./src/dynamic_sharing_service"; +import { SourceConstraintBuilder } from "./src/dynamic_sharing_service"; +import { RequestBuilder } from "./src/request/request.builder"; +import { Payload } from "./src/request/payload"; +import { YotiDate } from "./src/data_type/date"; +import constants = require("./src/yoti_common/constants"); +import { SessionSpecificationBuilder } from "./src/idv_service"; +import { NotificationConfigBuilder } from "./src/idv_service"; +import { SdkConfigBuilder } from "./src/idv_service"; +import { RequestedDocumentAuthenticityCheckBuilder } from "./src/idv_service"; +import { RequestedIdDocumentComparisonCheckBuilder } from "./src/idv_service"; +import { RequestedThirdPartyIdentityCheckBuilder } from "./src/idv_service"; +import { RequestedWatchlistScreeningCheckBuilder } from "./src/idv_service"; +import { RequestedWatchlistAdvancedCaCheckBuilder } from "./src/idv_service"; +import { RequestedFaceMatchCheckBuilder } from "./src/idv_service"; +import { RequestedFaceComparisonCheckBuilder } from "./src/idv_service"; +import { RequestedLivenessCheckBuilder } from "./src/idv_service"; +import { RequestedTextExtractionTaskBuilder } from "./src/idv_service"; +import { RequestedSupplementaryDocTextExtractionTaskBuilder } from "./src/idv_service"; +import { RequiredIdDocumentBuilder } from "./src/idv_service"; +import { RequiredSupplementaryDocumentBuilder } from "./src/idv_service"; +import { DocumentRestrictionsFilterBuilder } from "./src/idv_service"; +import { DocumentRestrictionBuilder } from "./src/idv_service"; +import { OrthogonalRestrictionsFilterBuilder } from "./src/idv_service"; +import { ProofOfAddressObjectiveBuilder } from "./src/idv_service"; +import { RequestedCustomAccountWatchlistAdvancedCaConfigBuilder } from "./src/idv_service"; +import { RequestedYotiAccountWatchlistAdvancedCaConfigBuilder } from "./src/idv_service"; +import { RequestedExactMatchingStrategyBuilder } from "./src/idv_service"; +import { RequestedFuzzyMatchingStrategyBuilder } from "./src/idv_service"; +import { RequestedSearchProfileSourcesBuilder } from "./src/idv_service"; +import { RequestedTypeListSourcesBuilder } from "./src/idv_service"; +import { CreateFaceCaptureResourcePayloadBuilder } from "./src/idv_service"; +import { UploadFaceCaptureImagePayloadBuilder } from "./src/idv_service"; +export declare namespace internals { + export { IDVService }; + export { YotiCommon }; + export { YotiRequest }; + export { IDVError }; +} +export { YotiClient as Client, IDVClient, DigitalIdentityClient, IDVConstants, AmlAddress, AmlProfile, DigitalIdentityBuilders, DynamicScenarioBuilder, DynamicPolicyBuilder, WantedAttributeBuilder, ExtensionBuilder, LocationConstraintExtensionBuilder, ThirdPartyAttributeExtensionBuilder, TransactionalFlowExtensionBuilder, WantedAnchorBuilder, ConstraintsBuilder, SourceConstraintBuilder, RequestBuilder, Payload, YotiDate, constants, SessionSpecificationBuilder, NotificationConfigBuilder, SdkConfigBuilder, RequestedDocumentAuthenticityCheckBuilder, RequestedIdDocumentComparisonCheckBuilder, RequestedThirdPartyIdentityCheckBuilder, RequestedWatchlistScreeningCheckBuilder, RequestedWatchlistAdvancedCaCheckBuilder, RequestedFaceMatchCheckBuilder, RequestedFaceComparisonCheckBuilder, RequestedLivenessCheckBuilder, RequestedTextExtractionTaskBuilder, RequestedSupplementaryDocTextExtractionTaskBuilder, RequiredIdDocumentBuilder, RequiredSupplementaryDocumentBuilder, DocumentRestrictionsFilterBuilder, DocumentRestrictionBuilder, OrthogonalRestrictionsFilterBuilder, ProofOfAddressObjectiveBuilder, RequestedCustomAccountWatchlistAdvancedCaConfigBuilder, RequestedYotiAccountWatchlistAdvancedCaConfigBuilder, RequestedExactMatchingStrategyBuilder, RequestedFuzzyMatchingStrategyBuilder, RequestedSearchProfileSourcesBuilder, RequestedTypeListSourcesBuilder, CreateFaceCaptureResourcePayloadBuilder, UploadFaceCaptureImagePayloadBuilder }; diff --git a/types/src/aml_service/index.d.ts b/types/src/aml_service/index.d.ts new file mode 100644 index 000000000..ccac224de --- /dev/null +++ b/types/src/aml_service/index.d.ts @@ -0,0 +1,23 @@ +export function performAmlCheck(amlProfile: any, pem: any, sdkId: any): Promise; +/** + * Service Class to handle interactions with the aml API + * + * @class AmlService + */ +export class AmlService { + /** + * @param {string} sdkId + * @param {string|Buffer} pem + * @param {{apiUrl?: string}} options + */ + constructor(sdkId: string, pem: string | Buffer, { apiUrl }?: { + apiUrl?: string; + }); + /** @private */ + private sdkId; + /** @private */ + private pem; + /** @private */ + private apiUrl; + performAmlCheck(amlProfile: any): Promise; +} diff --git a/types/src/aml_type/aml.address.d.ts b/types/src/aml_type/aml.address.d.ts new file mode 100644 index 000000000..a323b2de3 --- /dev/null +++ b/types/src/aml_type/aml.address.d.ts @@ -0,0 +1,36 @@ +export class AmlAddress { + constructor(countryCode: any, postcode: any); + /** + * @param countryCode + */ + setCountryCode(countryCode: any): void; + countryCode: any; + /** + * @returns country + */ + getCountryCode(): any; + /** + * @param postcode + */ + setPostcode(postcode: any): void; + postcode: any; + /** + * @returns postcode + */ + getPostcode(): any; + /** + * @returns {{}} + */ + getData(): {}; + /** + * + * @deprecated Replaced by Validation.notNullOrEmpty() + */ + validateCountryCode(): void; + /** + * Returns a string representing the object. + * + * @returns {string} + */ + toString(): string; +} diff --git a/types/src/aml_type/aml.profile.d.ts b/types/src/aml_type/aml.profile.d.ts new file mode 100644 index 000000000..b78c0e803 --- /dev/null +++ b/types/src/aml_type/aml.profile.d.ts @@ -0,0 +1,57 @@ +export class AmlProfile { + /** + * Check if amlAddress is an object. + * + * @param amlAddress + */ + static validateAmlAddress(amlAddress: any): void; + constructor(givenNames: any, familyName: any, amlAddress: any, ssn: any); + /** + * @param givenNames + */ + setGivenNames(givenNames: any): void; + givenNames: any; + /** + * @returns {*} + */ + getGivenNames(): any; + /** + * @param familyName + */ + setFamilyName(familyName: any): void; + familyName: any; + /** + * @returns familyName + */ + getFamilyName(): any; + /** + * @param amlAddress + */ + setAmlAddress(amlAddress: any): void; + amlAddress: any; + /** + * @returns amlAddress + */ + getAmlAddress(): any; + /** + * @param ssn + */ + setSsn(ssn: any): void; + ssn: any; + /** + * @returns ssn + */ + getSsn(): any; + /** + * Get profile data. + * + * @returns {{}} + */ + getData(): {}; + /** + * Returns a string representing the object. + * + * @returns {string} + */ + toString(): string; +} diff --git a/types/src/aml_type/index.d.ts b/types/src/aml_type/index.d.ts new file mode 100644 index 000000000..fe1100f80 --- /dev/null +++ b/types/src/aml_type/index.d.ts @@ -0,0 +1,5 @@ +import AmlAddress_1 = require("./aml.address"); +import AmlAddress = AmlAddress_1.AmlAddress; +import AmlProfile_1 = require("./aml.profile"); +import AmlProfile = AmlProfile_1.AmlProfile; +export { AmlAddress, AmlProfile }; diff --git a/types/src/client/digital.identity.client.d.ts b/types/src/client/digital.identity.client.d.ts new file mode 100644 index 000000000..aa7c554de --- /dev/null +++ b/types/src/client/digital.identity.client.d.ts @@ -0,0 +1,55 @@ +export = DigitalIdentityClient; +declare class DigitalIdentityClient { + /** + * @param {string} sdkId + * @param {string|Buffer} pem + * @param {{apiUrl?: string}} options + */ + constructor(sdkId: string, pem: string | Buffer, { apiUrl }?: { + apiUrl?: string; + }); + /** @private */ + private digitalIdentityService; + /** + * @typedef {import('../digital_identity_service/share.session.configuration.js')} ShareSessionConfig + * + * @param {ShareSessionConfig} shareSessionConfig + * + * @typedef {import('../digital_identity_service/create.share.session.result.js')} CreateShareSessionResult + * + * @returns {Promise} + */ + createShareSession(shareSessionConfig: import("../digital_identity_service/share.session.configuration.js")): Promise; + /** + * @param {string} sessionId + * + * @typedef {import('../digital_identity_service/get.share.session.result.js')} GetShareSessionResult + * + * @returns {Promise} + */ + getShareSession(sessionId: string): Promise; + /** + * @param {string} sessionId + * + * @typedef {import('../digital_identity_service/create.share.qr.code.result.js')} CreateShareQrCodeResult + * + * @returns {Promise} + */ + createShareQrCode(sessionId: string): Promise; + /** + * @param {string} qrCodeId + * + * @typedef {import('../digital_identity_service/get.share.qr.code.result.js')} GetShareQrCodeResult + * + * @returns {Promise} + */ + getShareQrCode(qrCodeId: string): Promise; + /** + * @param {string} receiptId + * + * @typedef {import('../digital_identity_service/get.share.receipt.result.js')} GetShareReceiptResult + * + * @returns {Promise} + */ + getShareReceipt(receiptId: string): Promise; +} diff --git a/types/src/client/idv.client.d.ts b/types/src/client/idv.client.d.ts new file mode 100644 index 000000000..487e93ea2 --- /dev/null +++ b/types/src/client/idv.client.d.ts @@ -0,0 +1,118 @@ +export = IDVClient; +/** + * Client used for communication with the Yoti IDV service + * + * The {@code IDVClient} facilitates requests to the Yoti IDV service + * + * @class IDVClient + */ +declare class IDVClient { + /** + * @param {string} sdkId + * @param {string|Buffer} pem + * @param {{apiUrl?: string}} options + */ + constructor(sdkId: string, pem: string | Buffer, { apiUrl }?: { + apiUrl?: string; + }); + /** @private */ + private idvService; + /** + * Creates a IDV session using the supplied session specification + * + * @typedef {import('../idv_service/session/create/session.specification.js')} SessionSpecification + * + * @param {SessionSpecification} sessionSpecification + * + * @typedef {import('../idv_service/session/create/create.session.result')} CreateSessionResult + * + * @returns {Promise} + */ + createSession(sessionSpecification: import("../idv_service/session/create/session.specification.js")): Promise; + /** + * Retrieves the state of a previously created Yoti IDV session + * + * @param {string} sessionId + * + * @typedef {import('../idv_service/session/retrieve/get.session.result.js')} GetSessionResult + * + * @returns {Promise} + */ + getSession(sessionId: string): Promise; + /** + * Deletes a previously created Yoti IDV session and all + * of its related resources + * + * @param {string} sessionId + * + * @returns {Promise} + */ + deleteSession(sessionId: string): Promise; + /** + * Retrieves media related to a Yoti IDV session based + * on the supplied media ID + * + * @param {string} sessionId + * @param {string} mediaId + * + * @typedef {import('../data_type/media.js')} Media + * + * @returns {Promise} + */ + getMediaContent(sessionId: string, mediaId: string): Promise; + /** + * Deletes media related to a Yoti IDV session based + * on the supplied media ID + * + * @param {string} sessionId + * @param {string} mediaId + * + * @returns {Promise} + */ + deleteMediaContent(sessionId: string, mediaId: string): Promise; + /** + * Gets a list of supported documents. + * + * @param {boolean} includeNonLatin + * + * @typedef {import('../idv_service/support/supported.documents.response.js')} SupportedDocumentsResponse + * + * @returns {Promise} + */ + getSupportedDocuments(includeNonLatin: boolean): Promise; + /** + * Creates a face capture resource + * @param {string} sessionId + * + * @typedef {import('../idv_service/session/create/face_capture/create.face.capture.resource.payload.js')} CreateFaceCaptureResourcePayload + * + * @param {CreateFaceCaptureResourcePayload} createFaceCaptureResourcePayload + * + * @typedef {import('../idv_service/session/retrieve/create.face.capture.resource.response.js')} CreateFaceCaptureResourceResponse + * + * @returns {Promise} + */ + createFaceCaptureResource(sessionId: string, createFaceCaptureResourcePayload: import("../idv_service/session/create/face_capture/create.face.capture.resource.payload.js")): Promise; + /** + * Uploads a face capture image + * @param {string} sessionId + * @param {string} resourceId + * + * @typedef {import('../idv_service/session/create/face_capture/upload.face.capture.image.payload.js')} UploadFaceCaptureImagePayload + * + * @param {UploadFaceCaptureImagePayload} uploadFaceCaptureImagePayload + * + * @returns {Promise} + */ + uploadFaceCaptureImage(sessionId: string, resourceId: string, uploadFaceCaptureImagePayload: import("../idv_service/session/create/face_capture/upload.face.capture.image.payload.js")): Promise; + /** + * Fetches the configuration for the given sessionID. + * + * @param {string} sessionId + * + * @typedef {import('../idv_service/session/retrieve/configuration/session.configuration.response.js')} SessionConfigurationResponse + * + * @returns {Promise} + */ + getSessionConfiguration(sessionId: string): Promise; +} diff --git a/types/src/client/index.d.ts b/types/src/client/index.d.ts new file mode 100644 index 000000000..895522e71 --- /dev/null +++ b/types/src/client/index.d.ts @@ -0,0 +1,4 @@ +import YotiClient = require("./yoti.client"); +import IDVClient = require("./idv.client"); +import DigitalIdentityClient = require("./digital.identity.client"); +export { YotiClient, IDVClient, DigitalIdentityClient }; diff --git a/types/src/client/yoti.client.d.ts b/types/src/client/yoti.client.d.ts new file mode 100644 index 000000000..12cbc825f --- /dev/null +++ b/types/src/client/yoti.client.d.ts @@ -0,0 +1,59 @@ +export = YotiClient; +/** + * @class YotiClient + */ +declare class YotiClient { + /** + * @param {string} sdkId + * @param {string} pem + * @param {{apiUrl?: string}} options + */ + constructor(sdkId: string, pem: string, { apiUrl }?: { + apiUrl?: string; + }); + /** @private */ + private sdkId; + /** @private */ + private pem; + /** @private */ + private amlService; + /** @private */ + private profileService; + /** @private */ + private dynamicShareService; + /** + * Get the activity details for a token. Amongst others contains the user profile with + * the user's attributes you have selected in your application configuration. + * + * Note: encrypted tokens should only be used once. You should not invoke this method + * multiple times with the same token. + * + * @param {string} encryptedConnectToken + * Encrypted Yoti token (can be only decrypted with your application's private key). + * Note that this token must only be used once. + * + * @returns {Promise} Resolving ActivityDetails instance holding the user's attributes + */ + getActivityDetails(encryptedConnectToken: string): Promise; + /** + * Request an AML check for the given profile. + * + * @param amlProfile + * Details of the profile to search for when performing the AML check + * + * @returns {Promise} resolving AmlResult with the results of the check + */ + performAmlCheck(amlProfile: any): Promise; + /** + * Given a dynamic scenario, get a custom QR code denoted by the dynamic policy + * provided in the request. + * + * @typedef {import('./../dynamic_sharing_service/dynamic.scenario')} DynamicScenario + * @typedef {import('./../dynamic_sharing_service/share.url.result')} ShareUrlResult + * + * @param {DynamicScenario} dynamicScenario - defines the wanted attribute list + * + * @returns {Promise} + */ + createShareUrl(dynamicScenario: import("./../dynamic_sharing_service/dynamic.scenario")): Promise; +} diff --git a/types/src/data_type/age.verification.d.ts b/types/src/data_type/age.verification.d.ts new file mode 100644 index 000000000..b08842ee0 --- /dev/null +++ b/types/src/data_type/age.verification.d.ts @@ -0,0 +1,36 @@ +/** + * Based on an 'Age Verify/Condition' attribute name and value, provides behaviour specific + * to verifying someone's age. + * + * @class AgeVerification + */ +export class AgeVerification { + static isAttributeNameMatchingAgeVerification(name: any): any; + constructor(name: any, value: any); + /** @private */ + private checkType; + /** @private */ + private age; + /** @private */ + private result; + /** + * The type of age check performed, as specified on Yoti Hub. + * + * Among the possible values are 'age_over' and 'age_under'. + * + * @returns {string} + */ + getCheckType(): string; + /** + * The age that was that checked, as specified on Yoti Hub. + * + * @returns {number} + */ + getAge(): number; + /** + * Whether the profile passed the age check. + * + * @returns {boolean} + */ + getResult(): boolean; +} diff --git a/types/src/data_type/anchor.d.ts b/types/src/data_type/anchor.d.ts new file mode 100644 index 000000000..c98aa5254 --- /dev/null +++ b/types/src/data_type/anchor.d.ts @@ -0,0 +1,78 @@ +export type YotiSignedTimeStamp = import("./../data_type/signed.timestamp").YotiSignedTimeStamp; +/** + * @typedef {import("./../data_type/signed.timestamp").YotiSignedTimeStamp} YotiSignedTimeStamp + */ +/** + * A class to represent a Yoti anchor. Anchors are metadata associated + * to the attribute, which describe how an attribute has been provided + * to Yoti (SOURCE Anchor) and how it has been verified (VERIFIER Anchor). + * + * If an attribute has only one SOURCE Anchor with the value set to + * "USER_PROVIDED" and zero VERIFIER Anchors, then the attribute + * is a self-certified one. + * + * @class YotiAnchor + */ +export class YotiAnchor { + /** + * @param {string} type + * @param {string} value + * @param {string} subType + * @param {YotiSignedTimeStamp} signedTimeStamp + * @param {Object[]} originServerCerts + */ + constructor(type: string, value: string, subType: string, signedTimeStamp: YotiSignedTimeStamp, originServerCerts: any[]); + /** @private */ + private type; + /** @private */ + private value; + /** @private */ + private subType; + /** @private */ + private signedTimeStamp; + /** @private */ + private originServerCerts; + /** + * Gets the type of the given anchor + * + * @returns {string} + */ + getType(): string; + /** + * Gets the value of the given anchor. + * + * Among possible options for SOURCE are "USER_PROVIDED", "PASSPORT", + * "DRIVING_LICENCE", "NATIONAL_ID" and "PASSCARD" + * + * Among possible options for VERIFIER are "YOTI_ADMIN", "YOTI_IDENTITY", + * "YOTI_OTP", "PASSPORT_NFC_SIGNATURE", "ISSUING_AUTHORITY" and + * "ISSUING_AUTHORITY_PKI". + * + * @returns {string} + */ + getValue(): string; + /** + * SubType is an indicator of any specific processing method, or subcategory, + * pertaining to an artifact. + * + * Examples: + * - For a passport, this would be either "NFC" or "OCR". + * - For a national ID, this could be "AADHAAR" + * + * @returns {string} + */ + getSubType(): string; + /** + * Timestamp applied at the time of Anchor creation. + * + * @returns {YotiSignedTimeStamp} + */ + getSignedTimeStamp(): YotiSignedTimeStamp; + /** + * Certificate chain generated when this Anchor was created (attribute value was + * sourced or verified). Securely encodes the Anchor type and value. + * + * @returns {Object[]} + */ + getOriginServerCerts(): any[]; +} diff --git a/types/src/data_type/attribute.d.ts b/types/src/data_type/attribute.d.ts new file mode 100644 index 000000000..613e032c7 --- /dev/null +++ b/types/src/data_type/attribute.d.ts @@ -0,0 +1,69 @@ +export type YotiAnchor = import("./anchor").YotiAnchor; +/** + * @typedef {import("./anchor").YotiAnchor} YotiAnchor + */ +/** + * A class to represent a Yoti attribute. + * + * A Yoti attribute consists of the attribute name, an associated + * attribute value, and a list of Anchors from Yoti. + * + * It may hold one or more anchors, which specify how an attribute has been provided + * and how it has been verified within the Yoti platform. + */ +export class Attribute { + constructor(attrObj: any); + /** @private */ + private value; + /** @private */ + private name; + /** @private */ + private sources; + /** @private */ + private verifiers; + /** @private */ + private id; + /** @private */ + private anchors; + /** + * Retrieves the id of an attribute. It can be undefined. + * + * @returns {*} + */ + getId(): any; + /** + * Retrieves the value of an attribute. If this is null, the default value for + * the type is returned. + * + * @returns {*} + */ + getValue(): any; + /** + * Gets the name of the attribute. + * + * @returns {string} + */ + getName(): string; + /** + * Sources are a subset of the anchors associated with an attribute, where the + * anchor type is SOURCE. + * + * @returns {YotiAnchor[]} + */ + getSources(): YotiAnchor[]; + /** + * Verifiers are a subset of the anchors associated with an attribute, where the + * anchor type is VERIFIER. + * + * @returns {YotiAnchor[]} + */ + getVerifiers(): YotiAnchor[]; + /** + * Get the anchors for an attribute. If an attribute has only one SOURCE + * Anchor with the value set to "USER_PROVIDED" and zero VERIFIER Anchors, + * then the attribute is a self-certified one. + * + * @returns {YotiAnchor[]} + */ + getAnchors(): YotiAnchor[]; +} diff --git a/types/src/data_type/attribute.definition.d.ts b/types/src/data_type/attribute.definition.d.ts new file mode 100644 index 000000000..15c1addf0 --- /dev/null +++ b/types/src/data_type/attribute.definition.d.ts @@ -0,0 +1,10 @@ +export = AttributeDefinition; +declare class AttributeDefinition { + constructor(name: any); + /** @private */ + private name; + getName(): any; + toJSON(): { + name: any; + }; +} diff --git a/types/src/data_type/attribute.issuance.details.d.ts b/types/src/data_type/attribute.issuance.details.d.ts new file mode 100644 index 000000000..0111391b3 --- /dev/null +++ b/types/src/data_type/attribute.issuance.details.d.ts @@ -0,0 +1,19 @@ +export = AttributeIssuanceDetails; +declare class AttributeIssuanceDetails { + /** + * @param {string} token + * @param {Date} [expiryDate] + * @param {AttributeDefinition[]} [issuingAttributes] + */ + constructor(token: string, expiryDate?: Date, issuingAttributes?: AttributeDefinition[]); + /** @private */ + private token; + /** @private */ + private expiryDate; + /** @private */ + private issuingAttributes; + getToken(): string; + getExpiryDate(): Date; + getIssuingAttributes(): AttributeDefinition[]; +} +import AttributeDefinition = require("./attribute.definition"); diff --git a/types/src/data_type/date.d.ts b/types/src/data_type/date.d.ts new file mode 100644 index 000000000..f38537f53 --- /dev/null +++ b/types/src/data_type/date.d.ts @@ -0,0 +1,52 @@ +/** + * Date object with microsecond accuracy. + * + * @class YotiDate + */ +export class YotiDate extends Date { + /** + * @param {string} dateString + */ + static fromDateString(dateString: string): YotiDate; + /** + * @param {number} timestamp + */ + constructor(timestamp: number); + /** @private */ + private microseconds; + /** @private */ + private microsecondUnixTimestamp; + /** + * Returns a number, between 0 and 999999, representing the microseconds. + * + * @returns {number} + */ + getMicroseconds(): number; + /** + * Time with microseconds. + * + * @returns {string} + * Time in format `{HH}:{MM}:{SS}.{mmmmmm}` + */ + getMicrosecondTime(): string; + /** + * Returns ISO 8601 UTC date. + * + * @returns {string} + * Date in format `{YYYY}-{MM}-{DD}` + */ + toISODateString(): string; + /** + * Returns ISO 8601 UTC timestamp with microseconds. + * + * @returns {string} + * Timestamp in format `{YYYY}-{MM}-{DD}T{HH}:{MM}:{SS}.{mmmmmm}Z` + */ + getMicrosecondTimestamp(): string; + /** + * Returns Unix timestamp with microseconds. + * + * @returns {number} + */ + getMicrosecondUnixTimestamp(): number; +} diff --git a/types/src/data_type/document.details.d.ts b/types/src/data_type/document.details.d.ts new file mode 100644 index 000000000..117b92895 --- /dev/null +++ b/types/src/data_type/document.details.d.ts @@ -0,0 +1,46 @@ +export class DocumentDetails { + constructor(value: any); + /** + * @param {string} value + * + * @deprecated value is no longer validated using pattern. + */ + validateData(value: string): void; + parseFromValue(value: any): void; + type: any; + issuingCountry: any; + documentNumber: any; + expirationDate: Date; + issuingAuthority: any; + /** + * Type of the document e.g. PASSPORT | DRIVING_LICENCE | NATIONAL_ID | PASS_CARD + * + * @returns {string} + */ + getType(): string; + /** + * ISO-3166-1 alpha-3 country code, e.g. “GBR“ + * + * @returns {string} + */ + getIssuingCountry(): string; + /** + * Document number (may include letters) from the document. + * + * @returns {string} + */ + getDocumentNumber(): string; + /** + * Expiration date of the document in Date format. If the document does not expire, this + * field will not be present. The time part of this Date will default to 00:00:00. + * + * @returns {Date|null|undefined} + */ + getExpirationDate(): Date | null | undefined; + /** + * Can either be a country code (for a state), or the name of the issuing authority. + * + * @returns {string|undefined} + */ + getIssuingAuthority(): string | undefined; +} diff --git a/types/src/data_type/image.d.ts b/types/src/data_type/image.d.ts new file mode 100644 index 000000000..2e0609c71 --- /dev/null +++ b/types/src/data_type/image.d.ts @@ -0,0 +1,7 @@ +export = Image; +/** + * Abstract Image class. + */ +declare class Image extends Media { +} +import Media = require("./media"); diff --git a/types/src/data_type/image.jpeg.d.ts b/types/src/data_type/image.jpeg.d.ts new file mode 100644 index 000000000..36fea212e --- /dev/null +++ b/types/src/data_type/image.jpeg.d.ts @@ -0,0 +1,5 @@ +export = ImageJpeg; +declare class ImageJpeg extends Image { + constructor(value: any); +} +import Image = require("./image"); diff --git a/types/src/data_type/image.png.d.ts b/types/src/data_type/image.png.d.ts new file mode 100644 index 000000000..42d134c96 --- /dev/null +++ b/types/src/data_type/image.png.d.ts @@ -0,0 +1,5 @@ +export = ImagePng; +declare class ImagePng extends Image { + constructor(value: any); +} +import Image = require("./image"); diff --git a/types/src/data_type/media.d.ts b/types/src/data_type/media.d.ts new file mode 100644 index 000000000..7ddb7de44 --- /dev/null +++ b/types/src/data_type/media.d.ts @@ -0,0 +1,30 @@ +export = Media; +declare class Media { + /** + * @param {Buffer} content + * @param {string} mimeType + */ + constructor(content: Buffer, mimeType: string); + /** @private */ + private content; + /** @private */ + private mimeType; + /** + * Get the raw image content. + * + * @returns {Buffer} + */ + getContent(): Buffer; + /** + * Get the base64 image content. + * + * @returns {string} + */ + getBase64Content(): string; + /** + * Get the image mime type. + * + * @returns {string} + */ + getMimeType(): string; +} diff --git a/types/src/data_type/multi.value.d.ts b/types/src/data_type/multi.value.d.ts new file mode 100644 index 000000000..2cb9b6ca8 --- /dev/null +++ b/types/src/data_type/multi.value.d.ts @@ -0,0 +1,57 @@ +export = MultiValue; +declare class MultiValue { + /** + * MultiValue constructor. + * + * @param {array} items + */ + constructor(items: any[]); + /** @private */ + private originalItems; + /** @private */ + private items; + /** @private */ + private allowedInstances; + /** @private */ + private allowedTypes; + /** + * Allow values by their instance type. + * + * @param {*} type + * + * @returns {MultiValue} + */ + allowInstance(type: any): MultiValue; + /** + * Allow values by their constructor name. + * + * @param {String} type + * + * @returns {MultiValue} + */ + allowType(type: string): MultiValue; + /** + * Apply all filters. + */ + applyFilters(): void; + /** + * Check if this MultiValue has been filtered. + */ + hasFilters(): boolean; + /** + * Check instance. + * + * @param {*} value + */ + isAllowedInstance(value: any): boolean; + /** + * Check constructor name (class). + * + * @param {*} value + */ + isAllowedType(value: any): boolean; + /** + * @returns {Readonly} List of filtered items. + */ + getItems(): Readonly; +} diff --git a/types/src/data_type/signed.timestamp.d.ts b/types/src/data_type/signed.timestamp.d.ts new file mode 100644 index 000000000..a6255d52d --- /dev/null +++ b/types/src/data_type/signed.timestamp.d.ts @@ -0,0 +1,30 @@ +/** + * SignedTimestamp is a timestamp associated with a message that has a + * cryptographic signature proving that it was issued by the correct authority. + * + * @class YotiSignedTimeStamp + */ +export class YotiSignedTimeStamp { + /** + * @param {number} version + * @param {YotiDate} timestamp + */ + constructor(version: number, timestamp: YotiDate); + /** @private */ + private version; + /** @private */ + private timestamp; + /** + * Version indicates how the digests within this object are calculated. + * + * @returns {number} + */ + getVersion(): number; + /** + * The actual timestamp with microsecond-level accuracy. + * + * @returns {YotiDate} + */ + getTimestamp(): YotiDate; +} +import { YotiDate } from "./date"; diff --git a/types/src/digital_identity_service/create.share.qr.code.result.d.ts b/types/src/digital_identity_service/create.share.qr.code.result.d.ts new file mode 100644 index 000000000..5d8233cf4 --- /dev/null +++ b/types/src/digital_identity_service/create.share.qr.code.result.d.ts @@ -0,0 +1,23 @@ +export = CreateShareQrCodeResult; +declare class CreateShareQrCodeResult { + /** + * @param {Object} response + */ + constructor(response: any); + /** @private */ + private id; + /** @private */ + private uri; + /** + * The QR code ID + * + * @returns {string} The QR code ID + */ + getId(): string; + /** + * The URI + * + * @returns {string} The URI + */ + getUri(): string; +} diff --git a/types/src/digital_identity_service/create.share.session.result.d.ts b/types/src/digital_identity_service/create.share.session.result.d.ts new file mode 100644 index 000000000..59e82bb01 --- /dev/null +++ b/types/src/digital_identity_service/create.share.session.result.d.ts @@ -0,0 +1,31 @@ +export = CreateShareSessionResult; +declare class CreateShareSessionResult { + /** + * @param {Object} response + */ + constructor(response: any); + /** @private */ + private id; + /** @private */ + private status; + /** @private */ + private expiry; + /** + * The share id + * + * @returns {string} The share id + */ + getId(): string; + /** + * The session status + * + * @returns {string} The session status + */ + getStatus(): string; + /** + * The session expiry date + * + * @returns {Date} The session expiry date + */ + getExpiry(): Date; +} diff --git a/types/src/digital_identity_service/digital.identity.service.error.d.ts b/types/src/digital_identity_service/digital.identity.service.error.d.ts new file mode 100644 index 000000000..048fd5533 --- /dev/null +++ b/types/src/digital_identity_service/digital.identity.service.error.d.ts @@ -0,0 +1,24 @@ +export = DigitalIdentityServiceError; +/** + * Signals that a problem occurred in a Yoti Digital Identity Service + * + * @class DigitalIdentityServiceError + */ +declare class DigitalIdentityServiceError extends Error { + constructor(error: any); + status: number; + code: string | number; + reason: string; +} +declare namespace DigitalIdentityServiceError { + export { ResponseBody, Response }; +} +type ResponseBody = { + message?: string; + error?: string; +}; +type Response = { + status: number; + text: string; + body?: ResponseBody; +}; diff --git a/types/src/digital_identity_service/extension/device.location.d.ts b/types/src/digital_identity_service/extension/device.location.d.ts new file mode 100644 index 000000000..4bd27f873 --- /dev/null +++ b/types/src/digital_identity_service/extension/device.location.d.ts @@ -0,0 +1,45 @@ +export = DeviceLocation; +/** + * Defines a device location. + * + * @class DeviceLocation + */ +declare class DeviceLocation { + /** + * @param {Number} latitude + * @param {Number} longitude + * @param {Number} radius + * @param {Number} maxUncertainty + */ + constructor(latitude: number, longitude: number, radius?: number, maxUncertainty?: number); + /** @private */ + private latitude; + /** @private */ + private longitude; + /** @private */ + private radius; + /** @private */ + private maxUncertainty; + /** + * @returns {Number} Latitude of the user's expected location + */ + getLatitude(): number; + /** + * @returns {Number} Longitude of the user's expected location + */ + getLongitude(): number; + /** + * @returns {Number} Radius of the circle, centred on the specified location + * coordinates, where the device is allowed to perform the share + */ + getRadius(): number; + /** + * @returns {Number} Maximum acceptable distance, in metres, of the area of + * uncertainty associated with the device location coordinates. + */ + getMaxUncertainty(): number; + /** + * @returns {Object} data for JSON.stringify() + */ + toJSON(): any; +} diff --git a/types/src/digital_identity_service/extension/extension.builder.d.ts b/types/src/digital_identity_service/extension/extension.builder.d.ts new file mode 100644 index 000000000..89709ea74 --- /dev/null +++ b/types/src/digital_identity_service/extension/extension.builder.d.ts @@ -0,0 +1,18 @@ +export = ExtensionBuilder; +declare class ExtensionBuilder { + /** + * @param {string} type + */ + withType(type: string): this; + type: string; + /** + * @param {*} content + */ + withContent(content: any): this; + content: any; + /** + * @returns {Extension} + */ + build(): Extension; +} +import Extension = require("./extension"); diff --git a/types/src/digital_identity_service/extension/extension.d.ts b/types/src/digital_identity_service/extension/extension.d.ts new file mode 100644 index 000000000..e3f590a88 --- /dev/null +++ b/types/src/digital_identity_service/extension/extension.d.ts @@ -0,0 +1,27 @@ +export = Extension; +declare class Extension { + /** + * @param {string} type + * @param {*} content + */ + constructor(type: string, content: any); + /** @private */ + private type; + /** @private */ + private content; + /** + * @returns {string} type + */ + getType(): string; + /** + * @returns {*} content + */ + getContent(): any; + /** + * Returns serialized data for JSON.stringify() + */ + toJSON(): { + type: string; + content: any; + }; +} diff --git a/types/src/digital_identity_service/extension/location.constraint.extension.builder.d.ts b/types/src/digital_identity_service/extension/location.constraint.extension.builder.d.ts new file mode 100644 index 000000000..1914be73e --- /dev/null +++ b/types/src/digital_identity_service/extension/location.constraint.extension.builder.d.ts @@ -0,0 +1,50 @@ +export = LocationConstraintExtensionBuilder; +declare class LocationConstraintExtensionBuilder { + /** + * Allows you to specify the Latitude of the user's expected location + * + * @param {Number} latitude + * + * @returns {LocationConstraintExtensionBuilder} + */ + withLatitude(latitude: number): LocationConstraintExtensionBuilder; + latitude: number; + /** + * Allows you to specify the Longitude of the user's expected location + * + * @param {Number} longitude + * + * @returns {LocationConstraintExtensionBuilder} + */ + withLongitude(longitude: number): LocationConstraintExtensionBuilder; + longitude: number; + /** + * Radius of the circle, centred on the specified location coordinates, where the device is + * allowed to perform the share. + * + * If not provided, a default value of 150m will be used. + * + * @param {Number} radius The allowable distance, in metres, from the given lat/long location + * + * @returns {LocationConstraintExtensionBuilder} + */ + withRadius(radius: number): LocationConstraintExtensionBuilder; + radius: number; + /** + * Maximum acceptable distance, in metres, of the area of uncertainty associated with the device + * location coordinates. + * + * If not provided, a default value of 150m will be used. + * + * @param {Number} maxUncertainty Maximum allowed measurement uncertainty, in metres + * + * @returns {LocationConstraintExtensionBuilder} + */ + withMaxUncertainty(maxUncertainty: number): LocationConstraintExtensionBuilder; + maxUncertainty: number; + /** + * @returns {Extension} Extension with LocationConstraintExtensionContent content + */ + build(): Extension; +} +import Extension = require("./extension"); diff --git a/types/src/digital_identity_service/extension/location.constraint.extension.content.d.ts b/types/src/digital_identity_service/extension/location.constraint.extension.content.d.ts new file mode 100644 index 000000000..6d88051ba --- /dev/null +++ b/types/src/digital_identity_service/extension/location.constraint.extension.content.d.ts @@ -0,0 +1,17 @@ +export = LocationConstraintContent; +declare class LocationConstraintContent { + constructor(latitude: any, longitude: any, radius: any, maxUncertainty: any); + /** @private */ + private expectedDeviceLocation; + /** + * @returns {DeviceLocation} + */ + getExpectedDeviceLocation(): DeviceLocation; + /** + * Returns serialized data for JSON.stringify() + */ + toJSON(): { + expected_device_location: DeviceLocation; + }; +} +import DeviceLocation = require("./device.location"); diff --git a/types/src/digital_identity_service/extension/third.party.attribute.extension.builder.d.ts b/types/src/digital_identity_service/extension/third.party.attribute.extension.builder.d.ts new file mode 100644 index 000000000..47108c640 --- /dev/null +++ b/types/src/digital_identity_service/extension/third.party.attribute.extension.builder.d.ts @@ -0,0 +1,16 @@ +export = ThirdPartyAttributeExtensionBuilder; +/** + * Builds a third party attribute Extension. + * + * @class ThirdPartyAttributeExtensionBuilder + */ +declare class ThirdPartyAttributeExtensionBuilder { + /** @private */ + private definitions; + withExpiryDate(expiryDate: any): this; + expiryDate: any; + withDefinition(definition: any): this; + withDefinitions(definitions: any): this; + build(): Extension; +} +import Extension = require("./extension"); diff --git a/types/src/digital_identity_service/extension/third.party.attribute.extension.content.d.ts b/types/src/digital_identity_service/extension/third.party.attribute.extension.content.d.ts new file mode 100644 index 000000000..7f2676771 --- /dev/null +++ b/types/src/digital_identity_service/extension/third.party.attribute.extension.content.d.ts @@ -0,0 +1,22 @@ +export = ThirdPartyAttributeExtensionContent; +/** + * Defines third party attribute extension content. + * + * @class ThirdPartyAttributeExtensionContent + */ +declare class ThirdPartyAttributeExtensionContent { + constructor(expiryDate: any, definitions: any); + /** @private */ + private expiryDate; + /** @private */ + private definitions; + getExpiryDate(): any; + getDefinitions(): any; + /** + * Returns serialized data for JSON.stringify() + */ + toJSON(): { + expiry_date: any; + definitions: any; + }; +} diff --git a/types/src/digital_identity_service/extension/transactional.flow.extension.builder.d.ts b/types/src/digital_identity_service/extension/transactional.flow.extension.builder.d.ts new file mode 100644 index 000000000..10ec514eb --- /dev/null +++ b/types/src/digital_identity_service/extension/transactional.flow.extension.builder.d.ts @@ -0,0 +1,16 @@ +export = TransactionalFlowExtensionBuilder; +declare class TransactionalFlowExtensionBuilder { + /** + * Allows you to provide a non-null object representing the content to be submitted + * in the TRANSACTIONAL_FLOW extension. + * + * @param {Object} content + */ + withContent(content: any): this; + content: any; + /** + * @returns {Extension} Extension with TRANSACTIONAL_FLOW type + */ + build(): Extension; +} +import Extension = require("./extension"); diff --git a/types/src/digital_identity_service/get.share.qr.code.result.d.ts b/types/src/digital_identity_service/get.share.qr.code.result.d.ts new file mode 100644 index 000000000..c067a63f5 --- /dev/null +++ b/types/src/digital_identity_service/get.share.qr.code.result.d.ts @@ -0,0 +1,39 @@ +export = GetShareQrCodeResult; +declare class GetShareQrCodeResult { + /** + * @param {Object} response + */ + constructor(response: any); + /** @private */ + private id; + /** @private */ + private expiry; + /** @private */ + private sessionId; + /** @private */ + private redirectUri; + /** + * The QR code ID + * + * @returns {string} The QR code ID + */ + getId(): string; + /** + * The expiry + * + * @returns {Date} The expiry + */ + getExpiry(): Date; + /** + * The session ID + * + * @returns {string} The session ID + */ + getSessionId(): string; + /** + * The redirect uri + * + * @returns {string} The redirect uri + */ + getRedirectUri(): string; +} diff --git a/types/src/digital_identity_service/get.share.receipt.result.d.ts b/types/src/digital_identity_service/get.share.receipt.result.d.ts new file mode 100644 index 000000000..4c2657118 --- /dev/null +++ b/types/src/digital_identity_service/get.share.receipt.result.d.ts @@ -0,0 +1,100 @@ +export = GetShareReceiptResult; +declare class GetShareReceiptResult { + /** + * @param {import ('./receipts/receipt.response')} receiptResponse + * Parsed ReceiptResponse. + * @param {UserContent} userContent + * The user content, including profile and extra data + * @param {ApplicationContent} applicationContent + * The application content, including profile and extra data + */ + constructor(receiptResponse: import('./receipts/receipt.response'), userContent?: UserContent, applicationContent?: ApplicationContent); + /** @private */ + private sessionId; + /** @private */ + private rememberMeId; + /** @private */ + private parentRememberMeId; + /** @private */ + private timestamp; + /** @private */ + private error; + /** @private */ + private id; + /** @private */ + private userContent; + /** @private */ + private applicationContent; + /** + * Returns the ID of the Session that the receipt belongs to. + * + * @returns {string} + */ + getSessionId(): string; + /** + * Return the Remember Me ID, which is a unique, stable identifier for + * a user in the context of an application. + * + * You can use it to identify returning users. This value will be different + * for the same user in different applications. + * + * @returns {string} + */ + getRememberMeId(): string; + /** + * Return the Parent Remember Me ID, which is a unique, stable identifier for a + * user in the context of an organisation. + * + * You can use it to identify returning users. This value is consistent for a + * given user across different applications belonging to a single organisation. + * + * @returns {string} + */ + getParentRememberMeId(): string; + /** + * Receipt ID identifying a completed activity. + * + * @returns {string} + */ + getReceiptId(): string; + /** + * Time and date of the sharing activity + * + * @returns {Date} + */ + getTimestamp(): Date; + /** + * The user profile with shared attributes and anchor information, returned + * by Yoti if the request was successful. + * + * @returns {import('./receipts/user.profile')} + */ + getProfile(): import('./receipts/user.profile'); + /** + * Extra data associated with the user content + * + * @typedef {import('./receipts/extra.data')} ExtraData + * @returns {ExtraData} + */ + getExtraData(): import("./receipts/extra.data"); + /** + * The user content (profile + extraData) + * + * @returns {UserContent} + */ + getUserContent(): UserContent; + /** + * The application content (profile + extraData) + * + * @returns {ApplicationContent} + */ + getApplicationContent(): ApplicationContent; + /** + * Error code of receipt + * + * @returns {string} + */ + getError(): string; +} +import UserContent = require("./receipts/user.content"); +import ApplicationContent = require("./receipts/application.content"); diff --git a/types/src/digital_identity_service/get.share.session.result.d.ts b/types/src/digital_identity_service/get.share.session.result.d.ts new file mode 100644 index 000000000..4de4df388 --- /dev/null +++ b/types/src/digital_identity_service/get.share.session.result.d.ts @@ -0,0 +1,63 @@ +export = GetShareSessionResult; +declare class GetShareSessionResult { + /** + * @param {Object} response + */ + constructor(response: any); + /** @private */ + private id; + /** @private */ + private status; + /** @private */ + private created; + /** @private */ + private updated; + /** @private */ + private expiry; + /** @private */ + private scannedQrCodeId; + /** @private */ + private receiptId; + /** + * The share id + * + * @returns {string} The share id + */ + getId(): string; + /** + * The session status + * + * @returns {string} The session status + */ + getStatus(): string; + /** + * The session expiry date + * + * @returns {Date} The session expiry date + */ + getExpiry(): Date; + /** + * The session updated date + * + * @returns {Date} The session updated date + */ + getUpdated(): Date; + /** + * The session created date + * + * @returns {Date} The session created date + */ + getCreated(): Date; + /** + * The session qr code id + * + * @returns {string} The session qr code id + */ + getScannedQrCodeId(): string; + /** + * The session receipt id + * + * @returns {string} The session receipt id + */ + getReceiptId(): string; +} diff --git a/types/src/digital_identity_service/index.d.ts b/types/src/digital_identity_service/index.d.ts new file mode 100644 index 000000000..def6f131c --- /dev/null +++ b/types/src/digital_identity_service/index.d.ts @@ -0,0 +1,90 @@ +/** + * Defines the Digital Identity Service. + * + * @class DigitalIdentityService + */ +export class DigitalIdentityService { + constructor(sdkId: any, pem: any, { apiUrl }?: { + apiUrl?: string; + }); + /** @private */ + private sdkId; + /** @private */ + private pem; + /** @private */ + private apiUrl; + /** + * @param {ShareSessionConfiguration} shareSessionConfig + * + * @returns {Promise} + */ + createShareSession(shareSessionConfig: ShareSessionConfiguration): Promise; + /** + * @param {string} sessionId + * + * @returns {Promise} + */ + getShareSession(sessionId: string): Promise; + /** + * + * @param {string} sessionId + * @returns {Promise} + */ + createShareQrCode(sessionId: string): Promise; + /** + * + * @param {string} qrCodeId + * @returns {Promise} + */ + getShareQrCode(qrCodeId: string): Promise; + /** + * + * @param {string} receiptId + * @returns {Promise} + */ + fetchReceipt(receiptId: string): Promise; + /** + * + * @param {string} receiptItemKeyId + * @returns {Promise} + */ + fetchReceiptItemKey(receiptItemKeyId: string): Promise; + /** + * + * @param {string} receiptId + * @returns {Promise} + */ + getShareReceipt(receiptId: string): Promise; +} +import LocationConstraintExtensionBuilder = require("./extension/location.constraint.extension.builder"); +import TransactionalFlowExtensionBuilder = require("./extension/transactional.flow.extension.builder"); +import ThirdPartyAttributeExtensionBuilder = require("./extension/third.party.attribute.extension.builder"); +import ExtensionBuilder = require("./extension/extension.builder"); +import WantedAnchorBuilder = require("./policy/wanted.anchor.builder"); +import SourceConstraintBuilder = require("./policy/source.constraint.builder"); +import ConstraintsBuilder = require("./policy/constraints.builder"); +import WantedAttributeBuilder = require("./policy/wanted.attribute.builder"); +import PolicyBuilder = require("./policy/policy.builder"); +import ShareSessionConfigurationBuilder = require("./share.session.configuration.builder"); +import ShareSessionNotificationBuilder = require("./share.session.notification.builder"); +import ShareSessionConfiguration = require("./share.session.configuration"); +import CreateShareSessionResult = require("./create.share.session.result"); +import GetShareSessionResult = require("./get.share.session.result"); +import CreateShareQrCodeResult = require("./create.share.qr.code.result"); +import GetShareQrCodeResult = require("./get.share.qr.code.result"); +import ReceiptResponse = require("./receipts/receipt.response"); +import ReceiptItemKeyResponse = require("./receipts/receipt.item.key.response"); +import GetShareReceiptResult = require("./get.share.receipt.result"); +export declare namespace DigitalIdentityBuilders { + export { LocationConstraintExtensionBuilder }; + export { TransactionalFlowExtensionBuilder }; + export { ThirdPartyAttributeExtensionBuilder }; + export { ExtensionBuilder }; + export { WantedAnchorBuilder }; + export { SourceConstraintBuilder }; + export { ConstraintsBuilder }; + export { WantedAttributeBuilder }; + export { PolicyBuilder }; + export { ShareSessionConfigurationBuilder }; + export { ShareSessionNotificationBuilder }; +} diff --git a/types/src/digital_identity_service/policy/constraints.builder.d.ts b/types/src/digital_identity_service/policy/constraints.builder.d.ts new file mode 100644 index 000000000..4d674f51c --- /dev/null +++ b/types/src/digital_identity_service/policy/constraints.builder.d.ts @@ -0,0 +1,16 @@ +export = ConstraintsBuilder; +declare class ConstraintsBuilder { + /** @private */ + private constraints; + /** + * @param {SourceConstraint} sourceConstraint + * @returns this + */ + withSourceConstraint(sourceConstraint: SourceConstraint): this; + /** + * @returns {Constraints} + */ + build(): Constraints; +} +import SourceConstraint = require("./source.constraint"); +import Constraints = require("./constraints"); diff --git a/types/src/digital_identity_service/policy/constraints.d.ts b/types/src/digital_identity_service/policy/constraints.d.ts new file mode 100644 index 000000000..5243a5ee6 --- /dev/null +++ b/types/src/digital_identity_service/policy/constraints.d.ts @@ -0,0 +1,13 @@ +export = Constraints; +declare class Constraints { + /** + * Set default properties. + */ + constructor(constraints: any); + /** @private */ + private constraints; + /** + * Returns serialized data for JSON.stringify() + */ + toJSON(): any; +} diff --git a/types/src/digital_identity_service/policy/policy.builder.d.ts b/types/src/digital_identity_service/policy/policy.builder.d.ts new file mode 100644 index 000000000..18b0ccef8 --- /dev/null +++ b/types/src/digital_identity_service/policy/policy.builder.d.ts @@ -0,0 +1,156 @@ +export = PolicyBuilder; +declare class PolicyBuilder { + /** @private */ + private wantedAttributes; + /** @private */ + private wantedAuthTypes; + /** + * @param {WantedAttribute} wantedAttribute + * @returns this + */ + withWantedAttribute(wantedAttribute: WantedAttribute): this; + /** + * @param {string} name + * @param {Constraints} [constraints] + * @param {boolean} [acceptSelfAsserted] + * @returns this + */ + withWantedAttributeByName(name: string, constraints?: Constraints, acceptSelfAsserted?: boolean): this; + /** + * @param {Constraints} [constraints] + * @param {boolean} [acceptSelfAsserted] + * @returns this + */ + withFamilyName(constraints?: Constraints, acceptSelfAsserted?: boolean): this; + /** + * @param {Constraints} [constraints] + * @param {boolean} [acceptSelfAsserted] + * @returns this + */ + withGivenNames(constraints?: Constraints, acceptSelfAsserted?: boolean): this; + /** + * @param {Constraints} [constraints] + * @param {boolean} [acceptSelfAsserted] + * @returns this + */ + withFullName(constraints?: Constraints, acceptSelfAsserted?: boolean): this; + /** + * @param {Constraints} [constraints] + * @param {boolean} [acceptSelfAsserted] + * @returns this + */ + withDateOfBirth(constraints?: Constraints, acceptSelfAsserted?: boolean): this; + /** + * @param {number} age + * @param {Constraints} [constraints] + * @param {boolean} [acceptSelfAsserted] + * @returns this + */ + withAgeOver(age: number, constraints?: Constraints, acceptSelfAsserted?: boolean): this; + /** + * @param {number} age + * @param {Constraints} [constraints] + * @param {boolean} [acceptSelfAsserted] + * @returns this + */ + withAgeUnder(age: number, constraints?: Constraints, acceptSelfAsserted?: boolean): this; + /** + * @param {string} derivation + * @param {Constraints} [constraints] + * @param {boolean} [acceptSelfAsserted] + * @returns this + */ + withAgeDerivedAttribute(derivation: string, constraints?: Constraints, acceptSelfAsserted?: boolean): this; + /** + * @param {Constraints} [constraints] + * @param {boolean} [acceptSelfAsserted] + * @returns this + */ + withGender(constraints?: Constraints, acceptSelfAsserted?: boolean): this; + /** + * @param {Constraints} [constraints] + * @param {boolean} [acceptSelfAsserted] + * @returns this + */ + withPostalAddress(constraints?: Constraints, acceptSelfAsserted?: boolean): this; + /** + * @param {Constraints} [constraints] + * @param {boolean} [acceptSelfAsserted] + * @returns this + */ + withStructuredPostalAddress(constraints?: Constraints, acceptSelfAsserted?: boolean): this; + /** + * @param {Constraints} [constraints] + * @param {boolean} [acceptSelfAsserted] + * @returns this + */ + withNationality(constraints?: Constraints, acceptSelfAsserted?: boolean): this; + /** + * @param {Constraints} [constraints] + * @param {boolean} [acceptSelfAsserted] + * @returns this + */ + withPhoneNumber(constraints?: Constraints, acceptSelfAsserted?: boolean): this; + /** + * @param {Constraints} [constraints] + * @param {boolean} [acceptSelfAsserted] + * @returns this + */ + withSelfie(constraints?: Constraints, acceptSelfAsserted?: boolean): this; + /** + * @param {Constraints} [constraints] + * @param {boolean} [acceptSelfAsserted] + * @returns this + */ + withDocumentDetails(constraints?: Constraints, acceptSelfAsserted?: boolean): this; + /** + * @param {Constraints} [constraints] + * @param {boolean} [acceptSelfAsserted] + * @returns this + */ + withDocumentImages(constraints?: Constraints, acceptSelfAsserted?: boolean): this; + /** + * @param {Constraints} [constraints] + * @param {boolean} [acceptSelfAsserted] + * @returns this + */ + withEmail(constraints?: Constraints, acceptSelfAsserted?: boolean): this; + /** + * @param {boolean} [enabled=true] + * @returns this + */ + withSelfieAuthentication(enabled?: boolean): this; + /** + * @param {boolean} [enabled=true] + * @returns this + */ + withPinAuthentication(enabled?: boolean): this; + /** + * @param {number} wantedAuthType + * @param {boolean} [enabled=true] + * @returns this + */ + withWantedAuthType(wantedAuthType: number, enabled?: boolean): this; + /** + * @param {boolean} [wantedRememberMe=true] + * @returns this + */ + withWantedRememberMe(wantedRememberMe?: boolean): this; + wantedRememberMe: boolean; + /** + * @param {object} identityProfileRequirements + * @returns this + */ + withIdentityProfileRequirements(identityProfileRequirements: object): this; + identityProfileRequirements: any; + /** + * @returns {Policy} + */ + build(): Policy; +} +declare namespace PolicyBuilder { + export { Constraints }; +} +import WantedAttribute = require("./wanted.attribute"); +import Policy = require("./policy"); +type Constraints = import('./constraints'); diff --git a/types/src/digital_identity_service/policy/policy.d.ts b/types/src/digital_identity_service/policy/policy.d.ts new file mode 100644 index 000000000..ec060f1ed --- /dev/null +++ b/types/src/digital_identity_service/policy/policy.d.ts @@ -0,0 +1,39 @@ +export = Policy; +declare class Policy { + /** + * @param {WantedAttribute[]} wantedAttributes - array of attributes to be requested. + * @param {number[]} wantedAuthTypes - auth types represents the authentication type to be used. + * @param {boolean} wantedRememberMe + * @param {object} identityProfileRequirements + */ + constructor(wantedAttributes: WantedAttribute[], wantedAuthTypes: number[], wantedRememberMe?: boolean, identityProfileRequirements?: object); + /** @private */ + private wantedAttributes; + /** @private */ + private wantedAuthTypes; + /** @private */ + private wantedRememberMe; + /** @private */ + private identityProfileRequirements; + /** + * @returns {WantedAttribute[]} array of attributes to be requested. + */ + getWantedAttributes(): WantedAttribute[]; + /** + * @returns {number[]} auth types represents the authentication type to be used. + */ + getWantedAuthTypes(): number[]; + /** + * @returns {boolean} + */ + getWantedRememberMe(): boolean; + /** + * @return {Object} + */ + getIdentityProfileRequirements(): any; + /** + * @returns {Object} data for JSON.stringify() + */ + toJSON(): any; +} +import WantedAttribute = require("./wanted.attribute"); diff --git a/types/src/digital_identity_service/policy/source.constraint.builder.d.ts b/types/src/digital_identity_service/policy/source.constraint.builder.d.ts new file mode 100644 index 000000000..8832f3552 --- /dev/null +++ b/types/src/digital_identity_service/policy/source.constraint.builder.d.ts @@ -0,0 +1,49 @@ +export = SourceConstraintBuilder; +declare class SourceConstraintBuilder { + /** @private */ + private anchors; + /** @private */ + private softPreference; + /** + * @typedef {import('./wanted.anchor')} WantedAnchor + * @param {WantedAnchor} anchor + * @returns this + */ + withAnchor(anchor: import("./wanted.anchor")): this; + /** + * @param {boolean} softPreference + * @returns this + */ + withSoftPreference(softPreference?: boolean): this; + /** + * @param {string} value + * @param {string} subType + * @returns this + */ + withAnchorByValue(value: string, subType?: string): this; + /** + * @param {string} subType + * @returns this + */ + withPassport(subType?: string): this; + /** + * @param {string} subType + * @returns this + */ + withDrivingLicence(subType?: string): this; + /** + * @param {string} subType + * @returns this + */ + withNationalId(subType?: string): this; + /** + * @param {string} subType + * @returns this + */ + withPasscard(subType?: string): this; + /** + * @returns {SourceConstraint} + */ + build(): SourceConstraint; +} +import SourceConstraint = require("./source.constraint"); diff --git a/types/src/digital_identity_service/policy/source.constraint.d.ts b/types/src/digital_identity_service/policy/source.constraint.d.ts new file mode 100644 index 000000000..199ec3cb8 --- /dev/null +++ b/types/src/digital_identity_service/policy/source.constraint.d.ts @@ -0,0 +1,23 @@ +export = SourceConstraint; +declare class SourceConstraint { + /** + * @param {WantedAnchor[]} anchors + * @param {boolean} softPreference + */ + constructor(anchors: WantedAnchor[], softPreference?: boolean); + /** @private */ + private anchors; + /** @private */ + private softPreference; + /** + * Returns serialized data for JSON.stringify() + */ + toJSON(): { + type: string; + preferred_sources: { + anchors: WantedAnchor[]; + soft_preference: boolean; + }; + }; +} +import WantedAnchor = require("./wanted.anchor"); diff --git a/types/src/digital_identity_service/policy/wanted.anchor.builder.d.ts b/types/src/digital_identity_service/policy/wanted.anchor.builder.d.ts new file mode 100644 index 000000000..b54e844f2 --- /dev/null +++ b/types/src/digital_identity_service/policy/wanted.anchor.builder.d.ts @@ -0,0 +1,20 @@ +export = WantedAnchorBuilder; +declare class WantedAnchorBuilder { + /** + * @param {string} value + * @returns this + */ + withValue(value: string): this; + value: string; + /** + * @param {string} subType + * @returns this + */ + withSubType(subType: string): this; + subType: string; + /** + * @returns {WantedAnchor} + */ + build(): WantedAnchor; +} +import WantedAnchor = require("./wanted.anchor"); diff --git a/types/src/digital_identity_service/policy/wanted.anchor.d.ts b/types/src/digital_identity_service/policy/wanted.anchor.d.ts new file mode 100644 index 000000000..2fe1d7bce --- /dev/null +++ b/types/src/digital_identity_service/policy/wanted.anchor.d.ts @@ -0,0 +1,19 @@ +export = WantedAnchor; +declare class WantedAnchor { + /** + * @param {string} value + * @param {string} subType + */ + constructor(value: string, subType?: string); + /** @private */ + private value; + /** @private */ + private subType; + /** + * Returns serialized data for JSON.stringify() + */ + toJSON(): { + name: string; + sub_type: string; + }; +} diff --git a/types/src/digital_identity_service/policy/wanted.attribute.builder.d.ts b/types/src/digital_identity_service/policy/wanted.attribute.builder.d.ts new file mode 100644 index 000000000..b69f3f479 --- /dev/null +++ b/types/src/digital_identity_service/policy/wanted.attribute.builder.d.ts @@ -0,0 +1,33 @@ +export = WantedAttributeBuilder; +declare class WantedAttributeBuilder { + /** + * @param {string} name + * @returns this + */ + withName(name: string): this; + name: string; + /** + * @param {string} derivation + * @returns this + */ + withDerivation(derivation: string): this; + derivation: string; + /** + * @typedef {import('./constraints')} Constraints + * @param {Constraints} constraints + * @returns this + */ + withConstraints(constraints: import("./constraints")): this; + constraints: import("./constraints"); + /** + * @param {boolean} [acceptSelfAsserted=true] + * @returns this + */ + withAcceptSelfAsserted(acceptSelfAsserted?: boolean): this; + acceptSelfAsserted: boolean; + /** + * @returns {WantedAttribute} + */ + build(): WantedAttribute; +} +import WantedAttribute = require("./wanted.attribute"); diff --git a/types/src/digital_identity_service/policy/wanted.attribute.d.ts b/types/src/digital_identity_service/policy/wanted.attribute.d.ts new file mode 100644 index 000000000..cf23f1c55 --- /dev/null +++ b/types/src/digital_identity_service/policy/wanted.attribute.d.ts @@ -0,0 +1,55 @@ +export = WantedAttribute; +declare class WantedAttribute { + /** + * @param {string} name + * @param {string|null} derivation + * @param {boolean|null} acceptSelfAsserted + * @param {Constraints|null} constraints + */ + constructor(name: string, derivation?: string | null, acceptSelfAsserted?: boolean | null, constraints?: Constraints | null); + /** @private */ + private name; + /** @private */ + private derivation; + /** @private */ + private acceptSelfAsserted; + /** @private */ + private constraints; + /** + * Name identifying the WantedAttribute + * + * @returns {string} + */ + getName(): string; + /** + * Additional derived criteria. + * + * @returns {string} + */ + getDerivation(): string; + /** + * List of constraints to add to an attribute. + * + * If you do not provide any particular constraints, Yoti will provide you with the + * information from the most recently added source. + * + * @returns {Constraints} + */ + getConstraints(): Constraints; + /** + * Accept self asserted attributes. + * + * These are attributes that have been self-declared, and not verified by Yoti. + * + * @returns {boolean} + */ + getAcceptSelfAsserted(): boolean; + /** + * Returns serialized data for JSON.stringify() + */ + toJSON(): { + name: string; + optional: boolean; + }; +} +import Constraints = require("./constraints"); diff --git a/types/src/digital_identity_service/receipts/application.content.d.ts b/types/src/digital_identity_service/receipts/application.content.d.ts new file mode 100644 index 000000000..be63bcce8 --- /dev/null +++ b/types/src/digital_identity_service/receipts/application.content.d.ts @@ -0,0 +1,21 @@ +export = ApplicationContent; +declare class ApplicationContent extends BaseContent { + /** + * @param {{ [k: string]: any }[]} attributes + * @param {{ [k: string]: any }[]} extraData + */ + constructor(attributes?: { + [k: string]: any; + }[], extraData?: { + [k: string]: any; + }[]); + /** @private */ + private profile; + /** + * Get the user profile + * @returns {ApplicationProfile} + */ + getProfile(): ApplicationProfile; +} +import BaseContent = require("./base.content"); +import ApplicationProfile = require("./application.profile"); diff --git a/types/src/digital_identity_service/receipts/application.profile.d.ts b/types/src/digital_identity_service/receipts/application.profile.d.ts new file mode 100644 index 000000000..1bcb0e7db --- /dev/null +++ b/types/src/digital_identity_service/receipts/application.profile.d.ts @@ -0,0 +1,37 @@ +export = ApplicationProfile; +/** + * @typedef {import('../../data_type/attribute').Attribute} Attribute + */ +/** + * Profile of a human user with convenience methods to access well-known attributes. + * + * @class Profile + * + */ +declare class ApplicationProfile extends BaseProfile { + getName(): import("../../data_type/attribute").Attribute; + /** + * The URL where the application is available at. + * + * @returns {null|Attribute} + */ + getUrl(): null | Attribute; + /** + * The logo of the application that will be displayed to users that perform a share with it. + * + * @returns {null|Attribute} + */ + getLogo(): null | Attribute; + /** + * The background colour that will be displayed on each receipt the user gets, as a result + * of a share with the application. + * + * @returns {null|Attribute} + */ + getReceiptBgColor(): null | Attribute; +} +declare namespace ApplicationProfile { + export { Attribute }; +} +import BaseProfile = require("./base.profile"); +type Attribute = import('../../data_type/attribute').Attribute; diff --git a/types/src/digital_identity_service/receipts/base.content.d.ts b/types/src/digital_identity_service/receipts/base.content.d.ts new file mode 100644 index 000000000..020515d96 --- /dev/null +++ b/types/src/digital_identity_service/receipts/base.content.d.ts @@ -0,0 +1,17 @@ +export = BaseContent; +declare class BaseContent { + /** + * @param {{ [k: string]: any }[]} extraData + */ + constructor(extraData?: { + [k: string]: any; + }[]); + /** @private */ + private extraData; + /** + * Get the user extra data + * @returns {ExtraData} + */ + getExtraData(): ExtraData; +} +import ExtraData = require("./extra.data"); diff --git a/types/src/digital_identity_service/receipts/base.profile.d.ts b/types/src/digital_identity_service/receipts/base.profile.d.ts new file mode 100644 index 000000000..a996fe068 --- /dev/null +++ b/types/src/digital_identity_service/receipts/base.profile.d.ts @@ -0,0 +1,48 @@ +export = BaseProfile; +declare class BaseProfile { + /** + * @param {Array} attributes + */ + constructor(attributes?: any[]); + /** @protected */ + protected attributes: Attribute[]; + /** @private */ + private attributesMap; + /** + * Return Attribute object. + * + * @param attrName + * + * @returns {Attribute|null} + */ + getAttribute(attrName: any): Attribute | null; + /** + * Return list of all Attribute objects for provided attribute name. + * + * @param attrName + * + * @returns {Attribute[]} + */ + getAttributesByName(attrName: any): Attribute[]; + /** + * Return first attribute found by id. + * + * @param attrId + * + * @returns {Attribute} + */ + getAttributeById(attrId: any): Attribute; + /** + * Return array of all attributes for the profile. + * + * @returns {Attribute[]} + */ + getAttributesList(): Attribute[]; + /** + * Returns a string representing the object. + * + * @returns {string} + */ + toString(): string; +} +import { Attribute } from "../../data_type/attribute"; diff --git a/types/src/digital_identity_service/receipts/content.factory.d.ts b/types/src/digital_identity_service/receipts/content.factory.d.ts new file mode 100644 index 000000000..06c525330 --- /dev/null +++ b/types/src/digital_identity_service/receipts/content.factory.d.ts @@ -0,0 +1,22 @@ +/** + * + * @param {{profile, extraData}} content encrypted profile content + * @param receiptContentKey + * @returns {ApplicationContent} + */ +export function buildApplicationContentFromEncryptedContent(content: { + profile: any; + extraData: any; +}, receiptContentKey: any): ApplicationContent; +/** + * + * @param {{profile, extraData}} content encrypted profile content + * @param receiptContentKey + * @returns {UserContent} + */ +export function buildUserContentFromEncryptedContent(content: { + profile: any; + extraData: any; +}, receiptContentKey: any): UserContent; +import ApplicationContent = require("./application.content"); +import UserContent = require("./user.content"); diff --git a/types/src/digital_identity_service/receipts/decryption.utils.d.ts b/types/src/digital_identity_service/receipts/decryption.utils.d.ts new file mode 100644 index 000000000..a22bd4ed2 --- /dev/null +++ b/types/src/digital_identity_service/receipts/decryption.utils.d.ts @@ -0,0 +1,2 @@ +export function unwrapReceiptKey(wrappedReceiptKey: any, encryptedItemKey: any, itemKeyIv: any, pem: any): Buffer; +export function decryptReceiptContent(content: any, receiptContentKey: any): Buffer; diff --git a/types/src/digital_identity_service/receipts/extra.data.d.ts b/types/src/digital_identity_service/receipts/extra.data.d.ts new file mode 100644 index 000000000..c7efc3b1b --- /dev/null +++ b/types/src/digital_identity_service/receipts/extra.data.d.ts @@ -0,0 +1,14 @@ +export = ExtraData; +declare class ExtraData { + /** + * @param {Object[]} dataEntries + */ + constructor(dataEntries?: any[]); + /** @private */ + private attributeIssuanceDetails; + /** + * @returns {AttributeIssuanceDetails} + */ + getAttributeIssuanceDetails(): AttributeIssuanceDetails; +} +import AttributeIssuanceDetails = require("../../data_type/attribute.issuance.details"); diff --git a/types/src/digital_identity_service/receipts/receipt.item.key.response.d.ts b/types/src/digital_identity_service/receipts/receipt.item.key.response.d.ts new file mode 100644 index 000000000..63063e7f8 --- /dev/null +++ b/types/src/digital_identity_service/receipts/receipt.item.key.response.d.ts @@ -0,0 +1,33 @@ +export = ReceiptItemKeyResponse; +/** + * The receipt item key response + * + * @class ReceiptItemKeyResponse + */ +declare class ReceiptItemKeyResponse { + constructor(response: any); + /** @private */ + private id; + /** @private */ + private iv; + /** @private */ + private value; + /** + * The Receipt Item Key ID + * + * @returns {string} The Receipt Item Key ID + */ + getId(): string; + /** + * The Receipt Item Key iv + * + * @returns {string} The Receipt Item Key iv + */ + getIv(): string; + /** + * The encrypted Receipt Item Key + * + * @returns {string} The encrypted Receipt Item Key + */ + getValue(): string; +} diff --git a/types/src/digital_identity_service/receipts/receipt.response.d.ts b/types/src/digital_identity_service/receipts/receipt.response.d.ts new file mode 100644 index 000000000..e0b24a517 --- /dev/null +++ b/types/src/digital_identity_service/receipts/receipt.response.d.ts @@ -0,0 +1,89 @@ +export = ReceiptResponse; +/** + * The receipt response + * + * @class ReceiptResponse + */ +declare class ReceiptResponse { + constructor(response: any); + /** @private */ + private id; + /** @private */ + private sessionId; + /** @private */ + private timestamp; + /** @private */ + private error; + /** @private */ + private rememberMeId; + /** @private */ + private parentRememberMeId; + /** @private */ + private content; + /** @private */ + private otherPartyContent; + /** @private */ + private wrappedItemKeyId; + /** @private */ + private wrappedKey; + /** + * The receipt ID + * + * @returns {string} The receipt ID + */ + getId(): string; + /** + * The session ID + * + * @returns {string} The session ID + */ + getSessionId(): string; + /** + * The timestamp + * + * @returns {Date} The timestamp + */ + getTimestamp(): Date; + /** + * The Remember Me ID + * + * @returns {string} The Remember Me ID + */ + getRememberMeId(): string; + /** + * The Parent Remember Me ID + * + * @returns {string} The Parent Remember Me ID + */ + getParentRememberMeId(): string; + /** + * The content + * + * @returns {Object} The content + */ + getContent(): any; + /** + * The otherPartyContent + * + * @returns {Object} The otherPartyContent + */ + getOtherPartyContent(): any; + /** + * The wrappedItemKeyId + * + * @returns {string} The wrappedItemKeyId + */ + getWrappedItemKeyId(): string; + /** + * The wrappedKey + * + * @returns {string} The wrappedKey + */ + getWrappedKey(): string; + /** + * The error of the receipt + * + * @returns {string} The error of the receipt + */ + getError(): string; +} diff --git a/types/src/digital_identity_service/receipts/user.content.d.ts b/types/src/digital_identity_service/receipts/user.content.d.ts new file mode 100644 index 000000000..7ad457a15 --- /dev/null +++ b/types/src/digital_identity_service/receipts/user.content.d.ts @@ -0,0 +1,21 @@ +export = UserContent; +declare class UserContent extends BaseContent { + /** + * @param {{ [k: string]: any }[]} attributes + * @param {{ [k: string]: any }[]} extraData + */ + constructor(attributes?: { + [k: string]: any; + }[], extraData?: { + [k: string]: any; + }[]); + /** @private */ + private profile; + /** + * Get the user profile + * @returns {UserProfile} + */ + getProfile(): UserProfile; +} +import BaseContent = require("./base.content"); +import UserProfile = require("./user.profile"); diff --git a/types/src/digital_identity_service/receipts/user.profile.d.ts b/types/src/digital_identity_service/receipts/user.profile.d.ts new file mode 100644 index 000000000..09614d27f --- /dev/null +++ b/types/src/digital_identity_service/receipts/user.profile.d.ts @@ -0,0 +1,131 @@ +export = UserProfile; +/** + * Profile of a human user with convenience methods to access well-known attributes. + * + * @class Profile + */ +declare class UserProfile extends BaseProfile { + /** @private */ + private ageVerifications; + /** + * The full name attribute. + * + * @returns {null|Attribute} + */ + getFullName(): null | Attribute; + /** + * Corresponds to secondary names in passport, and first/middle names in English. + * + * @returns {null|Attribute} + */ + getGivenNames(): null | Attribute; + /** + * Corresponds to primary name in passport, and surname in English. + * + * @returns {null|Attribute} + */ + getFamilyName(): null | Attribute; + /** + * Date of birth. + * + * @returns {null|Attribute} + */ + getDateOfBirth(): null | Attribute; + /** + * Finds all the 'Age Over' and 'Age Under' derived attributes returned with the profile, + * and returns them wrapped in AgeVerification objects + * + * @returns {Array} + */ + getAgeVerifications(): any[]; + /** + * Searches for an AgeVerification corresponding to an 'Age Over' check for the given age + * + * @param {number} age + * + * @returns {AgeVerification|null} + */ + findAgeOverVerification(age: number): AgeVerification | null; + /** + * Searches for an AgeVerification corresponding to an 'Age Under' check for the given age. + * + * @param {number} age + * + * @returns {AgeVerification|null} + */ + findAgeUnderVerification(age: number): AgeVerification | null; + /** + * Searches for an AgeVerification corresponding to provided type and age. + * + * @param {string} type + * @param {number} age + * + * @returns {AgeVerification|null} + */ + findAgeVerification(type: string, age: number): AgeVerification | null; + /** + * Corresponds to the gender in the passport; will be one of the strings + * "MALE", "FEMALE", "TRANSGENDER" or "OTHER". + * + * @returns {null|Attribute} + */ + getGender(): null | Attribute; + /** + * Corresponds to the nationality in the passport. + * + * @returns {Attribute|null} + */ + getNationality(): Attribute | null; + /** + * The user's phone number, as verified at registration time. This will be a number with + for + * international prefix and no spaces, e.g. "+447777123456". + * + * @returns {null|Attribute} + */ + getPhoneNumber(): null | Attribute; + /** + * Photograph of user, encoded as a JPEG image. + * + * @returns {Attribute|null} + */ + getSelfie(): Attribute | null; + /** + * The user's verified email address. + * + * @returns {null|Attribute} + */ + getEmailAddress(): null | Attribute; + /** + * The user's postal address as a String. + * + * @returns {null|Attribute} + */ + getPostalAddress(): null | Attribute; + /** + * The user's structured postal address as a Json. + * + * @returns {null|Attribute} + */ + getStructuredPostalAddress(): null | Attribute; + /** + * Document details. + * + * @returns {null|Attribute} + */ + getDocumentDetails(): null | Attribute; + /** + * Document images. + * + * @returns {null|Attribute} + */ + getDocumentImages(): null | Attribute; + /** + * Identity Profile Report. + * + * @returns {null|Attribute} + */ + getIdentityProfileReport(): null | Attribute; +} +import BaseProfile = require("./base.profile"); +import { Attribute } from "../../data_type/attribute"; +import { AgeVerification } from "../../data_type/age.verification"; diff --git a/types/src/digital_identity_service/share.session.configuration.builder.d.ts b/types/src/digital_identity_service/share.session.configuration.builder.d.ts new file mode 100644 index 000000000..064befb14 --- /dev/null +++ b/types/src/digital_identity_service/share.session.configuration.builder.d.ts @@ -0,0 +1,40 @@ +export = ShareSessionBuilder; +declare class ShareSessionBuilder { + /** @private */ + private extensions; + /** + * @param {Object} subject + */ + withSubject(subject: any): this; + subject: any; + /** + * @param {Policy} policy + */ + withPolicy(policy: Policy): this; + policy: import("./policy/policy"); + /** + * @param {string} redirectUri + */ + withRedirectUri(redirectUri: string): this; + redirectUri: string; + /** + * @param {Extension} extension + */ + withExtension(extension: Extension): this; + /** + * @param {ShareSessionNotification} notification + */ + withNotification(notification: ShareSessionNotification): this; + notification: import("./share.session.notification"); + /** + * @returns {ShareSessionConfiguration} + */ + build(): ShareSessionConfiguration; +} +declare namespace ShareSessionBuilder { + export { Policy, ShareSessionNotification, Extension }; +} +import ShareSessionConfiguration = require("./share.session.configuration"); +type Policy = import('./policy/policy'); +type ShareSessionNotification = import('./share.session.notification'); +type Extension = import('./extension/extension'); diff --git a/types/src/digital_identity_service/share.session.configuration.d.ts b/types/src/digital_identity_service/share.session.configuration.d.ts new file mode 100644 index 000000000..c5e3478cf --- /dev/null +++ b/types/src/digital_identity_service/share.session.configuration.d.ts @@ -0,0 +1,54 @@ +export = ShareSession; +declare class ShareSession { + /** + * @param {Policy} policy + * @param {Extension[]} extensions + * @param {Object} subject + * @param {string} redirectUri + * @param {ShareSessionNotification} notification + */ + constructor(policy: Policy, extensions: Extension[], subject: any, redirectUri: string, notification: ShareSessionNotification); + /** @private */ + private policy; + /** @private */ + private extensions; + /** @private */ + private redirectUri; + /** @private */ + private subject; + /** @private */ + private notification; + /** + * @returns {string} The redirect uri. + */ + getRedirectUri(): string; + /** + * @returns {Policy} The customisable Policy to use in the share. + */ + getPolicy(): Policy; + /** + * @returns {Extension[]} List of Extension to be activated for the application. + */ + getExtensions(): Extension[]; + /** + * @returns {Object} The subject describing data. + */ + getSubject(): any; + /** + * @returns {Object} The notification configuration. + */ + getNotification(): any; + /** + * Returns serialized data for JSON.stringify() + */ + toJSON(): { + notification: any; + policy: Policy; + extensions: Extension[]; + subject: any; + redirectUri: string; + }; +} +import Policy = require("./policy/policy"); +import Extension = require("./extension/extension"); +import ShareSessionNotification = require("./share.session.notification"); diff --git a/types/src/digital_identity_service/share.session.notification.builder.d.ts b/types/src/digital_identity_service/share.session.notification.builder.d.ts new file mode 100644 index 000000000..c0a2bc203 --- /dev/null +++ b/types/src/digital_identity_service/share.session.notification.builder.d.ts @@ -0,0 +1,27 @@ +export = ShareSessionNotificationBuilder; +declare class ShareSessionNotificationBuilder { + /** @private */ + private headers; + /** + * @param {string} url + */ + withUrl(url: string): this; + url: string; + /** + * @param {string} method + */ + withMethod(method: string): this; + method: string; + /** + * @param {string} headerName + * @param {string} value + */ + withHeader(headerName: string, value: string): this; + /** + * @param {boolean} verifyTls + */ + withVerifiedTls(verifyTls: boolean): this; + verifyTls: boolean; + build(): ShareSessionNotification; +} +import ShareSessionNotification = require("./share.session.notification"); diff --git a/types/src/digital_identity_service/share.session.notification.d.ts b/types/src/digital_identity_service/share.session.notification.d.ts new file mode 100644 index 000000000..b49bf9e93 --- /dev/null +++ b/types/src/digital_identity_service/share.session.notification.d.ts @@ -0,0 +1,43 @@ +export = ShareSessionNotification; +declare class ShareSessionNotification { + /** + * @param {string} url + * @param {string} method + * @param {Object} headers + * @param {boolean} verifyTls + */ + constructor(url: string, method: string, headers: any, verifyTls: boolean); + /** @private */ + private url; + /** @private */ + private method; + /** @private */ + private headers; + /** @private */ + private verifyTls; + /** + * @returns {string} The notification url. + */ + getUrl(): string; + /** + * @returns {string} The notification method. + */ + getMethod(): string; + /** + * @returns {Object} The notification headers. + */ + getHeaders(): any; + /** + * @returns {boolean} The notification verifyTls option. + */ + getVerifyTls(): boolean; + /** + * Returns serialized data for JSON.stringify() + */ + toJSON(): { + url: string; + method: string; + headers: any; + verifyTls: true; + }; +} diff --git a/types/src/dynamic_sharing_service/dynamic.scenario.builder.d.ts b/types/src/dynamic_sharing_service/dynamic.scenario.builder.d.ts new file mode 100644 index 000000000..489deffcc --- /dev/null +++ b/types/src/dynamic_sharing_service/dynamic.scenario.builder.d.ts @@ -0,0 +1,32 @@ +export = DynamicScenarioBuilder; +declare class DynamicScenarioBuilder { + /** @private */ + private extensions; + /** + * @param {string} callbackEndpoint + */ + withCallbackEndpoint(callbackEndpoint: string): this; + callbackEndpoint: string; + /** + * @typedef {import('./policy/dynamic.policy.js')} DynamicPolicy + * @param {DynamicPolicy} dynamicPolicy + */ + withPolicy(dynamicPolicy: import("./policy/dynamic.policy.js")): this; + dynamicPolicy: import("./policy/dynamic.policy.js"); + /** + * @typedef {import('./extension/extension.js')} Extension + * + * @param {Extension} extension + */ + withExtension(extension: import("./extension/extension.js")): this; + /** + * @param {Object} subject + */ + withSubject(subject: any): this; + subject: any; + /** + * @returns {DynamicScenario} + */ + build(): DynamicScenario; +} +import DynamicScenario = require("./dynamic.scenario"); diff --git a/types/src/dynamic_sharing_service/dynamic.scenario.d.ts b/types/src/dynamic_sharing_service/dynamic.scenario.d.ts new file mode 100644 index 000000000..4bbfa0d4a --- /dev/null +++ b/types/src/dynamic_sharing_service/dynamic.scenario.d.ts @@ -0,0 +1,45 @@ +export = DynamicScenario; +declare class DynamicScenario { + /** + * @param {string} callbackEndpoint + * The device's callback endpoint. Must be a URL relative to the Application + * Domain specified in your Yoti Hub. + * @param {DynamicPolicy} dynamicPolicy + * The customisable DynamicPolicy to use in the share. + * @param {Extension[]} extensions + * List of Extension to be activated for the application. + * @param {Object} subject + * The subject describing data. + */ + constructor(callbackEndpoint: string, dynamicPolicy: DynamicPolicy, extensions: Extension[], subject: any); + /** @private */ + private callbackEndpoint; + /** @private */ + private dynamicPolicy; + /** @private */ + private extensions; + /** @private */ + private subject; + /** + * @returns {string} The device's callback endpoint. + */ + getCallbackEndpoint(): string; + /** + * @returns {DynamicPolicy} The customisable DynamicPolicy to use in the share. + */ + getDynamicPolicy(): DynamicPolicy; + /** + * @returns {Extension[]} List of Extension to be activated for the application. + */ + getExtensions(): Extension[]; + /** + * @returns {Object} The subject describing data. + */ + getSubject(): any; + /** + * @returns {Object} data for JSON.stringify() + */ + toJSON(): any; +} +import DynamicPolicy = require("./policy/dynamic.policy"); +import Extension = require("./extension/extension"); diff --git a/types/src/dynamic_sharing_service/extension/device.location.d.ts b/types/src/dynamic_sharing_service/extension/device.location.d.ts new file mode 100644 index 000000000..4bd27f873 --- /dev/null +++ b/types/src/dynamic_sharing_service/extension/device.location.d.ts @@ -0,0 +1,45 @@ +export = DeviceLocation; +/** + * Defines a device location. + * + * @class DeviceLocation + */ +declare class DeviceLocation { + /** + * @param {Number} latitude + * @param {Number} longitude + * @param {Number} radius + * @param {Number} maxUncertainty + */ + constructor(latitude: number, longitude: number, radius?: number, maxUncertainty?: number); + /** @private */ + private latitude; + /** @private */ + private longitude; + /** @private */ + private radius; + /** @private */ + private maxUncertainty; + /** + * @returns {Number} Latitude of the user's expected location + */ + getLatitude(): number; + /** + * @returns {Number} Longitude of the user's expected location + */ + getLongitude(): number; + /** + * @returns {Number} Radius of the circle, centred on the specified location + * coordinates, where the device is allowed to perform the share + */ + getRadius(): number; + /** + * @returns {Number} Maximum acceptable distance, in metres, of the area of + * uncertainty associated with the device location coordinates. + */ + getMaxUncertainty(): number; + /** + * @returns {Object} data for JSON.stringify() + */ + toJSON(): any; +} diff --git a/types/src/dynamic_sharing_service/extension/extension.builder.d.ts b/types/src/dynamic_sharing_service/extension/extension.builder.d.ts new file mode 100644 index 000000000..89709ea74 --- /dev/null +++ b/types/src/dynamic_sharing_service/extension/extension.builder.d.ts @@ -0,0 +1,18 @@ +export = ExtensionBuilder; +declare class ExtensionBuilder { + /** + * @param {string} type + */ + withType(type: string): this; + type: string; + /** + * @param {*} content + */ + withContent(content: any): this; + content: any; + /** + * @returns {Extension} + */ + build(): Extension; +} +import Extension = require("./extension"); diff --git a/types/src/dynamic_sharing_service/extension/extension.d.ts b/types/src/dynamic_sharing_service/extension/extension.d.ts new file mode 100644 index 000000000..20a83ad54 --- /dev/null +++ b/types/src/dynamic_sharing_service/extension/extension.d.ts @@ -0,0 +1,24 @@ +export = Extension; +declare class Extension { + /** + * @param {string} type + * @param {*} content + */ + constructor(type: string, content: any); + /** @private */ + private type; + /** @private */ + private content; + /** + * @returns {string} type + */ + getType(): string; + /** + * @returns {*} content + */ + getContent(): any; + /** + * @returns {Object} data for JSON.stringify() + */ + toJSON(): any; +} diff --git a/types/src/dynamic_sharing_service/extension/location.constraint.extension.builder.d.ts b/types/src/dynamic_sharing_service/extension/location.constraint.extension.builder.d.ts new file mode 100644 index 000000000..1914be73e --- /dev/null +++ b/types/src/dynamic_sharing_service/extension/location.constraint.extension.builder.d.ts @@ -0,0 +1,50 @@ +export = LocationConstraintExtensionBuilder; +declare class LocationConstraintExtensionBuilder { + /** + * Allows you to specify the Latitude of the user's expected location + * + * @param {Number} latitude + * + * @returns {LocationConstraintExtensionBuilder} + */ + withLatitude(latitude: number): LocationConstraintExtensionBuilder; + latitude: number; + /** + * Allows you to specify the Longitude of the user's expected location + * + * @param {Number} longitude + * + * @returns {LocationConstraintExtensionBuilder} + */ + withLongitude(longitude: number): LocationConstraintExtensionBuilder; + longitude: number; + /** + * Radius of the circle, centred on the specified location coordinates, where the device is + * allowed to perform the share. + * + * If not provided, a default value of 150m will be used. + * + * @param {Number} radius The allowable distance, in metres, from the given lat/long location + * + * @returns {LocationConstraintExtensionBuilder} + */ + withRadius(radius: number): LocationConstraintExtensionBuilder; + radius: number; + /** + * Maximum acceptable distance, in metres, of the area of uncertainty associated with the device + * location coordinates. + * + * If not provided, a default value of 150m will be used. + * + * @param {Number} maxUncertainty Maximum allowed measurement uncertainty, in metres + * + * @returns {LocationConstraintExtensionBuilder} + */ + withMaxUncertainty(maxUncertainty: number): LocationConstraintExtensionBuilder; + maxUncertainty: number; + /** + * @returns {Extension} Extension with LocationConstraintExtensionContent content + */ + build(): Extension; +} +import Extension = require("./extension"); diff --git a/types/src/dynamic_sharing_service/extension/location.constraint.extension.content.d.ts b/types/src/dynamic_sharing_service/extension/location.constraint.extension.content.d.ts new file mode 100644 index 000000000..05698bb8c --- /dev/null +++ b/types/src/dynamic_sharing_service/extension/location.constraint.extension.content.d.ts @@ -0,0 +1,15 @@ +export = LocationConstraintContent; +declare class LocationConstraintContent { + constructor(latitude: any, longitude: any, radius: any, maxUncertainty: any); + /** @private */ + private expectedDeviceLocation; + /** + * @returns {DeviceLocation} + */ + getExpectedDeviceLocation(): DeviceLocation; + /** + * @returns {Object} data for JSON.stringify() + */ + toJSON(): any; +} +import DeviceLocation = require("./device.location"); diff --git a/types/src/dynamic_sharing_service/extension/third.party.attribute.extension.builder.d.ts b/types/src/dynamic_sharing_service/extension/third.party.attribute.extension.builder.d.ts new file mode 100644 index 000000000..cb3987eec --- /dev/null +++ b/types/src/dynamic_sharing_service/extension/third.party.attribute.extension.builder.d.ts @@ -0,0 +1,11 @@ +export = ThirdPartyAttributeExtensionBuilder; +declare class ThirdPartyAttributeExtensionBuilder { + /** @private */ + private definitions; + withExpiryDate(expiryDate: any): this; + expiryDate: any; + withDefinition(definition: any): this; + withDefinitions(definitions: any): this; + build(): Extension; +} +import Extension = require("./extension"); diff --git a/types/src/dynamic_sharing_service/extension/third.party.attribute.extension.content.d.ts b/types/src/dynamic_sharing_service/extension/third.party.attribute.extension.content.d.ts new file mode 100644 index 000000000..40e9689c6 --- /dev/null +++ b/types/src/dynamic_sharing_service/extension/third.party.attribute.extension.content.d.ts @@ -0,0 +1,14 @@ +export = ThirdPartyAttributeExtensionContent; +declare class ThirdPartyAttributeExtensionContent { + constructor(expiryDate: any, definitions: any); + /** @private */ + private expiryDate; + /** @private */ + private definitions; + getExpiryDate(): any; + getDefinitions(): any; + toJSON(): { + expiry_date: any; + definitions: any; + }; +} diff --git a/types/src/dynamic_sharing_service/extension/transactional.flow.extension.builder.d.ts b/types/src/dynamic_sharing_service/extension/transactional.flow.extension.builder.d.ts new file mode 100644 index 000000000..10ec514eb --- /dev/null +++ b/types/src/dynamic_sharing_service/extension/transactional.flow.extension.builder.d.ts @@ -0,0 +1,16 @@ +export = TransactionalFlowExtensionBuilder; +declare class TransactionalFlowExtensionBuilder { + /** + * Allows you to provide a non-null object representing the content to be submitted + * in the TRANSACTIONAL_FLOW extension. + * + * @param {Object} content + */ + withContent(content: any): this; + content: any; + /** + * @returns {Extension} Extension with TRANSACTIONAL_FLOW type + */ + build(): Extension; +} +import Extension = require("./extension"); diff --git a/types/src/dynamic_sharing_service/index.d.ts b/types/src/dynamic_sharing_service/index.d.ts new file mode 100644 index 000000000..fbe4e625a --- /dev/null +++ b/types/src/dynamic_sharing_service/index.d.ts @@ -0,0 +1,44 @@ +/** + * Requests a share URL for provided Dynamic Scenario. + * + * @param {DynamicScenario} dynamicScenario + * @param {string} pem + * @param {string} sdkId + * + * @returns {Promise} containing a ShareUrlResult + */ +export function createShareUrl(dynamicScenario: DynamicScenario, pem: string, sdkId: string): Promise; +/** + * Service Class to handle interactions with the dynamic share API + * + * @class DynamicShareService + */ +export class DynamicShareService { + /** + * @param {string} sdkId + * @param {string|Buffer} pem + * @param {{apiUrl?: string}} options + */ + constructor(sdkId: string, pem: string | Buffer, { apiUrl }?: { + apiUrl?: string; + }); + /** @private */ + private sdkId; + /** @private */ + private pem; + /** @private */ + private apiUrl; + createShareUrl(dynamicScenario: any): Promise; +} +import DynamicScenarioBuilder = require("./dynamic.scenario.builder"); +import DynamicPolicyBuilder = require("./policy/dynamic.policy.builder"); +import WantedAttributeBuilder = require("./policy/wanted.attribute.builder"); +import ExtensionBuilder = require("./extension/extension.builder"); +import LocationConstraintExtensionBuilder = require("./extension/location.constraint.extension.builder"); +import TransactionalFlowExtensionBuilder = require("./extension/transactional.flow.extension.builder"); +import ThirdPartyAttributeExtensionBuilder = require("./extension/third.party.attribute.extension.builder"); +import WantedAnchorBuilder = require("./policy/wanted.anchor.builder"); +import ConstraintsBuilder = require("./policy/constraints.builder"); +import SourceConstraintBuilder = require("./policy/source.constraint.builder"); +import DynamicScenario = require("./dynamic.scenario"); +export { DynamicScenarioBuilder, DynamicPolicyBuilder, WantedAttributeBuilder, ExtensionBuilder, LocationConstraintExtensionBuilder, TransactionalFlowExtensionBuilder, ThirdPartyAttributeExtensionBuilder, WantedAnchorBuilder, ConstraintsBuilder, SourceConstraintBuilder }; diff --git a/types/src/dynamic_sharing_service/policy/constraints.builder.d.ts b/types/src/dynamic_sharing_service/policy/constraints.builder.d.ts new file mode 100644 index 000000000..95175d7d7 --- /dev/null +++ b/types/src/dynamic_sharing_service/policy/constraints.builder.d.ts @@ -0,0 +1,15 @@ +export = ConstraintsBuilder; +declare class ConstraintsBuilder { + /** @private */ + private constraints; + /** + * @param {SourceConstraint} sourceConstraint + */ + withSourceConstraint(sourceConstraint: SourceConstraint): this; + /** + * @returns {Constraints} + */ + build(): Constraints; +} +import SourceConstraint = require("./source.constraint"); +import Constraints = require("./constraints"); diff --git a/types/src/dynamic_sharing_service/policy/constraints.d.ts b/types/src/dynamic_sharing_service/policy/constraints.d.ts new file mode 100644 index 000000000..a352f61ef --- /dev/null +++ b/types/src/dynamic_sharing_service/policy/constraints.d.ts @@ -0,0 +1,18 @@ +export = Constraints; +/** + * List of constraints to apply to a wanted attribute. + * + * @class Constraints + */ +declare class Constraints { + /** + * Set default properties. + */ + constructor(constraints: any); + /** @private */ + private constraints; + /** + * @returns {Array} for JSON.stringify() + */ + toJSON(): any[]; +} diff --git a/types/src/dynamic_sharing_service/policy/dynamic.policy.builder.d.ts b/types/src/dynamic_sharing_service/policy/dynamic.policy.builder.d.ts new file mode 100644 index 000000000..dd19fad8c --- /dev/null +++ b/types/src/dynamic_sharing_service/policy/dynamic.policy.builder.d.ts @@ -0,0 +1,133 @@ +export = DynamicPolicyBuilder; +declare class DynamicPolicyBuilder { + /** @private */ + private wantedAttributes; + /** @private */ + private wantedAuthTypes; + /** + * @param {WantedAttribute} wantedAttribute + */ + withWantedAttribute(wantedAttribute: WantedAttribute): this; + /** + * @param {string} name + * @param {Constraints} constraints + * @param {boolean|null} acceptSelfAsserted + */ + withWantedAttributeByName(name: string, constraints?: Constraints, acceptSelfAsserted?: boolean | null): this; + /** + * @param {Constraints} constraints + * @param {boolean} acceptSelfAsserted + */ + withFamilyName(constraints?: Constraints, acceptSelfAsserted?: boolean): this; + /** + * @param {Constraints} constraints + * @param {boolean} acceptSelfAsserted + */ + withGivenNames(constraints?: Constraints, acceptSelfAsserted?: boolean): this; + /** + * @param {Constraints} constraints + * @param {boolean} acceptSelfAsserted + */ + withFullName(constraints?: Constraints, acceptSelfAsserted?: boolean): this; + /** + * @param {Constraints} constraints + * @param {boolean} acceptSelfAsserted + */ + withDateOfBirth(constraints?: Constraints, acceptSelfAsserted?: boolean): this; + /** + * @param {number} age + * @param {Constraints} constraints + * @param {boolean} acceptSelfAsserted + */ + withAgeOver(age: number, constraints?: Constraints, acceptSelfAsserted?: boolean): this; + /** + * @param {number} age + * @param {Constraints} constraints + * @param {boolean} acceptSelfAsserted + */ + withAgeUnder(age: number, constraints?: Constraints, acceptSelfAsserted?: boolean): this; + /** + * @param {string} derivation + * @param {Constraints} constraints + * @param {boolean} acceptSelfAsserted + */ + withAgeDerivedAttribute(derivation: string, constraints?: Constraints, acceptSelfAsserted?: boolean): this; + /** + * @param {Constraints} constraints + * @param {boolean} acceptSelfAsserted + */ + withGender(constraints?: Constraints, acceptSelfAsserted?: boolean): this; + /** + * @param {Constraints} constraints + * @param {boolean} acceptSelfAsserted + */ + withPostalAddress(constraints?: Constraints, acceptSelfAsserted?: boolean): this; + /** + * @param {Constraints} constraints + * @param {boolean} acceptSelfAsserted + */ + withStructuredPostalAddress(constraints?: Constraints, acceptSelfAsserted?: boolean): this; + /** + * @param {Constraints} constraints + * @param {boolean} acceptSelfAsserted + */ + withNationality(constraints?: Constraints, acceptSelfAsserted?: boolean): this; + /** + * @param {Constraints} constraints + * @param {boolean} acceptSelfAsserted + */ + withPhoneNumber(constraints?: Constraints, acceptSelfAsserted?: boolean): this; + /** + * @param {Constraints} constraints + * @param {boolean} acceptSelfAsserted + */ + withSelfie(constraints?: Constraints, acceptSelfAsserted?: boolean): this; + /** + * @param {Constraints} constraints + * @param {boolean} acceptSelfAsserted + */ + withDocumentDetails(constraints?: Constraints, acceptSelfAsserted?: boolean): this; + /** + * @param {Constraints} constraints + * @param {boolean} acceptSelfAsserted + */ + withDocumentImages(constraints?: Constraints, acceptSelfAsserted?: boolean): this; + /** + * @param {Constraints} constraints + * @param {boolean} acceptSelfAsserted + */ + withEmail(constraints?: Constraints, acceptSelfAsserted?: boolean): this; + /** + * @param {boolean} enabled + */ + withSelfieAuthentication(enabled?: boolean): this; + /** + * @param {boolean} enabled + */ + withPinAuthentication(enabled?: boolean): this; + /** + * @param {number} wantedAuthType + * @param {boolean} enabled + */ + withWantedAuthType(wantedAuthType: number, enabled?: boolean): this; + /** + * @param {boolean} wantedRememberMe + */ + withWantedRememberMe(wantedRememberMe: boolean): this; + wantedRememberMe: boolean; + /** + * @param {object} identityProfileRequirements + */ + withIdentityProfileRequirements(identityProfileRequirements: object): this; + identityProfileRequirements: any; + /** + * @returns {DynamicPolicy} + */ + build(): DynamicPolicy; +} +declare namespace DynamicPolicyBuilder { + export { Constraints }; +} +import WantedAttribute = require("./wanted.attribute"); +import DynamicPolicy = require("./dynamic.policy"); +type Constraints = import('./constraints'); diff --git a/types/src/dynamic_sharing_service/policy/dynamic.policy.d.ts b/types/src/dynamic_sharing_service/policy/dynamic.policy.d.ts new file mode 100644 index 000000000..086380b90 --- /dev/null +++ b/types/src/dynamic_sharing_service/policy/dynamic.policy.d.ts @@ -0,0 +1,39 @@ +export = DynamicPolicy; +declare class DynamicPolicy { + /** + * @param {WantedAttribute[]} wantedAttributes - array of attributes to be requested. + * @param {number[]} wantedAuthTypes - auth types represents the authentication type to be used. + * @param {boolean} wantedRememberMe + * @param {object} identityProfileRequirements + */ + constructor(wantedAttributes: WantedAttribute[], wantedAuthTypes: number[], wantedRememberMe?: boolean, identityProfileRequirements?: object); + /** @private */ + private wantedAttributes; + /** @private */ + private wantedAuthTypes; + /** @private */ + private wantedRememberMe; + /** @private */ + private identityProfileRequirements; + /** + * @returns {WantedAttribute[]} array of attributes to be requested. + */ + getWantedAttributes(): WantedAttribute[]; + /** + * @returns {number[]} auth types represents the authentication type to be used. + */ + getWantedAuthTypes(): number[]; + /** + * @returns {boolean} + */ + getWantedRememberMe(): boolean; + /** + * @return {Object} + */ + getIdentityProfileRequirements(): any; + /** + * @returns {Object} data for JSON.stringify() + */ + toJSON(): any; +} +import WantedAttribute = require("./wanted.attribute"); diff --git a/types/src/dynamic_sharing_service/policy/source.constraint.builder.d.ts b/types/src/dynamic_sharing_service/policy/source.constraint.builder.d.ts new file mode 100644 index 000000000..bcafd937a --- /dev/null +++ b/types/src/dynamic_sharing_service/policy/source.constraint.builder.d.ts @@ -0,0 +1,43 @@ +export = SourceConstraintBuilder; +declare class SourceConstraintBuilder { + /** @private */ + private anchors; + /** @private */ + private softPreference; + /** + * @typedef {import('./wanted.anchor')} WantedAnchor + * + * @param {WantedAnchor} anchor + */ + withAnchor(anchor: import("./wanted.anchor")): this; + /** + * @param {boolean} softPreference + */ + withSoftPreference(softPreference?: boolean): this; + /** + * @param {string} value + * @param {string} subType + */ + withAnchorByValue(value: string, subType?: string): this; + /** + * @param {string} subType + */ + withPassport(subType?: string): this; + /** + * @param {string} subType + */ + withDrivingLicence(subType?: string): this; + /** + * @param {string} subType + */ + withNationalId(subType?: string): this; + /** + * @param {string} subType + */ + withPasscard(subType?: string): this; + /** + * @returns {SourceConstraint} + */ + build(): SourceConstraint; +} +import SourceConstraint = require("./source.constraint"); diff --git a/types/src/dynamic_sharing_service/policy/source.constraint.d.ts b/types/src/dynamic_sharing_service/policy/source.constraint.d.ts new file mode 100644 index 000000000..298e37167 --- /dev/null +++ b/types/src/dynamic_sharing_service/policy/source.constraint.d.ts @@ -0,0 +1,17 @@ +export = SourceConstraint; +declare class SourceConstraint { + /** + * @param {WantedAnchor[]} anchors + * @param {boolean} softPreference + */ + constructor(anchors: WantedAnchor[], softPreference?: boolean); + /** @private */ + private anchors; + /** @private */ + private softPreference; + /** + * @returns {Object} data for JSON.stringify() + */ + toJSON(): any; +} +import WantedAnchor = require("./wanted.anchor"); diff --git a/types/src/dynamic_sharing_service/policy/wanted.anchor.builder.d.ts b/types/src/dynamic_sharing_service/policy/wanted.anchor.builder.d.ts new file mode 100644 index 000000000..053382fe6 --- /dev/null +++ b/types/src/dynamic_sharing_service/policy/wanted.anchor.builder.d.ts @@ -0,0 +1,18 @@ +export = WantedAnchorBuilder; +declare class WantedAnchorBuilder { + /** + * @param {string} value + */ + withValue(value: string): this; + value: string; + /** + * @param {string} subType + */ + withSubType(subType: string): this; + subType: string; + /** + * @returns {WantedAnchor} + */ + build(): WantedAnchor; +} +import WantedAnchor = require("./wanted.anchor"); diff --git a/types/src/dynamic_sharing_service/policy/wanted.anchor.d.ts b/types/src/dynamic_sharing_service/policy/wanted.anchor.d.ts new file mode 100644 index 000000000..547b94d2b --- /dev/null +++ b/types/src/dynamic_sharing_service/policy/wanted.anchor.d.ts @@ -0,0 +1,16 @@ +export = WantedAnchor; +declare class WantedAnchor { + /** + * @param {string} value + * @param {string} subType + */ + constructor(value: string, subType?: string); + /** @private */ + private value; + /** @private */ + private subType; + /** + * @returns {Object} data for JSON.stringify() + */ + toJSON(): any; +} diff --git a/types/src/dynamic_sharing_service/policy/wanted.attribute.builder.d.ts b/types/src/dynamic_sharing_service/policy/wanted.attribute.builder.d.ts new file mode 100644 index 000000000..76b49104b --- /dev/null +++ b/types/src/dynamic_sharing_service/policy/wanted.attribute.builder.d.ts @@ -0,0 +1,30 @@ +export = WantedAttributeBuilder; +declare class WantedAttributeBuilder { + /** + * @param {string} name + */ + withName(name: string): this; + name: string; + /** + * @param {string} derivation + */ + withDerivation(derivation: string): this; + derivation: string; + /** + * @typedef {import('./constraints')} Constraints + * + * @param {Constraints} constraints + */ + withConstraints(constraints: import("./constraints")): this; + constraints: import("./constraints"); + /** + * @param {boolean} acceptSelfAsserted + */ + withAcceptSelfAsserted(acceptSelfAsserted?: boolean): this; + acceptSelfAsserted: boolean; + /** + * @returns {WantedAttribute} + */ + build(): WantedAttribute; +} +import WantedAttribute = require("./wanted.attribute"); diff --git a/types/src/dynamic_sharing_service/policy/wanted.attribute.d.ts b/types/src/dynamic_sharing_service/policy/wanted.attribute.d.ts new file mode 100644 index 000000000..501af454d --- /dev/null +++ b/types/src/dynamic_sharing_service/policy/wanted.attribute.d.ts @@ -0,0 +1,52 @@ +export = WantedAttribute; +declare class WantedAttribute { + /** + * @param {string} name + * @param {string|null} derivation + * @param {boolean|null} acceptSelfAsserted + * @param {Constraints|null} constraints + */ + constructor(name: string, derivation?: string | null, acceptSelfAsserted?: boolean | null, constraints?: Constraints | null); + /** @private */ + private name; + /** @private */ + private derivation; + /** @private */ + private acceptSelfAsserted; + /** @private */ + private constraints; + /** + * Name identifying the WantedAttribute + * + * @returns {string} + */ + getName(): string; + /** + * Additional derived criteria. + * + * @returns {string} + */ + getDerivation(): string; + /** + * List of constraints to add to an attribute. + * + * If you do not provide any particular constraints, Yoti will provide you with the + * information from the most recently added source. + * + * @returns {Constraints} + */ + getConstraints(): Constraints; + /** + * Accept self asserted attributes. + * + * These are attributes that have been self-declared, and not verified by Yoti. + * + * @returns {boolean} + */ + getAcceptSelfAsserted(): boolean; + /** + * @returns {Object} data for JSON.stringify() + */ + toJSON(): any; +} +import Constraints = require("./constraints"); diff --git a/types/src/dynamic_sharing_service/share.url.result.d.ts b/types/src/dynamic_sharing_service/share.url.result.d.ts new file mode 100644 index 000000000..302263d15 --- /dev/null +++ b/types/src/dynamic_sharing_service/share.url.result.d.ts @@ -0,0 +1,23 @@ +export = ShareUrlResult; +declare class ShareUrlResult { + /** + * @param {Object} response + */ + constructor(response: any); + /** @private */ + private shareUrl; + /** @private */ + private refId; + /** + * The URL that the 3rd party should use for the share. + * + * @returns {string} The share URL + */ + getShareUrl(): string; + /** + * Get the Yoti reference id for the share. + * + * @returns {string} reference id for the share + */ + getRefId(): string; +} diff --git a/types/src/idv_service/idv.constants.d.ts b/types/src/idv_service/idv.constants.d.ts new file mode 100644 index 000000000..4d6a0748b --- /dev/null +++ b/types/src/idv_service/idv.constants.d.ts @@ -0,0 +1,54 @@ +declare const _exports: Readonly<{ + ID_DOCUMENT_AUTHENTICITY: "ID_DOCUMENT_AUTHENTICITY"; + ID_DOCUMENT_TEXT_DATA_CHECK: "ID_DOCUMENT_TEXT_DATA_CHECK"; + SUPPLEMENTARY_DOCUMENT_TEXT_DATA_CHECK: "SUPPLEMENTARY_DOCUMENT_TEXT_DATA_CHECK"; + ID_DOCUMENT_TEXT_DATA_EXTRACTION: "ID_DOCUMENT_TEXT_DATA_EXTRACTION"; + SUPPLEMENTARY_DOCUMENT_TEXT_DATA_EXTRACTION: "SUPPLEMENTARY_DOCUMENT_TEXT_DATA_EXTRACTION"; + ID_DOCUMENT_FACE_MATCH: "ID_DOCUMENT_FACE_MATCH"; + ID_DOCUMENT_COMPARISON: "ID_DOCUMENT_COMPARISON"; + THIRD_PARTY_IDENTITY: "THIRD_PARTY_IDENTITY"; + THIRD_PARTY_IDENTITY_FRAUD_1: "THIRD_PARTY_IDENTITY_FRAUD_1"; + WATCHLIST_SCREENING: "WATCHLIST_SCREENING"; + WATCHLIST_ADVANCED_CA: "WATCHLIST_ADVANCED_CA"; + FACE_COMPARISON: "FACE_COMPARISON"; + ADVERSE_MEDIA: "ADVERSE-MEDIA"; + SANCTIONS: "SANCTIONS"; + FACE_CAPTURE: "FACE_CAPTURE"; + LIVENESS: "LIVENESS"; + ZOOM: "ZOOM"; + STATIC: "STATIC"; + CAMERA: "CAMERA"; + CAMERA_AND_UPLOAD: "CAMERA_AND_UPLOAD"; + RESOURCE_UPDATE: "RESOURCE_UPDATE"; + TASK_COMPLETION: "TASK_COMPLETION"; + CHECK_COMPLETION: "CHECK_COMPLETION"; + SESSION_COMPLETION: "SESSION_COMPLETION"; + ALWAYS: "ALWAYS"; + FALLBACK: "FALLBACK"; + NEVER: "NEVER"; + ID_DOCUMENT: "ID_DOCUMENT"; + SUPPLEMENTARY_DOCUMENT: "SUPPLEMENTARY_DOCUMENT"; + ORTHOGONAL_RESTRICTIONS: "ORTHOGONAL_RESTRICTIONS"; + DOCUMENT_RESTRICTIONS: "DOCUMENT_RESTRICTIONS"; + INCLUSION_WHITELIST: "WHITELIST"; + INCLUSION_BLACKLIST: "BLACKLIST"; + DESIRED: "DESIRED"; + IGNORE: "IGNORE"; + PROOF_OF_ADDRESS: "PROOF_OF_ADDRESS"; + BASIC: "BASIC"; + BEARER: "BEARER"; + WITH_YOTI_ACCOUNT: "WITH_YOTI_ACCOUNT"; + WITH_CUSTOM_ACCOUNT: "WITH_CUSTOM_ACCOUNT"; + TYPE_LIST: "TYPE_LIST"; + PROFILE: "PROFILE"; + EXACT: "EXACT"; + FUZZY: "FUZZY"; + GENERIC: "GENERIC"; + RECLASSIFICATION: "RECLASSIFICATION"; + EARLY: "EARLY"; + JUST_IN_TIME: "JUST_IN_TIME"; + END_USER: "END_USER"; + RELYING_BUSINESS: "RELYING_BUSINESS"; + IBV: "IBV"; +}>; +export = _exports; diff --git a/types/src/idv_service/idv.error.d.ts b/types/src/idv_service/idv.error.d.ts new file mode 100644 index 000000000..85f959139 --- /dev/null +++ b/types/src/idv_service/idv.error.d.ts @@ -0,0 +1,34 @@ +export = IDVError; +/** + * Signals that a problem occurred in a Yoti IDV call + * + * @class IDVError + */ +declare class IDVError extends Error { + constructor(error: any); + /** @private */ + private response; + /** + * @returns {number|null} + */ + getResponseStatusCode(): number | null; + /** + * @returns {string|object|null} The parsed response body. + */ + getResponseBody(): string | object | null; +} +declare namespace IDVError { + export { ResponseBody, Response, APIError }; +} +type ResponseBody = { + message?: string; + code?: string; + errors?: any[]; +}; +type Response = { + body?: ResponseBody; +}; +type APIError = { + response?: Response; + message?: string; +}; diff --git a/types/src/idv_service/idv.service.d.ts b/types/src/idv_service/idv.service.d.ts new file mode 100644 index 000000000..969724e87 --- /dev/null +++ b/types/src/idv_service/idv.service.d.ts @@ -0,0 +1,103 @@ +export = IDVService; +/** + * Service Class to handle interactions with the IDV API + * + * @class IDVService + */ +declare class IDVService { + /** + * @param {string} sdkId + * @param {string|Buffer} pem + * @param {{apiUrl?: string}} options + */ + constructor(sdkId: string, pem: string | Buffer, { apiUrl }?: { + apiUrl?: string; + }); + /** @protected */ + protected sdkId: string; + /** @protected */ + protected pem: string | Buffer; + /** @protected */ + protected apiUrl: string; + /** + * Uses the supplied session specification to create a session + * + * @param {SessionSpecification} sessionSpecification + * + * @returns {Promise} + */ + createSession(sessionSpecification: SessionSpecification): Promise; + /** + * Retrieves the current state of a given session + * + * @param {string} sessionId + * + * @returns {Promise} + */ + getSession(sessionId: string): Promise; + /** + * Deletes a session and all of its associated content + * + * @param {string} sessionId + * + * @returns {Promise} + */ + deleteSession(sessionId: string): Promise; + /** + * Retrieves {@link Media} content for a given session and media ID + * + * @param {string} sessionId + * @param {string} mediaId + * + * @returns {Promise} + */ + getMediaContent(sessionId: string, mediaId: string): Promise; + /** + * Deletes media content for a given session and media ID + * + * @param {string} sessionId + * @param {string} mediaId + * + * @returns {Promise} + */ + deleteMediaContent(sessionId: string, mediaId: string): Promise; + /** + * Gets a list of supported documents. + * + * @param {boolean} includeNonLatin + * + * @returns {Promise} + */ + getSupportedDocuments(includeNonLatin: boolean): Promise; + /** + * Creates a face capture resource + * @param {string} sessionId + * @param {CreateFaceCaptureResourcePayload} createFaceCaptureResourcePayload + * + * @returns {Promise} + */ + createFaceCaptureResource(sessionId: string, createFaceCaptureResourcePayload: CreateFaceCaptureResourcePayload): Promise; + /** + * Uploads a face capture image + * @param {string} sessionId + * @param {string} resourceId + * @param {UploadFaceCaptureImagePayload} uploadFaceCaptureImagePayload + * + */ + uploadFaceCaptureImage(sessionId: string, resourceId: string, uploadFaceCaptureImagePayload: UploadFaceCaptureImagePayload): Promise; + /** + * @param {string} sessionId + * + * @returns {Promise} + */ + getSessionConfiguration(sessionId: string): Promise; +} +import SessionSpecification = require("./session/create/session.specification"); +import CreateSessionResult = require("./session/create/create.session.result"); +import GetSessionResult = require("./session/retrieve/get.session.result"); +import Media = require("../data_type/media"); +import SupportedDocumentsResponse = require("./support/supported.documents.response"); +import CreateFaceCaptureResourcePayload = require("./session/create/face_capture/create.face.capture.resource.payload"); +import CreateFaceCaptureResourceResponse = require("./session/retrieve/create.face.capture.resource.response"); +import UploadFaceCaptureImagePayload = require("./session/create/face_capture/upload.face.capture.image.payload"); +import SessionConfigurationResponse = require("./session/retrieve/configuration/session.configuration.response"); diff --git a/types/src/idv_service/index.d.ts b/types/src/idv_service/index.d.ts new file mode 100644 index 000000000..137906650 --- /dev/null +++ b/types/src/idv_service/index.d.ts @@ -0,0 +1,30 @@ +import IDVService = require("./idv.service"); +import IDVConstants = require("./idv.constants"); +import SessionSpecificationBuilder = require("./session/create/session.specification.builder"); +import NotificationConfigBuilder = require("./session/create/notification.config.builder"); +import SdkConfigBuilder = require("./session/create/sdk.config.builder"); +import RequestedDocumentAuthenticityCheckBuilder = require("./session/create/check/requested.document.authenticity.check.builder"); +import RequestedIdDocumentComparisonCheckBuilder = require("./session/create/check/requested.id.document.comparison.check.builder"); +import RequestedThirdPartyIdentityCheckBuilder = require("./session/create/check/requested.third.party.identity.check.builder"); +import RequestedWatchlistScreeningCheckBuilder = require("./session/create/check/requested.watchlist.screening.check.builder"); +import RequestedWatchlistAdvancedCaCheckBuilder = require("./session/create/check/requested.watchlist.advanced.ca.check.builder"); +import RequestedFaceMatchCheckBuilder = require("./session/create/check/requested.face.match.check.builder"); +import RequestedFaceComparisonCheckBuilder = require("./session/create/check/requested.face.comparison.check.builder"); +import RequestedLivenessCheckBuilder = require("./session/create/check/requested.liveness.check.builder"); +import RequestedTextExtractionTaskBuilder = require("./session/create/task/requested.text.extraction.task.builder"); +import RequestedSupplementaryDocTextExtractionTaskBuilder = require("./session/create/task/requested.supplementary.doc.text.extraction.task.builder"); +import RequiredIdDocumentBuilder = require("./session/create/filters/required.id.document.builder"); +import RequiredSupplementaryDocumentBuilder = require("./session/create/filters/required.supplementary.document.builder"); +import DocumentRestrictionsFilterBuilder = require("./session/create/filters/document/document.restrictions.filter.builder"); +import DocumentRestrictionBuilder = require("./session/create/filters/document/document.restriction.builder"); +import OrthogonalRestrictionsFilterBuilder = require("./session/create/filters/orthogonal/orthogonal.restrictions.filter.builder"); +import ProofOfAddressObjectiveBuilder = require("./session/create/objective/proof.of.address.objective.builder"); +import RequestedYotiAccountWatchlistAdvancedCaConfigBuilder = require("./session/create/check/requested.yoti.account.watchlist.advanced.ca.config.builder"); +import RequestedCustomAccountWatchlistAdvancedCaConfigBuilder = require("./session/create/check/requested.custom.account.watchlist.advanced.ca.config.builder"); +import RequestedExactMatchingStrategyBuilder = require("./session/create/check/requested.exact.matching.strategy.builder"); +import RequestedFuzzyMatchingStrategyBuilder = require("./session/create/check/requested.fuzzy.matching.strategy.builder"); +import RequestedSearchProfileSourcesBuilder = require("./session/create/check/requested.search.profile.sources.builder"); +import RequestedTypeListSourcesBuilder = require("./session/create/check/requested.type.list.sources.builder"); +import CreateFaceCaptureResourcePayloadBuilder = require("./session/create/face_capture/create.face.capture.resource.payload.builder"); +import UploadFaceCaptureImagePayloadBuilder = require("./session/create/face_capture/upload.face.capture.image.payload.builder"); +export { IDVService, IDVConstants, SessionSpecificationBuilder, NotificationConfigBuilder, SdkConfigBuilder, RequestedDocumentAuthenticityCheckBuilder, RequestedIdDocumentComparisonCheckBuilder, RequestedThirdPartyIdentityCheckBuilder, RequestedWatchlistScreeningCheckBuilder, RequestedWatchlistAdvancedCaCheckBuilder, RequestedFaceMatchCheckBuilder, RequestedFaceComparisonCheckBuilder, RequestedLivenessCheckBuilder, RequestedTextExtractionTaskBuilder, RequestedSupplementaryDocTextExtractionTaskBuilder, RequiredIdDocumentBuilder, RequiredSupplementaryDocumentBuilder, DocumentRestrictionsFilterBuilder, DocumentRestrictionBuilder, OrthogonalRestrictionsFilterBuilder, ProofOfAddressObjectiveBuilder, RequestedYotiAccountWatchlistAdvancedCaConfigBuilder, RequestedCustomAccountWatchlistAdvancedCaConfigBuilder, RequestedExactMatchingStrategyBuilder, RequestedFuzzyMatchingStrategyBuilder, RequestedSearchProfileSourcesBuilder, RequestedTypeListSourcesBuilder, CreateFaceCaptureResourcePayloadBuilder, UploadFaceCaptureImagePayloadBuilder }; diff --git a/types/src/idv_service/session/create/check/requested.ca.matching.strategy.d.ts b/types/src/idv_service/session/create/check/requested.ca.matching.strategy.d.ts new file mode 100644 index 000000000..5926d3039 --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.ca.matching.strategy.d.ts @@ -0,0 +1,10 @@ +export = RequestedCaMatchingStrategy; +/** + * + * @class RequestedCaMatchingStrategy + */ +declare class RequestedCaMatchingStrategy { + constructor(type: any); + /** @protected */ + protected type: any; +} diff --git a/types/src/idv_service/session/create/check/requested.ca.sources.d.ts b/types/src/idv_service/session/create/check/requested.ca.sources.d.ts new file mode 100644 index 000000000..76ce4fbde --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.ca.sources.d.ts @@ -0,0 +1,10 @@ +export = RequestedCaSources; +/** + * + * @class RequestedCaSources + */ +declare class RequestedCaSources { + constructor(type: any); + /** @protected */ + protected type: any; +} diff --git a/types/src/idv_service/session/create/check/requested.check.d.ts b/types/src/idv_service/session/create/check/requested.check.d.ts new file mode 100644 index 000000000..eff97f5ec --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.check.d.ts @@ -0,0 +1,23 @@ +export = RequestedCheck; +/** + * Requests creation of a Check to be performed on a document + * + * @class RequestedCheck + */ +declare class RequestedCheck { + /** + * @param {string} type + * The type of the Check to create + * @param {*} config + * The configuration to apply to the Check + */ + constructor(type: string, config: any); + /** @private */ + private type; + /** @private */ + private config; + /** + * @returns {Object} data for JSON.stringify() + */ + toJSON(): any; +} diff --git a/types/src/idv_service/session/create/check/requested.custom.account.watchlist.advanced.ca.config.builder.d.ts b/types/src/idv_service/session/create/check/requested.custom.account.watchlist.advanced.ca.config.builder.d.ts new file mode 100644 index 000000000..2d6d10b79 --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.custom.account.watchlist.advanced.ca.config.builder.d.ts @@ -0,0 +1,51 @@ +export = RequestedCustomAccountWatchlistAdvancedCaConfigBuilder; +/** + * Builder to assist creation of {@link RequestedCustomAccountWatchlistAdvancedCaConfig}. + * + * @class RequestedWatchlistScreeningConfig + */ +declare class RequestedCustomAccountWatchlistAdvancedCaConfigBuilder extends RequestedWatchlistAdvancedCaConfigBuilder { + /** + * Sets monitoring used for custom account watchlist advanced ca + * + * @param apiKey {string} + * + * @returns {this} + */ + withApiKey(apiKey: string): this; + apiKey: string; + /** + * Sets monitoring used for custom account watchlist advanced ca + * + * @param monitoring {boolean} + * + * @returns {this} + */ + withMonitoring(monitoring: boolean): this; + monitoring: boolean; + /** + * Sets tags used for custom account watchlist advanced ca + * + * @param tags {object} + * + * @returns {this} + */ + withTags(tags: object): this; + tags: any; + /** + * Sets monitoring used for custom account watchlist advanced ca + * + * @param clientRef {string} + * + * @returns {this} + */ + withClientRef(clientRef: string): this; + clientRef: string; + /** + * + * @return {RequestedCustomAccountWatchlistAdvancedCaConfig} + */ + build(): RequestedCustomAccountWatchlistAdvancedCaConfig; +} +import RequestedWatchlistAdvancedCaConfigBuilder = require("./requested.watchlist.advanced.ca.config.builder"); +import RequestedCustomAccountWatchlistAdvancedCaConfig = require("./requested.custom.account.watchlist.advanced.ca.config"); diff --git a/types/src/idv_service/session/create/check/requested.custom.account.watchlist.advanced.ca.config.d.ts b/types/src/idv_service/session/create/check/requested.custom.account.watchlist.advanced.ca.config.d.ts new file mode 100644 index 000000000..75016f7b1 --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.custom.account.watchlist.advanced.ca.config.d.ts @@ -0,0 +1,41 @@ +export = RequestedCustomAccountWatchlistAdvancedCaConfig; +/** + * @typedef {import('./requested.watchlist.advanced.ca.check')} RequestedWatchlistAdvancedCaCheck + * @typedef {import('./requested.ca.sources')} RequestedCaSources + * @typedef {import('./requested.ca.matching.strategy')} RequestedCaMatchingStrategy + */ +/** + * The configuration applied when creating a {@link RequestedWatchlistAdvancedCaCheck} + * with custom account + * + * @class RequestedCustomAccountWatchlistAdvancedCaConfig + */ +declare class RequestedCustomAccountWatchlistAdvancedCaConfig extends RequestedWatchlistAdvancedCaConfig { + /** + * + * @param removeDeceased {boolean} + * @param shareUrl {boolean} + * @param sources {RequestedCaSources} + * @param matchingStrategy {RequestedCaMatchingStrategy} + * @param apiKey {string} + * @param monitoring {boolean} + * @param tags {object} + * @param clientRef {string} + */ + constructor(removeDeceased: boolean, shareUrl: boolean, sources: RequestedCaSources, matchingStrategy: RequestedCaMatchingStrategy, apiKey: string, monitoring: boolean, tags: object, clientRef: string); + /** @private */ + private apiKey; + /** @private */ + private monitoring; + /** @private */ + private tags; + /** @private */ + private clientRef; +} +declare namespace RequestedCustomAccountWatchlistAdvancedCaConfig { + export { RequestedWatchlistAdvancedCaCheck, RequestedCaSources, RequestedCaMatchingStrategy }; +} +import RequestedWatchlistAdvancedCaConfig = require("./requested.watchlist.advanced.ca.config"); +type RequestedWatchlistAdvancedCaCheck = import('./requested.watchlist.advanced.ca.check'); +type RequestedCaSources = import('./requested.ca.sources'); +type RequestedCaMatchingStrategy = import('./requested.ca.matching.strategy'); diff --git a/types/src/idv_service/session/create/check/requested.document.authenticity.check.builder.d.ts b/types/src/idv_service/session/create/check/requested.document.authenticity.check.builder.d.ts new file mode 100644 index 000000000..204c063fb --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.document.authenticity.check.builder.d.ts @@ -0,0 +1,36 @@ +export = RequestedDocumentAuthenticityCheckBuilder; +/** + * Builder to assist the creation of {@link RequestedDocumentAuthenticityCheck}. + * + * @class RequestedDocumentAuthenticityCheckBuilder + */ +declare class RequestedDocumentAuthenticityCheckBuilder { + /** + * Requires that a manual follow-up check is always performed + * + * @returns {this} + */ + withManualCheckAlways(): this; + manualCheck: "ALWAYS" | "FALLBACK" | "NEVER"; + /** + * Requires that a manual follow-up check is performed only on failed Checks, + * and those with a low level of confidence + * + * @returns {this} + */ + withManualCheckFallback(): this; + /** + * Requires that only an automated Check is performed. No manual follow-up + * Check will ever be initiated + * + * @returns {this} + */ + withManualCheckNever(): this; + /** + * Build a {@link RequestedDocumentAuthenticityCheck} using the values supplied to the builder + * + * @returns {RequestedDocumentAuthenticityCheck} + */ + build(): RequestedDocumentAuthenticityCheck; +} +import RequestedDocumentAuthenticityCheck = require("./requested.document.authenticity.check"); diff --git a/types/src/idv_service/session/create/check/requested.document.authenticity.check.d.ts b/types/src/idv_service/session/create/check/requested.document.authenticity.check.d.ts new file mode 100644 index 000000000..53405cc8e --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.document.authenticity.check.d.ts @@ -0,0 +1,14 @@ +export = RequestedDocumentAuthenticityCheck; +/** + * Requests creation of a DocumentAuthenticityCheck + * + * @class RequestedDocumentAuthenticityCheck + */ +declare class RequestedDocumentAuthenticityCheck extends RequestedCheck { + /** + * @param {RequestedDocumentAuthenticityConfig} config + */ + constructor(config: RequestedDocumentAuthenticityConfig); +} +import RequestedCheck = require("./requested.check"); +import RequestedDocumentAuthenticityConfig = require("./requested.document.authenticity.config"); diff --git a/types/src/idv_service/session/create/check/requested.document.authenticity.config.d.ts b/types/src/idv_service/session/create/check/requested.document.authenticity.config.d.ts new file mode 100644 index 000000000..97f9dc066 --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.document.authenticity.config.d.ts @@ -0,0 +1,18 @@ +export = RequestedDocumentAuthenticityConfig; +/** + * The configuration applied when creating a DocumentAuthenticityCheck + * + * @class RequestedDocumentAuthenticityConfig + */ +declare class RequestedDocumentAuthenticityConfig { + /** + * @param {string} manualCheck + */ + constructor(manualCheck: string); + /** @private */ + private manualCheck; + /** + * @returns {Object} data for JSON.stringify() + */ + toJSON(): any; +} diff --git a/types/src/idv_service/session/create/check/requested.exact.matching.strategy.builder.d.ts b/types/src/idv_service/session/create/check/requested.exact.matching.strategy.builder.d.ts new file mode 100644 index 000000000..3ff3b1fde --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.exact.matching.strategy.builder.d.ts @@ -0,0 +1,15 @@ +export = RequestedExactMatchingStrategyBuilder; +/** + * + * Builder to assist creation of {@link RequestedExactMatchingStrategy}. + * + * @class RequestedExactMatchingStrategyBuilder + */ +declare class RequestedExactMatchingStrategyBuilder { + /** + * + * @return {RequestedExactMatchingStrategy} + */ + build(): RequestedExactMatchingStrategy; +} +import RequestedExactMatchingStrategy = require("./requested.exact.matching.strategy"); diff --git a/types/src/idv_service/session/create/check/requested.exact.matching.strategy.d.ts b/types/src/idv_service/session/create/check/requested.exact.matching.strategy.d.ts new file mode 100644 index 000000000..d88b84594 --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.exact.matching.strategy.d.ts @@ -0,0 +1,13 @@ +export = RequestedExactMatchingStrategy; +/** + * + * @class RequestedExactMatchingStrategy + */ +declare class RequestedExactMatchingStrategy extends RequestedCaMatchingStrategy { + constructor(); + /** + * @returns {Object} data for JSON.stringify() + */ + toJSON(): any; +} +import RequestedCaMatchingStrategy = require("./requested.ca.matching.strategy"); diff --git a/types/src/idv_service/session/create/check/requested.face.comparison.check.builder.d.ts b/types/src/idv_service/session/create/check/requested.face.comparison.check.builder.d.ts new file mode 100644 index 000000000..71c65c375 --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.face.comparison.check.builder.d.ts @@ -0,0 +1,23 @@ +export = RequestedFaceComparisonCheckBuilder; +/** + * Builder to assist creation of {@link RequestedFaceComparisonCheck}. + * + * @class RequestedFaceComparisonCheckBuilder + */ +declare class RequestedFaceComparisonCheckBuilder { + /** + * Requires that only an automated Check is performed. No manual follow-up + * Check will ever be initiated + * + * @returns {this} + */ + withManualCheckNever(): this; + manualCheck: "NEVER"; + /** + * Build a {@link RequestedFaceComparisonCheck} using the values supplied to the builder + * + * @returns {RequestedFaceComparisonCheck} + */ + build(): RequestedFaceComparisonCheck; +} +import RequestedFaceComparisonCheck = require("./requested.face.comparison.check"); diff --git a/types/src/idv_service/session/create/check/requested.face.comparison.check.d.ts b/types/src/idv_service/session/create/check/requested.face.comparison.check.d.ts new file mode 100644 index 000000000..8d27eafff --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.face.comparison.check.d.ts @@ -0,0 +1,14 @@ +export = RequestedFaceComparisonCheck; +/** + * Requests creation of a FaceComparisonCheck + * + * @class RequestedFaceComparisonCheck + */ +declare class RequestedFaceComparisonCheck extends RequestedCheck { + /** + * @param {RequestedFaceComparisonCheckConfig} config + */ + constructor(config: RequestedFaceComparisonCheckConfig); +} +import RequestedCheck = require("./requested.check"); +import RequestedFaceComparisonCheckConfig = require("./requested.face.comparison.config"); diff --git a/types/src/idv_service/session/create/check/requested.face.comparison.config.d.ts b/types/src/idv_service/session/create/check/requested.face.comparison.config.d.ts new file mode 100644 index 000000000..0104acd33 --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.face.comparison.config.d.ts @@ -0,0 +1,19 @@ +export = RequestedFaceComparisonConfig; +/** + * The configuration applied when creating a FaceComparisonCheck + * + * @class RequestedFaceComparisonConfig + */ +declare class RequestedFaceComparisonConfig { + /** + * @param {string} manualCheck + * The value for a manual check for a given face match. + */ + constructor(manualCheck: string); + /** @private */ + private manualCheck; + /** + * @returns {Object} data for JSON.stringify() + */ + toJSON(): any; +} diff --git a/types/src/idv_service/session/create/check/requested.face.match.check.builder.d.ts b/types/src/idv_service/session/create/check/requested.face.match.check.builder.d.ts new file mode 100644 index 000000000..3894f664a --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.face.match.check.builder.d.ts @@ -0,0 +1,36 @@ +export = RequestedFaceMatchCheckBuilder; +/** + * Builder to assist creation of {@link RequestedFaceMatchCheck}. + * + * @class RequestedFaceMatchCheckBuilder + */ +declare class RequestedFaceMatchCheckBuilder { + /** + * Requires that a manual follow-up check is always performed + * + * @returns {this} + */ + withManualCheckAlways(): this; + manualCheck: "ALWAYS" | "FALLBACK" | "NEVER"; + /** + * Requires that a manual follow-up check is performed only on failed Checks, + * and those with a low level of confidence + * + * @returns {this} + */ + withManualCheckFallback(): this; + /** + * Requires that only an automated Check is performed. No manual follow-up + * Check will ever be initiated + * + * @returns {this} + */ + withManualCheckNever(): this; + /** + * Build a {@link RequestedFaceMatchCheck} using the values supplied to the builder + * + * @returns {RequestedFaceMatchCheck} + */ + build(): RequestedFaceMatchCheck; +} +import RequestedFaceMatchCheck = require("./requested.face.match.check"); diff --git a/types/src/idv_service/session/create/check/requested.face.match.check.d.ts b/types/src/idv_service/session/create/check/requested.face.match.check.d.ts new file mode 100644 index 000000000..017e8ab69 --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.face.match.check.d.ts @@ -0,0 +1,14 @@ +export = RequestedFaceMatchCheck; +/** + * Requests creation of a FaceMatchCheck + * + * @class RequestedFaceMatchCheck + */ +declare class RequestedFaceMatchCheck extends RequestedCheck { + /** + * @param {RequestedFaceMatchCheckConfig} config + */ + constructor(config: RequestedFaceMatchCheckConfig); +} +import RequestedCheck = require("./requested.check"); +import RequestedFaceMatchCheckConfig = require("./requested.face.match.config"); diff --git a/types/src/idv_service/session/create/check/requested.face.match.config.d.ts b/types/src/idv_service/session/create/check/requested.face.match.config.d.ts new file mode 100644 index 000000000..32bebc2ef --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.face.match.config.d.ts @@ -0,0 +1,19 @@ +export = RequestedFaceMatchConfig; +/** + * The configuration applied when creating a FaceMatchCheck + * + * @class RequestedFaceMatchConfig + */ +declare class RequestedFaceMatchConfig { + /** + * @param {string} manualCheck + * The value for a manual check for a given face match. + */ + constructor(manualCheck: string); + /** @private */ + private manualCheck; + /** + * @returns {Object} data for JSON.stringify() + */ + toJSON(): any; +} diff --git a/types/src/idv_service/session/create/check/requested.fuzzy.matching.strategy.builder.d.ts b/types/src/idv_service/session/create/check/requested.fuzzy.matching.strategy.builder.d.ts new file mode 100644 index 000000000..828b31028 --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.fuzzy.matching.strategy.builder.d.ts @@ -0,0 +1,23 @@ +export = RequestedFuzzyMatchingStrategyBuilder; +/** + * Builder to assist creation of {@link RequestedFuzzyMatchingStrategy}. + * + * @class RequestedFuzzyMatchingStrategyBuilder + */ +declare class RequestedFuzzyMatchingStrategyBuilder { + /** + * Sets fuzziness used for matching strategy + * + * @param fuzziness {number} + * + * @returns {this} + */ + withFuzziness(fuzziness: number): this; + fuzziness: number; + /** + * + * @return {RequestedFuzzyMatchingStrategy} + */ + build(): RequestedFuzzyMatchingStrategy; +} +import RequestedFuzzyMatchingStrategy = require("./requested.fuzzy.matching.strategy"); diff --git a/types/src/idv_service/session/create/check/requested.fuzzy.matching.strategy.d.ts b/types/src/idv_service/session/create/check/requested.fuzzy.matching.strategy.d.ts new file mode 100644 index 000000000..9f938d443 --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.fuzzy.matching.strategy.d.ts @@ -0,0 +1,15 @@ +export = RequestedFuzzyMatchingStrategy; +/** + * + * @class RequestedFuzzyMatchingStrategy + */ +declare class RequestedFuzzyMatchingStrategy extends RequestedCaMatchingStrategy { + constructor(fuzziness?: number); + /** @private */ + private fuzziness; + /** + * @returns {Object} data for JSON.stringify() + */ + toJSON(): any; +} +import RequestedCaMatchingStrategy = require("./requested.ca.matching.strategy"); diff --git a/types/src/idv_service/session/create/check/requested.id.document.comparison.check.builder.d.ts b/types/src/idv_service/session/create/check/requested.id.document.comparison.check.builder.d.ts new file mode 100644 index 000000000..bb1815110 --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.id.document.comparison.check.builder.d.ts @@ -0,0 +1,10 @@ +export = RequestedIdDocumentComparisonCheckBuilder; +/** + * Builder to assist the creation of {@link RequestedIdDocumentComparisonCheck}. + * + * @class RequestedIdDocumentComparisonCheckBuilder + */ +declare class RequestedIdDocumentComparisonCheckBuilder { + build(): RequestedIdDocumentComparisonCheck; +} +import RequestedIdDocumentComparisonCheck = require("./requested.id.document.comparison.check"); diff --git a/types/src/idv_service/session/create/check/requested.id.document.comparison.check.d.ts b/types/src/idv_service/session/create/check/requested.id.document.comparison.check.d.ts new file mode 100644 index 000000000..9b17db34a --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.id.document.comparison.check.d.ts @@ -0,0 +1,12 @@ +export = RequestedIdDocumentComparisonCheck; +/** + * @class RequestedIdDocumentComparisonCheck + */ +declare class RequestedIdDocumentComparisonCheck extends RequestedCheck { + /** + * @param {RequestedIdDocumentComparisonConfig} config + */ + constructor(config: RequestedIdDocumentComparisonConfig); +} +import RequestedCheck = require("./requested.check"); +import RequestedIdDocumentComparisonConfig = require("./requested.id.document.comparison.config"); diff --git a/types/src/idv_service/session/create/check/requested.id.document.comparison.config.d.ts b/types/src/idv_service/session/create/check/requested.id.document.comparison.config.d.ts new file mode 100644 index 000000000..84d62ff4a --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.id.document.comparison.config.d.ts @@ -0,0 +1,12 @@ +export = RequestedIdDocumentComparisonConfig; +/** + * The configuration applied when creating a RequestedIdDocumentComparisonCheck + * + * @class RequestedIdDocumentComparisonConfig + */ +declare class RequestedIdDocumentComparisonConfig { + /** + * @returns {Object} data for JSON.stringify() + */ + toJSON(): any; +} diff --git a/types/src/idv_service/session/create/check/requested.liveness.check.builder.d.ts b/types/src/idv_service/session/create/check/requested.liveness.check.builder.d.ts new file mode 100644 index 000000000..ccf367981 --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.liveness.check.builder.d.ts @@ -0,0 +1,46 @@ +export = RequestedLivenessCheckBuilder; +/** + * Builder to assist the creation of {@link RequestedLivenessCheck}. + */ +declare class RequestedLivenessCheckBuilder { + /** @private */ + private maxRetries; + /** + * Sets the type to be of a ZOOM liveness check + * + * @returns {this} + */ + forZoomLiveness(): this; + /** + * Sets the type to be of a Static liveness check + * + * @returns {this} + */ + forStaticLiveness(): this; + /** + * Sets the type of the liveness check to the supplied value + * + * @param {string} livenessType + * The type of the liveness check + * + * @returns {this} + */ + forLivenessType(livenessType: string): this; + livenessType: string; + /** + * Sets the maximum number of retries allowed by the user + * + * @param {number} maxRetries + * The maximum number of retries + * + * @returns {this} + */ + withMaxRetries(maxRetries: number): this; + /** + * Builds a {@link RequestedLivenessCheck} using the values supplied to the builder + * + * @returns {RequestedLivenessCheck} + */ + build(): RequestedLivenessCheck; +} +import RequestedLivenessCheck = require("./requested.liveness.check"); diff --git a/types/src/idv_service/session/create/check/requested.liveness.check.d.ts b/types/src/idv_service/session/create/check/requested.liveness.check.d.ts new file mode 100644 index 000000000..d66d9ce77 --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.liveness.check.d.ts @@ -0,0 +1,14 @@ +export = RequestedLivenessCheck; +/** + * Requests creation of a LivenessCheck + * + * @class RequestedLivenessCheck + */ +declare class RequestedLivenessCheck extends RequestedCheck { + /** + * @param {RequestedLivenessConfig} config + */ + constructor(config: RequestedLivenessConfig); +} +import RequestedCheck = require("./requested.check"); +import RequestedLivenessConfig = require("./requested.liveness.config"); diff --git a/types/src/idv_service/session/create/check/requested.liveness.config.d.ts b/types/src/idv_service/session/create/check/requested.liveness.config.d.ts new file mode 100644 index 000000000..e973aa1ed --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.liveness.config.d.ts @@ -0,0 +1,24 @@ +export = RequestedLivenessConfig; +/** + * The configuration applied when creating a LivenessCheck + * + * @class RequestedLivenessConfig + */ +declare class RequestedLivenessConfig { + /** + * @param {number} maxRetries + * The maximum number of retries allowed by the user + * for a given liveness check + * @param {string} livenessType + * The type of the liveness check + */ + constructor(maxRetries: number, livenessType: string); + /** @private */ + private maxRetries; + /** @private */ + private livenessType; + /** + * @returns {Object} data for JSON.stringify() + */ + toJSON(): any; +} diff --git a/types/src/idv_service/session/create/check/requested.search.profile.sources.builder.d.ts b/types/src/idv_service/session/create/check/requested.search.profile.sources.builder.d.ts new file mode 100644 index 000000000..eab23c557 --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.search.profile.sources.builder.d.ts @@ -0,0 +1,23 @@ +export = RequestedSearchProfileSourcesBuilder; +/** + * Builder to assist the creation of {@link RequestedSearchProfileSources}. + * + * @class RequestedSearchProfileSourcesBuilder + */ +declare class RequestedSearchProfileSourcesBuilder { + /** + * Sets searchProfile used for sources + * + * @param searchProfile {string} + * + * @returns {this} + */ + withSearchProfile(searchProfile: string): this; + searchProfile: string; + /** + * + * @return {RequestedSearchProfileSources} + */ + build(): RequestedSearchProfileSources; +} +import RequestedSearchProfileSources = require("./requested.search.profile.sources"); diff --git a/types/src/idv_service/session/create/check/requested.search.profile.sources.d.ts b/types/src/idv_service/session/create/check/requested.search.profile.sources.d.ts new file mode 100644 index 000000000..695e464c7 --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.search.profile.sources.d.ts @@ -0,0 +1,19 @@ +export = RequestedSearchProfileSources; +/** + * + * @class RequestedSearchProfileSources + */ +declare class RequestedSearchProfileSources extends RequestedCaSources { + /** + * @param searchProfile {string} + * + */ + constructor(searchProfile: string); + /** @private */ + private searchProfile; + /** + * @returns {Object} data for JSON.stringify() + */ + toJSON(): any; +} +import RequestedCaSources = require("./requested.ca.sources"); diff --git a/types/src/idv_service/session/create/check/requested.third.party.identity.check.builder.d.ts b/types/src/idv_service/session/create/check/requested.third.party.identity.check.builder.d.ts new file mode 100644 index 000000000..0c65b2720 --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.third.party.identity.check.builder.d.ts @@ -0,0 +1,10 @@ +export = RequestedThirdPartyIdentityCheckBuilder; +/** + * Builder to assist the creation of {@link RequestedThirdPartyIdentityCheck}. + * + * @class RequestedThirdPartyIdentityCheckBuilder + */ +declare class RequestedThirdPartyIdentityCheckBuilder { + build(): RequestedThirdPartyIdentityCheck; +} +import RequestedThirdPartyIdentityCheck = require("./requested.third.party.identity.check"); diff --git a/types/src/idv_service/session/create/check/requested.third.party.identity.check.d.ts b/types/src/idv_service/session/create/check/requested.third.party.identity.check.d.ts new file mode 100644 index 000000000..36295945d --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.third.party.identity.check.d.ts @@ -0,0 +1,12 @@ +export = RequestedThirdPartyIdentityCheck; +/** + * @class RequestedThirdPartyIdentityCheck + */ +declare class RequestedThirdPartyIdentityCheck extends RequestedCheck { + /** + * @param {RequestedThirdPartyIdentityConfig} config + */ + constructor(config: RequestedThirdPartyIdentityConfig); +} +import RequestedCheck = require("./requested.check"); +import RequestedThirdPartyIdentityConfig = require("./requested.third.party.identity.config"); diff --git a/types/src/idv_service/session/create/check/requested.third.party.identity.config.d.ts b/types/src/idv_service/session/create/check/requested.third.party.identity.config.d.ts new file mode 100644 index 000000000..6511f9ab6 --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.third.party.identity.config.d.ts @@ -0,0 +1,12 @@ +export = RequestedThirdPartyIdentityConfig; +/** + * The configuration applied when creating a RequestedThirdPartyIdentityCheck + * + * @class RequestedThirdPartyIdentityConfig + */ +declare class RequestedThirdPartyIdentityConfig { + /** + * @returns {Object} data for JSON.stringify() + */ + toJSON(): any; +} diff --git a/types/src/idv_service/session/create/check/requested.type.list.sources.builder.d.ts b/types/src/idv_service/session/create/check/requested.type.list.sources.builder.d.ts new file mode 100644 index 000000000..bb6e2938f --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.type.list.sources.builder.d.ts @@ -0,0 +1,19 @@ +export = RequestedTypeListSourcesBuilder; +/** + * Builder to assist the creation of {@link RequestedTypeListSources}. + * + * @class RequestedTypeListSourcesBuilder + */ +declare class RequestedTypeListSourcesBuilder { + /** + * Sets types used for sources + * + * @param types {string[]} + * + * @returns {this} + */ + withTypes(types: string[]): this; + types: string[]; + build(): RequestedTypeListSources; +} +import RequestedTypeListSources = require("./requested.type.list.sources"); diff --git a/types/src/idv_service/session/create/check/requested.type.list.sources.d.ts b/types/src/idv_service/session/create/check/requested.type.list.sources.d.ts new file mode 100644 index 000000000..828d29b55 --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.type.list.sources.d.ts @@ -0,0 +1,19 @@ +export = RequestedTypeListSources; +/** + * + * @class RequestedSearchProfileSources + */ +declare class RequestedTypeListSources extends RequestedCaSources { + /** + * @param types {string[]} + * + */ + constructor(types?: string[]); + /** @private */ + private types; + /** + * @returns {Object} data for JSON.stringify() + */ + toJSON(): any; +} +import RequestedCaSources = require("./requested.ca.sources"); diff --git a/types/src/idv_service/session/create/check/requested.watchlist.advanced.ca.check.builder.d.ts b/types/src/idv_service/session/create/check/requested.watchlist.advanced.ca.check.builder.d.ts new file mode 100644 index 000000000..9b3b5c237 --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.watchlist.advanced.ca.check.builder.d.ts @@ -0,0 +1,19 @@ +export = RequestedWatchlistAdvancedCaCheckBuilder; +/** + * Builder to assist the creation of {@link RequestedWatchlistAdvancedCaCheck}. + * + * @class RequestedWatchlistAdvancedCaCheckBuilder + */ +declare class RequestedWatchlistAdvancedCaCheckBuilder { + /** + * + * @param config {RequestedWatchlistAdvancedCaConfig} + * + * @returns {this} + */ + withConfig(config: RequestedWatchlistAdvancedCaConfig): this; + config: RequestedWatchlistAdvancedCaConfig; + build(): RequestedWatchlistAdvancedCaCheck; +} +import RequestedWatchlistAdvancedCaConfig = require("./requested.watchlist.advanced.ca.config"); +import RequestedWatchlistAdvancedCaCheck = require("./requested.watchlist.advanced.ca.check"); diff --git a/types/src/idv_service/session/create/check/requested.watchlist.advanced.ca.check.d.ts b/types/src/idv_service/session/create/check/requested.watchlist.advanced.ca.check.d.ts new file mode 100644 index 000000000..43c4f93da --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.watchlist.advanced.ca.check.d.ts @@ -0,0 +1,12 @@ +export = RequestedWatchlistAdvancedCaCheck; +/** + * @class RequestedWatchlistAdvancedCaCheck + */ +declare class RequestedWatchlistAdvancedCaCheck extends RequestedCheck { + /** + * @param {RequestedWatchlistAdvancedCaConfig} config + */ + constructor(config: RequestedWatchlistAdvancedCaConfig); +} +import RequestedCheck = require("./requested.check"); +import RequestedWatchlistAdvancedCaConfig = require("./requested.watchlist.advanced.ca.config"); diff --git a/types/src/idv_service/session/create/check/requested.watchlist.advanced.ca.config.builder.d.ts b/types/src/idv_service/session/create/check/requested.watchlist.advanced.ca.config.builder.d.ts new file mode 100644 index 000000000..db474944b --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.watchlist.advanced.ca.config.builder.d.ts @@ -0,0 +1,53 @@ +export = RequestedWatchlistAdvancedCaConfigBuilder; +/** + * @typedef {import('./requested.watchlist.advanced.ca.config')} RequestedWatchlistAdvancedCaConfig + */ +/** + * The base Builder to assist the creation of {@link RequestedWatchlistAdvancedCaConfig}. + * + * @class RequestedWatchlistAdvancedCaConfigBuilder + */ +declare class RequestedWatchlistAdvancedCaConfigBuilder { + /** + * Sets removeDeceased used for watchlist advanced ca + * + * @param removeDeceased {boolean} + * + * @returns {this} + */ + withRemoveDeceased(removeDeceased: boolean): this; + removeDeceased: boolean; + /** + * Sets shareUrl used for watchlist advanced ca + * + * @param shareUrl {boolean} + * + * @returns {this} + */ + withShareUrl(shareUrl: boolean): this; + shareUrl: boolean; + /** + * Sets sources used for watchlist advanced ca + * + * @param sources {RequestedCaSources} + * + * @returns {this} + */ + withSources(sources: RequestedCaSources): this; + sources: RequestedCaSources; + /** + * Sets matchingStrategy used for watchlist advanced ca + * + * @param matchingStrategy {RequestedCaMatchingStrategy} + * + * @returns {this} + */ + withMatchingStrategy(matchingStrategy: RequestedCaMatchingStrategy): this; + matchingStrategy: RequestedCaMatchingStrategy; +} +declare namespace RequestedWatchlistAdvancedCaConfigBuilder { + export { RequestedWatchlistAdvancedCaConfig }; +} +import RequestedCaSources = require("./requested.ca.sources"); +import RequestedCaMatchingStrategy = require("./requested.ca.matching.strategy"); +type RequestedWatchlistAdvancedCaConfig = import('./requested.watchlist.advanced.ca.config'); diff --git a/types/src/idv_service/session/create/check/requested.watchlist.advanced.ca.config.d.ts b/types/src/idv_service/session/create/check/requested.watchlist.advanced.ca.config.d.ts new file mode 100644 index 000000000..e170db9a7 --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.watchlist.advanced.ca.config.d.ts @@ -0,0 +1,37 @@ +export = RequestedWatchlistAdvancedCaConfig; +/** + * @typedef {import('./requested.watchlist.advanced.ca.check')} RequestedWatchlistAdvancedCaCheck + */ +/** + * The base configuration applied when creating a {@link RequestedWatchlistAdvancedCaCheck} + * + * @class RequestedWatchlistAdvancedCaConfig + */ +declare class RequestedWatchlistAdvancedCaConfig { + /** + * + * @param removeDeceased {boolean} + * @param shareUrl {boolean} + * @param sources {RequestedCaSources} + * @param matchingStrategy {RequestedCaMatchingStrategy} + */ + constructor(removeDeceased: boolean, shareUrl: boolean, sources: RequestedCaSources, matchingStrategy: RequestedCaMatchingStrategy); + /** @private */ + private removeDeceased; + /** @private */ + private shareUrl; + /** @private */ + private sources; + /** @private */ + private matchingStrategy; + /** + * @returns {Object} data for JSON.stringify() + */ + toJSON(): any; +} +declare namespace RequestedWatchlistAdvancedCaConfig { + export { RequestedWatchlistAdvancedCaCheck }; +} +import RequestedCaSources = require("./requested.ca.sources"); +import RequestedCaMatchingStrategy = require("./requested.ca.matching.strategy"); +type RequestedWatchlistAdvancedCaCheck = import('./requested.watchlist.advanced.ca.check'); diff --git a/types/src/idv_service/session/create/check/requested.watchlist.screening.check.builder.d.ts b/types/src/idv_service/session/create/check/requested.watchlist.screening.check.builder.d.ts new file mode 100644 index 000000000..ffb620568 --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.watchlist.screening.check.builder.d.ts @@ -0,0 +1,32 @@ +export = RequestedWatchlistScreeningCheckBuilder; +/** + * Builder to assist the creation of {@link RequestedWatchlistScreeningCheck}. + * + * @class RequestedWatchlistScreeningCheckBuilder + */ +declare class RequestedWatchlistScreeningCheckBuilder { + /** @private */ + private categories; + /** + * Adds ADVERSE_MEDIA to the list of categories used for watchlist screening + * + * @returns {this} + */ + withAdverseMediaCategory(): this; + /** + * Adds SANCTIONS to the list of categories used for watchlist screening + * + * @returns {this} + */ + withSanctionsCategory(): this; + /** + * Adds a category to the list of categories used for watchlist screening + * + * @param {string} category + * + * @returns {this} + */ + withCategory(category: string): this; + build(): RequestedWatchlistScreeningCheck; +} +import RequestedWatchlistScreeningCheck = require("./requested.watchlist.screening.check"); diff --git a/types/src/idv_service/session/create/check/requested.watchlist.screening.check.d.ts b/types/src/idv_service/session/create/check/requested.watchlist.screening.check.d.ts new file mode 100644 index 000000000..8f7dee92d --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.watchlist.screening.check.d.ts @@ -0,0 +1,12 @@ +export = RequestedWatchlistScreeningCheck; +/** + * @class RequestedWatchlistScreeningCheck + */ +declare class RequestedWatchlistScreeningCheck extends RequestedCheck { + /** + * @param {RequestedWatchlistScreeningConfig} config + */ + constructor(config: RequestedWatchlistScreeningConfig); +} +import RequestedCheck = require("./requested.check"); +import RequestedWatchlistScreeningConfig = require("./requested.watchlist.screening.config"); diff --git a/types/src/idv_service/session/create/check/requested.watchlist.screening.config.d.ts b/types/src/idv_service/session/create/check/requested.watchlist.screening.config.d.ts new file mode 100644 index 000000000..3694d919a --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.watchlist.screening.config.d.ts @@ -0,0 +1,19 @@ +export = RequestedWatchlistScreeningConfig; +/** + * The configuration applied when creating a RequestedWatchlistScreeningCheck + * + * @class RequestedWatchlistScreeningConfig + */ +declare class RequestedWatchlistScreeningConfig { + /** + * @param {string[]} categories + * The list of categories corresponding to each watchlist screening conducted + */ + constructor(categories: string[]); + /** @private */ + private categories; + /** + * @returns {Object} data for JSON.stringify() + */ + toJSON(): any; +} diff --git a/types/src/idv_service/session/create/check/requested.yoti.account.watchlist.advanced.ca.config.builder.d.ts b/types/src/idv_service/session/create/check/requested.yoti.account.watchlist.advanced.ca.config.builder.d.ts new file mode 100644 index 000000000..1317fa4a2 --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.yoti.account.watchlist.advanced.ca.config.builder.d.ts @@ -0,0 +1,15 @@ +export = RequestedYotiAccountWatchlistAdvancedCaConfigBuilder; +/** + * Builder to assist creation of {@link RequestedYotiAccountWatchlistAdvancedCaConfig}. + * + * @class RequestedYotiAccountWatchlistAdvancedCaConfigBuilder + */ +declare class RequestedYotiAccountWatchlistAdvancedCaConfigBuilder extends RequestedWatchlistAdvancedCaConfigBuilder { + /** + * + * @return {RequestedYotiAccountWatchlistAdvancedCaConfig} + */ + build(): RequestedYotiAccountWatchlistAdvancedCaConfig; +} +import RequestedWatchlistAdvancedCaConfigBuilder = require("./requested.watchlist.advanced.ca.config.builder"); +import RequestedYotiAccountWatchlistAdvancedCaConfig = require("./requested.yoti.account.watchlist.advanced.ca.config"); diff --git a/types/src/idv_service/session/create/check/requested.yoti.account.watchlist.advanced.ca.config.d.ts b/types/src/idv_service/session/create/check/requested.yoti.account.watchlist.advanced.ca.config.d.ts new file mode 100644 index 000000000..102380bc0 --- /dev/null +++ b/types/src/idv_service/session/create/check/requested.yoti.account.watchlist.advanced.ca.config.d.ts @@ -0,0 +1,17 @@ +export = RequestedYotiAccountWatchlistAdvancedCaConfig; +/** + * @typedef {import('./requested.watchlist.advanced.ca.check')} RequestedWatchlistAdvancedCaCheck + */ +/** + * The configuration applied when creating a {@link RequestedWatchlistAdvancedCaCheck} + * with Yoti account + * + * @class RequestedYotiAccountWatchlistAdvancedCaConfig + */ +declare class RequestedYotiAccountWatchlistAdvancedCaConfig extends RequestedWatchlistAdvancedCaConfig { +} +declare namespace RequestedYotiAccountWatchlistAdvancedCaConfig { + export { RequestedWatchlistAdvancedCaCheck }; +} +import RequestedWatchlistAdvancedCaConfig = require("./requested.watchlist.advanced.ca.config"); +type RequestedWatchlistAdvancedCaCheck = import('./requested.watchlist.advanced.ca.check'); diff --git a/types/src/idv_service/session/create/create.session.result.d.ts b/types/src/idv_service/session/create/create.session.result.d.ts new file mode 100644 index 000000000..0e4b5b961 --- /dev/null +++ b/types/src/idv_service/session/create/create.session.result.d.ts @@ -0,0 +1,38 @@ +export = CreateSessionResult; +/** + * The response to a successful CreateSession call + * + * @class CreateSessionResult + */ +declare class CreateSessionResult { + /** + * @param {Object} response + * The parsed JSON response. + */ + constructor(response: any); + /** @private */ + private clientSessionTokenTtl; + /** @private */ + private clientSessionToken; + /** @private */ + private sessionId; + /** + * Returns the time-to-live (TTL) for the client session + * token for the created session + * + * @returns {number} the client session token TTL + */ + getClientSessionTokenTtl(): number; + /** + * Returns the client session token for the created session + * + * @returns {string} the client session token + */ + getClientSessionToken(): string; + /** + * Session ID of the created session + * + * @returns {string} the session id + */ + getSessionId(): string; +} diff --git a/types/src/idv_service/session/create/face_capture/create.face.capture.resource.payload.builder.d.ts b/types/src/idv_service/session/create/face_capture/create.face.capture.resource.payload.builder.d.ts new file mode 100644 index 000000000..bee3c3c3f --- /dev/null +++ b/types/src/idv_service/session/create/face_capture/create.face.capture.resource.payload.builder.d.ts @@ -0,0 +1,17 @@ +export = CreateFaceCaptureResourcePayloadBuilder; +/** + * + * @class CreateFaceCaptureResourcePayloadBuilder + */ +declare class CreateFaceCaptureResourcePayloadBuilder { + /** + * Sets the id of the requirement that the resource will be used to satisfy. + * + * @param {string} requirementId + * @return CreateFaceCaptureResourcePayloadBuilder + */ + withRequirementId(requirementId: string): this; + requirementId: string; + build(): CreateFaceCaptureResourcePayload; +} +import CreateFaceCaptureResourcePayload = require("./create.face.capture.resource.payload"); diff --git a/types/src/idv_service/session/create/face_capture/create.face.capture.resource.payload.d.ts b/types/src/idv_service/session/create/face_capture/create.face.capture.resource.payload.d.ts new file mode 100644 index 000000000..1d1300714 --- /dev/null +++ b/types/src/idv_service/session/create/face_capture/create.face.capture.resource.payload.d.ts @@ -0,0 +1,19 @@ +export = CreateFaceCaptureResourcePayload; +/** + * + * @class CreateFaceCaptureResourcePayload + */ +declare class CreateFaceCaptureResourcePayload { + /** + * @param {string} requirementId + */ + constructor(requirementId: string); + /** @private */ + private requirementId; + /** + * Returns serialized data for JSON.stringify() + */ + toJSON(): { + requirement_id: string; + }; +} diff --git a/types/src/idv_service/session/create/face_capture/upload.face.capture.image.payload.builder.d.ts b/types/src/idv_service/session/create/face_capture/upload.face.capture.image.payload.builder.d.ts new file mode 100644 index 000000000..b79c3357d --- /dev/null +++ b/types/src/idv_service/session/create/face_capture/upload.face.capture.image.payload.builder.d.ts @@ -0,0 +1,33 @@ +export = UploadFaceCaptureImagePayloadBuilder; +/** + * + * @class UploadFaceCaptureImagePayloadBuilder + */ +declare class UploadFaceCaptureImagePayloadBuilder { + /** + * Sets the content type for uploading a JPEG image + * + * @return this + */ + forJpegImage(): this; + imageContentType: string; + /** + * Sets the content type for uploading a PNG image + * + * @return this + */ + forPngImage(): this; + /** + * Sets the contents of the image to be uploaded + * + * @param {Buffer} imageContents + * @return this + */ + withImageContents(imageContents: Buffer): this; + imageContents: Buffer; + /** + * @return UploadFaceCaptureImagePayload + */ + build(): UploadFaceCaptureImagePayload; +} +import UploadFaceCaptureImagePayload = require("./upload.face.capture.image.payload"); diff --git a/types/src/idv_service/session/create/face_capture/upload.face.capture.image.payload.d.ts b/types/src/idv_service/session/create/face_capture/upload.face.capture.image.payload.d.ts new file mode 100644 index 000000000..b72e094f7 --- /dev/null +++ b/types/src/idv_service/session/create/face_capture/upload.face.capture.image.payload.d.ts @@ -0,0 +1,39 @@ +export = UploadFaceCaptureImagePayload; +/** + * + * @class UploadFaceCaptureImagePayload + */ +declare class UploadFaceCaptureImagePayload { + /** + * @param {string} imageContentType + * @param {Buffer} imageContents + */ + constructor(imageContentType: string, imageContents: Buffer); + /** @private */ + private imageContentType; + /** @private */ + private imageContents; + /** + * @return string + */ + getImageContentType(): string; + /** + * @return Buffer + */ + getImageContents(): Buffer; + /** + * @return {Array<{ + * name: string, + * value: Buffer, + * options: {filename: string, contentType: string} + * }>} + */ + getFormDataFields(): Array<{ + name: string; + value: Buffer; + options: { + filename: string; + contentType: string; + }; + }>; +} diff --git a/types/src/idv_service/session/create/filters/document.filter.d.ts b/types/src/idv_service/session/create/filters/document.filter.d.ts new file mode 100644 index 000000000..cf4c5567f --- /dev/null +++ b/types/src/idv_service/session/create/filters/document.filter.d.ts @@ -0,0 +1,12 @@ +export = DocumentFilter; +declare class DocumentFilter { + /** + * @param {string} type + */ + constructor(type: string); + /** @private */ + private type; + toJSON(): { + type: string; + }; +} diff --git a/types/src/idv_service/session/create/filters/document/document.restriction.builder.d.ts b/types/src/idv_service/session/create/filters/document/document.restriction.builder.d.ts new file mode 100644 index 000000000..009db42ae --- /dev/null +++ b/types/src/idv_service/session/create/filters/document/document.restriction.builder.d.ts @@ -0,0 +1,9 @@ +export = DocumentRestrictionBuilder; +declare class DocumentRestrictionBuilder { + withDocumentTypes(documentTypes: any): this; + documentTypes: any; + withCountries(countryCodes: any): this; + countryCodes: any; + build(): DocumentRestriction; +} +import DocumentRestriction = require("./document.restriction"); diff --git a/types/src/idv_service/session/create/filters/document/document.restriction.d.ts b/types/src/idv_service/session/create/filters/document/document.restriction.d.ts new file mode 100644 index 000000000..d5bac9c82 --- /dev/null +++ b/types/src/idv_service/session/create/filters/document/document.restriction.d.ts @@ -0,0 +1,16 @@ +export = DocumentRestriction; +declare class DocumentRestriction { + /** + * @param {string[]} countryCodes + * @param {string[]} documentTypes + */ + constructor(countryCodes: string[], documentTypes: string[]); + /** @private */ + private countryCodes; + /** @private */ + private documentTypes; + toJSON(): { + document_types: string[]; + country_codes: string[]; + }; +} diff --git a/types/src/idv_service/session/create/filters/document/document.restrictions.filter.builder.d.ts b/types/src/idv_service/session/create/filters/document/document.restrictions.filter.builder.d.ts new file mode 100644 index 000000000..962a27f21 --- /dev/null +++ b/types/src/idv_service/session/create/filters/document/document.restrictions.filter.builder.d.ts @@ -0,0 +1,40 @@ +export = DocumentRestrictionsFilterBuilder; +declare class DocumentRestrictionsFilterBuilder { + /** @private */ + private documents; + /** + * @returns {this} + */ + forWhitelist(): this; + inclusion: "WHITELIST" | "BLACKLIST"; + /** + * @returns {this} + */ + forBlacklist(): this; + /** + * @param {DocumentRestriction} documentRestriction + * + * @returns {this} + */ + withDocumentRestriction(documentRestriction: DocumentRestriction): this; + /** + * @param {Boolean} allowExpiredDocuments + * + * @returns {this} + */ + withAllowExpiredDocuments(allowExpiredDocuments: boolean): this; + allowExpiredDocuments: boolean; + /** + * @param {Boolean} allowNonLatinDocuments + * + * @returns {this} + */ + withAllowNonLatinDocuments(allowNonLatinDocuments: boolean): this; + allowNonLatinDocuments: boolean; + /** + * @returns {DocumentRestrictionsFilter} + */ + build(): DocumentRestrictionsFilter; +} +import DocumentRestriction = require("./document.restriction"); +import DocumentRestrictionsFilter = require("./document.restrictions.filter"); diff --git a/types/src/idv_service/session/create/filters/document/document.restrictions.filter.d.ts b/types/src/idv_service/session/create/filters/document/document.restrictions.filter.d.ts new file mode 100644 index 000000000..c2c4a62a6 --- /dev/null +++ b/types/src/idv_service/session/create/filters/document/document.restrictions.filter.d.ts @@ -0,0 +1,20 @@ +export = DocumentRestrictionsFilter; +declare class DocumentRestrictionsFilter extends DocumentFilter { + /** + * @param {string} inclusion + * @param {DocumentRestriction[]} documents + * @param {Boolean} allowExpiredDocuments + * @param {Boolean} allowNonLatinDocuments + */ + constructor(inclusion: string, documents: DocumentRestriction[], allowExpiredDocuments: boolean, allowNonLatinDocuments: boolean); + /** @private */ + private inclusion; + /** @private */ + private documents; + /** @private */ + private allowExpiredDocuments; + /** @private */ + private allowNonLatinDocuments; +} +import DocumentFilter = require("../document.filter"); +import DocumentRestriction = require("./document.restriction"); diff --git a/types/src/idv_service/session/create/filters/orthogonal/country.restriction.d.ts b/types/src/idv_service/session/create/filters/orthogonal/country.restriction.d.ts new file mode 100644 index 000000000..47d52e27f --- /dev/null +++ b/types/src/idv_service/session/create/filters/orthogonal/country.restriction.d.ts @@ -0,0 +1,16 @@ +export = CountryRestriction; +declare class CountryRestriction { + /** + * @param {string} inclusion + * @param {string[]} countryCodes + */ + constructor(inclusion: string, countryCodes: string[]); + /** @private */ + private inclusion; + /** @private */ + private countryCodes; + toJSON(): { + inclusion: string; + country_codes: string[]; + }; +} diff --git a/types/src/idv_service/session/create/filters/orthogonal/orthogonal.restrictions.filter.builder.d.ts b/types/src/idv_service/session/create/filters/orthogonal/orthogonal.restrictions.filter.builder.d.ts new file mode 100644 index 000000000..40d9e5788 --- /dev/null +++ b/types/src/idv_service/session/create/filters/orthogonal/orthogonal.restrictions.filter.builder.d.ts @@ -0,0 +1,50 @@ +export = OrthogonalRestrictionsFilterBuilder; +declare class OrthogonalRestrictionsFilterBuilder { + /** + * @param {string[]} countryCodes + * + * @returns {this} + */ + withWhitelistedCountries(countryCodes: string[]): this; + countryRestriction: CountryRestriction; + /** + * @param {string[]} countryCodes + * + * @returns {this} + */ + withBlacklistedCountries(countryCodes: string[]): this; + /** + * @param {string[]} documentTypes + * + * @returns {this} + */ + withWhitelistedDocumentTypes(documentTypes: string[]): this; + typeRestriction: TypeRestriction; + /** + * @param {string[]} documentTypes + * + * @returns {this} + */ + withBlacklistedDocumentTypes(documentTypes: string[]): this; + /** + * @param {Boolean} allowExpiredDocuments + * + * @returns {this} + */ + withAllowExpiredDocuments(allowExpiredDocuments: boolean): this; + allowExpiredDocuments: boolean; + /** + * @param {Boolean} allowNonLatinDocuments + * + * @returns {this} + */ + withAllowNonLatinDocuments(allowNonLatinDocuments: boolean): this; + allowNonLatinDocuments: boolean; + /** + * @returns {OrthogonalRestrictionsFilter} + */ + build(): OrthogonalRestrictionsFilter; +} +import CountryRestriction = require("./country.restriction"); +import TypeRestriction = require("./type.restriction"); +import OrthogonalRestrictionsFilter = require("./orthogonal.restrictions.filter"); diff --git a/types/src/idv_service/session/create/filters/orthogonal/orthogonal.restrictions.filter.d.ts b/types/src/idv_service/session/create/filters/orthogonal/orthogonal.restrictions.filter.d.ts new file mode 100644 index 000000000..93971a1ad --- /dev/null +++ b/types/src/idv_service/session/create/filters/orthogonal/orthogonal.restrictions.filter.d.ts @@ -0,0 +1,21 @@ +export = OrthogonalRestrictionsFilter; +declare class OrthogonalRestrictionsFilter extends DocumentFilter { + /** + * @param {CountryRestriction} countryRestriction + * @param {TypeRestriction} typeRestriction + * @param {Boolean} allowExpiredDocuments + * @param {Boolean} allowNonLatinDocuments + */ + constructor(countryRestriction: CountryRestriction, typeRestriction: TypeRestriction, allowExpiredDocuments: boolean, allowNonLatinDocuments: boolean); + /** @private */ + private countryRestriction; + /** @private */ + private typeRestriction; + /** @private */ + private allowExpiredDocuments; + /** @private */ + private allowNonLatinDocuments; +} +import DocumentFilter = require("../document.filter"); +import CountryRestriction = require("./country.restriction"); +import TypeRestriction = require("./type.restriction"); diff --git a/types/src/idv_service/session/create/filters/orthogonal/type.restriction.d.ts b/types/src/idv_service/session/create/filters/orthogonal/type.restriction.d.ts new file mode 100644 index 000000000..0a2c7609c --- /dev/null +++ b/types/src/idv_service/session/create/filters/orthogonal/type.restriction.d.ts @@ -0,0 +1,16 @@ +export = TypeRestriction; +declare class TypeRestriction { + /** + * @param {string} inclusion + * @param {string[]} documentTypes + */ + constructor(inclusion: string, documentTypes: string[]); + /** @private */ + private inclusion; + /** @private */ + private documentTypes; + toJSON(): { + inclusion: string; + document_types: string[]; + }; +} diff --git a/types/src/idv_service/session/create/filters/required.document.d.ts b/types/src/idv_service/session/create/filters/required.document.d.ts new file mode 100644 index 000000000..05e5c07b1 --- /dev/null +++ b/types/src/idv_service/session/create/filters/required.document.d.ts @@ -0,0 +1,12 @@ +export = RequiredDocument; +declare class RequiredDocument { + /** + * @param {string} type + */ + constructor(type: string); + /** @private */ + private type; + toJSON(): { + type: string; + }; +} diff --git a/types/src/idv_service/session/create/filters/required.id.document.builder.d.ts b/types/src/idv_service/session/create/filters/required.id.document.builder.d.ts new file mode 100644 index 000000000..0f345f716 --- /dev/null +++ b/types/src/idv_service/session/create/filters/required.id.document.builder.d.ts @@ -0,0 +1,16 @@ +export = RequiredIdDocumentBuilder; +declare class RequiredIdDocumentBuilder { + /** + * @param {DocumentFilter} filter + * + * @returns {this} + */ + withFilter(filter: DocumentFilter): this; + filter: DocumentFilter; + /** + * @returns {RequiredIdDocument} + */ + build(): RequiredIdDocument; +} +import DocumentFilter = require("./document.filter"); +import RequiredIdDocument = require("./required.id.document"); diff --git a/types/src/idv_service/session/create/filters/required.id.document.d.ts b/types/src/idv_service/session/create/filters/required.id.document.d.ts new file mode 100644 index 000000000..3debcf127 --- /dev/null +++ b/types/src/idv_service/session/create/filters/required.id.document.d.ts @@ -0,0 +1,11 @@ +export = RequiredIdDocument; +declare class RequiredIdDocument extends RequiredDocument { + /** + * @param {DocumentFilter} filter + */ + constructor(filter: DocumentFilter); + /** @private */ + private filter; +} +import RequiredDocument = require("./required.document"); +import DocumentFilter = require("./document.filter"); diff --git a/types/src/idv_service/session/create/filters/required.supplementary.document.builder.d.ts b/types/src/idv_service/session/create/filters/required.supplementary.document.builder.d.ts new file mode 100644 index 000000000..3ff1245e6 --- /dev/null +++ b/types/src/idv_service/session/create/filters/required.supplementary.document.builder.d.ts @@ -0,0 +1,30 @@ +export = RequiredSupplementaryDocumentBuilder; +declare class RequiredSupplementaryDocumentBuilder { + /** + * @param {string[]} countryCodes + * + * @returns {this} + */ + withCountryCodes(countryCodes: string[]): this; + countryCodes: string[]; + /** + * @param {string[]} documentTypes + * + * @returns {this} + */ + withDocumentTypes(documentTypes: string[]): this; + documentTypes: string[]; + /** + * @param {Objective} objective + * + * @returns {this} + */ + withObjective(objective: Objective): this; + objective: Objective; + /** + * @returns {RequiredSupplementaryDocument} + */ + build(): RequiredSupplementaryDocument; +} +import Objective = require("../objective/objective"); +import RequiredSupplementaryDocument = require("./required.supplementary.document"); diff --git a/types/src/idv_service/session/create/filters/required.supplementary.document.d.ts b/types/src/idv_service/session/create/filters/required.supplementary.document.d.ts new file mode 100644 index 000000000..c8b3b8f3f --- /dev/null +++ b/types/src/idv_service/session/create/filters/required.supplementary.document.d.ts @@ -0,0 +1,24 @@ +export = RequiredSupplementaryDocument; +declare class RequiredSupplementaryDocument extends RequiredDocument { + /** + * @param {Objective} objective + * @param {string[]} documentTypes + * @param {string[]} countryCodes + */ + constructor(objective: Objective, documentTypes: string[], countryCodes: string[]); + /** @private */ + private objective; + /** @private */ + private documentTypes; + /** @private */ + private countryCodes; + toJSON(): { + type: string; + } & { + objective: Objective; + document_types: string[]; + country_codes: string[]; + }; +} +import RequiredDocument = require("./required.document"); +import Objective = require("../objective/objective"); diff --git a/types/src/idv_service/session/create/notification.config.builder.d.ts b/types/src/idv_service/session/create/notification.config.builder.d.ts new file mode 100644 index 000000000..e6a0b7c0b --- /dev/null +++ b/types/src/idv_service/session/create/notification.config.builder.d.ts @@ -0,0 +1,80 @@ +export = NotificationConfigBuilder; +/** + * Builder to assist in the creation of {@link NotificationConfig}. + * + * @class NotificationConfigBuilder + */ +declare class NotificationConfigBuilder { + /** @private */ + private topics; + /** + * Sets the authorization token to be included in call-back messages + * + * @param {string} authToken + * + * @returns {this} + */ + withAuthToken(authToken: string): this; + authToken: string; + /** + * Sets the authorization type as BASIC + * + * @returns {this} + */ + withAuthTypeBasic(): this; + authType: "BASIC" | "BEARER"; + /** + * Sets the authorization type as BEARER + * + * @returns {this} + */ + withAuthTypeBearer(): this; + /** + * Sets the endpoint that notifications should be sent to + * + * @param {string} endpoint + * + * @returns {this} + */ + withEndpoint(endpoint: string): this; + endpoint: string; + /** + * Adds RESOURCE_UPDATE to the list of topics that trigger notification messages + * + * @returns {this} + */ + forResourceUpdate(): this; + /** + * Adds TASK_COMPLETION to the list of topics that trigger notification messages + * + * @returns {this} + */ + forTaskCompletion(): this; + /** + * Adds CHECK_COMPLETION to the list of topics that trigger notification messages + * + * @returns {this} + */ + forCheckCompletion(): this; + /** + * Adds SESSION_COMPLETION to the list of topics that trigger notification messages + * + * @returns {this} + */ + forSessionCompletion(): this; + /** + * Adds a topic to the list of topics that trigger notification messages + * + * @param {string} topicName + * + * @returns {this} + */ + withTopic(topicName: string): this; + /** + * Build the {@link NotificationConfig} using the supplied values + * + * @returns {NotificationConfig} + */ + build(): NotificationConfig; +} +import NotificationConfig = require("./notification.config"); diff --git a/types/src/idv_service/session/create/notification.config.d.ts b/types/src/idv_service/session/create/notification.config.d.ts new file mode 100644 index 000000000..e92fb487e --- /dev/null +++ b/types/src/idv_service/session/create/notification.config.d.ts @@ -0,0 +1,40 @@ +export = NotificationConfig; +/** + * Configures call-back Notifications to some backend endpoint provided + * by the Relying Business. + * + * Notifications can be configured to notified a client backend of certain + * events, avoiding the need to poll for the state of the Session. + * + * @class NotificationConfig + */ +declare class NotificationConfig { + /** + * @param {string} authToken + * The authorization token to be included in call-back messages + * @param {string} endpoint + * The endpoint that notifications should be sent to + * @param {string[]} topics + * The list of topics that should trigger notifications + * @param {string} authType + * The authorization type to used in call-back messages, accepts BASIC, BEARER + */ + constructor(authToken: string, endpoint: string, topics: string[], authType: string); + /** @private */ + private authToken; + /** @private */ + private endpoint; + /** @private */ + private topics; + /** @private */ + private authType; + /** + * Returns serialized data for JSON.stringify() + */ + toJSON(): { + auth_token: string; + auth_type: string; + endpoint: string; + topics: string[]; + }; +} diff --git a/types/src/idv_service/session/create/objective/objective.d.ts b/types/src/idv_service/session/create/objective/objective.d.ts new file mode 100644 index 000000000..b37c41c83 --- /dev/null +++ b/types/src/idv_service/session/create/objective/objective.d.ts @@ -0,0 +1,12 @@ +export = Objective; +declare class Objective { + /** + * @param {string} type + */ + constructor(type: string); + /** @private */ + private type; + toJSON(): { + type: string; + }; +} diff --git a/types/src/idv_service/session/create/objective/proof.of.address.objective.builder.d.ts b/types/src/idv_service/session/create/objective/proof.of.address.objective.builder.d.ts new file mode 100644 index 000000000..4258759c9 --- /dev/null +++ b/types/src/idv_service/session/create/objective/proof.of.address.objective.builder.d.ts @@ -0,0 +1,5 @@ +export = ProofOfAddressObjectiveBuilder; +declare class ProofOfAddressObjectiveBuilder { + build(): ProofOfAddressObjective; +} +import ProofOfAddressObjective = require("./proof.of.address.objective"); diff --git a/types/src/idv_service/session/create/objective/proof.of.address.objective.d.ts b/types/src/idv_service/session/create/objective/proof.of.address.objective.d.ts new file mode 100644 index 000000000..0ffb73b35 --- /dev/null +++ b/types/src/idv_service/session/create/objective/proof.of.address.objective.d.ts @@ -0,0 +1,5 @@ +export = ProofOfAddressObjective; +declare class ProofOfAddressObjective extends Objective { + constructor(); +} +import Objective = require("./objective"); diff --git a/types/src/idv_service/session/create/sdk.config.builder.d.ts b/types/src/idv_service/session/create/sdk.config.builder.d.ts new file mode 100644 index 000000000..a2b5a60e3 --- /dev/null +++ b/types/src/idv_service/session/create/sdk.config.builder.d.ts @@ -0,0 +1,173 @@ +export = SdkConfigBuilder; +/** + * Builder to assist in the creation of {@link SdkConfig}. + * + * @class SdkConfigBuilder + */ +declare class SdkConfigBuilder { + /** + * Sets the allowed capture method to "CAMERA" + * + * @returns {this} + */ + withAllowsCamera(): this; + /** + * Sets the allowed capture method to "CAMERA_AND_UPLOAD" + * + * @returns {this} + */ + withAllowsCameraAndUpload(): this; + /** + * Sets the allowed capture method + * + * @param {string} allowedCaptureMethods the allowed capture method + * + * @returns {this} + */ + withAllowedCaptureMethods(allowedCaptureMethods: string): this; + allowedCaptureMethods: string; + /** + * Sets the primary colour to be used by the web/native client + * + * @param {string} primaryColour + * The primary colour, hexadecimal value e.g. #ff0000 + * + * @returns {this} + */ + withPrimaryColour(primaryColour: string): this; + primaryColour: string; + /** + * Sets the secondary colour to be used by the web/native client (used on the button) + * + * @param {string} secondaryColour + * The secondary colour, hexadecimal value e.g. #ff0000 + * + * @returns {this} + */ + withSecondaryColour(secondaryColour: string): this; + secondaryColour: string; + /** + * Sets the font colour to be used by the web/native client (used on the button) + * + * @param {string} fontColour + * The font colour + * + * @returns {this} + */ + withFontColour(fontColour: string): this; + fontColour: string; + /** + * Sets the locale on the builder + * + * @param {string} locale + * The locale, e.g. "en" + * + * @returns {this} + */ + withLocale(locale: string): this; + locale: string; + /** + * Sets the preset issuing country on the builder + * + * @param {string} presetIssuingCountry the preset issuing country + * + * @returns {this} + */ + withPresetIssuingCountry(presetIssuingCountry: string): this; + presetIssuingCountry: string; + /** + * Sets the success URL for the redirect that follows the web/native client + * uploading documents successfully + * + * @param {string} successUrl the success URL + * + * @returns {this} + */ + withSuccessUrl(successUrl: string): this; + successUrl: string; + /** + * Sets the error URL for the redirect that follows the web/native client + * uploading documents unsuccessfully + * + * @param {string} errorUrl the error URL + * + * @returns {this} + */ + withErrorUrl(errorUrl: string): this; + errorUrl: string; + /** + * Sets the privacy policy URL + * + * @param {string} privacyPolicyUrl the privacy policy URL + * + * @returns {this} + */ + withPrivacyPolicyUrl(privacyPolicyUrl: string): this; + privacyPolicyUrl: string; + /** + * Sets the biometric consent flow to "EARLY" + * + * @returns {this} + */ + withEarlyBiometricConsentFlow(): this; + /** + * Sets the biometric consent flow to "JUST_IN_TIME" + * + * @returns {this} + */ + withJustInTimeBiometricConsentFlow(): this; + /** + * Sets the biometric consent flow + * + * @param {string} biometricConsentFlow the biometric consent flow + * + * @returns {this} + */ + withBiometricConsentFlow(biometricConsentFlow: string): this; + biometricConsentFlow: string; + /** + * Sets whether mobile handoff is allowed, so the user can start a session on their desktop + * and then switch to mobile to finish + * + * @param {boolean} allowHandoff allow mobile handoff + * + * @returns {this} + */ + withAllowHandoff(allowHandoff: boolean): this; + allowHandoff: boolean; + /** + * Allows configuring the number of attempts permitted for text extraction on an ID document + * + * @param {string} category the category of retries + * @param {number} retries the number of retries (more than 0) + * + * @returns {this} + */ + withIdDocumentTextExtractionCategoryRetries(category: string, retries: number): this; + attemptsConfiguration: {}; + /** + * Allows configuring the number of 'Reclassification' attempts permitted for text extraction + * on an ID document + * + * @param {number} retries the number of retries (more than 0) + * + * @returns {this} + */ + withIdDocumentTextExtractionReclassificationRetries(retries: number): this; + /** + * Allows configuring the number of 'Generic' attempts permitted for text extraction + * on an ID document + * + * @param {number} retries the number of retries (more than 0) + * + * @returns {this} + */ + withIdDocumentTextExtractionGenericRetries(retries: number): this; + /** + * Builds the {@link SdkConfig} using the values supplied to the builder + * + * @returns {SdkConfig} + */ + build(): SdkConfig; +} +import SdkConfig = require("./sdk.config"); diff --git a/types/src/idv_service/session/create/sdk.config.d.ts b/types/src/idv_service/session/create/sdk.config.d.ts new file mode 100644 index 000000000..d6f1cbdef --- /dev/null +++ b/types/src/idv_service/session/create/sdk.config.d.ts @@ -0,0 +1,71 @@ +export = SdkConfig; +declare class SdkConfig { + /** + * @param {string} allowedCaptureMethods + * The methods allowed for capturing document images + * @param {string} primaryColour + * The primary colour + * @param {string} secondaryColour + * The secondary colour + * @param {string} fontColour + * The font colour + * @param {string} locale + * The locale + * @param {string} presetIssuingCountry + * The preset issuing country + * @param {string} successUrl + * The success URL + * @param {string} errorUrl + * The error URL + * @param {string} privacyPolicyUrl + * The privacy policy URL + * @param {string} biometricConsentFlow + * Specifies the biometric consent in flow + * @param {boolean} allowHandoff + * Allows user to handoff to mobile during session + * @param {object} attemptsConfiguration + * The attempts configuration + */ + constructor(allowedCaptureMethods: string, primaryColour: string, secondaryColour: string, fontColour: string, locale: string, presetIssuingCountry: string, successUrl: string, errorUrl: string, privacyPolicyUrl: string, biometricConsentFlow: string, allowHandoff: boolean, attemptsConfiguration: object); + /** @private */ + private allowedCaptureMethods; + /** @private */ + private primaryColour; + /** @private */ + private secondaryColour; + /** @private */ + private fontColour; + /** @private */ + private locale; + /** @private */ + private presetIssuingCountry; + /** @private */ + private successUrl; + /** @private */ + private errorUrl; + /** @private */ + private privacyPolicyUrl; + /** @private */ + private biometricConsentFlow; + /** @private */ + private allowHandoff; + /** @private */ + private attemptsConfiguration; + /** + * Returns serialized data for JSON.stringify() + */ + toJSON(): { + allowed_capture_methods: string; + primary_colour: string; + secondary_colour: string; + font_colour: string; + locale: string; + preset_issuing_country: string; + success_url: string; + error_url: string; + privacy_policy_url: string; + biometric_consent_flow: string; + allow_handoff: boolean; + attempts_configuration: any; + }; +} diff --git a/types/src/idv_service/session/create/session.specification.builder.d.ts b/types/src/idv_service/session/create/session.specification.builder.d.ts new file mode 100644 index 000000000..49d131e9d --- /dev/null +++ b/types/src/idv_service/session/create/session.specification.builder.d.ts @@ -0,0 +1,121 @@ +export = SessionSpecificationBuilder; +/** + * Builder to assist the creation of {@link SessionSpecification}. + * + * @class SessionSpecificationBuilder + */ +declare class SessionSpecificationBuilder { + /** @private */ + private requestedChecks; + /** @private */ + private requestedTasks; + /** @private */ + private requiredDocuments; + /** + * Sets the client session token TTL (time-to-live) + * + * @param {number} clientSessionTokenTtl + * The client session token TTL + * + * @returns {this} + */ + withClientSessionTokenTtl(clientSessionTokenTtl: number): this; + clientSessionTokenTtl: number; + /** + * Sets the session deadline (alternative to session token TTL) + * + * @param {Date} sessionDeadline + * The session deadline date-time + * + * @returns {this} + */ + withSessionDeadline(sessionDeadline: Date): this; + sessionDeadline: Date; + /** + * Sets the resources TTL (time-to-live) + * + * @param {number} resourcesTtl + * The resources TTL + * + * @returns {this} + */ + withResourcesTtl(resourcesTtl: number): this; + resourcesTtl: number; + /** + * Sets the user tracking ID + * + * @param {string} userTrackingId + * The user tracking ID + * + * @returns {this} + */ + withUserTrackingId(userTrackingId: string): this; + userTrackingId: string; + /** + * Sets the {@link NotificationConfig} + * + * @param {NotificationConfig} notifications + * + * @returns {this} + */ + withNotifications(notifications: NotificationConfig): this; + notifications: NotificationConfig; + /** + * Adds a {@link RequestedCheck} to the list + * + * @param {RequestedCheck} requestedCheck + * + * @returns {this} + */ + withRequestedCheck(requestedCheck: RequestedCheck): this; + /** + * Adds a {@link RequestedTask} to the list + * + * @param {RequestedTask} requestedTask + * + * @returns {this} + */ + withRequestedTask(requestedTask: RequestedTask): this; + /** + * Sets the {@link SdkConfig} + * + * @param {SdkConfig} sdkConfig + * + * @returns {this} + */ + withSdkConfig(sdkConfig: SdkConfig): this; + sdkConfig: SdkConfig; + /** + * Adds a {@link RequiredDocument} to the list documents required from the client + * + * @param {RequiredDocument} requiredDocument + * + * @returns {this} + */ + withRequiredDocument(requiredDocument: RequiredDocument): this; + /** + * Sets whether or not to block the collection of biometric consent + * + * @param {boolean} blockBiometricConsent + * + * @return {this} + */ + withBlockBiometricConsent(blockBiometricConsent: boolean): this; + blockBiometricConsent: boolean; + withSubject(subject: any): this; + subject: any; + withIdentityProfileRequirements(identityProfileRequirements: any): this; + identityProfileRequirements: any; + /** + * Builds the {@link SessionSpecification} based on the values supplied to the builder + * + * @returns {SessionSpecification} + */ + build(): SessionSpecification; +} +import NotificationConfig = require("./notification.config"); +import RequestedCheck = require("./check/requested.check"); +import RequestedTask = require("./task/requested.task"); +import SdkConfig = require("./sdk.config"); +import RequiredDocument = require("./filters/required.document"); +import SessionSpecification = require("./session.specification"); diff --git a/types/src/idv_service/session/create/session.specification.d.ts b/types/src/idv_service/session/create/session.specification.d.ts new file mode 100644 index 000000000..ce84f5566 --- /dev/null +++ b/types/src/idv_service/session/create/session.specification.d.ts @@ -0,0 +1,80 @@ +export = SessionSpecification; +/** + * Definition for the IDV Session to be created + * + * @class SessionSpecification + */ +declare class SessionSpecification { + /** + * @param {number} clientSessionTokenTtl + * Client-session-token time-to-live to apply to the created session + * @param {number} resourcesTtl + * Time-to-live used for all Resources created in the course of the session + * @param {string} userTrackingId + * User tracking id, for the Relying Business to track returning users + * @param {NotificationConfig} notifications + * For configuring call-back messages + * @param {RequestedCheck[]} requestedChecks + * The Checks to be performed on each Document + * @param {RequestedTask[]} requestedTasks + * The Tasks to be performed on each Document + * @param {SdkConfig} sdkConfig + * The SDK configuration set on the session specification + * @param {RequiredDocument[]} requiredDocuments + * List of RequiredDocument defining the documents required from the client + * @param {boolean} blockBiometricConsent + * Sets whether or not to block the collection of biometric consent + * @param {Date} sessionDeadline + * The deadline that the session needs to be completed by + * @param {object} identityProfileRequirements + * @param {object} subject + * Information about the subject of the session + */ + constructor(clientSessionTokenTtl: number, resourcesTtl: number, userTrackingId: string, notifications: NotificationConfig, requestedChecks: RequestedCheck[], requestedTasks: RequestedTask[], sdkConfig: SdkConfig, requiredDocuments: RequiredDocument[], blockBiometricConsent: boolean, sessionDeadline: Date, identityProfileRequirements: object, subject: object); + /** @private */ + private clientSessionTokenTtl; + /** @private */ + private sessionDeadline; + /** @private */ + private resourcesTtl; + /** @private */ + private userTrackingId; + /** @private */ + private notifications; + /** @private */ + private sdkConfig; + /** @private */ + private identityProfileRequirements; + /** @private */ + private subject; + /** @private */ + private requestedChecks; + /** @private */ + private requestedTasks; + /** @private */ + private requiredDocuments; + /** @private */ + private blockBiometricConsent; + /** + * Returns serialized data for JSON.stringify() + */ + toJSON(): { + client_session_token_ttl: number; + session_deadline: string; + resources_ttl: number; + user_tracking_id: string; + notifications: NotificationConfig; + requested_checks: RequestedCheck[]; + requested_tasks: RequestedTask[]; + sdk_config: SdkConfig; + required_documents: RequiredDocument[]; + block_biometric_consent: boolean; + identity_profile_requirements: any; + subject: any; + }; +} +import NotificationConfig = require("./notification.config"); +import RequestedCheck = require("./check/requested.check"); +import RequestedTask = require("./task/requested.task"); +import SdkConfig = require("./sdk.config"); +import RequiredDocument = require("./filters/required.document"); diff --git a/types/src/idv_service/session/create/task/requested.supplementary.doc.text.extraction.config.d.ts b/types/src/idv_service/session/create/task/requested.supplementary.doc.text.extraction.config.d.ts new file mode 100644 index 000000000..8743310c1 --- /dev/null +++ b/types/src/idv_service/session/create/task/requested.supplementary.doc.text.extraction.config.d.ts @@ -0,0 +1,19 @@ +export = RequestedSupplementaryDocTextExtractionConfig; +/** + * The configuration applied when creating each RequestedSupplementaryDocTextExtraction + * + * @class RequestedSupplementaryDocTextExtractionConfig + */ +declare class RequestedSupplementaryDocTextExtractionConfig { + /** + * @param {string} manualCheck + * Describes the manual fallback behaviour applied to each Task + */ + constructor(manualCheck: string); + /** @private */ + private manualCheck; + /** + * @returns {Object} data for JSON.stringify() + */ + toJSON(): any; +} diff --git a/types/src/idv_service/session/create/task/requested.supplementary.doc.text.extraction.task.builder.d.ts b/types/src/idv_service/session/create/task/requested.supplementary.doc.text.extraction.task.builder.d.ts new file mode 100644 index 000000000..38a310507 --- /dev/null +++ b/types/src/idv_service/session/create/task/requested.supplementary.doc.text.extraction.task.builder.d.ts @@ -0,0 +1,35 @@ +export = RequestedSupplementaryDocTextExtractionTaskBuilder; +/** + * Builder to assist creation of {@link RequestedSupplementaryDocTextExtractionTask}. + * + * @class RequestedSupplementaryDocTextExtractionTaskBuilder + */ +declare class RequestedSupplementaryDocTextExtractionTaskBuilder { + /** + * Requires that the Task is always followed by a manual TextDataCheck + * + * @returns {this} + */ + withManualCheckAlways(): this; + manualCheck: "ALWAYS" | "FALLBACK" | "NEVER"; + /** + * Requires that only failed Tasks are followed by a manual TextDataCheck + * + * @returns {this} + */ + withManualCheckFallback(): this; + /** + * The SupplementaryTextExtractionTask will never fallback to a manual TextDataCheck + * + * @returns {this} + */ + withManualCheckNever(): this; + /** + * Builds a {@link RequestedSupplementaryDocTextExtractionTask} using the values + * supplied to the builder + * + * @returns {RequestedSupplementaryDocTextExtractionTask} + */ + build(): RequestedSupplementaryDocTextExtractionTask; +} +import RequestedSupplementaryDocTextExtractionTask = require("./requested.supplementary.doc.text.extraction.task"); diff --git a/types/src/idv_service/session/create/task/requested.supplementary.doc.text.extraction.task.d.ts b/types/src/idv_service/session/create/task/requested.supplementary.doc.text.extraction.task.d.ts new file mode 100644 index 000000000..6c24c0f04 --- /dev/null +++ b/types/src/idv_service/session/create/task/requested.supplementary.doc.text.extraction.task.d.ts @@ -0,0 +1,14 @@ +export = RequestedSupplementaryDocTextExtractionTask; +/** + * Requests that a SupplementaryTextExtractionTask be applied to each Document + * + * @class RequestedSupplementaryDocTextExtractionTask + */ +declare class RequestedSupplementaryDocTextExtractionTask extends RequestedTask { + /** + * @param {RequestedSupplementaryTextExtractionConfig} config + */ + constructor(config: RequestedSupplementaryTextExtractionConfig); +} +import RequestedTask = require("./requested.task"); +import RequestedSupplementaryTextExtractionConfig = require("./requested.supplementary.doc.text.extraction.config"); diff --git a/types/src/idv_service/session/create/task/requested.task.d.ts b/types/src/idv_service/session/create/task/requested.task.d.ts new file mode 100644 index 000000000..a654b3aa9 --- /dev/null +++ b/types/src/idv_service/session/create/task/requested.task.d.ts @@ -0,0 +1,23 @@ +export = RequestedTask; +/** + * Requests creation of a Task to be performed on each document + * + * @class RequestedTask + */ +declare class RequestedTask { + /** + * @param {string} type + * The type of the Task to create + * @param {*} config + * Configuration to apply to the Task + */ + constructor(type: string, config: any); + /** @private */ + private type; + /** @private */ + private config; + /** + * @returns {Object} data for JSON.stringify() + */ + toJSON(): any; +} diff --git a/types/src/idv_service/session/create/task/requested.text.extraction.config.d.ts b/types/src/idv_service/session/create/task/requested.text.extraction.config.d.ts new file mode 100644 index 000000000..a53cc90fe --- /dev/null +++ b/types/src/idv_service/session/create/task/requested.text.extraction.config.d.ts @@ -0,0 +1,27 @@ +export = RequestedTextExtractionConfig; +/** + * The configuration applied when creating each TextExtractionTask + * + * @class RequestedTextExtractionConfig + */ +declare class RequestedTextExtractionConfig { + /** + * @param {string} manualCheck + * Describes the manual fallback behaviour applied to each Task + * @param {string} chipData + * Describes the chip data requirement for each Task + * @param {boolean} createExpandedDocumentFields + * Enables additional information + */ + constructor(manualCheck: string, chipData: string, createExpandedDocumentFields: boolean); + /** @private */ + private manualCheck; + /** @private */ + private chipData; + /** @private */ + private createExpandedDocumentFields; + /** + * @returns {Object} data for JSON.stringify() + */ + toJSON(): any; +} diff --git a/types/src/idv_service/session/create/task/requested.text.extraction.task.builder.d.ts b/types/src/idv_service/session/create/task/requested.text.extraction.task.builder.d.ts new file mode 100644 index 000000000..12b2b27be --- /dev/null +++ b/types/src/idv_service/session/create/task/requested.text.extraction.task.builder.d.ts @@ -0,0 +1,49 @@ +export = RequestedTextExtractionTaskBuilder; +/** + * Builder to assist creation of {@link RequestedTextExtractionTask}. + * + * @class RequestedTextExtractionTaskBuilder + */ +declare class RequestedTextExtractionTaskBuilder { + /** + * Requires that the Task is always followed by a manual TextDataCheck + * + * @returns {this} + */ + withManualCheckAlways(): this; + manualCheck: "ALWAYS" | "FALLBACK" | "NEVER"; + /** + * Requires that only failed Tasks are followed by a manual TextDataCheck + * + * @returns {this} + */ + withManualCheckFallback(): this; + /** + * The TextExtractionTask will never fallback to a manual TextDataCheck + * + * @returns {this} + */ + withManualCheckNever(): this; + /** + * @returns {this} + */ + withChipDataDesired(): this; + chipData: "DESIRED" | "IGNORE"; + /** + * @returns {this} + */ + withChipDataIgnore(): this; + /** + * @param {boolean} createExpandedDocumentFields boolean + * @returns {this} + */ + withCreateExpandedDocumentFields(createExpandedDocumentFields: boolean): this; + createExpandedDocumentFields: boolean; + /** + * Builds a {@link RequestedTextExtractionTask} using the values supplied to the builder + * + * @returns {RequestedTextExtractionTask} + */ + build(): RequestedTextExtractionTask; +} +import RequestedTextExtractionTask = require("./requested.text.extraction.task"); diff --git a/types/src/idv_service/session/create/task/requested.text.extraction.task.d.ts b/types/src/idv_service/session/create/task/requested.text.extraction.task.d.ts new file mode 100644 index 000000000..24e12415b --- /dev/null +++ b/types/src/idv_service/session/create/task/requested.text.extraction.task.d.ts @@ -0,0 +1,14 @@ +export = RequestedTextExtractionTask; +/** + * Requests that a TextExtractionTask be applied to each Document + * + * @class RequestedTextExtractionTask + */ +declare class RequestedTextExtractionTask extends RequestedTask { + /** + * @param {RequestedTextExtractionConfig} config + */ + constructor(config: RequestedTextExtractionConfig); +} +import RequestedTask = require("./requested.task"); +import RequestedTextExtractionConfig = require("./requested.text.extraction.config"); diff --git a/types/src/idv_service/session/retrieve/authenticity.check.response.d.ts b/types/src/idv_service/session/retrieve/authenticity.check.response.d.ts new file mode 100644 index 000000000..12044479c --- /dev/null +++ b/types/src/idv_service/session/retrieve/authenticity.check.response.d.ts @@ -0,0 +1,4 @@ +export = AuthenticityCheckResponse; +declare class AuthenticityCheckResponse extends CheckResponse { +} +import CheckResponse = require("./check.response"); diff --git a/types/src/idv_service/session/retrieve/breakdown.response.d.ts b/types/src/idv_service/session/retrieve/breakdown.response.d.ts new file mode 100644 index 000000000..e51fb05a2 --- /dev/null +++ b/types/src/idv_service/session/retrieve/breakdown.response.d.ts @@ -0,0 +1,23 @@ +export = BreakdownResponse; +declare class BreakdownResponse { + constructor(breakdown: any); + /** @private */ + private subCheck; + /** @private */ + private result; + /** @private */ + private details; + /** + * @returns {string} + */ + getSubCheck(): string; + /** + * @returns {string} + */ + getResult(): string; + /** + * @returns {DetailsResponse[]} + */ + getDetails(): DetailsResponse[]; +} +import DetailsResponse = require("./details.response"); diff --git a/types/src/idv_service/session/retrieve/ca.matching.strategy.response.d.ts b/types/src/idv_service/session/retrieve/ca.matching.strategy.response.d.ts new file mode 100644 index 000000000..d4b930690 --- /dev/null +++ b/types/src/idv_service/session/retrieve/ca.matching.strategy.response.d.ts @@ -0,0 +1,20 @@ +export = CaMatchingStrategyResponse; +declare class CaMatchingStrategyResponse { + constructor(matchingStrategy: any); + /** @private */ + private type; + /** + * + * @return {string} + */ + getType(): string; +} +declare namespace CaMatchingStrategyResponse { + export { types }; +} +declare namespace types { + export { EXACT }; + export { FUZZY }; +} +import { EXACT } from "../../idv.constants"; +import { FUZZY } from "../../idv.constants"; diff --git a/types/src/idv_service/session/retrieve/ca.sources.response.d.ts b/types/src/idv_service/session/retrieve/ca.sources.response.d.ts new file mode 100644 index 000000000..9b7519088 --- /dev/null +++ b/types/src/idv_service/session/retrieve/ca.sources.response.d.ts @@ -0,0 +1,20 @@ +export = CaSourcesResponse; +declare class CaSourcesResponse { + constructor(sources: any); + /** @private */ + private type; + /** + * + * @return {string} + */ + getType(): string; +} +declare namespace CaSourcesResponse { + export { types }; +} +declare namespace types { + export { PROFILE }; + export { TYPE_LIST }; +} +import { PROFILE } from "../../idv.constants"; +import { TYPE_LIST } from "../../idv.constants"; diff --git a/types/src/idv_service/session/retrieve/check.response.d.ts b/types/src/idv_service/session/retrieve/check.response.d.ts new file mode 100644 index 000000000..44bd6c535 --- /dev/null +++ b/types/src/idv_service/session/retrieve/check.response.d.ts @@ -0,0 +1,55 @@ +export = CheckResponse; +declare class CheckResponse { + constructor(check: any); + /** @private */ + private type; + /** @private */ + private id; + /** @private */ + private state; + /** @private */ + private resourcesUsed; + /** @private */ + private generatedMedia; + /** @protected */ + protected report: ReportResponse; + /** @private */ + private created; + /** @private */ + private lastUpdated; + /** + * @returns {string} + */ + getType(): string; + /** + * @returns {string} + */ + getId(): string; + /** + * @returns {string} + */ + getState(): string; + /** + * @returns {string[]} + */ + getResourcesUsed(): string[]; + /** + * @returns {GeneratedMedia[]} + */ + getGeneratedMedia(): GeneratedMedia[]; + /** + * @returns {ReportResponse} + */ + getReport(): ReportResponse; + /** + * @returns {YotiDate} + */ + getCreated(): YotiDate; + /** + * @returns {YotiDate} + */ + getLastUpdated(): YotiDate; +} +import ReportResponse = require("./report.response"); +import GeneratedMedia = require("./generated.media"); +import { YotiDate } from "../../../data_type/date"; diff --git a/types/src/idv_service/session/retrieve/configuration/capture/capture.response.d.ts b/types/src/idv_service/session/retrieve/configuration/capture/capture.response.d.ts new file mode 100644 index 000000000..577d317e0 --- /dev/null +++ b/types/src/idv_service/session/retrieve/configuration/capture/capture.response.d.ts @@ -0,0 +1,74 @@ +export = CaptureResponse; +declare class CaptureResponse { + /** + * @param {object} capture + */ + constructor(capture: object); + /** @private */ + private biometricConsent; + /** @private */ + private requiredResources; + /** + * Returns a String enum of the state of biometric consent + * + * return if biometric consent needs to be captured + * + * @return {string | null} + */ + getBiometricConsent(): string | null; + /** + * Returns a list of required resources, in order to satisfy the sessions + * requirements + * + * return the list of required resources + * + * @return {RequiredResourceResponse[]} + */ + getRequiredResources(): RequiredResourceResponse[]; + /** + * Returns a list of all the document resource + * requirements (including ID and supplementary documents) + * @return {RequiredDocumentResourceResponse[]} + */ + getDocumentResourceRequirements(): RequiredDocumentResourceResponse[]; + /** + * Returns a list of all the ID document resource requirements + * + * @return {RequiredIdDocumentResourceResponse[]} + */ + getIdDocumentResourceRequirements(): RequiredIdDocumentResourceResponse[]; + /** + * Returns a list of all the supplementary document resource requirements + * + * @return {RequiredSupplementaryDocumentResourceResponse[]} + */ + getSupplementaryResourceRequirements(): RequiredSupplementaryDocumentResourceResponse[]; + /** + * Returns a list of all the liveness resource requirements + * + * @return {RequiredLivenessResourceResponse[]} + */ + getLivenessResourceRequirements(): RequiredLivenessResourceResponse[]; + /** + * Returns a list of all the zoom liveness resource requirements + * + * @return {RequiredZoomLivenessResourceResponse[]} + */ + getZoomLivenessResourceRequirements(): RequiredZoomLivenessResourceResponse[]; + /** + * Returns a list of all the Face Capture resource requirements + * + * @return {RequiredFaceCaptureResourceResponse[]} + */ + getFaceCaptureResourceRequirements(): RequiredFaceCaptureResourceResponse[]; +} +declare namespace CaptureResponse { + export { RequiredResourceResponse }; +} +import RequiredDocumentResourceResponse = require("./document/required.document.resource.response"); +import RequiredIdDocumentResourceResponse = require("./document/required.id.document.resource.response"); +import RequiredSupplementaryDocumentResourceResponse = require("./document/required.supplementary.document.resource.response"); +import RequiredLivenessResourceResponse = require("./liveness/required.liveness.resource.response"); +import RequiredZoomLivenessResourceResponse = require("./liveness/required.zoom.liveness.resource.response"); +import RequiredFaceCaptureResourceResponse = require("./face_capture/required.face.capture.resource.response"); +type RequiredResourceResponse = import('./required.resource.response'); diff --git a/types/src/idv_service/session/retrieve/configuration/capture/document/objective.response.d.ts b/types/src/idv_service/session/retrieve/configuration/capture/document/objective.response.d.ts new file mode 100644 index 000000000..788c96348 --- /dev/null +++ b/types/src/idv_service/session/retrieve/configuration/capture/document/objective.response.d.ts @@ -0,0 +1,15 @@ +export = ObjectiveResponse; +declare class ObjectiveResponse { + /** + * @param {object} objective + */ + constructor(objective: object); + /** @private */ + private type; + /** + * Returns the objective type as a String + * + * @return {string | null} + */ + getType(): string | null; +} diff --git a/types/src/idv_service/session/retrieve/configuration/capture/document/required.document.resource.response.d.ts b/types/src/idv_service/session/retrieve/configuration/capture/document/required.document.resource.response.d.ts new file mode 100644 index 000000000..224ad9234 --- /dev/null +++ b/types/src/idv_service/session/retrieve/configuration/capture/document/required.document.resource.response.d.ts @@ -0,0 +1,17 @@ +export = RequiredDocumentResourceResponse; +declare class RequiredDocumentResourceResponse extends RequiredResourceResponse { + /** @private */ + private requestedTasks; + /** + * Returns any tasks that need to be completed as part of the document + * requirement. + * + * @return {RequestedTaskResponse[]} + */ + getRequestedTasks(): RequestedTaskResponse[]; +} +declare namespace RequiredDocumentResourceResponse { + export { RequestedTaskResponse }; +} +import RequiredResourceResponse = require("../required.resource.response"); +type RequestedTaskResponse = import('../task/requested.task.response'); diff --git a/types/src/idv_service/session/retrieve/configuration/capture/document/required.id.document.resource.response.d.ts b/types/src/idv_service/session/retrieve/configuration/capture/document/required.id.document.resource.response.d.ts new file mode 100644 index 000000000..2739c7125 --- /dev/null +++ b/types/src/idv_service/session/retrieve/configuration/capture/document/required.id.document.resource.response.d.ts @@ -0,0 +1,32 @@ +export = RequiredIdDocumentResourceResponse; +declare class RequiredIdDocumentResourceResponse extends RequiredDocumentResourceResponse { + /** @private */ + private supportedCountries; + /** @private */ + private allowedCaptureMethods; + /** @private */ + private attemptsRemaining; + /** + * Returns a list of supported country codes, that can be used + * to satisfy the requirement. Each supported country will contain + * a list of document types that can be used. + * + * @return {SupportedCountryResponse[] | null} + */ + getSupportedCountries(): SupportedCountryResponse[] | null; + /** + * Returns the allowed capture method as a String + * + * @return {string | null} + */ + getAllowedCaptureMethods(): string | null; + /** + * Returns a Map, that is used to track how many attempts are + * remaining when performing text-extraction. + * + * @return {object | null} + */ + getAttemptsRemaining(): object | null; +} +import RequiredDocumentResourceResponse = require("./required.document.resource.response"); +import SupportedCountryResponse = require("./supported.country.response"); diff --git a/types/src/idv_service/session/retrieve/configuration/capture/document/required.supplementary.document.resource.response.d.ts b/types/src/idv_service/session/retrieve/configuration/capture/document/required.supplementary.document.resource.response.d.ts new file mode 100644 index 000000000..b371d2174 --- /dev/null +++ b/types/src/idv_service/session/retrieve/configuration/capture/document/required.supplementary.document.resource.response.d.ts @@ -0,0 +1,30 @@ +export = RequiredSupplementaryDocumentResourceResponse; +declare class RequiredSupplementaryDocumentResourceResponse extends RequiredDocumentResourceResponse { + /** @private */ + private documentTypes; + /** @private */ + private countryCodes; + /** @private */ + private objective; + /** + * Returns a list of document types that can be used to satisfy the requirement + * + * @return {string[] | null} + */ + getDocumentTypes(): string[] | null; + /** + * Returns a list of country codes that can be used to satisfy the requirement + * + * @return {string[] | null} + */ + getCountryCodes(): string[] | null; + /** + * Returns the objective that the + * {@link RequiredSupplementaryDocumentResourceResponse} will satisfy + * + * @return {ObjectiveResponse | null} + */ + getObjective(): ObjectiveResponse | null; +} +import RequiredDocumentResourceResponse = require("./required.document.resource.response"); +import ObjectiveResponse = require("./objective.response"); diff --git a/types/src/idv_service/session/retrieve/configuration/capture/document/supported.country.response.d.ts b/types/src/idv_service/session/retrieve/configuration/capture/document/supported.country.response.d.ts new file mode 100644 index 000000000..ff916e6ae --- /dev/null +++ b/types/src/idv_service/session/retrieve/configuration/capture/document/supported.country.response.d.ts @@ -0,0 +1,24 @@ +export = SupportedCountryResponse; +declare class SupportedCountryResponse { + /** + * @param {object} supportedCountry + */ + constructor(supportedCountry: object); + /** @private */ + private code; + /** @private */ + private supportedDocuments; + /** + * Returns the ISO Country Code of the supported country + * + * @return {string | null} + */ + getCode(): string | null; + /** + * Returns a list of document types that are supported for the country code + * + * @return {SupportedDocumentResponse[] | null} + */ + getSupportedDocuments(): SupportedDocumentResponse[] | null; +} +import SupportedDocumentResponse = require("./supported.document.response"); diff --git a/types/src/idv_service/session/retrieve/configuration/capture/document/supported.document.response.d.ts b/types/src/idv_service/session/retrieve/configuration/capture/document/supported.document.response.d.ts new file mode 100644 index 000000000..7bc04f543 --- /dev/null +++ b/types/src/idv_service/session/retrieve/configuration/capture/document/supported.document.response.d.ts @@ -0,0 +1,15 @@ +export = SupportedDocumentResponse; +declare class SupportedDocumentResponse { + /** + * @param {object} supportedDocument + */ + constructor(supportedDocument: object); + /** @private */ + private type; + /** + * Returns the type of document that is supported. + * + * @return {string | null} + */ + getType(): string | null; +} diff --git a/types/src/idv_service/session/retrieve/configuration/capture/face_capture/required.face.capture.resource.response.d.ts b/types/src/idv_service/session/retrieve/configuration/capture/face_capture/required.face.capture.resource.response.d.ts new file mode 100644 index 000000000..2dcff0ec1 --- /dev/null +++ b/types/src/idv_service/session/retrieve/configuration/capture/face_capture/required.face.capture.resource.response.d.ts @@ -0,0 +1,4 @@ +export = RequiredFaceCaptureResourceResponse; +declare class RequiredFaceCaptureResourceResponse extends RequiredResourceResponse { +} +import RequiredResourceResponse = require("../required.resource.response"); diff --git a/types/src/idv_service/session/retrieve/configuration/capture/liveness/required.liveness.resource.response.d.ts b/types/src/idv_service/session/retrieve/configuration/capture/liveness/required.liveness.resource.response.d.ts new file mode 100644 index 000000000..91df17242 --- /dev/null +++ b/types/src/idv_service/session/retrieve/configuration/capture/liveness/required.liveness.resource.response.d.ts @@ -0,0 +1,10 @@ +export = RequiredLivenessResourceResponse; +declare class RequiredLivenessResourceResponse extends RequiredResourceResponse { + /** @private */ + private livenessType; + /** + * @return {string | null} + */ + getLivenessType(): string | null; +} +import RequiredResourceResponse = require("../required.resource.response"); diff --git a/types/src/idv_service/session/retrieve/configuration/capture/liveness/required.zoom.liveness.resource.response.d.ts b/types/src/idv_service/session/retrieve/configuration/capture/liveness/required.zoom.liveness.resource.response.d.ts new file mode 100644 index 000000000..ff1c85f61 --- /dev/null +++ b/types/src/idv_service/session/retrieve/configuration/capture/liveness/required.zoom.liveness.resource.response.d.ts @@ -0,0 +1,4 @@ +export = RequiredZoomLivenessResourceResponse; +declare class RequiredZoomLivenessResourceResponse extends RequiredLivenessResourceResponse { +} +import RequiredLivenessResourceResponse = require("./required.liveness.resource.response"); diff --git a/types/src/idv_service/session/retrieve/configuration/capture/required.resource.response.d.ts b/types/src/idv_service/session/retrieve/configuration/capture/required.resource.response.d.ts new file mode 100644 index 000000000..0b40feb0e --- /dev/null +++ b/types/src/idv_service/session/retrieve/configuration/capture/required.resource.response.d.ts @@ -0,0 +1,45 @@ +export = RequiredResourceResponse; +declare class RequiredResourceResponse { + /** + * @param {object} requiredResource + */ + constructor(requiredResource: object); + /** @private */ + private type; + /** @private */ + private id; + /** @private */ + private state; + /** @private */ + private allowedSources; + /** + * @return {string} + */ + getType(): string; + /** + * @return {string} + */ + getId(): string; + /** + * @return {string} + */ + getState(): string; + /** + * @return {AllowedSourceResponse[]} + */ + getAllowedSources(): AllowedSourceResponse[]; + /** + * + * Returns if the Relying Business is allowed to upload resources + * to satisfy the requirement. + * + * return the end user is allowed to upload resources + * + * @return {boolean} + */ + isRelyingBusinessAllowed(): boolean; +} +declare namespace RequiredResourceResponse { + export { AllowedSourceResponse }; +} +type AllowedSourceResponse = import('./source/allowed.source.response'); diff --git a/types/src/idv_service/session/retrieve/configuration/capture/source/allowed.source.response.d.ts b/types/src/idv_service/session/retrieve/configuration/capture/source/allowed.source.response.d.ts new file mode 100644 index 000000000..8939eef8c --- /dev/null +++ b/types/src/idv_service/session/retrieve/configuration/capture/source/allowed.source.response.d.ts @@ -0,0 +1,7 @@ +export = AllowedSourceResponse; +declare class AllowedSourceResponse { + constructor(type: any); + /** @private */ + private type; + getType(): any; +} diff --git a/types/src/idv_service/session/retrieve/configuration/capture/source/end.user.allowed.source.response.d.ts b/types/src/idv_service/session/retrieve/configuration/capture/source/end.user.allowed.source.response.d.ts new file mode 100644 index 000000000..f4eb1bc9b --- /dev/null +++ b/types/src/idv_service/session/retrieve/configuration/capture/source/end.user.allowed.source.response.d.ts @@ -0,0 +1,5 @@ +export = EndUserAllowedSourceResponse; +declare class EndUserAllowedSourceResponse extends AllowedSourceResponse { + constructor(); +} +import AllowedSourceResponse = require("./allowed.source.response"); diff --git a/types/src/idv_service/session/retrieve/configuration/capture/source/ibv.allowed.source.response.d.ts b/types/src/idv_service/session/retrieve/configuration/capture/source/ibv.allowed.source.response.d.ts new file mode 100644 index 000000000..037addefa --- /dev/null +++ b/types/src/idv_service/session/retrieve/configuration/capture/source/ibv.allowed.source.response.d.ts @@ -0,0 +1,5 @@ +export = IbvAllowedSourceResponse; +declare class IbvAllowedSourceResponse extends AllowedSourceResponse { + constructor(); +} +import AllowedSourceResponse = require("./allowed.source.response"); diff --git a/types/src/idv_service/session/retrieve/configuration/capture/source/relying.business.allowed.source.response.d.ts b/types/src/idv_service/session/retrieve/configuration/capture/source/relying.business.allowed.source.response.d.ts new file mode 100644 index 000000000..853f66312 --- /dev/null +++ b/types/src/idv_service/session/retrieve/configuration/capture/source/relying.business.allowed.source.response.d.ts @@ -0,0 +1,5 @@ +export = RelyingBusinessAllowedSourceResponse; +declare class RelyingBusinessAllowedSourceResponse extends AllowedSourceResponse { + constructor(); +} +import AllowedSourceResponse = require("./allowed.source.response"); diff --git a/types/src/idv_service/session/retrieve/configuration/capture/source/unknown.allowed.source.response.d.ts b/types/src/idv_service/session/retrieve/configuration/capture/source/unknown.allowed.source.response.d.ts new file mode 100644 index 000000000..27188e023 --- /dev/null +++ b/types/src/idv_service/session/retrieve/configuration/capture/source/unknown.allowed.source.response.d.ts @@ -0,0 +1,5 @@ +export = UnknownAllowedSourceResponse; +declare class UnknownAllowedSourceResponse extends AllowedSourceResponse { + constructor(); +} +import AllowedSourceResponse = require("./allowed.source.response"); diff --git a/types/src/idv_service/session/retrieve/configuration/capture/task/requested.id.doc.task.response.d.ts b/types/src/idv_service/session/retrieve/configuration/capture/task/requested.id.doc.task.response.d.ts new file mode 100644 index 000000000..9aea4cbd6 --- /dev/null +++ b/types/src/idv_service/session/retrieve/configuration/capture/task/requested.id.doc.task.response.d.ts @@ -0,0 +1,8 @@ +export = RequestedIdDocTaskResponse; +declare class RequestedIdDocTaskResponse extends RequestedTaskResponse { + /** + * @param {object} requestedTask + */ + constructor(requestedTask: object); +} +import RequestedTaskResponse = require("./requested.task.response"); diff --git a/types/src/idv_service/session/retrieve/configuration/capture/task/requested.supplementary.doc.task.response.d.ts b/types/src/idv_service/session/retrieve/configuration/capture/task/requested.supplementary.doc.task.response.d.ts new file mode 100644 index 000000000..c4422b8cb --- /dev/null +++ b/types/src/idv_service/session/retrieve/configuration/capture/task/requested.supplementary.doc.task.response.d.ts @@ -0,0 +1,8 @@ +export = RequestedSupplementaryDocTaskResponse; +declare class RequestedSupplementaryDocTaskResponse extends RequestedTaskResponse { + /** + * @param {object} requestedTask + */ + constructor(requestedTask: object); +} +import RequestedTaskResponse = require("./requested.task.response"); diff --git a/types/src/idv_service/session/retrieve/configuration/capture/task/requested.task.response.d.ts b/types/src/idv_service/session/retrieve/configuration/capture/task/requested.task.response.d.ts new file mode 100644 index 000000000..0b6b95c1f --- /dev/null +++ b/types/src/idv_service/session/retrieve/configuration/capture/task/requested.task.response.d.ts @@ -0,0 +1,19 @@ +export = RequestedTaskResponse; +declare class RequestedTaskResponse { + /** @protected {string|null} */ + protected type: any; + /** @protected {string|null} */ + protected state: any; + /** + * Returns the type of the {@link RequestedTaskResponse} + * + * @return {string | null} + */ + getType(): string | null; + /** + * Returns the current state of the Requested Task + * + * @return {string | null} + */ + getState(): string | null; +} diff --git a/types/src/idv_service/session/retrieve/configuration/capture/task/unknown.requested.task.response.d.ts b/types/src/idv_service/session/retrieve/configuration/capture/task/unknown.requested.task.response.d.ts new file mode 100644 index 000000000..20fc645f6 --- /dev/null +++ b/types/src/idv_service/session/retrieve/configuration/capture/task/unknown.requested.task.response.d.ts @@ -0,0 +1,4 @@ +export = UnknownRequestedTaskResponse; +declare class UnknownRequestedTaskResponse extends RequestedTaskResponse { +} +import RequestedTaskResponse = require("./requested.task.response"); diff --git a/types/src/idv_service/session/retrieve/configuration/capture/unknown.required.resource.response.d.ts b/types/src/idv_service/session/retrieve/configuration/capture/unknown.required.resource.response.d.ts new file mode 100644 index 000000000..1dcd5ec55 --- /dev/null +++ b/types/src/idv_service/session/retrieve/configuration/capture/unknown.required.resource.response.d.ts @@ -0,0 +1,4 @@ +export = UnknownRequiredResourceResponse; +declare class UnknownRequiredResourceResponse extends RequiredResourceResponse { +} +import RequiredResourceResponse = require("./required.resource.response"); diff --git a/types/src/idv_service/session/retrieve/configuration/session.configuration.response.d.ts b/types/src/idv_service/session/retrieve/configuration/session.configuration.response.d.ts new file mode 100644 index 000000000..c9568dfd5 --- /dev/null +++ b/types/src/idv_service/session/retrieve/configuration/session.configuration.response.d.ts @@ -0,0 +1,40 @@ +export = SessionConfigurationResponse; +declare class SessionConfigurationResponse { + constructor(payload: any); + /** @private */ + private clientSessionTokenTtl; + /** @private */ + private sessionId; + /** @private */ + private requestedChecks; + /** @private */ + private capture; + /** + * Returns the amount of time remaining in seconds until the session + * expires. + * + * @return {number | null} + */ + getClientSessionTokenTtl(): number | null; + /** + * Returns the session ID that the configuration belongs to + * + * @return {string | null} + */ + getSessionId(): string | null; + /** + * Returns a list of strings, signifying the checks that have been requested + * in the session + * + * @return {string[] | null} + */ + getRequestedChecks(): string[] | null; + /** + * Returns information about what needs to be captured to fulfil the + * sessions requirements + * + * @return {CaptureResponse | null} + */ + getCapture(): CaptureResponse | null; +} +import CaptureResponse = require("./capture/capture.response"); diff --git a/types/src/idv_service/session/retrieve/create.face.capture.resource.response.d.ts b/types/src/idv_service/session/retrieve/create.face.capture.resource.response.d.ts new file mode 100644 index 000000000..d30ae61b8 --- /dev/null +++ b/types/src/idv_service/session/retrieve/create.face.capture.resource.response.d.ts @@ -0,0 +1,26 @@ +export = CreateFaceCaptureResourceResponse; +declare class CreateFaceCaptureResourceResponse { + /** + * @param {{id: string, frames: number}} resourceData + */ + constructor(resourceData: { + id: string; + frames: number; + }); + /** @private */ + private id; + /** @private */ + private frames; + /** + * Returns the ID of the newly created Face Capture resource + * + * @return string + */ + getId(): string; + /** + * Returns the number of image frames required + * + * @return int + */ + getFrames(): number; +} diff --git a/types/src/idv_service/session/retrieve/custom.account.watchlist.ca.search.config.response.d.ts b/types/src/idv_service/session/retrieve/custom.account.watchlist.ca.search.config.response.d.ts new file mode 100644 index 000000000..06bb36421 --- /dev/null +++ b/types/src/idv_service/session/retrieve/custom.account.watchlist.ca.search.config.response.d.ts @@ -0,0 +1,34 @@ +export = CustomAccountWatchlistCaSearchConfigResponse; +declare class CustomAccountWatchlistCaSearchConfigResponse extends WatchlistAdvancedCaSearchConfigResponse { + /** @private */ + private apiKey; + /** @private */ + private monitoring; + /** @private */ + private tags; + /** @private */ + private clientRef; + /** + * + * @return {string} + */ + getApiKey(): string; + /** + * + * @return {boolean} + */ + isMonitoring(): boolean; + /** + * + * @return {{[k: string]: string}} + */ + getTags(): { + [k: string]: string; + }; + /** + * + * @return {string} + */ + getClientRef(): string; +} +import WatchlistAdvancedCaSearchConfigResponse = require("./watchlist.advanced.ca.search.config.response"); diff --git a/types/src/idv_service/session/retrieve/details.response.d.ts b/types/src/idv_service/session/retrieve/details.response.d.ts new file mode 100644 index 000000000..c239b0329 --- /dev/null +++ b/types/src/idv_service/session/retrieve/details.response.d.ts @@ -0,0 +1,16 @@ +export = DetailsResponse; +declare class DetailsResponse { + constructor(details: any); + /** @private */ + private name; + /** @private */ + private value; + /** + * @returns {string} + */ + getName(): string; + /** + * @returns {string} + */ + getValue(): string; +} diff --git a/types/src/idv_service/session/retrieve/document.fields.response.d.ts b/types/src/idv_service/session/retrieve/document.fields.response.d.ts new file mode 100644 index 000000000..5fee11fd2 --- /dev/null +++ b/types/src/idv_service/session/retrieve/document.fields.response.d.ts @@ -0,0 +1,11 @@ +export = DocumentFieldsResponse; +declare class DocumentFieldsResponse { + constructor(documentFields: any); + /** @private */ + private media; + /** + * @returns {MediaResponse} + */ + getMedia(): MediaResponse; +} +import MediaResponse = require("./media.response"); diff --git a/types/src/idv_service/session/retrieve/document.id.photo.response.d.ts b/types/src/idv_service/session/retrieve/document.id.photo.response.d.ts new file mode 100644 index 000000000..94c6c96ae --- /dev/null +++ b/types/src/idv_service/session/retrieve/document.id.photo.response.d.ts @@ -0,0 +1,11 @@ +export = DocumentIdPhotoResponse; +declare class DocumentIdPhotoResponse { + constructor(documentFields: any); + /** @private */ + private media; + /** + * @returns {MediaResponse} + */ + getMedia(): MediaResponse; +} +import MediaResponse = require("./media.response"); diff --git a/types/src/idv_service/session/retrieve/exact.matching.strategy.response.d.ts b/types/src/idv_service/session/retrieve/exact.matching.strategy.response.d.ts new file mode 100644 index 000000000..ee372df3d --- /dev/null +++ b/types/src/idv_service/session/retrieve/exact.matching.strategy.response.d.ts @@ -0,0 +1,11 @@ +export = ExactMatchingStrategyResponse; +declare class ExactMatchingStrategyResponse extends CaMatchingStrategyResponse { + /** @private */ + private exactMatch; + /** + * + * @return {number} + */ + isExactMatch(): number; +} +import CaMatchingStrategyResponse = require("./ca.matching.strategy.response"); diff --git a/types/src/idv_service/session/retrieve/expanded.document.fields.response.d.ts b/types/src/idv_service/session/retrieve/expanded.document.fields.response.d.ts new file mode 100644 index 000000000..f1f9bf7bb --- /dev/null +++ b/types/src/idv_service/session/retrieve/expanded.document.fields.response.d.ts @@ -0,0 +1,11 @@ +export = ExpandedDocumentFieldsResponse; +declare class ExpandedDocumentFieldsResponse { + constructor(expandedDocumentFields: any); + /** @private */ + private media; + /** + * @returns {MediaResponse} + */ + getMedia(): MediaResponse; +} +import MediaResponse = require("./media.response"); diff --git a/types/src/idv_service/session/retrieve/face.capture.image.response.d.ts b/types/src/idv_service/session/retrieve/face.capture.image.response.d.ts new file mode 100644 index 000000000..9a434c7b2 --- /dev/null +++ b/types/src/idv_service/session/retrieve/face.capture.image.response.d.ts @@ -0,0 +1,11 @@ +export = FaceCaptureImageResponse; +declare class FaceCaptureImageResponse { + constructor(image: any); + /** @private */ + private media; + /** + * @return MediaResponse + */ + getMedia(): MediaResponse; +} +import MediaResponse = require("./media.response"); diff --git a/types/src/idv_service/session/retrieve/face.capture.resource.response.d.ts b/types/src/idv_service/session/retrieve/face.capture.resource.response.d.ts new file mode 100644 index 000000000..04581ea83 --- /dev/null +++ b/types/src/idv_service/session/retrieve/face.capture.resource.response.d.ts @@ -0,0 +1,11 @@ +export = FaceCaptureResourceResponse; +declare class FaceCaptureResourceResponse extends ResourceResponse { + /** @private */ + private image; + /** + * @return FaceCaptureImageResponse + */ + getImage(): FaceCaptureImageResponse; +} +import ResourceResponse = require("./resource.response"); +import FaceCaptureImageResponse = require("./face.capture.image.response"); diff --git a/types/src/idv_service/session/retrieve/face.comparison.check.response.d.ts b/types/src/idv_service/session/retrieve/face.comparison.check.response.d.ts new file mode 100644 index 000000000..ba7710a26 --- /dev/null +++ b/types/src/idv_service/session/retrieve/face.comparison.check.response.d.ts @@ -0,0 +1,4 @@ +export = FaceComparisonCheckResponse; +declare class FaceComparisonCheckResponse extends CheckResponse { +} +import CheckResponse = require("./check.response"); diff --git a/types/src/idv_service/session/retrieve/face.map.response.d.ts b/types/src/idv_service/session/retrieve/face.map.response.d.ts new file mode 100644 index 000000000..4100a58e1 --- /dev/null +++ b/types/src/idv_service/session/retrieve/face.map.response.d.ts @@ -0,0 +1,11 @@ +export = FaceMapResponse; +declare class FaceMapResponse { + constructor(facemap: any); + /** @private */ + private media; + /** + * @returns {MediaResponse} + */ + getMedia(): MediaResponse; +} +import MediaResponse = require("./media.response"); diff --git a/types/src/idv_service/session/retrieve/face.match.check.response.d.ts b/types/src/idv_service/session/retrieve/face.match.check.response.d.ts new file mode 100644 index 000000000..791176b16 --- /dev/null +++ b/types/src/idv_service/session/retrieve/face.match.check.response.d.ts @@ -0,0 +1,4 @@ +export = FaceMatchCheckResponse; +declare class FaceMatchCheckResponse extends CheckResponse { +} +import CheckResponse = require("./check.response"); diff --git a/types/src/idv_service/session/retrieve/file.response.d.ts b/types/src/idv_service/session/retrieve/file.response.d.ts new file mode 100644 index 000000000..ee987e23d --- /dev/null +++ b/types/src/idv_service/session/retrieve/file.response.d.ts @@ -0,0 +1,11 @@ +export = FileResponse; +declare class FileResponse { + constructor(file: any); + /** @private */ + private media; + /** + * @returns {MediaResponse} + */ + getMedia(): MediaResponse; +} +import MediaResponse = require("./media.response"); diff --git a/types/src/idv_service/session/retrieve/frame.response.d.ts b/types/src/idv_service/session/retrieve/frame.response.d.ts new file mode 100644 index 000000000..261092727 --- /dev/null +++ b/types/src/idv_service/session/retrieve/frame.response.d.ts @@ -0,0 +1,11 @@ +export = FrameResponse; +declare class FrameResponse { + constructor(frame: any); + /** @private */ + private media; + /** + * @returns {MediaResponse} + */ + getMedia(): MediaResponse; +} +import MediaResponse = require("./media.response"); diff --git a/types/src/idv_service/session/retrieve/fuzzy.matching.strategy.response.d.ts b/types/src/idv_service/session/retrieve/fuzzy.matching.strategy.response.d.ts new file mode 100644 index 000000000..7a81d04f8 --- /dev/null +++ b/types/src/idv_service/session/retrieve/fuzzy.matching.strategy.response.d.ts @@ -0,0 +1,11 @@ +export = FuzzyMatchingStrategyResponse; +declare class FuzzyMatchingStrategyResponse extends CaMatchingStrategyResponse { + /** @private */ + private fuzziness; + /** + * + * @return {number} + */ + getFuzziness(): number; +} +import CaMatchingStrategyResponse = require("./ca.matching.strategy.response"); diff --git a/types/src/idv_service/session/retrieve/generated.check.response.d.ts b/types/src/idv_service/session/retrieve/generated.check.response.d.ts new file mode 100644 index 000000000..b08d7b67e --- /dev/null +++ b/types/src/idv_service/session/retrieve/generated.check.response.d.ts @@ -0,0 +1,16 @@ +export = GeneratedCheckResponse; +declare class GeneratedCheckResponse { + constructor(check: any); + /** @private */ + private id; + /** @private */ + private type; + /** + * @returns {string} + */ + getId(): string; + /** + * @returns {string} + */ + getType(): string; +} diff --git a/types/src/idv_service/session/retrieve/generated.media.d.ts b/types/src/idv_service/session/retrieve/generated.media.d.ts new file mode 100644 index 000000000..1f82b451d --- /dev/null +++ b/types/src/idv_service/session/retrieve/generated.media.d.ts @@ -0,0 +1,16 @@ +export = GeneratedMedia; +declare class GeneratedMedia { + constructor(media: any); + /** @private */ + private id; + /** @private */ + private type; + /** + * @returns {string} + */ + getId(): string; + /** + * @returns {string} + */ + getType(): string; +} diff --git a/types/src/idv_service/session/retrieve/generated.profile.response.d.ts b/types/src/idv_service/session/retrieve/generated.profile.response.d.ts new file mode 100644 index 000000000..daca21455 --- /dev/null +++ b/types/src/idv_service/session/retrieve/generated.profile.response.d.ts @@ -0,0 +1,11 @@ +export = GeneratedProfileResponse; +declare class GeneratedProfileResponse { + constructor(generatedProfile: any); + /** @private */ + private media; + /** + * @returns {MediaResponse} + */ + getMedia(): MediaResponse; +} +import MediaResponse = require("./media.response"); diff --git a/types/src/idv_service/session/retrieve/generated.supplementary.document.text.data.check.response.d.ts b/types/src/idv_service/session/retrieve/generated.supplementary.document.text.data.check.response.d.ts new file mode 100644 index 000000000..37b2cdff7 --- /dev/null +++ b/types/src/idv_service/session/retrieve/generated.supplementary.document.text.data.check.response.d.ts @@ -0,0 +1,4 @@ +export = GeneratedSupplementaryDocumentTextDataCheckResponse; +declare class GeneratedSupplementaryDocumentTextDataCheckResponse extends GeneratedTextDataCheckResponse { +} +import GeneratedTextDataCheckResponse = require("./generated.text.data.check.response"); diff --git a/types/src/idv_service/session/retrieve/generated.text.data.check.response.d.ts b/types/src/idv_service/session/retrieve/generated.text.data.check.response.d.ts new file mode 100644 index 000000000..b7d3a55d9 --- /dev/null +++ b/types/src/idv_service/session/retrieve/generated.text.data.check.response.d.ts @@ -0,0 +1,4 @@ +export = GeneratedTextDataCheckResponse; +declare class GeneratedTextDataCheckResponse extends GeneratedCheckResponse { +} +import GeneratedCheckResponse = require("./generated.check.response"); diff --git a/types/src/idv_service/session/retrieve/get.session.result.d.ts b/types/src/idv_service/session/retrieve/get.session.result.d.ts new file mode 100644 index 000000000..3e77a54c1 --- /dev/null +++ b/types/src/idv_service/session/retrieve/get.session.result.d.ts @@ -0,0 +1,123 @@ +export = GetSessionResult; +declare class GetSessionResult { + constructor(response: any); + /** @private */ + private clientSessionTokenTtl; + /** @private */ + private sessionId; + /** @private */ + private userTrackingId; + /** @private */ + private state; + /** @private */ + private clientSessionToken; + /** @private */ + private checks; + /** @private */ + private resources; + /** @private */ + private biometricConsent; + /** @private */ + private identityProfile; + /** + * @returns {string} + */ + getSessionId(): string; + /** + * @returns {number} + */ + getClientSessionTokenTtl(): number; + /** + * @returns {string} + */ + getState(): string; + /** + * @returns {string} + */ + getClientSessionToken(): string; + /** + * @returns {CheckResponse[]} + */ + getChecks(): CheckResponse[]; + /** + * @returns {AuthenticityCheckResponse[]} + */ + getAuthenticityChecks(): AuthenticityCheckResponse[]; + /** + * @returns {FaceMatchCheckResponse[]} + */ + getFaceMatchChecks(): FaceMatchCheckResponse[]; + /** + * @returns {TextDataCheckResponse[]} + */ + getIdDocumentTextDataChecks(): TextDataCheckResponse[]; + /** + * @deprecated replaced by getIdDocumentTextDataChecks() + * + * @returns {TextDataCheckResponse[]} + */ + getTextDataChecks(): TextDataCheckResponse[]; + /** + * @returns {SupplementaryDocumentTextDataCheckResponse[]} + */ + getSupplementaryDocumentTextDataChecks(): SupplementaryDocumentTextDataCheckResponse[]; + /** + * @returns {LivenessCheckResponse[]} + */ + getLivenessChecks(): LivenessCheckResponse[]; + /** + * @returns {IdDocumentComparisonCheckResponse[]} + */ + getIdDocumentComparisonChecks(): IdDocumentComparisonCheckResponse[]; + /** + * @returns {ThirdPartyIdentityCheckResponse[]} + */ + getThirdPartyIdentityChecks(): ThirdPartyIdentityCheckResponse[]; + /** + * @returns {WatchlistScreeningCheckResponse[]} + */ + getWatchlistScreeningChecks(): WatchlistScreeningCheckResponse[]; + /** + * @returns {WatchlistAdvancedCaCheckResponse[]} + */ + getWatchlistAdvancedCaChecks(): WatchlistAdvancedCaCheckResponse[]; + /** + * @returns {ThirdPartyIdentityFraud1CheckResponse[]} + */ + getThirdPartyIdentityFraud1Checks(): ThirdPartyIdentityFraud1CheckResponse[]; + /** + * @returns {FaceComparisonCheckResponse[]} + */ + getFaceComparisonChecks(): FaceComparisonCheckResponse[]; + /** + * @returns {ResourceContainer} + */ + getResources(): ResourceContainer; + /** + * @returns {string} + */ + getUserTrackingId(): string; + /** + * @returns {YotiDate} + */ + getBiometricConsentTimestamp(): YotiDate; + /** + * @returns {IdentityProfileResponse} + */ + getIdentityProfile(): IdentityProfileResponse; +} +import CheckResponse = require("./check.response"); +import AuthenticityCheckResponse = require("./authenticity.check.response"); +import FaceMatchCheckResponse = require("./face.match.check.response"); +import TextDataCheckResponse = require("./text.data.check.response"); +import SupplementaryDocumentTextDataCheckResponse = require("./supplementary.document.text.data.check.response"); +import LivenessCheckResponse = require("./liveness.check.response"); +import IdDocumentComparisonCheckResponse = require("./id.document.comparison.check.response"); +import ThirdPartyIdentityCheckResponse = require("./third.party.identity.check.response"); +import WatchlistScreeningCheckResponse = require("./watchlist.screening.check.response"); +import WatchlistAdvancedCaCheckResponse = require("./watchlist.advanced.ca.check.response"); +import ThirdPartyIdentityFraud1CheckResponse = require("./third.party.identity.fraud.1.check.response"); +import FaceComparisonCheckResponse = require("./face.comparison.check.response"); +import ResourceContainer = require("./resource.container"); +import { YotiDate } from "../../../data_type/date"; +import IdentityProfileResponse = require("./identity.profile.response"); diff --git a/types/src/idv_service/session/retrieve/id.document.comparison.check.response.d.ts b/types/src/idv_service/session/retrieve/id.document.comparison.check.response.d.ts new file mode 100644 index 000000000..02ab6eda5 --- /dev/null +++ b/types/src/idv_service/session/retrieve/id.document.comparison.check.response.d.ts @@ -0,0 +1,4 @@ +export = IdDocumentComparisonCheckResponse; +declare class IdDocumentComparisonCheckResponse extends CheckResponse { +} +import CheckResponse = require("./check.response"); diff --git a/types/src/idv_service/session/retrieve/id.document.resource.response.d.ts b/types/src/idv_service/session/retrieve/id.document.resource.response.d.ts new file mode 100644 index 000000000..aa0abfd76 --- /dev/null +++ b/types/src/idv_service/session/retrieve/id.document.resource.response.d.ts @@ -0,0 +1,49 @@ +export = IdDocumentResourceResponse; +declare class IdDocumentResourceResponse extends ResourceResponse { + /** @private */ + private documentType; + /** @private */ + private issuingCountry; + /** @private */ + private pages; + /** @private */ + private documentFields; + /** @private */ + private documentIdPhoto; + /** @private */ + private expandedDocumentFields; + /** + * @returns {string} + */ + getDocumentType(): string; + /** + * @returns {string} + */ + getIssuingCountry(): string; + /** + * @returns {PageResponse[]} + */ + getPages(): PageResponse[]; + /** + * @returns {DocumentFieldsResponse} + */ + getDocumentFields(): DocumentFieldsResponse; + /** + * @returns {DocumentIdPhotoResponse} + */ + getDocumentIdPhoto(): DocumentIdPhotoResponse; + /** + * @returns {ExpandedDocumentFieldsResponse} + */ + getExpandedDocumentFields(): ExpandedDocumentFieldsResponse; + /** + * @returns {TextExtractionTaskResponse[]} + */ + getTextExtractionTasks(): TextExtractionTaskResponse[]; +} +import ResourceResponse = require("./resource.response"); +import PageResponse = require("./page.response"); +import DocumentFieldsResponse = require("./document.fields.response"); +import DocumentIdPhotoResponse = require("./document.id.photo.response"); +import ExpandedDocumentFieldsResponse = require("./expanded.document.fields.response"); +import TextExtractionTaskResponse = require("./text.extraction.task.response"); diff --git a/types/src/idv_service/session/retrieve/identity.profile.failure.reason.response.d.ts b/types/src/idv_service/session/retrieve/identity.profile.failure.reason.response.d.ts new file mode 100644 index 000000000..7aaa8d683 --- /dev/null +++ b/types/src/idv_service/session/retrieve/identity.profile.failure.reason.response.d.ts @@ -0,0 +1,7 @@ +export = IdentityProfileFailureReasonResponse; +declare class IdentityProfileFailureReasonResponse { + constructor(failureReason: any); + /** @private */ + private reasonCode; + getReasonCode(): any; +} diff --git a/types/src/idv_service/session/retrieve/identity.profile.report.response.d.ts b/types/src/idv_service/session/retrieve/identity.profile.report.response.d.ts new file mode 100644 index 000000000..062844c77 --- /dev/null +++ b/types/src/idv_service/session/retrieve/identity.profile.report.response.d.ts @@ -0,0 +1,24 @@ +export = IdentityProfileReportResponse; +declare class IdentityProfileReportResponse { + constructor(report: any); + /** @private */ + private trustFramework; + /** @private */ + private schemesCompliance; + /** @private */ + private media; + /** + * @returns {string} + */ + getTrustFramework(): string; + /** + * @returns {IdentityProfileReportSchemesComplianceResponse[]} + */ + getSchemesCompliance(): IdentityProfileReportSchemesComplianceResponse[]; + /** + * @returns {MediaResponse} + */ + getMedia(): MediaResponse; +} +import IdentityProfileReportSchemesComplianceResponse = require("./identity.profile.report.schemes.compliance.response"); +import MediaResponse = require("./media.response"); diff --git a/types/src/idv_service/session/retrieve/identity.profile.report.schemes.compliance.response.d.ts b/types/src/idv_service/session/retrieve/identity.profile.report.schemes.compliance.response.d.ts new file mode 100644 index 000000000..d63c600ed --- /dev/null +++ b/types/src/idv_service/session/retrieve/identity.profile.report.schemes.compliance.response.d.ts @@ -0,0 +1,22 @@ +export = IdentityProfileReportSchemesComplianceResponse; +declare class IdentityProfileReportSchemesComplianceResponse { + constructor(schemesCompliance: any); + /** @private */ + private scheme; + /** @private */ + private requirementsMet; + /** @private */ + private requirementsNotMetInfo; + /** + * @returns {object} + */ + getScheme(): object; + /** + * @returns {boolean} + */ + isRequirementsMet(): boolean; + /** + * @returns {string} + */ + getRequirementsNotMetInfo(): string; +} diff --git a/types/src/idv_service/session/retrieve/identity.profile.response.d.ts b/types/src/idv_service/session/retrieve/identity.profile.response.d.ts new file mode 100644 index 000000000..4a291f230 --- /dev/null +++ b/types/src/idv_service/session/retrieve/identity.profile.response.d.ts @@ -0,0 +1,29 @@ +export = IdentityProfileResponse; +declare class IdentityProfileResponse { + constructor(identityProfile: any); + /** @private */ + private subjectId; + /** @private */ + private result; + /** @private */ + private failureReason; + /** @private */ + private identityProfileReport; + /** + * @returns {string} + */ + getSubjectId(): string; + /** + * @returns {string} + */ + getResult(): string; + /** + * @returns {object} + */ + getFailureReason(): object; + /** + * @returns {IdentityProfileReportResponse} + */ + getIdentityProfileReport(): IdentityProfileReportResponse; +} +import IdentityProfileReportResponse = require("./identity.profile.report.response"); diff --git a/types/src/idv_service/session/retrieve/liveness.check.response.d.ts b/types/src/idv_service/session/retrieve/liveness.check.response.d.ts new file mode 100644 index 000000000..34a919d67 --- /dev/null +++ b/types/src/idv_service/session/retrieve/liveness.check.response.d.ts @@ -0,0 +1,4 @@ +export = LivenessCheckResponse; +declare class LivenessCheckResponse extends CheckResponse { +} +import CheckResponse = require("./check.response"); diff --git a/types/src/idv_service/session/retrieve/liveness.resource.response.d.ts b/types/src/idv_service/session/retrieve/liveness.resource.response.d.ts new file mode 100644 index 000000000..5e6da3b17 --- /dev/null +++ b/types/src/idv_service/session/retrieve/liveness.resource.response.d.ts @@ -0,0 +1,10 @@ +export = LivenessResourceResponse; +declare class LivenessResourceResponse extends ResourceResponse { + /** @private */ + private livenessType; + /** + * @returns {string} + */ + getLivenessType(): string; +} +import ResourceResponse = require("./resource.response"); diff --git a/types/src/idv_service/session/retrieve/media.response.d.ts b/types/src/idv_service/session/retrieve/media.response.d.ts new file mode 100644 index 000000000..1120f9164 --- /dev/null +++ b/types/src/idv_service/session/retrieve/media.response.d.ts @@ -0,0 +1,29 @@ +export = MediaResponse; +declare class MediaResponse { + constructor(media: any); + /** @private */ + private id; + /** @private */ + private type; + /** @private */ + private created; + /** @private */ + private lastUpdated; + /** + * @returns {string} + */ + getId(): string; + /** + * @returns {string} + */ + getType(): string; + /** + * @returns {YotiDate} + */ + getCreated(): YotiDate; + /** + * @returns {YotiDate} + */ + getLastUpdated(): YotiDate; +} +import { YotiDate } from "../../../data_type/date"; diff --git a/types/src/idv_service/session/retrieve/page.response.d.ts b/types/src/idv_service/session/retrieve/page.response.d.ts new file mode 100644 index 000000000..8d736a701 --- /dev/null +++ b/types/src/idv_service/session/retrieve/page.response.d.ts @@ -0,0 +1,24 @@ +export = PageResponse; +declare class PageResponse { + constructor(page: any); + /** @private */ + private captureMethod; + /** @private */ + private media; + /** @private */ + private frames; + /** + * @returns {string} + */ + getCaptureMethod(): string; + /** + * @returns {MediaResponse} + */ + getMedia(): MediaResponse; + /** + * @returns {FrameResponse[]} + */ + getFrames(): FrameResponse[]; +} +import MediaResponse = require("./media.response"); +import FrameResponse = require("./frame.response"); diff --git a/types/src/idv_service/session/retrieve/profile.check.response.d.ts b/types/src/idv_service/session/retrieve/profile.check.response.d.ts new file mode 100644 index 000000000..ee7e891ef --- /dev/null +++ b/types/src/idv_service/session/retrieve/profile.check.response.d.ts @@ -0,0 +1,11 @@ +export = ProfileCheckResponse; +declare class ProfileCheckResponse extends CheckResponse { + /** @private */ + private generatedProfile; + /** + * @returns {GeneratedProfileResponse} + */ + getGeneratedProfile(): GeneratedProfileResponse; +} +import CheckResponse = require("./check.response"); +import GeneratedProfileResponse = require("./generated.profile.response"); diff --git a/types/src/idv_service/session/retrieve/raw.results.response.d.ts b/types/src/idv_service/session/retrieve/raw.results.response.d.ts new file mode 100644 index 000000000..e97e86d3e --- /dev/null +++ b/types/src/idv_service/session/retrieve/raw.results.response.d.ts @@ -0,0 +1,11 @@ +export = RawResultsResponse; +declare class RawResultsResponse { + constructor(rawResults: any); + /** @private */ + private media; + /** + * @returns {MediaResponse} + */ + getMedia(): MediaResponse; +} +import MediaResponse = require("./media.response"); diff --git a/types/src/idv_service/session/retrieve/recommendation.response.d.ts b/types/src/idv_service/session/retrieve/recommendation.response.d.ts new file mode 100644 index 000000000..d7b9f0ac0 --- /dev/null +++ b/types/src/idv_service/session/retrieve/recommendation.response.d.ts @@ -0,0 +1,22 @@ +export = RecommendationResponse; +declare class RecommendationResponse { + constructor(recommendation: any); + /** @private */ + private value; + /** @private */ + private reason; + /** @private */ + private recoverySuggestion; + /** + * @returns {string} + */ + getValue(): string; + /** + * @returns {string} + */ + getReason(): string; + /** + * @returns {string} + */ + getRecoverySuggestion(): string; +} diff --git a/types/src/idv_service/session/retrieve/report.response.d.ts b/types/src/idv_service/session/retrieve/report.response.d.ts new file mode 100644 index 000000000..c99307d4e --- /dev/null +++ b/types/src/idv_service/session/retrieve/report.response.d.ts @@ -0,0 +1,18 @@ +export = ReportResponse; +declare class ReportResponse { + constructor(report: any); + /** @private */ + private recommendation; + /** @private */ + private breakdown; + /** + * @returns {RecommendationResponse} + */ + getRecommendation(): RecommendationResponse; + /** + * @returns {BreakdownResponse[]} + */ + getBreakdown(): BreakdownResponse[]; +} +import RecommendationResponse = require("./recommendation.response"); +import BreakdownResponse = require("./breakdown.response"); diff --git a/types/src/idv_service/session/retrieve/resource.container.d.ts b/types/src/idv_service/session/retrieve/resource.container.d.ts new file mode 100644 index 000000000..3b052d4d6 --- /dev/null +++ b/types/src/idv_service/session/retrieve/resource.container.d.ts @@ -0,0 +1,56 @@ +export = ResourceContainer; +declare class ResourceContainer { + constructor(resources: any); + /** @private */ + private idDocuments; + /** @private */ + private supplementaryDocuments; + /** @private */ + private livenessCapture; + /** @private */ + private faceCapture; + /** + * Returns ID documents that were uploaded by the user + * + * @returns {IdDocumentResourceResponse[]} + * The list of ID documents + */ + getIdDocuments(): IdDocumentResourceResponse[]; + /** + * Returns supplementary documents that were uploaded by the user + * + * @returns {SupplementaryDocumentResourceResponse[]} + * The list of supplementary documents + */ + getSupplementaryDocuments(): SupplementaryDocumentResourceResponse[]; + /** + * Returns liveness resources uploaded by the user + * + * @returns {LivenessResourceResponse[]} + * The list of liveness resources + */ + getLivenessCapture(): LivenessResourceResponse[]; + /** + * @returns {ZoomLivenessResourceResponse[]} + * The list of Zoom liveness resources + */ + getZoomLivenessResources(): ZoomLivenessResourceResponse[]; + /** + * @returns {StaticLivenessResourceResponse[]} + * The list of Static liveness resources + */ + getStaticLivenessResources(): StaticLivenessResourceResponse[]; + /** + * Returns face resources uploaded by the user + * + * @returns {FaceCaptureResourceResponse[]} + * The list of face resources + */ + getFaceCaptureResources(): FaceCaptureResourceResponse[]; +} +import IdDocumentResourceResponse = require("./id.document.resource.response"); +import SupplementaryDocumentResourceResponse = require("./supplementary.document.resource.response"); +import LivenessResourceResponse = require("./liveness.resource.response"); +import ZoomLivenessResourceResponse = require("./zoom.liveness.resource.response"); +import StaticLivenessResourceResponse = require("./static.liveness.resource.response"); +import FaceCaptureResourceResponse = require("./face.capture.resource.response"); diff --git a/types/src/idv_service/session/retrieve/resource.response.d.ts b/types/src/idv_service/session/retrieve/resource.response.d.ts new file mode 100644 index 000000000..1d8e1c11a --- /dev/null +++ b/types/src/idv_service/session/retrieve/resource.response.d.ts @@ -0,0 +1,17 @@ +export = ResourceResponse; +declare class ResourceResponse { + constructor(resource: any); + /** @private */ + private id; + /** @private */ + private tasks; + /** + * @returns {TaskResponse[]} + */ + getTasks(): TaskResponse[]; + /** + * @returns {string} + */ + getId(): string; +} +import TaskResponse = require("./task.response"); diff --git a/types/src/idv_service/session/retrieve/search.profile.sources.response.d.ts b/types/src/idv_service/session/retrieve/search.profile.sources.response.d.ts new file mode 100644 index 000000000..77917e804 --- /dev/null +++ b/types/src/idv_service/session/retrieve/search.profile.sources.response.d.ts @@ -0,0 +1,11 @@ +export = SearchProfileSourcesResponse; +declare class SearchProfileSourcesResponse extends CaSourcesResponse { + /** @private */ + private searchProfile; + /** + * + * @return {string} + */ + getSearchProfile(): string; +} +import CaSourcesResponse = require("./ca.sources.response"); diff --git a/types/src/idv_service/session/retrieve/static.liveness.resource.response.d.ts b/types/src/idv_service/session/retrieve/static.liveness.resource.response.d.ts new file mode 100644 index 000000000..6fc85083a --- /dev/null +++ b/types/src/idv_service/session/retrieve/static.liveness.resource.response.d.ts @@ -0,0 +1,11 @@ +export = StaticLivenessResourceResponse; +declare class StaticLivenessResourceResponse extends LivenessResourceResponse { + /** @private */ + private image; + /** + * @returns {MediaResponse} + */ + getImage(): MediaResponse; +} +import LivenessResourceResponse = require("./liveness.resource.response"); +import MediaResponse = require("./media.response"); diff --git a/types/src/idv_service/session/retrieve/supplementary.document.resource.response.d.ts b/types/src/idv_service/session/retrieve/supplementary.document.resource.response.d.ts new file mode 100644 index 000000000..2a5f15293 --- /dev/null +++ b/types/src/idv_service/session/retrieve/supplementary.document.resource.response.d.ts @@ -0,0 +1,42 @@ +export = SupplementaryDocumentResourceResponse; +declare class SupplementaryDocumentResourceResponse extends ResourceResponse { + /** @private */ + private documentType; + /** @private */ + private issuingCountry; + /** @private */ + private pages; + /** @private */ + private documentFields; + /** @private */ + private file; + /** + * @returns {SupplementaryDocumentTextExtractionTaskResponse[]} + */ + getTextExtractionTasks(): SupplementaryDocumentTextExtractionTaskResponse[]; + /** + * @returns {string} + */ + getDocumentType(): string; + /** + * @returns {string} + */ + getIssuingCountry(): string; + /** + * @returns {PageResponse[]} + */ + getPages(): PageResponse[]; + /** + * @returns {DocumentFieldsResponse} + */ + getDocumentFields(): DocumentFieldsResponse; + /** + * @returns {FileResponse} + */ + getDocumentFile(): FileResponse; +} +import ResourceResponse = require("./resource.response"); +import SupplementaryDocumentTextExtractionTaskResponse = require("./supplementary.document.text.extraction.task.response"); +import PageResponse = require("./page.response"); +import DocumentFieldsResponse = require("./document.fields.response"); +import FileResponse = require("./file.response"); diff --git a/types/src/idv_service/session/retrieve/supplementary.document.text.data.check.response.d.ts b/types/src/idv_service/session/retrieve/supplementary.document.text.data.check.response.d.ts new file mode 100644 index 000000000..68ffe4104 --- /dev/null +++ b/types/src/idv_service/session/retrieve/supplementary.document.text.data.check.response.d.ts @@ -0,0 +1,4 @@ +export = SupplementaryDocumentTextDataCheckResponse; +declare class SupplementaryDocumentTextDataCheckResponse extends CheckResponse { +} +import CheckResponse = require("./check.response"); diff --git a/types/src/idv_service/session/retrieve/supplementary.document.text.extraction.task.response.d.ts b/types/src/idv_service/session/retrieve/supplementary.document.text.extraction.task.response.d.ts new file mode 100644 index 000000000..d4a5336fe --- /dev/null +++ b/types/src/idv_service/session/retrieve/supplementary.document.text.extraction.task.response.d.ts @@ -0,0 +1,4 @@ +export = SupplementaryDocumentTextExtractionTaskResponse; +declare class SupplementaryDocumentTextExtractionTaskResponse extends TaskResponse { +} +import TaskResponse = require("./task.response"); diff --git a/types/src/idv_service/session/retrieve/task.response.d.ts b/types/src/idv_service/session/retrieve/task.response.d.ts new file mode 100644 index 000000000..e1ad133df --- /dev/null +++ b/types/src/idv_service/session/retrieve/task.response.d.ts @@ -0,0 +1,56 @@ +export = TaskResponse; +declare class TaskResponse { + constructor(task: any); + /** @private */ + private type; + /** @private */ + private id; + /** @private */ + private state; + /** @private */ + private created; + /** @private */ + private lastUpdated; + /** @private */ + private generatedChecks; + /** @private */ + private generatedMedia; + /** + * @returns {string} + */ + getType(): string; + /** + * @returns {string} + */ + getId(): string; + /** + * @returns {string} + */ + getState(): string; + /** + * @returns {YotiDate} + */ + getCreated(): YotiDate; + /** + * @returns {YotiDate} + */ + getLastUpdated(): YotiDate; + /** + * @returns {GeneratedCheckResponse[]} + */ + getGeneratedChecks(): GeneratedCheckResponse[]; + /** + * @deprecated this method is now implemented on subclasses. + * + * @returns {GeneratedTextDataCheckResponse[]} + */ + getGeneratedTextDataChecks(): GeneratedTextDataCheckResponse[]; + /** + * @returns {GeneratedMedia[]} + */ + getGeneratedMedia(): GeneratedMedia[]; +} +import { YotiDate } from "../../../data_type/date"; +import GeneratedCheckResponse = require("./generated.check.response"); +import GeneratedTextDataCheckResponse = require("./generated.text.data.check.response"); +import GeneratedMedia = require("./generated.media"); diff --git a/types/src/idv_service/session/retrieve/text.data.check.response.d.ts b/types/src/idv_service/session/retrieve/text.data.check.response.d.ts new file mode 100644 index 000000000..1119c5a6b --- /dev/null +++ b/types/src/idv_service/session/retrieve/text.data.check.response.d.ts @@ -0,0 +1,4 @@ +export = TextDataCheckResponse; +declare class TextDataCheckResponse extends CheckResponse { +} +import CheckResponse = require("./check.response"); diff --git a/types/src/idv_service/session/retrieve/text.extraction.task.response.d.ts b/types/src/idv_service/session/retrieve/text.extraction.task.response.d.ts new file mode 100644 index 000000000..2e8827c86 --- /dev/null +++ b/types/src/idv_service/session/retrieve/text.extraction.task.response.d.ts @@ -0,0 +1,4 @@ +export = TextExtractionTaskResponse; +declare class TextExtractionTaskResponse extends TaskResponse { +} +import TaskResponse = require("./task.response"); diff --git a/types/src/idv_service/session/retrieve/third.party.identity.check.response.d.ts b/types/src/idv_service/session/retrieve/third.party.identity.check.response.d.ts new file mode 100644 index 000000000..55de6c7f6 --- /dev/null +++ b/types/src/idv_service/session/retrieve/third.party.identity.check.response.d.ts @@ -0,0 +1,4 @@ +export = ThirdPartyIdentityCheckResponse; +declare class ThirdPartyIdentityCheckResponse extends ProfileCheckResponse { +} +import ProfileCheckResponse = require("./profile.check.response"); diff --git a/types/src/idv_service/session/retrieve/third.party.identity.fraud.1.check.response.d.ts b/types/src/idv_service/session/retrieve/third.party.identity.fraud.1.check.response.d.ts new file mode 100644 index 000000000..898893c70 --- /dev/null +++ b/types/src/idv_service/session/retrieve/third.party.identity.fraud.1.check.response.d.ts @@ -0,0 +1,4 @@ +export = ThirdPartyIdentityFraud1CheckResponse; +declare class ThirdPartyIdentityFraud1CheckResponse extends ProfileCheckResponse { +} +import ProfileCheckResponse = require("./profile.check.response"); diff --git a/types/src/idv_service/session/retrieve/type.list.sources.response.d.ts b/types/src/idv_service/session/retrieve/type.list.sources.response.d.ts new file mode 100644 index 000000000..97f0e15e3 --- /dev/null +++ b/types/src/idv_service/session/retrieve/type.list.sources.response.d.ts @@ -0,0 +1,11 @@ +export = TypeListSourcesResponse; +declare class TypeListSourcesResponse extends CaSourcesResponse { + /** @private */ + private types; + /** + * + * @return {string[]} + */ + getTypes(): string[]; +} +import CaSourcesResponse = require("./ca.sources.response"); diff --git a/types/src/idv_service/session/retrieve/watchlist.advanced.ca.check.response.d.ts b/types/src/idv_service/session/retrieve/watchlist.advanced.ca.check.response.d.ts new file mode 100644 index 000000000..3ef015282 --- /dev/null +++ b/types/src/idv_service/session/retrieve/watchlist.advanced.ca.check.response.d.ts @@ -0,0 +1,13 @@ +export = WatchlistAdvancedCaCheckResponse; +declare class WatchlistAdvancedCaCheckResponse extends WatchlistCheckResponse { + /** + * @returns {ReportResponse|WatchlistAdvancedCaReportResponse} + */ + getReport(): ReportResponse | WatchlistAdvancedCaReportResponse; +} +declare namespace WatchlistAdvancedCaCheckResponse { + export { ReportResponse }; +} +import WatchlistCheckResponse = require("./watchlist.check.response"); +import WatchlistAdvancedCaReportResponse = require("./watchlist.advanced.ca.report.response"); +type ReportResponse = import('./report.response'); diff --git a/types/src/idv_service/session/retrieve/watchlist.advanced.ca.report.response.d.ts b/types/src/idv_service/session/retrieve/watchlist.advanced.ca.report.response.d.ts new file mode 100644 index 000000000..7c48ef8a2 --- /dev/null +++ b/types/src/idv_service/session/retrieve/watchlist.advanced.ca.report.response.d.ts @@ -0,0 +1,12 @@ +export = WatchlistAdvancedCaReportResponse; +declare class WatchlistAdvancedCaReportResponse extends WatchlistReportResponse { + /** @private */ + private watchListSummary; + /** + * + * @return {WatchlistAdvancedCaSummaryResponse} + */ + getWatchlistSummary(): WatchlistAdvancedCaSummaryResponse; +} +import WatchlistReportResponse = require("./watchlist.report.response"); +import WatchlistAdvancedCaSummaryResponse = require("./watchlist.advanced.ca.summary.response"); diff --git a/types/src/idv_service/session/retrieve/watchlist.advanced.ca.search.config.response.d.ts b/types/src/idv_service/session/retrieve/watchlist.advanced.ca.search.config.response.d.ts new file mode 100644 index 000000000..d58fd21d3 --- /dev/null +++ b/types/src/idv_service/session/retrieve/watchlist.advanced.ca.search.config.response.d.ts @@ -0,0 +1,46 @@ +export = WatchlistAdvancedCaSearchConfigResponse; +declare class WatchlistAdvancedCaSearchConfigResponse extends WatchlistSearchConfigResponse { + constructor(searchConfig: any); + /** @private */ + private type; + /** @private */ + private removeDeceased; + /** @private */ + private shareUrl; + /** @private */ + private sources; + /** @private */ + private matchingStrategy; + /** + * @returns {string} + */ + getType(): string; + /** + * @returns {boolean} + */ + isRemoveDeceased(): boolean; + /** + * @returns {boolean} + */ + isShareUrl(): boolean; + /** + * @returns {CaSourcesResponse} + */ + getSources(): CaSourcesResponse; + /** + * @returns {CaMatchingStrategyResponse} + */ + getMatchingStrategy(): CaMatchingStrategyResponse; +} +declare namespace WatchlistAdvancedCaSearchConfigResponse { + export { types }; +} +import WatchlistSearchConfigResponse = require("./watchlist.search.config.response"); +import CaSourcesResponse = require("./ca.sources.response"); +import CaMatchingStrategyResponse = require("./ca.matching.strategy.response"); +declare namespace types { + export { WITH_YOTI_ACCOUNT }; + export { WITH_CUSTOM_ACCOUNT }; +} +import { WITH_YOTI_ACCOUNT } from "../../idv.constants"; +import { WITH_CUSTOM_ACCOUNT } from "../../idv.constants"; diff --git a/types/src/idv_service/session/retrieve/watchlist.advanced.ca.summary.response.d.ts b/types/src/idv_service/session/retrieve/watchlist.advanced.ca.summary.response.d.ts new file mode 100644 index 000000000..d81ddb702 --- /dev/null +++ b/types/src/idv_service/session/retrieve/watchlist.advanced.ca.summary.response.d.ts @@ -0,0 +1,11 @@ +export = WatchlistAdvancedCaSummaryResponse; +declare class WatchlistAdvancedCaSummaryResponse extends WatchlistSummaryResponse { + /** @private */ + private searchConfig; + /** + * @returns {WatchlistAdvancedCaSearchConfigResponse} + */ + getSearchConfig(): WatchlistAdvancedCaSearchConfigResponse; +} +import WatchlistSummaryResponse = require("./watchlist.summary.response"); +import WatchlistAdvancedCaSearchConfigResponse = require("./watchlist.advanced.ca.search.config.response"); diff --git a/types/src/idv_service/session/retrieve/watchlist.check.response.d.ts b/types/src/idv_service/session/retrieve/watchlist.check.response.d.ts new file mode 100644 index 000000000..163821674 --- /dev/null +++ b/types/src/idv_service/session/retrieve/watchlist.check.response.d.ts @@ -0,0 +1,4 @@ +export = WatchlistCheckResponse; +declare class WatchlistCheckResponse extends ProfileCheckResponse { +} +import ProfileCheckResponse = require("./profile.check.response"); diff --git a/types/src/idv_service/session/retrieve/watchlist.report.response.d.ts b/types/src/idv_service/session/retrieve/watchlist.report.response.d.ts new file mode 100644 index 000000000..9cb779f53 --- /dev/null +++ b/types/src/idv_service/session/retrieve/watchlist.report.response.d.ts @@ -0,0 +1,4 @@ +export = WatchlistReportResponse; +declare class WatchlistReportResponse extends ReportResponse { +} +import ReportResponse = require("./report.response"); diff --git a/types/src/idv_service/session/retrieve/watchlist.screening.check.response.d.ts b/types/src/idv_service/session/retrieve/watchlist.screening.check.response.d.ts new file mode 100644 index 000000000..554aaaed2 --- /dev/null +++ b/types/src/idv_service/session/retrieve/watchlist.screening.check.response.d.ts @@ -0,0 +1,17 @@ +export = WatchlistScreeningCheckResponse; +/** + * @typedef {import('./report.response')} ReportResponse + */ +declare class WatchlistScreeningCheckResponse extends WatchlistCheckResponse { + /** + * + * @return {ReportResponse|WatchlistScreeningReportResponse} + */ + getReport(): ReportResponse | WatchlistScreeningReportResponse; +} +declare namespace WatchlistScreeningCheckResponse { + export { ReportResponse }; +} +import WatchlistCheckResponse = require("./watchlist.check.response"); +import WatchlistScreeningReportResponse = require("./watchlist.screening.report.response"); +type ReportResponse = import('./report.response'); diff --git a/types/src/idv_service/session/retrieve/watchlist.screening.report.response.d.ts b/types/src/idv_service/session/retrieve/watchlist.screening.report.response.d.ts new file mode 100644 index 000000000..a60014276 --- /dev/null +++ b/types/src/idv_service/session/retrieve/watchlist.screening.report.response.d.ts @@ -0,0 +1,12 @@ +export = WatchlistScreeningReportResponse; +declare class WatchlistScreeningReportResponse extends WatchlistReportResponse { + /** @private */ + private watchListSummary; + /** + * + * @return {WatchlistScreeningSummaryResponse} + */ + getWatchlistSummary(): WatchlistScreeningSummaryResponse; +} +import WatchlistReportResponse = require("./watchlist.report.response"); +import WatchlistScreeningSummaryResponse = require("./watchlist.screening.summary.response"); diff --git a/types/src/idv_service/session/retrieve/watchlist.screening.search.config.response.d.ts b/types/src/idv_service/session/retrieve/watchlist.screening.search.config.response.d.ts new file mode 100644 index 000000000..5fd0c8ebc --- /dev/null +++ b/types/src/idv_service/session/retrieve/watchlist.screening.search.config.response.d.ts @@ -0,0 +1,11 @@ +export = WatchlistScreeningSearchConfigResponse; +declare class WatchlistScreeningSearchConfigResponse extends WatchlistSearchConfigResponse { + constructor(searchConfig: any); + /** @private */ + private categories; + /** + * @returns {string[]} + */ + getCategories(): string[]; +} +import WatchlistSearchConfigResponse = require("./watchlist.search.config.response"); diff --git a/types/src/idv_service/session/retrieve/watchlist.screening.summary.response.d.ts b/types/src/idv_service/session/retrieve/watchlist.screening.summary.response.d.ts new file mode 100644 index 000000000..f0ef2c645 --- /dev/null +++ b/types/src/idv_service/session/retrieve/watchlist.screening.summary.response.d.ts @@ -0,0 +1,11 @@ +export = WatchlistScreeningSummaryResponse; +declare class WatchlistScreeningSummaryResponse extends WatchlistSummaryResponse { + /** @private */ + private searchConfig; + /** + * @returns {WatchlistScreeningSearchConfigResponse} + */ + getSearchConfig(): WatchlistScreeningSearchConfigResponse; +} +import WatchlistSummaryResponse = require("./watchlist.summary.response"); +import WatchlistScreeningSearchConfigResponse = require("./watchlist.screening.search.config.response"); diff --git a/types/src/idv_service/session/retrieve/watchlist.search.config.response.d.ts b/types/src/idv_service/session/retrieve/watchlist.search.config.response.d.ts new file mode 100644 index 000000000..06b2fddad --- /dev/null +++ b/types/src/idv_service/session/retrieve/watchlist.search.config.response.d.ts @@ -0,0 +1,3 @@ +export = WatchlistSearchConfigResponse; +declare class WatchlistSearchConfigResponse { +} diff --git a/types/src/idv_service/session/retrieve/watchlist.summary.response.d.ts b/types/src/idv_service/session/retrieve/watchlist.summary.response.d.ts new file mode 100644 index 000000000..69ece3eb4 --- /dev/null +++ b/types/src/idv_service/session/retrieve/watchlist.summary.response.d.ts @@ -0,0 +1,23 @@ +export = WatchlistSummaryResponse; +declare class WatchlistSummaryResponse { + constructor(summary: any); + /** @private */ + private totalHits; + /** @private */ + private associatedCountryCodes; + /** @private */ + private rawResults; + /** + * @returns {number} + */ + getTotalHits(): number; + /** + * @returns {string[]} + */ + getAssociatedCountryCodes(): string[]; + /** + * @returns {RawResultsResponse} + */ + getRawResults(): RawResultsResponse; +} +import RawResultsResponse = require("./raw.results.response"); diff --git a/types/src/idv_service/session/retrieve/yoti.account.watchlist.ca.search.config.response.d.ts b/types/src/idv_service/session/retrieve/yoti.account.watchlist.ca.search.config.response.d.ts new file mode 100644 index 000000000..131fb8265 --- /dev/null +++ b/types/src/idv_service/session/retrieve/yoti.account.watchlist.ca.search.config.response.d.ts @@ -0,0 +1,4 @@ +export = YotiAccountWatchlistCaSearchConfigResponse; +declare class YotiAccountWatchlistCaSearchConfigResponse extends WatchlistAdvancedCaSearchConfigResponse { +} +import WatchlistAdvancedCaSearchConfigResponse = require("./watchlist.advanced.ca.search.config.response"); diff --git a/types/src/idv_service/session/retrieve/zoom.liveness.resource.response.d.ts b/types/src/idv_service/session/retrieve/zoom.liveness.resource.response.d.ts new file mode 100644 index 000000000..95a7c3256 --- /dev/null +++ b/types/src/idv_service/session/retrieve/zoom.liveness.resource.response.d.ts @@ -0,0 +1,18 @@ +export = ZoomLivenessResourceResponse; +declare class ZoomLivenessResourceResponse extends LivenessResourceResponse { + /** @private */ + private faceMap; + /** @private */ + private frames; + /** + * @returns {FaceMapResponse} + */ + getFaceMap(): FaceMapResponse; + /** + * @returns {FrameResponse[]} + */ + getFrames(): FrameResponse[]; +} +import LivenessResourceResponse = require("./liveness.resource.response"); +import FaceMapResponse = require("./face.map.response"); +import FrameResponse = require("./frame.response"); diff --git a/types/src/idv_service/support/supported.country.d.ts b/types/src/idv_service/support/supported.country.d.ts new file mode 100644 index 000000000..db3348540 --- /dev/null +++ b/types/src/idv_service/support/supported.country.d.ts @@ -0,0 +1,10 @@ +export = SupportedCountry; +declare class SupportedCountry { + constructor(country: any); + /** @private */ + private code; + /** @private */ + private supportedDocuments; + getCode(): any; + getSupportedDocuments(): any; +} diff --git a/types/src/idv_service/support/supported.document.d.ts b/types/src/idv_service/support/supported.document.d.ts new file mode 100644 index 000000000..45f728158 --- /dev/null +++ b/types/src/idv_service/support/supported.document.d.ts @@ -0,0 +1,18 @@ +export = SupportedDocument; +declare class SupportedDocument { + constructor(document: any); + /** @private */ + private type; + /** @private */ + private isStrictlyLatin; + /** + * + * @return {string|undefined} + */ + getType(): string | undefined; + /** + * + * @return {boolean|undefined} + */ + getIsStrictlyLatin(): boolean | undefined; +} diff --git a/types/src/idv_service/support/supported.documents.response.d.ts b/types/src/idv_service/support/supported.documents.response.d.ts new file mode 100644 index 000000000..5a27ebafa --- /dev/null +++ b/types/src/idv_service/support/supported.documents.response.d.ts @@ -0,0 +1,7 @@ +export = SupportedDocumentsResponse; +declare class SupportedDocumentsResponse { + constructor(response: any); + /** @private */ + private supportedCountries; + getSupportedCountries(): any; +} diff --git a/types/src/profile_service/activity.details.d.ts b/types/src/profile_service/activity.details.d.ts new file mode 100644 index 000000000..061bcf07c --- /dev/null +++ b/types/src/profile_service/activity.details.d.ts @@ -0,0 +1,96 @@ +/** + * Details of an activity between a user and the application. + * + * @class ActivityDetails + */ +export class ActivityDetails { + /** + * @param {object} parsedResponse + * Parsed JSON response. + * @param {{attributes: Object[]}} userProfile + * Decrypted user profile data. + * @param {{attributes: Object[]}} applicationProfile + * Decrypted application profile data. + * @param {*[]} extraData + * Decrypted and converted extra data. + */ + constructor(parsedResponse: object, userProfile: { + attributes: any[]; + }, applicationProfile: { + attributes: any[]; + }, extraData: any[]); + /** @private */ + private parsedResponse; + /** @private */ + private receipt; + /** @private */ + private userProfile; + /** @private */ + private applicationProfile; + /** @private */ + private extraData; + /** + * Return the Remember Me ID, which is a unique, stable identifier for + * a user in the context of an application. + * + * You can use it to identify returning users. This value will be different + * for the same user in different applications. + * + * @returns {string} + */ + getRememberMeId(): string; + /** + * Return the Parent Remember Me ID, which is a unique, stable identifier for a + * user in the context of an organisation. + * + * You can use it to identify returning users. This value is consistent for a + * given user across different applications belonging to a single organisation. + * + * @returns {string} + */ + getParentRememberMeId(): string; + /** + * The user profile with shared attributes and anchor information, returned + * by Yoti if the request was successful. + * + * @returns {Profile} + */ + getProfile(): Profile; + /** + * Profile of an application, with convenience methods to access well-known attributes. + * + * @returns {ApplicationProfile} + */ + getApplicationProfile(): ApplicationProfile; + /** + * An enum to represent the success state when requesting a profile. + * + * @returns {string} + */ + getOutcome(): string; + getErrorDetails(): { + errorCode: any; + description: any; + }; + /** + * Receipt ID identifying a completed activity. + * + * @returns {string} + */ + getReceiptId(): string; + /** + * Time and date of the sharing activity + * + * @returns {Date} + */ + getTimestamp(): Date; + /** + * Extra data associated with the receipt + * + * @returns {ExtraData} + */ + getExtraData(): ExtraData; +} +import { Profile } from "./profile"; +import { ApplicationProfile } from "./application.profile"; +import ExtraData = require("./extra.data"); diff --git a/types/src/profile_service/application.profile.d.ts b/types/src/profile_service/application.profile.d.ts new file mode 100644 index 000000000..b5e1e8bba --- /dev/null +++ b/types/src/profile_service/application.profile.d.ts @@ -0,0 +1,38 @@ +export type Attribute = import('../data_type/attribute').Attribute; +/** + * @typedef {import('../data_type/attribute').Attribute} Attribute + */ +/** + * Profile of an application with convenience methods to access well-known attributes. + * + * @class ApplicationProfile + * + */ +export class ApplicationProfile extends BaseProfile { + /** + * The name of the application. + * + * @returns {null|Attribute} + */ + getName(): null | Attribute; + /** + * The URL where the application is available at. + * + * @returns {null|Attribute} + */ + getUrl(): null | Attribute; + /** + * The logo of the application that will be displayed to users that perform a share with it. + * + * @returns {null|Attribute} + */ + getLogo(): null | Attribute; + /** + * The background colour that will be displayed on each receipt the user gets, as a result + * of a share with the application. + * + * @returns {null|Attribute} + */ + getReceiptBgColor(): null | Attribute; +} +import { BaseProfile } from "./base.profile"; diff --git a/types/src/profile_service/base.profile.d.ts b/types/src/profile_service/base.profile.d.ts new file mode 100644 index 000000000..841a5c73d --- /dev/null +++ b/types/src/profile_service/base.profile.d.ts @@ -0,0 +1,47 @@ +export class BaseProfile { + /** + * @param {Array} attributes + */ + constructor(attributes?: any[]); + /** @protected */ + protected attributes: Attribute[]; + /** @private */ + private attributesMap; + /** + * Return Attribute object. + * + * @param attrName + * + * @returns {Attribute|null} + */ + getAttribute(attrName: any): Attribute | null; + /** + * Return list of all Attribute objects for provided attribute name. + * + * @param attrName + * + * @returns {Attribute[]} + */ + getAttributesByName(attrName: any): Attribute[]; + /** + * Return first attribute found by id. + * + * @param attrId + * + * @returns {Attribute} + */ + getAttributeById(attrId: any): Attribute; + /** + * Return array of all attributes for the profile. + * + * @returns {Attribute[]} + */ + getAttributesList(): Attribute[]; + /** + * Returns a string representing the object. + * + * @returns {string} + */ + toString(): string; +} +import { Attribute } from "../data_type/attribute"; diff --git a/types/src/profile_service/extra.data.d.ts b/types/src/profile_service/extra.data.d.ts new file mode 100644 index 000000000..e7b437a34 --- /dev/null +++ b/types/src/profile_service/extra.data.d.ts @@ -0,0 +1,14 @@ +export = ExtraData; +declare class ExtraData { + /** + * @param {Object[]} dataEntries + */ + constructor(dataEntries?: any[]); + /** @private */ + private attributeIssuanceDetails; + /** + * @returns {AttributeIssuanceDetails} + */ + getAttributeIssuanceDetails(): AttributeIssuanceDetails; +} +import AttributeIssuanceDetails = require("../data_type/attribute.issuance.details"); diff --git a/types/src/profile_service/index.d.ts b/types/src/profile_service/index.d.ts new file mode 100644 index 000000000..24e5d300d --- /dev/null +++ b/types/src/profile_service/index.d.ts @@ -0,0 +1,23 @@ +export function getReceipt(token: any, pem: any, sdkId: any): Promise; +/** + * Service Class to handle interactions with the profile API + * + * @class ProfileService + */ +export class ProfileService { + /** + * @param {string} sdkId + * @param {string|Buffer} pem + * @param {{apiUrl?: string}} options + */ + constructor(sdkId: string, pem: string | Buffer, { apiUrl }?: { + apiUrl?: string; + }); + /** @private */ + private sdkId; + /** @private */ + private pem; + /** @private */ + private apiUrl; + getReceipt(token: any): Promise; +} diff --git a/types/src/profile_service/profile.d.ts b/types/src/profile_service/profile.d.ts new file mode 100644 index 000000000..7a28c36ad --- /dev/null +++ b/types/src/profile_service/profile.d.ts @@ -0,0 +1,130 @@ +/** + * Profile of a human user with convenience methods to access well-known attributes. + * + * @class Profile + */ +export class Profile extends BaseProfile { + /** @private */ + private ageVerifications; + /** + * The full name attribute. + * + * @returns {null|Attribute} + */ + getFullName(): null | Attribute; + /** + * Corresponds to secondary names in passport, and first/middle names in English. + * + * @returns {null|Attribute} + */ + getGivenNames(): null | Attribute; + /** + * Corresponds to primary name in passport, and surname in English. + * + * @returns {null|Attribute} + */ + getFamilyName(): null | Attribute; + /** + * Date of birth. + * + * @returns {null|Attribute} + */ + getDateOfBirth(): null | Attribute; + /** + * Finds all the 'Age Over' and 'Age Under' derived attributes returned with the profile, + * and returns them wrapped in AgeVerification objects + * + * @returns {Array} + */ + getAgeVerifications(): any[]; + /** + * Searches for an AgeVerification corresponding to an 'Age Over' check for the given age + * + * @param {number} age + * + * @returns {AgeVerification|null} + */ + findAgeOverVerification(age: number): AgeVerification | null; + /** + * Searches for an AgeVerification corresponding to an 'Age Under' check for the given age. + * + * @param {number} age + * + * @returns {AgeVerification|null} + */ + findAgeUnderVerification(age: number): AgeVerification | null; + /** + * Searches for an AgeVerification corresponding to provided type and age. + * + * @param {string} type + * @param {number} age + * + * @returns {AgeVerification|null} + */ + findAgeVerification(type: string, age: number): AgeVerification | null; + /** + * Corresponds to the gender in the passport; will be one of the strings + * "MALE", "FEMALE", "TRANSGENDER" or "OTHER". + * + * @returns {null|Attribute} + */ + getGender(): null | Attribute; + /** + * Corresponds to the nationality in the passport. + * + * @returns {Attribute|null} + */ + getNationality(): Attribute | null; + /** + * The user's phone number, as verified at registration time. This will be a number with + for + * international prefix and no spaces, e.g. "+447777123456". + * + * @returns {null|Attribute} + */ + getPhoneNumber(): null | Attribute; + /** + * Photograph of user, encoded as a JPEG image. + * + * @returns {Attribute} + */ + getSelfie(): Attribute; + /** + * The user's verified email address. + * + * @returns {null|Attribute} + */ + getEmailAddress(): null | Attribute; + /** + * The user's postal address as a String. + * + * @returns {null|Attribute} + */ + getPostalAddress(): null | Attribute; + /** + * The user's structured postal address as a Json. + * + * @returns {null|*} + */ + getStructuredPostalAddress(): null | any; + /** + * Document details. + * + * @returns {null|Attribute} + */ + getDocumentDetails(): null | Attribute; + /** + * Document images. + * + * @returns {null|Attribute} + */ + getDocumentImages(): null | Attribute; + /** + * Identity Profile Report. + * + * @returns {null|Attribute} + */ + getIdentityProfileReport(): null | Attribute; +} +import { BaseProfile } from "./base.profile"; +import { Attribute } from "../data_type/attribute"; +import { AgeVerification } from "../data_type/age.verification"; diff --git a/types/src/proto/index.d.ts b/types/src/proto/index.d.ts new file mode 100644 index 000000000..e9320c91a --- /dev/null +++ b/types/src/proto/index.d.ts @@ -0,0 +1,3 @@ +import types = require("./types"); +import messages = require("./messages"); +export { types, messages }; diff --git a/types/src/proto/messages/index.d.ts b/types/src/proto/messages/index.d.ts new file mode 100644 index 000000000..80ef455fc --- /dev/null +++ b/types/src/proto/messages/index.d.ts @@ -0,0 +1,35 @@ +declare const _exports: { + decodeSignedTimeStamp(binaryData: Uint8Array): { + version: number; + timestamp: number; + }; + encodeSignedTimeStamp(notificationData: any): Uint8Array; + decodeThirdPartyAttribute(binaryData: any): { + issuanceToken: Buffer; + issuingAttributes: { + expiryDate: string; + definitions: { + name: string; + }[]; + }; + }; + decodeExtraData(binaryData: any): { + list: any[]; + }; + decodeEncryptedData(binaryData: Uint8Array): { + cipherText: string; + iv: string; + }; + encodeEncryptedData(notificationData: any): Uint8Array; + decodeMultiValue(value: Uint8Array): { + values: { + data: Buffer; + contentType: number; + }[]; + }; + decodeAttributeList(binaryData: Uint8Array): { + attributes: protobuf.Type[]; + }; + encodeAttributeList(attributesData: any): Uint8Array; +}; +export = _exports; diff --git a/types/src/proto/messages/proto.attribute.list.d.ts b/types/src/proto/messages/proto.attribute.list.d.ts new file mode 100644 index 000000000..81b4a93b0 --- /dev/null +++ b/types/src/proto/messages/proto.attribute.list.d.ts @@ -0,0 +1,13 @@ +export type Attribute = protobuf.Type; +/** + * Decode all attributes. + * + * @param {Uint8Array} binaryData + * + * @returns {{attributes: Attribute[]}} + */ +declare function decodeAttributeList(binaryData: Uint8Array): { + attributes: protobuf.Type[]; +}; +declare function encodeAttributeList(attributesData: any): Uint8Array; +export {}; diff --git a/types/src/proto/messages/proto.common.encrypted-data.d.ts b/types/src/proto/messages/proto.common.encrypted-data.d.ts new file mode 100644 index 000000000..b76f1e24d --- /dev/null +++ b/types/src/proto/messages/proto.common.encrypted-data.d.ts @@ -0,0 +1,9 @@ +/** + * @param {Uint8Array} binaryData + * @returns {{cipherText: string, iv: string}} + */ +export function decodeEncryptedData(binaryData: Uint8Array): { + cipherText: string; + iv: string; +}; +export function encodeEncryptedData(notificationData: any): Uint8Array; diff --git a/types/src/proto/messages/proto.multi.value.d.ts b/types/src/proto/messages/proto.multi.value.d.ts new file mode 100644 index 000000000..5b6dd91c5 --- /dev/null +++ b/types/src/proto/messages/proto.multi.value.d.ts @@ -0,0 +1,12 @@ +/** + * @typedef {{data: Buffer, contentType: number}} Value + * + * @param {Uint8Array} value + * @returns {{values: Value[]}} + */ +export function decodeMultiValue(value: Uint8Array): { + values: { + data: Buffer; + contentType: number; + }[]; +}; diff --git a/types/src/proto/messages/proto.share.extra-data.d.ts b/types/src/proto/messages/proto.share.extra-data.d.ts new file mode 100644 index 000000000..0fa0403b9 --- /dev/null +++ b/types/src/proto/messages/proto.share.extra-data.d.ts @@ -0,0 +1,7 @@ +/** + * @param {*} binaryData + * @returns {{list: Array}} + */ +export function decodeExtraData(binaryData: any): { + list: any[]; +}; diff --git a/types/src/proto/messages/proto.share.third-party-attribute.d.ts b/types/src/proto/messages/proto.share.third-party-attribute.d.ts new file mode 100644 index 000000000..caf32ece6 --- /dev/null +++ b/types/src/proto/messages/proto.share.third-party-attribute.d.ts @@ -0,0 +1,19 @@ +/** + * @typedef {Object} Definition + * @property {string} name + * + * @typedef {Object} IssuingAttributes + * @property {string} expiryDate + * @property {Definition[]} definitions + * + * @returns {{issuanceToken: Buffer, issuingAttributes:IssuingAttributes }} + */ +export function decodeThirdPartyAttribute(binaryData: any): { + issuanceToken: Buffer; + issuingAttributes: { + expiryDate: string; + definitions: { + name: string; + }[]; + }; +}; diff --git a/types/src/proto/messages/proto.signed.timestamp.d.ts b/types/src/proto/messages/proto.signed.timestamp.d.ts new file mode 100644 index 000000000..0461eeee5 --- /dev/null +++ b/types/src/proto/messages/proto.signed.timestamp.d.ts @@ -0,0 +1,9 @@ +/** + * @param {Uint8Array} binaryData + * @returns {{version: number, timestamp: number}} + */ +export function decodeSignedTimeStamp(binaryData: Uint8Array): { + version: number; + timestamp: number; +}; +export function encodeSignedTimeStamp(notificationData: any): Uint8Array; diff --git a/types/src/proto/root.d.ts b/types/src/proto/root.d.ts new file mode 100644 index 000000000..58301462d --- /dev/null +++ b/types/src/proto/root.d.ts @@ -0,0 +1,3 @@ +export = root; +declare const root: ProtoBuf.Root; +import ProtoBuf = require("protobufjs"); diff --git a/types/src/proto/types.d.ts b/types/src/proto/types.d.ts new file mode 100644 index 000000000..a83fa2b67 --- /dev/null +++ b/types/src/proto/types.d.ts @@ -0,0 +1,9 @@ +export let Anchor: protobuf.Type; +export let Attribute: protobuf.Type; +export let AttributeList: protobuf.Type; +export let MultiValue: protobuf.Type; +export let EncryptedData: protobuf.Type; +export let DataEntry: protobuf.Type; +export let ExtraData: protobuf.Type; +export let ThirdPartyAttribute: protobuf.Type; +export let SignedTimestamp: protobuf.Type; diff --git a/types/src/request/aml.result.d.ts b/types/src/request/aml.result.d.ts new file mode 100644 index 000000000..f57c40814 --- /dev/null +++ b/types/src/request/aml.result.d.ts @@ -0,0 +1,16 @@ +export class AmlResult { + /** + * Check if all expected attributes are included in the result. + * + * @param rawResult + */ + static checkAttributes(rawResult: any): void; + /** + * Process and extract the error message sent from Connect API + * + * @param Error + * + * @returns {string} + */ + static processAmlError(Error: any): string; +} diff --git a/types/src/request/constants.d.ts b/types/src/request/constants.d.ts new file mode 100644 index 000000000..eaa5625db --- /dev/null +++ b/types/src/request/constants.d.ts @@ -0,0 +1,4 @@ +export namespace ContentType { + let JSON: string; + let FORM_DATA: string; +} diff --git a/types/src/request/payload.d.ts b/types/src/request/payload.d.ts new file mode 100644 index 000000000..76d99589d --- /dev/null +++ b/types/src/request/payload.d.ts @@ -0,0 +1,31 @@ +export class Payload { + constructor(data: any, type?: string); + /** @private */ + private contentType; + /** @private */ + private data; + /** + * Get content type. + * + * @returns {string} + */ + getContentType(): string; + /** + * Get payload as a Buffer or as a string. + * + * @returns {Buffer | string} + */ + getPayloadData(): Buffer | string; + /** + * Get payload as a Base64 string. + * + * @returns {string} + */ + getBase64Payload(): string; + /** + * Get raw data. + * + * @returns {*} + */ + getRawData(): any; +} diff --git a/types/src/request/request.builder.d.ts b/types/src/request/request.builder.d.ts new file mode 100644 index 000000000..5eeac4658 --- /dev/null +++ b/types/src/request/request.builder.d.ts @@ -0,0 +1,94 @@ +/** + * Builds a request. + * + * @class RequestBuilder + */ +export class RequestBuilder { + /** @private */ + private headers; + /** @private */ + private queryParams; + /** + * @param {string} baseUrl Base URL without trailing slashes. + * + * @returns {RequestBuilder} + */ + withBaseUrl(baseUrl: string): RequestBuilder; + baseUrl: string; + /** + * @param {string} endpoint Endpoint with a single leading slash. + * + * @returns {RequestBuilder} + */ + withEndpoint(endpoint: string): RequestBuilder; + endpoint: string; + /** + * @param {string} pem + * + * @returns {RequestBuilder} + */ + withPemString(pem: string): RequestBuilder; + pem: string; + /** + * @param {string} filePath + * + * @returns {RequestBuilder} + */ + withPemFilePath(filePath: string): RequestBuilder; + /** + * @param {string} name + * @param {string} value + * + * @returns {RequestBuilder} + */ + withHeader(name: string, value: string): RequestBuilder; + /** + * @param {string} method + * + * @returns {RequestBuilder} + */ + withMethod(method: string): RequestBuilder; + method: string; + /** + * @returns {RequestBuilder} + */ + withGet(): RequestBuilder; + /** + * @returns {RequestBuilder} + */ + withPost(): RequestBuilder; + /** + * @returns {RequestBuilder} + */ + withPut(): RequestBuilder; + /** + * @param {import('./payload').Payload} payload + * + * @returns {RequestBuilder} + */ + withPayload(payload: import('./payload').Payload): RequestBuilder; + payload: import("./payload").Payload; + /** + * @param {string} name + * @param {string|boolean|number} value + * + * @returns {RequestBuilder} + */ + withQueryParam(name: string, value: string | boolean | number): RequestBuilder; + /** + * Default request headers. + * + * @param {string} messageSignature + */ + getDefaultHeaders(messageSignature: string): { + 'X-Yoti-Auth-Digest': string; + 'X-Yoti-SDK': string; + 'X-Yoti-SDK-Version': string; + Accept: string; + }; + /** + * @returns {YotiRequest} + */ + build(): YotiRequest; +} +import { YotiRequest } from "./request"; diff --git a/types/src/request/request.d.ts b/types/src/request/request.d.ts new file mode 100644 index 000000000..bc94ced26 --- /dev/null +++ b/types/src/request/request.d.ts @@ -0,0 +1,42 @@ +/** + * Represents a HTTP request message. + * + * @class YotiRequest + */ +export class YotiRequest { + constructor(method: any, url: any, headers: any, payload?: any); + /** @private */ + private method; + /** @private */ + private payload; + /** @private */ + private url; + /** @private */ + private headers; + /** + * @returns {string} + */ + getMethod(): string; + /** + * @returns {string} + */ + getUrl(): string; + /** + * @returns {import('./payload').Payload|null} + */ + getPayload(): import('./payload').Payload | null; + /** + * @returns {Object.} + */ + getHeaders(): { + [x: string]: string; + }; + /** + * Executes the request. + * + * @param {boolean} buffer Return the response as a Buffer. + * + * @returns {Promise} Resolves {YotiResponse} + */ + execute(buffer?: boolean): Promise; +} diff --git a/types/src/request/request.handler.d.ts b/types/src/request/request.handler.d.ts new file mode 100644 index 000000000..15409307a --- /dev/null +++ b/types/src/request/request.handler.d.ts @@ -0,0 +1,5 @@ +export function execute(yotiRequest: YotiRequest, buffer?: boolean): Promise; +/** + * Default HTTP request handler. + */ +export type YotiRequest = import('./request').YotiRequest; diff --git a/types/src/request/response.d.ts b/types/src/request/response.d.ts new file mode 100644 index 000000000..ac9977d5e --- /dev/null +++ b/types/src/request/response.d.ts @@ -0,0 +1,47 @@ +/** + * @class YotiResponse + */ +export class YotiResponse { + /** + * @param {*} parsedResponse + * @param {number} statusCode + * @param {Object|null} receipt + * @param {Buffer|string|null} body + * @param {Object.|null} headers + */ + constructor(parsedResponse: any, statusCode: number, receipt?: any | null, body?: Buffer | string | null, headers?: { + [x: string]: string; + } | null); + /** @private */ + private parsedResponse; + /** @private */ + private statusCode; + /** @private */ + private receipt; + /** @private */ + private body; + /** @private */ + private headers; + /** + * @returns {Object|null} Receipt if available. + */ + getReceipt(): any | null; + /** + * @returns {*} Parsed API response. + */ + getParsedResponse(): any; + /** + * @returns {Buffer|string|null} The response body. + */ + getBody(): Buffer | string | null; + /** + * @returns {number} Response status code. + */ + getStatusCode(): number; + /** + * @returns {Object.} Response headers + */ + getHeaders(): { + [x: string]: string; + }; +} diff --git a/types/src/yoti_common/anchor.processor.d.ts b/types/src/yoti_common/anchor.processor.d.ts new file mode 100644 index 000000000..e5b9a76a9 --- /dev/null +++ b/types/src/yoti_common/anchor.processor.d.ts @@ -0,0 +1,177 @@ +/** + * - defined in forge, see X.509v3 RSA certificate (mocked here) + */ +export type Certificate = { + version: number; + serialNumber: string; + extensions: any[]; +}; +export type AnchorsGroup = { + sources: []; + verifiers: []; + unknown: []; +}; +/** + * Creates anchor list from certificates. + * + * @class AnchorProcessor + */ +export class AnchorProcessor { + /** + * Extract matching Attribute Anchors from list. + * + * @param anchors + * + * @returns {Object.} + */ + static process(anchors: any): { + [x: string]: YotiAnchor[]; + }; + /** + * Get an anchor from certificate list. + * + * @param {Array} certificatesList + * @param {YotiSignedTimeStamp} signedTimestamp + * @param {Certificate[]} originServerCerts + * @param {string} subType + * + * @returns {YotiAnchor} + */ + static getAnchorFromCerts(certificatesList: any[], signedTimestamp: YotiSignedTimeStamp, originServerCerts: Certificate[], subType: string): YotiAnchor; + /** + * Return YotiAnchors list from a protobuf anchor. + * + * @deprecated no longer in use. + * + * @param {Object} anchorObj + * + * @returns {Object.} + */ + static processSingleAnchor(anchorObj: any): { + [x: string]: YotiAnchor[]; + }; + /** + * Get anchors from a single certificate. + * + * @deprecated no longer in use. + * + * @param {Buffer} certArrayBuffer + * @param {YotiSignedTimeStamp} signedTimestamp + * @param {Certificate[]} originServerCerts + * @param {string} subType + * + * @returns {Object.} + */ + static getAnchorsByCertificate(certArrayBuffer: Buffer, subType: string, signedTimestamp: YotiSignedTimeStamp, originServerCerts: Certificate[]): { + [x: string]: YotiAnchor[]; + }; + /** + * Return YotiAnchor object for provided oid. + * + * @deprecated no longer in use. + * + * @param {Array} extensionsData + * @param {string} subType + * @param {YotiSignedTimeStamp} signedTimestamp + * @param {Certificate[]} originServerCerts + * @param {string} oid + * + * @returns {YotiAnchor|null} + */ + static getAnchorByOid(extensionsData: any[], subType: string, signedTimestamp: YotiSignedTimeStamp, originServerCerts: Certificate[], oid: string): YotiAnchor | null; + /** + * Return Anchor value. + * + * @deprecated no longer in use. + * + * @param {Array} extensionsData + * @param {string} oid + * + * @returns {string} + */ + static getAnchorValueByOid(extensionsData: any[], oid: string): string; + /** + * Return extension for given oid. + * + * @param {Array} extensionsData + * @param {string} oid + * + * @returns {Object|null} + */ + static getExtensionByOid(extensionsData: any[], oid: string): any | null; + /** + * Return Yoti signedTimestamp. + * + * @param {Buffer} signedTimestampBuffer + * + * @returns {YotiSignedTimeStamp} + */ + static processSignedTimeStamp(signedTimestampBuffer: Buffer): YotiSignedTimeStamp; + /** + * Merge arrays by anchor type. + * + * @deprecated no longer in use. + * + * @param {AnchorsGroup} targetList + * @param {AnchorsGroup} sourceList + * @returns {AnchorsGroup} + */ + static mergeAnchorsLists(targetList: AnchorsGroup, sourceList: AnchorsGroup): AnchorsGroup; + /** + * Convert certificate list to a list of X509 certificates. + * + * @param {Buffer[]} certificatesList + * + * @returns {Certificate[]} + */ + static convertCertsListToX509(certificatesList: Buffer[]): Certificate[]; + /** + * Convert certificate from byte arrays to X509 certificate. + * + * @param {Buffer} certArrayBuffer + * + * @returns {Certificate} + */ + static convertCertToX509(certArrayBuffer: Buffer): Certificate; + /** + * Returns the elem index or -1 if it doesn't find any. + * + * @param {Array} array + * @param {Object} anchorOidObj + * + * @returns {number} + */ + static findOidIndex(array: any[], anchorOidObj: any): number; + /** + * @returns {Object.} + */ + static getResultFormat(): { + [x: string]: any[]; + }; + /** + * Map of anchor list keys to oids. + * + * @returns {Object} + */ + static getAnchorTypesMap(): any; + /** + * Get anchor list key by type. + * + * @param {string} type + */ + static getAnchorListKeyByType(type: string): string; + /** + * Get anchor type by oid. + * + * @param {string} oid + */ + static getAnchorTypeByOid(oid: string): string; + /** + * List of anchor list keys. + * + * @returns {string[]} + */ + static getAnchorTypes(): string[]; +} +import { YotiAnchor } from "../data_type/anchor"; +import { YotiSignedTimeStamp } from "../data_type/signed.timestamp"; diff --git a/types/src/yoti_common/constants.d.ts b/types/src/yoti_common/constants.d.ts new file mode 100644 index 000000000..cb8b10cac --- /dev/null +++ b/types/src/yoti_common/constants.d.ts @@ -0,0 +1,33 @@ +declare const _exports: Readonly<{ + API_BASE_URL: "https://api.yoti.com"; + ON_PEP_LIST_ATTR: "on_pep_list"; + ON_FRAUD_LIST_ATTR: "on_fraud_list"; + ON_WATCH_LIST_ATTR: "on_watch_list"; + GIVEN_NAMES_ATTR: "given_names"; + FAMILY_NAME_ATTR: "family_name"; + SSN_ATTR: "ssn"; + ADDRESS_ATTR: "address"; + POSTCODE_ATTR: "post_code"; + COUNTRY_ATTR: "country"; + ATTR_FAMILY_NAME: "family_name"; + ATTR_GIVEN_NAMES: "given_names"; + ATTR_FULL_NAME: "full_name"; + ATTR_DATE_OF_BIRTH: "date_of_birth"; + ATTR_AGE_UNDER: "age_under:"; + ATTR_AGE_OVER: "age_over:"; + ATTR_GENDER: "gender"; + ATTR_NATIONALITY: "nationality"; + ATTR_PHONE_NUMBER: "phone_number"; + ATTR_SELFIE: "selfie"; + ATTR_EMAIL_ADDRESS: "email_address"; + ATTR_POSTAL_ADDRESS: "postal_address"; + ATTR_DOCUMENT_DETAILS: "document_details"; + ATTR_STRUCTURED_POSTAL_ADDRESS: "structured_postal_address"; + ATTR_DOCUMENT_IMAGES: "document_images"; + ATTR_IDENTITY_PROFILE_REPORT: "identity_profile_report"; + ATTR_APPLICATION_NAME: "application_name"; + ATTR_APPLICATION_LOGO: "application_logo"; + ATTR_APPLICATION_URL: "application_url"; + ATTR_APPLICATION_RECEIPT_BGCOLOR: "application_receipt_bgcolor"; +}>; +export = _exports; diff --git a/types/src/yoti_common/converters/attribute.converter.d.ts b/types/src/yoti_common/converters/attribute.converter.d.ts new file mode 100644 index 000000000..efdca29ca --- /dev/null +++ b/types/src/yoti_common/converters/attribute.converter.d.ts @@ -0,0 +1,6 @@ +export class AttributeConverter { + static convertValueBasedOnAttributeName(value: any, name: any): any; + static convertValueBasedOnContentType(value: any, contentType: any): any; + static convertMultiValue(value: any): MultiValue; +} +import MultiValue = require("../../data_type/multi.value"); diff --git a/types/src/yoti_common/converters/attribute.list.converter.d.ts b/types/src/yoti_common/converters/attribute.list.converter.d.ts new file mode 100644 index 000000000..2b3e902ed --- /dev/null +++ b/types/src/yoti_common/converters/attribute.list.converter.d.ts @@ -0,0 +1,12 @@ +export class AttributeListConverter { + static convertAttributeList(attributes?: any[]): { + name: any; + value: any; + sources: import("../../data_type/anchor").YotiAnchor[]; + verifiers: import("../../data_type/anchor").YotiAnchor[]; + anchors: { + [x: string]: import("../../data_type/anchor").YotiAnchor[]; + }; + id: any; + }[]; +} diff --git a/types/src/yoti_common/converters/data.entry.converter.d.ts b/types/src/yoti_common/converters/data.entry.converter.d.ts new file mode 100644 index 000000000..73f848317 --- /dev/null +++ b/types/src/yoti_common/converters/data.entry.converter.d.ts @@ -0,0 +1,16 @@ +export = DataEntryConverter; +/** + * @typedef {import('./../../data_type/attribute.issuance.details')} AttributeIssuanceDetails + */ +declare class DataEntryConverter { + /** + * @param type + * @param value + * @returns {AttributeIssuanceDetails|undefined} + */ + static convertValue(type: any, value: any): AttributeIssuanceDetails | undefined; +} +declare namespace DataEntryConverter { + export { AttributeIssuanceDetails }; +} +type AttributeIssuanceDetails = import('./../../data_type/attribute.issuance.details'); diff --git a/types/src/yoti_common/converters/extra.data.converter.d.ts b/types/src/yoti_common/converters/extra.data.converter.d.ts new file mode 100644 index 000000000..54e52f200 --- /dev/null +++ b/types/src/yoti_common/converters/extra.data.converter.d.ts @@ -0,0 +1,15 @@ +export = ExtraDataConverter; +/** + * @typedef {import('./../../data_type/attribute.issuance.details')} AttributeIssuanceDetails + */ +declare class ExtraDataConverter { + /** + * @param {Buffer} extraDataBytes + * @returns {(AttributeIssuanceDetails|undefined)[]|undefined} + */ + static convertExtraData(extraDataBytes: Buffer): (AttributeIssuanceDetails | undefined)[] | undefined; +} +declare namespace ExtraDataConverter { + export { AttributeIssuanceDetails }; +} +type AttributeIssuanceDetails = import('./../../data_type/attribute.issuance.details'); diff --git a/types/src/yoti_common/converters/third.party.attribute.converter.d.ts b/types/src/yoti_common/converters/third.party.attribute.converter.d.ts new file mode 100644 index 000000000..5e435352b --- /dev/null +++ b/types/src/yoti_common/converters/third.party.attribute.converter.d.ts @@ -0,0 +1,5 @@ +export = ThirdPartyAttributeConverter; +declare class ThirdPartyAttributeConverter { + static convertThirdPartyAttribute(protoBytes: any): AttributeIssuanceDetails; +} +import AttributeIssuanceDetails = require("../../data_type/attribute.issuance.details"); diff --git a/types/src/yoti_common/index.d.ts b/types/src/yoti_common/index.d.ts new file mode 100644 index 000000000..4f9a00566 --- /dev/null +++ b/types/src/yoti_common/index.d.ts @@ -0,0 +1,18 @@ +export function requestCanSendPayload(httpMethod: string): boolean; +export function getRSASignatureForMessage(message: string, pem: string): string; +export function getAuthKeyFromPem(pem: string): string; +export function decryptUserProfile(receipt: any, pem: string): { + attributes: any[]; +}; +export function decryptApplicationProfile(receipt: any, pem: string): { + attributes: any[]; +}; +export function parseExtraData(receipt: any, pem: string): (AttributeIssuanceDetails | undefined)[]; +export function decryptAESGCM(cipherText: Buffer, tag: Buffer, iv: Buffer, secret: Buffer): Buffer; +export function decryptAESCBC(cipherText: Buffer, iv: Buffer, secret: Buffer): Buffer; +export function decryptAsymmetric(cipherText: Buffer, pem: Buffer): Buffer; +export function decomposeAESGCMCipherText(secret: Buffer, tagSize?: number): { + cipherText: Buffer; + tag: Buffer; +}; +export type AttributeIssuanceDetails = import('./../data_type/attribute.issuance.details'); diff --git a/types/src/yoti_common/validation.d.ts b/types/src/yoti_common/validation.d.ts new file mode 100644 index 000000000..3559e6da1 --- /dev/null +++ b/types/src/yoti_common/validation.d.ts @@ -0,0 +1,156 @@ +export = Validation; +declare class Validation { + /** + * @param {*} value + * @param {*} type + * @param {string} name + * + * @throws {TypeError} + */ + static instanceOf(value: any, type: any, name: string): void; + /** + * @param {*} value + * @param {string} name + * @param {boolean} optional the value can be undefined + * + * @throws {TypeError} + */ + static isString(value: any, name: string, optional?: boolean): void; + /** + * @param {*} value + * @param {string} name + * @param {boolean} optional the value can be undefined + * + * @throws {TypeError} + */ + static isStringDate(value: any, name: string, optional?: boolean): void; + /** + * @param {*} value + * @param {string} name + * @param {boolean} optional the value can be undefined + * + * @throws {TypeError} + */ + static isBoolean(value: any, name: string, optional?: boolean): void; + /** + * @param {Object} value + * @param {string} name + * + * @throws {TypeError} + */ + static hasOnlyStringValues(value: any, name: string): void; + /** + * @param {*} value + * @param {string} name + * + * @throws {TypeError} + */ + static isArray(value: any, name: string): void; + /** + * @param {*} value + * @param {string} name + * @param {boolean} optional the value can be undefined + * + * @throws {TypeError} + */ + static isInteger(value: any, name: string, optional?: boolean): void; + /** + * @param {*} value + * @param {string} name + * + * @throws {TypeError} + */ + static isNumber(value: any, name: string): void; + /** + * @param {*} value + * @param {string} name + * + * @throws {TypeError} + */ + static isPlainObject(value: any, name: string): void; + /** + * @param {*} value + * @param {string} name + * + * @throws {TypeError} + */ + static notNull(value: any, name: string): void; + /** + * @param {*} values + * @param {*} type + * @param {string} name + * + * @throws {TypeError} + */ + static isArrayOfType(values: any, type: any, name: string): void; + /** + * @param {*} values + * @param {Array} types + * @param {string} name + * + * @throws {TypeError} + */ + static isArrayOfTypes(values: any, types: any[], name: string): void; + /** + * @param {*} values + * @param {string} name + * + * @throws {TypeError} + */ + static isArrayOfStrings(values: any, name: string): void; + /** + * @param {*} values + * @param {string} name + * + * @throws {TypeError} + */ + static isArrayOfIntegers(values: any, name: string): void; + /** + * @param {*} value + * @param {*} limit + * @param {string} name + * + * @throws {RangeError} + */ + static notGreaterThan(value: any, limit: any, name: string): void; + /** + * @param {*} value + * @param {*} limit + * @param {string} name + * + * @throws {RangeError} + */ + static notLessThan(value: any, limit: any, name: string): void; + /** + * @param {string} value + * @param {RegExp} regexp + * @param {string} name + * + * @throws {TypeError} + */ + static matchesPattern(value: string, regexp: RegExp, name: string): void; + /** + * @param {*} value + * @param {*} minLimit + * @param {*} maxLimit + * @param {string} name + * + * @throws {RangeError} + */ + static withinRange(value: any, minLimit: any, maxLimit: any, name: string): void; + /** + * @param {*} value + * @param {string} name + * + * @throws {TypeError} + */ + static notNullOrEmpty(value: any, name: string): void; + /** + * @param {*} value + * @param {array} acceptedValues + * @param {string} name + * + * @throws {TypeError} + */ + static oneOf(value: any, acceptedValues: any[], name: string): void; +}