@prove-identity/prove-auth 2.15.1 → 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/build/bundle/release/prove-auth.js +1 -1
- package/build/lib/index.d.ts +7 -3
- package/build/lib/index.js +23 -9
- package/build/lib/proveauth/authenticator-builder.d.ts +9 -11
- package/build/lib/proveauth/authenticator-builder.js +54 -114
- package/build/lib/proveauth/common/base64.js +2 -1
- package/build/lib/proveauth/common/logger.js +2 -2
- package/build/lib/proveauth/device-context-options.d.ts +0 -8
- package/build/lib/proveauth/device-context-options.js +2 -12
- package/build/lib/proveauth/device-role.d.ts +4 -0
- package/build/lib/proveauth/device-role.js +8 -0
- package/build/lib/proveauth/docv.d.ts +11 -0
- package/build/lib/proveauth/docv.js +2 -0
- package/build/lib/proveauth/instantlink.js +1 -1
- package/build/lib/proveauth/internal/auth-request.d.ts +6 -1
- package/build/lib/proveauth/internal/auth-response-status.js +1 -1
- package/build/lib/proveauth/internal/auth-response.d.ts +6 -0
- package/build/lib/proveauth/internal/auth-session.d.ts +0 -1
- package/build/lib/proveauth/internal/auth-session.js +54 -29
- package/build/lib/proveauth/internal/auth-token-claims.d.ts +4 -0
- package/build/lib/proveauth/internal/auth-token-claims.js +1 -1
- package/build/lib/proveauth/internal/device-passive-step.d.ts +2 -1
- package/build/lib/proveauth/internal/device-passive-step.js +4 -4
- package/build/lib/proveauth/internal/device-universal-redirect-steps.js +2 -2
- package/build/lib/proveauth/internal/external-integrations.d.ts +34 -0
- package/build/lib/proveauth/internal/external-integrations.js +49 -0
- package/build/lib/proveauth/internal/fido-options-error.js +1 -1
- package/build/lib/proveauth/internal/main-authenticator.d.ts +2 -0
- package/build/lib/proveauth/internal/main-authenticator.js +3 -0
- package/build/lib/proveauth/internal/mobile-instant-step.js +1 -2
- package/build/lib/proveauth/internal/platform.d.ts +9 -13
- package/build/lib/proveauth/internal/platform.js +7 -6
- package/build/lib/proveauth/internal/report-error-step.d.ts +1 -0
- package/build/lib/proveauth/internal/report-error-step.js +8 -3
- package/build/lib/proveauth/internal/user-docv-steps.d.ts +13 -0
- package/build/lib/proveauth/internal/user-docv-steps.js +105 -0
- package/build/lib/proveauth/internal/user-ppb-steps.js +37 -33
- package/build/lib/proveauth/internal/web-device-auth.js +4 -1
- package/build/lib/proveauth/internal/web-platform.d.ts +6 -6
- package/build/lib/proveauth/internal/web-platform.js +11 -93
- package/build/lib/proveauth/internal/web-socket-close-reasons.js +1 -1
- package/build/lib/proveauth/otp.js +1 -1
- package/build/lib/proveauth/version.d.ts +2 -2
- package/build/lib/proveauth/version.js +1 -1
- package/package.json +35 -39
- package/build/lib/proveauth/external/@authid/web-component/authid-web-component.d.ts +0 -3
- package/build/lib/proveauth/external/@authid/web-component/authid-web-component.js +0 -55
package/build/lib/index.js
CHANGED
|
@@ -15,24 +15,35 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
28
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.InstantLinkResultType = exports.BuildConfig = exports.PhoneValidationError = exports.OtpError = exports.OtpFinishResultType = exports.MobileAuthImplementation = exports.LogLevel = exports.LoggerFactory = exports.DeviceRole = exports.CancelablePromise = exports.AuthResponseStatus = exports.AuthenticatorBuilder = exports.VERSION = void 0;
|
|
39
|
+
exports.InstantLinkResultType = exports.BuildConfig = exports.PhoneValidationError = exports.OtpError = exports.OtpFinishResultType = exports.MobileAuthImplementation = exports.LogLevel = exports.LoggerFactory = exports.DeviceRole = exports.CancelablePromise = exports.AuthResponseStatus = exports.FingerprintJSIntegration = exports.AuthIDIntegration = exports.AuthenticatorBuilder = exports.VERSION = void 0;
|
|
30
40
|
const version_1 = require("./proveauth/version");
|
|
31
41
|
Object.defineProperty(exports, "VERSION", { enumerable: true, get: function () { return version_1.VERSION; } });
|
|
32
42
|
const authenticator_builder_1 = __importStar(require("./proveauth/authenticator-builder"));
|
|
33
43
|
exports.AuthenticatorBuilder = authenticator_builder_1.default;
|
|
34
|
-
Object.defineProperty(exports, "DeviceRole", { enumerable: true, get: function () { return authenticator_builder_1.DeviceRole; } });
|
|
35
44
|
Object.defineProperty(exports, "MobileAuthImplementation", { enumerable: true, get: function () { return authenticator_builder_1.MobileAuthImplementation; } });
|
|
45
|
+
const device_role_1 = require("./proveauth/device-role");
|
|
46
|
+
Object.defineProperty(exports, "DeviceRole", { enumerable: true, get: function () { return device_role_1.DeviceRole; } });
|
|
36
47
|
const device_context_options_1 = require("./proveauth/device-context-options");
|
|
37
48
|
Object.defineProperty(exports, "BuildConfig", { enumerable: true, get: function () { return device_context_options_1.BuildConfig; } });
|
|
38
49
|
const auth_response_status_1 = require("./proveauth/internal/auth-response-status");
|
|
@@ -49,3 +60,6 @@ Object.defineProperty(exports, "OtpError", { enumerable: true, get: function ()
|
|
|
49
60
|
Object.defineProperty(exports, "OtpFinishResultType", { enumerable: true, get: function () { return otp_1.OtpFinishResultType; } });
|
|
50
61
|
const instantlink_1 = require("./proveauth/instantlink");
|
|
51
62
|
Object.defineProperty(exports, "InstantLinkResultType", { enumerable: true, get: function () { return instantlink_1.InstantLinkResultType; } });
|
|
63
|
+
const external_integrations_1 = require("./proveauth/internal/external-integrations");
|
|
64
|
+
Object.defineProperty(exports, "AuthIDIntegration", { enumerable: true, get: function () { return external_integrations_1.AuthIDIntegration; } });
|
|
65
|
+
Object.defineProperty(exports, "FingerprintJSIntegration", { enumerable: true, get: function () { return external_integrations_1.FingerprintJSIntegration; } });
|
|
@@ -5,16 +5,13 @@ import { AuthResponseStatus } from './internal/auth-response-status';
|
|
|
5
5
|
import Platform from './internal/platform';
|
|
6
6
|
import { OtpFinishStep, OtpFinishStepFn, OtpStartStep, OtpStartStepFn } from './otp';
|
|
7
7
|
import { InstantLinkRetryStep, InstantLinkRetryStepFn, InstantLinkStartStep, InstantLinkStartStepFn } from './instantlink';
|
|
8
|
-
import
|
|
9
|
-
import DeviceContextOptions, { BuildConfig } from './device-context-options';
|
|
8
|
+
import DeviceContextOptions from './device-context-options';
|
|
10
9
|
import UserConsentStep, { UserConsentStepFn } from './user-consent-step';
|
|
11
10
|
import { PpbFinishStep, PpbFinishStepFn, PpbStartStep, PpbStartStepFn } from './ppb';
|
|
11
|
+
import { DocVFinishStep, DocVFinishStepFn, DocVStartStep, DocVStartStepFn } from './docv';
|
|
12
|
+
import { DeviceRole } from './device-role';
|
|
12
13
|
export type AuthMessageHandler = (message: AuthMessage) => Promise<AuthResponseStatus>;
|
|
13
14
|
export type PasskeyAlreadyExistCallback = () => Promise<AuthResponseStatus>;
|
|
14
|
-
export declare enum DeviceRole {
|
|
15
|
-
Primary = 0,
|
|
16
|
-
Secondary = 1
|
|
17
|
-
}
|
|
18
15
|
export declare enum MobileAuthImplementation {
|
|
19
16
|
Pixel = "pixel",
|
|
20
17
|
Fetch = "fetch"
|
|
@@ -38,8 +35,11 @@ export default class AuthenticatorBuilder {
|
|
|
38
35
|
private ppbEnabled;
|
|
39
36
|
private ppbStartStep?;
|
|
40
37
|
private ppbFinishStep?;
|
|
41
|
-
private
|
|
38
|
+
private docvEnabled;
|
|
39
|
+
private docvStartStep?;
|
|
40
|
+
private docvFinishStep?;
|
|
42
41
|
private deviceContextOptions?;
|
|
42
|
+
private readonly log;
|
|
43
43
|
constructor();
|
|
44
44
|
withDeviceContext(options: DeviceContextOptions): AuthenticatorBuilder;
|
|
45
45
|
withAuthFinishStep(step: AuthFinishStep | AuthFinishStepFn): AuthenticatorBuilder;
|
|
@@ -52,12 +52,10 @@ export default class AuthenticatorBuilder {
|
|
|
52
52
|
withDeviceIpAddress(deviceIp: string | (() => string | null) | null): AuthenticatorBuilder;
|
|
53
53
|
withOtpFallback(startStep: OtpStartStep | OtpStartStepFn, finishStep: OtpFinishStep | OtpFinishStepFn): AuthenticatorBuilder;
|
|
54
54
|
withInstantLinkFallback(startStep: InstantLinkStartStep | InstantLinkStartStepFn, retryStep?: InstantLinkRetryStep | InstantLinkRetryStepFn): AuthenticatorBuilder;
|
|
55
|
-
withUPKEnabled(): this;
|
|
56
55
|
withUniversalProveKey(step?: UserConsentStep | UserConsentStepFn): this;
|
|
57
56
|
withPrivacyPreservingBiometrics(startStep?: PpbStartStep | PpbStartStepFn, finishStep?: PpbFinishStep | PpbFinishStepFn): this;
|
|
58
|
-
|
|
59
|
-
getRegionByBuildConfig(buildConfig?: BuildConfig): Region;
|
|
60
|
-
private getFpPromiseInstanceFromOptions;
|
|
57
|
+
withDocumentVerification(startStep: DocVStartStep | DocVStartStepFn, finishStep?: DocVFinishStep | DocVFinishStepFn): this;
|
|
61
58
|
withPasskeyAlreadyExistCallback(handler: PasskeyAlreadyExistCallback): AuthenticatorBuilder;
|
|
62
59
|
build(): Authenticator;
|
|
60
|
+
private getAuthSteps;
|
|
63
61
|
}
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.MobileAuthImplementation =
|
|
6
|
+
exports.MobileAuthImplementation = void 0;
|
|
7
7
|
const web_platform_1 = require("./internal/web-platform");
|
|
8
8
|
const device_passive_register_step_1 = __importDefault(require("./internal/device-passive-register-step"));
|
|
9
9
|
const device_passive_step_1 = __importDefault(require("./internal/device-passive-step"));
|
|
@@ -20,24 +20,21 @@ const device_universal_redirect_steps_1 = require("./internal/device-universal-r
|
|
|
20
20
|
const main_authenticator_1 = __importDefault(require("./internal/main-authenticator"));
|
|
21
21
|
const logger_1 = require("./common/logger");
|
|
22
22
|
const settings_1 = __importDefault(require("./internal/settings"));
|
|
23
|
-
const device_context_options_1 = require("./device-context-options");
|
|
24
23
|
const user_ppb_steps_1 = require("./internal/user-ppb-steps");
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
DeviceRole[DeviceRole["Primary"] = 0] = "Primary";
|
|
28
|
-
DeviceRole[DeviceRole["Secondary"] = 1] = "Secondary";
|
|
29
|
-
})(DeviceRole = exports.DeviceRole || (exports.DeviceRole = {}));
|
|
24
|
+
const user_docv_steps_1 = require("./internal/user-docv-steps");
|
|
25
|
+
const device_role_1 = require("./device-role");
|
|
30
26
|
var MobileAuthImplementation;
|
|
31
27
|
(function (MobileAuthImplementation) {
|
|
32
28
|
MobileAuthImplementation["Pixel"] = "pixel";
|
|
33
29
|
MobileAuthImplementation["Fetch"] = "fetch";
|
|
34
|
-
})(MobileAuthImplementation
|
|
30
|
+
})(MobileAuthImplementation || (exports.MobileAuthImplementation = MobileAuthImplementation = {}));
|
|
35
31
|
class AuthenticatorBuilder {
|
|
36
32
|
constructor() {
|
|
37
|
-
this.role = DeviceRole.Primary;
|
|
33
|
+
this.role = device_role_1.DeviceRole.Primary;
|
|
38
34
|
this.mobileAuthImplementation = MobileAuthImplementation.Fetch;
|
|
39
35
|
this.upkEnabled = false;
|
|
40
36
|
this.ppbEnabled = false;
|
|
37
|
+
this.docvEnabled = false;
|
|
41
38
|
this.log = logger_1.LoggerFactory.getLogger('authenticator-builder');
|
|
42
39
|
if (typeof window !== 'undefined') {
|
|
43
40
|
this.storage = window.localStorage;
|
|
@@ -117,9 +114,6 @@ class AuthenticatorBuilder {
|
|
|
117
114
|
}
|
|
118
115
|
return this;
|
|
119
116
|
}
|
|
120
|
-
withUPKEnabled() {
|
|
121
|
-
return this.withUniversalProveKey();
|
|
122
|
-
}
|
|
123
117
|
withUniversalProveKey(step) {
|
|
124
118
|
if (!step) {
|
|
125
119
|
this.userConsentStep = { execute: () => Promise.resolve({ consentGranted: true }) };
|
|
@@ -149,127 +143,73 @@ class AuthenticatorBuilder {
|
|
|
149
143
|
}
|
|
150
144
|
return this;
|
|
151
145
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
device_context_options_1.ProveAuthProxyScriptUrl.DEFAULT_US_PROD_SCRIPT_URL.toString(),
|
|
157
|
-
device_context_options_1.ProveAuthProxyEndpoint.DEFAULT_US_PROD_ENDPOINT.toString(),
|
|
158
|
-
];
|
|
159
|
-
case device_context_options_1.BuildConfig.US_UAT:
|
|
160
|
-
return [
|
|
161
|
-
device_context_options_1.ProveAuthProxyScriptUrl.DEFAULT_US_UAT_SCRIPT_URL.toString(),
|
|
162
|
-
device_context_options_1.ProveAuthProxyEndpoint.DEFAULT_US_UAT_ENDPOINT.toString(),
|
|
163
|
-
];
|
|
164
|
-
case device_context_options_1.BuildConfig.DEV:
|
|
165
|
-
this.log.debug("Recommended for Prove's internal testing only, BuildConfig.DEV " +
|
|
166
|
-
'might need custom endpoint URL and custom script URL values to bypass ad blockers');
|
|
167
|
-
return [undefined, undefined];
|
|
168
|
-
default:
|
|
169
|
-
this.log.warn('Unknown BuildConfig value: ' + buildConfig);
|
|
170
|
-
return [undefined, undefined];
|
|
146
|
+
withDocumentVerification(startStep, finishStep) {
|
|
147
|
+
this.docvEnabled = true;
|
|
148
|
+
if (typeof startStep === 'function') {
|
|
149
|
+
this.docvStartStep = { execute: startStep };
|
|
171
150
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
var region;
|
|
175
|
-
switch (buildConfig) {
|
|
176
|
-
case device_context_options_1.BuildConfig.DEV:
|
|
177
|
-
case device_context_options_1.BuildConfig.US_PROD:
|
|
178
|
-
case device_context_options_1.BuildConfig.US_UAT:
|
|
179
|
-
region = 'us';
|
|
180
|
-
break;
|
|
181
|
-
default:
|
|
182
|
-
this.log.warn('Unknown BuildConfig value, set Region to default value: us');
|
|
183
|
-
region = 'us';
|
|
184
|
-
break;
|
|
151
|
+
else {
|
|
152
|
+
this.docvStartStep = startStep;
|
|
185
153
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
getFpPromiseInstanceFromOptions(options) {
|
|
189
|
-
try {
|
|
190
|
-
const FingerprintJS = require('@fingerprintjs/fingerprintjs-pro');
|
|
191
|
-
if (!FingerprintJS) {
|
|
192
|
-
this.log.debug('fingerprintjs package is not installed or failed to load');
|
|
193
|
-
}
|
|
194
|
-
else if (!options) {
|
|
195
|
-
this.log.warn('Prove Key Persistence feature is not enabled');
|
|
196
|
-
}
|
|
197
|
-
else {
|
|
198
|
-
let region = this.getRegionByBuildConfig(options.buildConfig);
|
|
199
|
-
let [scriptUrl, endpointUrl] = this.getUrlsByBuildConfig(options.buildConfig);
|
|
200
|
-
if (options.customScriptUrl && options.customEndpointUrl) {
|
|
201
|
-
scriptUrl = options.customScriptUrl;
|
|
202
|
-
endpointUrl = options.customEndpointUrl;
|
|
203
|
-
}
|
|
204
|
-
const scriptUrlPattern = scriptUrl
|
|
205
|
-
? [
|
|
206
|
-
`${scriptUrl}?apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>`,
|
|
207
|
-
FingerprintJS.defaultScriptUrlPattern,
|
|
208
|
-
]
|
|
209
|
-
: [FingerprintJS.defaultScriptUrlPattern];
|
|
210
|
-
const endpoint = endpointUrl
|
|
211
|
-
? [`${endpointUrl}?region=${region}`, FingerprintJS.defaultEndpoint]
|
|
212
|
-
: [FingerprintJS.defaultEndpoint];
|
|
213
|
-
const fpPromise = FingerprintJS.load({
|
|
214
|
-
apiKey: options.publicApiKey,
|
|
215
|
-
endpoint: endpoint,
|
|
216
|
-
scriptUrlPattern: scriptUrlPattern,
|
|
217
|
-
region: region,
|
|
218
|
-
});
|
|
219
|
-
const status = fpPromise ? 'successfully' : 'unsuccessfully with null instance';
|
|
220
|
-
this.log.trace(`Instantiating FingerprintJS ${status}`);
|
|
221
|
-
return fpPromise;
|
|
222
|
-
}
|
|
154
|
+
if (typeof finishStep === 'function') {
|
|
155
|
+
this.docvFinishStep = { execute: finishStep };
|
|
223
156
|
}
|
|
224
|
-
|
|
225
|
-
this.
|
|
157
|
+
else {
|
|
158
|
+
this.docvFinishStep = finishStep;
|
|
226
159
|
}
|
|
160
|
+
return this;
|
|
227
161
|
}
|
|
228
162
|
withPasskeyAlreadyExistCallback(handler) {
|
|
229
163
|
this.passkeyCreationHandler = handler;
|
|
230
164
|
return this;
|
|
231
165
|
}
|
|
232
166
|
build() {
|
|
233
|
-
var _a;
|
|
234
167
|
if (!this.platform) {
|
|
235
168
|
throw new Error('Implementation of Platform is required');
|
|
236
169
|
}
|
|
237
170
|
if (!this.storage) {
|
|
238
171
|
throw new Error('Implementation of Storage is required');
|
|
239
172
|
}
|
|
240
|
-
const fpPromise = this.getFpPromiseInstanceFromOptions(this.deviceContextOptions);
|
|
241
|
-
if (fpPromise) {
|
|
242
|
-
(_a = this.platform) === null || _a === void 0 ? void 0 : _a.setFpPromise(fpPromise);
|
|
243
|
-
}
|
|
244
173
|
const settings = new settings_1.default(this.storage);
|
|
245
174
|
settings.upkEnabled = this.upkEnabled;
|
|
246
|
-
if (this.
|
|
247
|
-
|
|
248
|
-
new device_universal_step_1.default(this.upkEnabled),
|
|
249
|
-
new device_universal_redirect_steps_1.DeviceUniversalRedirectExchangeStep(),
|
|
250
|
-
new device_universal_redirect_steps_1.DeviceUniversalRedirectFinishStep(),
|
|
251
|
-
new device_passive_step_1.default(this.getDisplayName, this.passkeyCreationHandler, this.role),
|
|
252
|
-
new device_passive_stepup_step_1.default(this.getDisplayName, this.passkeyCreationHandler),
|
|
253
|
-
new device_passive_silent_step_1.default(this.upkEnabled, this.userConsentStep),
|
|
254
|
-
new device_passive_register_step_1.default(),
|
|
255
|
-
new device_passive_verify_step_1.default(),
|
|
256
|
-
new mobile_instant_step_1.default(this.mobileAuthImplementation, this.getDeviceIp),
|
|
257
|
-
new mobile_instantlink_step_1.default(this.instantLinkStartStep, this.instantLinkRetryStep, this.getDeviceIp),
|
|
258
|
-
new mobile_otp_step_1.default(this.otpStartStep, this.otpFinishStep),
|
|
259
|
-
new scan_message_step_1.default(this.authMessageHandler),
|
|
260
|
-
new user_mobileactive_step_1.default(),
|
|
261
|
-
new user_ppb_steps_1.UserPpbEnrollStep(this.ppbEnabled, this.ppbStartStep, this.ppbFinishStep),
|
|
262
|
-
new user_ppb_steps_1.UserPpbVerifyStep(this.ppbEnabled, this.ppbStartStep, this.ppbFinishStep),
|
|
263
|
-
]);
|
|
175
|
+
if (this.deviceContextOptions) {
|
|
176
|
+
this.platform.initFingerprintJS(this.deviceContextOptions);
|
|
264
177
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
178
|
+
const steps = this.getAuthSteps(this.role);
|
|
179
|
+
return new main_authenticator_1.default(this.platform, settings, this.authFinishStep, steps);
|
|
180
|
+
}
|
|
181
|
+
getAuthSteps(role) {
|
|
182
|
+
switch (this.role) {
|
|
183
|
+
case device_role_1.DeviceRole.Primary:
|
|
184
|
+
return [
|
|
185
|
+
new device_universal_step_1.default(this.upkEnabled),
|
|
186
|
+
new device_universal_redirect_steps_1.DeviceUniversalRedirectExchangeStep(),
|
|
187
|
+
new device_universal_redirect_steps_1.DeviceUniversalRedirectFinishStep(),
|
|
188
|
+
new device_passive_step_1.default(this.getDisplayName, this.passkeyCreationHandler, this.role),
|
|
189
|
+
new device_passive_stepup_step_1.default(this.getDisplayName, this.passkeyCreationHandler),
|
|
190
|
+
new device_passive_silent_step_1.default(this.upkEnabled, this.userConsentStep),
|
|
191
|
+
new device_passive_register_step_1.default(),
|
|
192
|
+
new device_passive_verify_step_1.default(),
|
|
193
|
+
new mobile_instant_step_1.default(this.mobileAuthImplementation, this.getDeviceIp),
|
|
194
|
+
new mobile_instantlink_step_1.default(this.instantLinkStartStep, this.instantLinkRetryStep, this.getDeviceIp),
|
|
195
|
+
new mobile_otp_step_1.default(this.otpStartStep, this.otpFinishStep),
|
|
196
|
+
new scan_message_step_1.default(this.authMessageHandler),
|
|
197
|
+
new user_mobileactive_step_1.default(),
|
|
198
|
+
new user_ppb_steps_1.UserPpbEnrollStep(this.ppbEnabled, this.ppbStartStep, this.ppbFinishStep),
|
|
199
|
+
new user_ppb_steps_1.UserPpbVerifyStep(this.ppbEnabled, this.ppbStartStep, this.ppbFinishStep),
|
|
200
|
+
new user_docv_steps_1.UserDocVerifyStep(this.docvEnabled, this.docvStartStep, this.docvFinishStep),
|
|
201
|
+
];
|
|
202
|
+
case device_role_1.DeviceRole.Secondary:
|
|
203
|
+
return [
|
|
204
|
+
new device_passive_step_1.default(this.getDisplayName, undefined, this.role),
|
|
205
|
+
new mobile_instant_step_1.default(this.mobileAuthImplementation, this.getDeviceIp),
|
|
206
|
+
new mobile_instantlink_step_1.default(this.instantLinkStartStep, this.instantLinkRetryStep, this.getDeviceIp),
|
|
207
|
+
new user_ppb_steps_1.UserPpbEnrollStep(this.ppbEnabled, this.ppbStartStep, this.ppbFinishStep),
|
|
208
|
+
new user_ppb_steps_1.UserPpbVerifyStep(this.ppbEnabled, this.ppbStartStep, this.ppbFinishStep),
|
|
209
|
+
new user_docv_steps_1.UserDocVerifyStep(this.docvEnabled, this.docvStartStep, this.docvFinishStep),
|
|
210
|
+
];
|
|
211
|
+
default:
|
|
212
|
+
throw new Error(`Unknown role: ${this.role}`);
|
|
273
213
|
}
|
|
274
214
|
}
|
|
275
215
|
}
|
|
@@ -6,7 +6,8 @@ class Base64 {
|
|
|
6
6
|
'='.repeat(value.length % 4 ? 4 - (value.length % 4) : 0));
|
|
7
7
|
}
|
|
8
8
|
static bufferDecode(value) {
|
|
9
|
-
|
|
9
|
+
const uint8Array = Uint8Array.from(atob(Base64.stringToBase64(value)), (c) => c.charCodeAt(0));
|
|
10
|
+
return uint8Array.buffer.slice(uint8Array.byteOffset, uint8Array.byteOffset + uint8Array.byteLength);
|
|
10
11
|
}
|
|
11
12
|
static bufferEncode(value) {
|
|
12
13
|
const arrayValue = ArrayBuffer.isView(value) ? value.buffer : value;
|
|
@@ -9,7 +9,7 @@ var LogLevel;
|
|
|
9
9
|
LogLevel[LogLevel["info"] = 3] = "info";
|
|
10
10
|
LogLevel[LogLevel["debug"] = 4] = "debug";
|
|
11
11
|
LogLevel[LogLevel["trace"] = 5] = "trace";
|
|
12
|
-
})(LogLevel
|
|
12
|
+
})(LogLevel || (exports.LogLevel = LogLevel = {}));
|
|
13
13
|
class ConsoleLogger {
|
|
14
14
|
trace(...args) {
|
|
15
15
|
console.info(...args);
|
|
@@ -80,6 +80,6 @@ class LoggerFactory {
|
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
+
exports.LoggerFactory = LoggerFactory;
|
|
83
84
|
LoggerFactory.logWriter = new ConsoleLogWriter();
|
|
84
85
|
LoggerFactory.logLevel = LogLevel.info;
|
|
85
|
-
exports.LoggerFactory = LoggerFactory;
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
export declare enum ProveAuthProxyScriptUrl {
|
|
2
|
-
DEFAULT_US_UAT_SCRIPT_URL = "https://upk.uat.prove-auth.proveapis.com/vFqZceQyx8/uqLttozA7q",
|
|
3
|
-
DEFAULT_US_PROD_SCRIPT_URL = "https://upk.prove-auth.proveapis.com/vf82rhgDRK/r4VnwuwPUd"
|
|
4
|
-
}
|
|
5
|
-
export declare enum ProveAuthProxyEndpoint {
|
|
6
|
-
DEFAULT_US_UAT_ENDPOINT = "https://upk.uat.prove-auth.proveapis.com/vFqZceQyx8/bt9xhGAgQw",
|
|
7
|
-
DEFAULT_US_PROD_ENDPOINT = "https://upk.prove-auth.proveapis.com/vf82rhgDRK/ePaZsNne4X"
|
|
8
|
-
}
|
|
9
1
|
export declare enum BuildConfig {
|
|
10
2
|
DEV = "DEV",
|
|
11
3
|
US_UAT = "US_UAT",
|
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BuildConfig =
|
|
4
|
-
var ProveAuthProxyScriptUrl;
|
|
5
|
-
(function (ProveAuthProxyScriptUrl) {
|
|
6
|
-
ProveAuthProxyScriptUrl["DEFAULT_US_UAT_SCRIPT_URL"] = "https://upk.uat.prove-auth.proveapis.com/vFqZceQyx8/uqLttozA7q";
|
|
7
|
-
ProveAuthProxyScriptUrl["DEFAULT_US_PROD_SCRIPT_URL"] = "https://upk.prove-auth.proveapis.com/vf82rhgDRK/r4VnwuwPUd";
|
|
8
|
-
})(ProveAuthProxyScriptUrl = exports.ProveAuthProxyScriptUrl || (exports.ProveAuthProxyScriptUrl = {}));
|
|
9
|
-
var ProveAuthProxyEndpoint;
|
|
10
|
-
(function (ProveAuthProxyEndpoint) {
|
|
11
|
-
ProveAuthProxyEndpoint["DEFAULT_US_UAT_ENDPOINT"] = "https://upk.uat.prove-auth.proveapis.com/vFqZceQyx8/bt9xhGAgQw";
|
|
12
|
-
ProveAuthProxyEndpoint["DEFAULT_US_PROD_ENDPOINT"] = "https://upk.prove-auth.proveapis.com/vf82rhgDRK/ePaZsNne4X";
|
|
13
|
-
})(ProveAuthProxyEndpoint = exports.ProveAuthProxyEndpoint || (exports.ProveAuthProxyEndpoint = {}));
|
|
3
|
+
exports.BuildConfig = void 0;
|
|
14
4
|
var BuildConfig;
|
|
15
5
|
(function (BuildConfig) {
|
|
16
6
|
BuildConfig["DEV"] = "DEV";
|
|
17
7
|
BuildConfig["US_UAT"] = "US_UAT";
|
|
18
8
|
BuildConfig["US_PROD"] = "US_PROD";
|
|
19
|
-
})(BuildConfig
|
|
9
|
+
})(BuildConfig || (exports.BuildConfig = BuildConfig = {}));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeviceRole = void 0;
|
|
4
|
+
var DeviceRole;
|
|
5
|
+
(function (DeviceRole) {
|
|
6
|
+
DeviceRole[DeviceRole["Primary"] = 0] = "Primary";
|
|
7
|
+
DeviceRole[DeviceRole["Secondary"] = 1] = "Secondary";
|
|
8
|
+
})(DeviceRole || (exports.DeviceRole = DeviceRole = {}));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export default interface DocumentTypeInput {
|
|
2
|
+
documentType: string;
|
|
3
|
+
}
|
|
4
|
+
export interface DocVStartStep {
|
|
5
|
+
execute: () => Promise<DocumentTypeInput>;
|
|
6
|
+
}
|
|
7
|
+
export interface DocVFinishStep {
|
|
8
|
+
execute: (error?: Error) => Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
export type DocVStartStepFn = () => Promise<DocumentTypeInput>;
|
|
11
|
+
export type DocVFinishStepFn = (error?: Error) => Promise<void>;
|
|
@@ -5,4 +5,4 @@ var InstantLinkResultType;
|
|
|
5
5
|
(function (InstantLinkResultType) {
|
|
6
6
|
InstantLinkResultType[InstantLinkResultType["OnResend"] = 0] = "OnResend";
|
|
7
7
|
InstantLinkResultType[InstantLinkResultType["OnMobileNumberChange"] = 1] = "OnMobileNumberChange";
|
|
8
|
-
})(InstantLinkResultType
|
|
8
|
+
})(InstantLinkResultType || (exports.InstantLinkResultType = InstantLinkResultType = {}));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MobileAuthImplementation } from '../authenticator-builder';
|
|
2
2
|
import { AuthResponseStatus } from './auth-response-status';
|
|
3
|
-
export type AuthRequest = V1ClientDeviceFido2RegisterStart | V1ClientDeviceFido2RegisterFinish | V1ClientDeviceFido2VerifyStart | V1ClientDeviceFido2VerifyFinish | V1ClientDevicePassiveRegister | V1ClientDevicePassiveVerify | V1ClientUserResponse | V1ClientAnyError | V1ClientChallenge | V1ClientMobileInstantLinkStart | V1ClientMobileInstantStart | V1ClientMobileInstantFinish | V1ClientOtpStart | V1ClientOtpFinish | V1ClientPpbFinish;
|
|
3
|
+
export type AuthRequest = V1ClientDeviceFido2RegisterStart | V1ClientDeviceFido2RegisterFinish | V1ClientDeviceFido2VerifyStart | V1ClientDeviceFido2VerifyFinish | V1ClientDevicePassiveRegister | V1ClientDevicePassiveVerify | V1ClientUserResponse | V1ClientAnyError | V1ClientChallenge | V1ClientMobileInstantLinkStart | V1ClientMobileInstantStart | V1ClientMobileInstantFinish | V1ClientOtpStart | V1ClientOtpFinish | V1ClientPpbFinish | V1ClientDocVStart | V1ClientDocVFinish;
|
|
4
4
|
export type AuthRegistration = PassiveRegistration | Fido2Registration;
|
|
5
5
|
export interface PublicKey {
|
|
6
6
|
id: string;
|
|
@@ -102,3 +102,8 @@ export interface V1ClientPpbFinish {
|
|
|
102
102
|
requestId: string;
|
|
103
103
|
operationId: string;
|
|
104
104
|
}
|
|
105
|
+
export interface V1ClientDocVStart {
|
|
106
|
+
requestId: string;
|
|
107
|
+
documentType: string;
|
|
108
|
+
}
|
|
109
|
+
export type V1ClientDocVFinish = V1ClientPpbFinish;
|
|
@@ -9,4 +9,4 @@ var AuthResponseStatus;
|
|
|
9
9
|
AuthResponseStatus["Unexpected"] = "unexpected";
|
|
10
10
|
AuthResponseStatus["Timeout"] = "timeout";
|
|
11
11
|
AuthResponseStatus["Unknown"] = "unknown";
|
|
12
|
-
})(AuthResponseStatus
|
|
12
|
+
})(AuthResponseStatus || (exports.AuthResponseStatus = AuthResponseStatus = {}));
|
|
@@ -22,6 +22,8 @@ export type OtpFinishResponse = AuthResponse;
|
|
|
22
22
|
export type InstantLinkStartResponse = AuthResponse;
|
|
23
23
|
export type PpbStartResponse = AuthResponse;
|
|
24
24
|
export type PpbFinishResponse = AuthResponse;
|
|
25
|
+
export type DocVStartResponse = AuthResponse;
|
|
26
|
+
export type DocVFinishResponse = AuthResponse;
|
|
25
27
|
export interface RegisterStartAuthResponseData {
|
|
26
28
|
credCreateOptions?: PublicKeyCredentialCreationOptions;
|
|
27
29
|
credRequestOptions?: PublicKeyCredentialRequestOptions;
|
|
@@ -60,3 +62,7 @@ export interface PpbOperation {
|
|
|
60
62
|
export interface PpbResponseData extends ResponseData {
|
|
61
63
|
ppb?: PpbOperation;
|
|
62
64
|
}
|
|
65
|
+
export type DocVOperation = PpbOperation;
|
|
66
|
+
export interface DocVResponseData extends ResponseData {
|
|
67
|
+
docv?: DocVOperation;
|
|
68
|
+
}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
13
|
};
|
|
@@ -77,7 +86,23 @@ class AuthSession {
|
|
|
77
86
|
headers: headers,
|
|
78
87
|
body: bodyStr,
|
|
79
88
|
})
|
|
80
|
-
.then((response) =>
|
|
89
|
+
.then((response) => __awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
if (!response.ok) {
|
|
91
|
+
const statusSuffix = response.statusText ? ` - ${response.statusText}` : '';
|
|
92
|
+
const errorMessage = `Got ${response.status} HTTP error${statusSuffix}`;
|
|
93
|
+
throw new auth_error_1.default(errorMessage, undefined, undefined, false);
|
|
94
|
+
}
|
|
95
|
+
const responseText = yield response.text();
|
|
96
|
+
if (!responseText) {
|
|
97
|
+
throw new auth_error_1.default('Empty response from server');
|
|
98
|
+
}
|
|
99
|
+
try {
|
|
100
|
+
return JSON.parse(responseText);
|
|
101
|
+
}
|
|
102
|
+
catch (parseError) {
|
|
103
|
+
throw new auth_error_1.default(`Failed to parse JSON response: ${parseError.message}`);
|
|
104
|
+
}
|
|
105
|
+
}))
|
|
81
106
|
.then((response) => {
|
|
82
107
|
if (response.error) {
|
|
83
108
|
if (response.error.code === error_code_1.default.ERROR_NO_DEVICE_FOUND) {
|
|
@@ -247,49 +272,48 @@ class AuthSession {
|
|
|
247
272
|
}
|
|
248
273
|
getFingerprintData() {
|
|
249
274
|
return new Promise((resolve) => {
|
|
250
|
-
var fpPromise = this.platform.getFpPromise();
|
|
251
275
|
if (!this.shouldCollectFP()) {
|
|
252
|
-
this.log.trace('
|
|
276
|
+
this.log.trace('FingerprintJS is not enabled in the AuthToken');
|
|
253
277
|
resolve(undefined);
|
|
278
|
+
return;
|
|
254
279
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
const msg = 'Cannot found sealed result in Fingerprint returned payload';
|
|
280
|
+
this.platform.getDataCollector().then((collector) => {
|
|
281
|
+
if (!collector) {
|
|
282
|
+
const msg = 'Found null instance of FingerprintJS, check if your input API key is valid ' +
|
|
283
|
+
'and FingerprintJS integration module is properly initialized';
|
|
284
|
+
this.log.warn(msg);
|
|
285
|
+
resolve({ error: msg });
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
if (!this.shouldRefreshFpSignal(this.getCurrentTimestampInSeconds())) {
|
|
289
|
+
this.log.trace('Existing FingerprintJS signal has not yet expired, skipping new collection');
|
|
290
|
+
resolve(undefined);
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
this.log.trace('Collect new FingerprintJS data');
|
|
294
|
+
collector
|
|
295
|
+
.getCollectedData()
|
|
296
|
+
.then((data) => {
|
|
297
|
+
if (!data) {
|
|
298
|
+
const msg = 'FingerprintJS returned no result data';
|
|
275
299
|
this.log.warn(msg);
|
|
276
300
|
resolve({ error: msg });
|
|
301
|
+
return;
|
|
277
302
|
}
|
|
303
|
+
resolve({ results: data });
|
|
304
|
+
return;
|
|
278
305
|
})
|
|
279
306
|
.catch((error) => {
|
|
280
|
-
const msg = `Error in collecting
|
|
307
|
+
const msg = `Error in collecting FingerprintJS data: ${auth_error_1.default.extractMessage(error)}`;
|
|
281
308
|
this.log.warn(error);
|
|
282
309
|
resolve({ error: msg });
|
|
283
310
|
});
|
|
284
|
-
}
|
|
311
|
+
});
|
|
285
312
|
});
|
|
286
313
|
}
|
|
287
314
|
shouldCollectFP() {
|
|
288
315
|
var _a, _b, _c;
|
|
289
|
-
|
|
290
|
-
return true;
|
|
291
|
-
}
|
|
292
|
-
return false;
|
|
316
|
+
return (_c = (_b = (_a = this.claims) === null || _a === void 0 ? void 0 : _a.auth.subs.dev) === null || _b === void 0 ? void 0 : _b.sgnls) === null || _c === void 0 ? void 0 : _c.fpt;
|
|
293
317
|
}
|
|
294
318
|
shouldRefreshFpSignal(currentTimestamp) {
|
|
295
319
|
var _a, _b, _c, _d;
|
|
@@ -298,6 +322,7 @@ class AuthSession {
|
|
|
298
322
|
return true;
|
|
299
323
|
}
|
|
300
324
|
const refreshRate = (_d = (_c = (_b = (_a = this.claims) === null || _a === void 0 ? void 0 : _a.auth.subs.dev) === null || _b === void 0 ? void 0 : _b.sgnls) === null || _c === void 0 ? void 0 : _c.fptrr) !== null && _d !== void 0 ? _d : 0;
|
|
325
|
+
this.log.debug(`Fingerprint refresh rate: ${refreshRate}`);
|
|
301
326
|
const interval = currentTimestamp - this.settings.fingerPrintTimestamp;
|
|
302
327
|
return interval >= refreshRate;
|
|
303
328
|
}
|
|
@@ -26,6 +26,9 @@ export interface UniversalAuthenticator {
|
|
|
26
26
|
export interface PpbAuthenticator {
|
|
27
27
|
endp: string;
|
|
28
28
|
}
|
|
29
|
+
export interface DocVAuthenticator {
|
|
30
|
+
endp: string;
|
|
31
|
+
}
|
|
29
32
|
export interface DeviceAuthenticators {
|
|
30
33
|
pasv?: PassiveAuthenticator;
|
|
31
34
|
unvsl?: UniversalAuthenticator;
|
|
@@ -41,6 +44,7 @@ export interface UserAuthenticators {
|
|
|
41
44
|
pasv?: PassiveAuthenticator;
|
|
42
45
|
prst?: PresentAuthenticator;
|
|
43
46
|
ppb?: PpbAuthenticator;
|
|
47
|
+
docv?: DocVAuthenticator;
|
|
44
48
|
}
|
|
45
49
|
export interface Signals {
|
|
46
50
|
fpt?: boolean;
|
|
@@ -6,4 +6,4 @@ var UserVerificationLevel;
|
|
|
6
6
|
UserVerificationLevel["Discouraged"] = "none";
|
|
7
7
|
UserVerificationLevel["Preferred"] = "pref";
|
|
8
8
|
UserVerificationLevel["Required"] = "req";
|
|
9
|
-
})(UserVerificationLevel
|
|
9
|
+
})(UserVerificationLevel || (exports.UserVerificationLevel = UserVerificationLevel = {}));
|