@prove-identity/prove-auth 2.13.1 → 2.15.1
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/build/bundle/release/prove-auth.js +1 -1
- package/build/lib/index.d.ts +3 -2
- package/build/lib/index.js +1 -2
- package/build/lib/proveauth/authenticator-builder.d.ts +5 -0
- package/build/lib/proveauth/authenticator-builder.js +25 -2
- package/build/lib/proveauth/external/@authid/web-component/authid-web-component.d.ts +3 -0
- package/build/lib/proveauth/external/@authid/web-component/authid-web-component.js +55 -0
- package/build/lib/proveauth/instantlink.d.ts +2 -6
- package/build/lib/proveauth/instantlink.js +1 -11
- package/build/lib/proveauth/internal/auth-request.d.ts +5 -3
- package/build/lib/proveauth/internal/auth-response.d.ts +24 -28
- package/build/lib/proveauth/internal/auth-session.d.ts +6 -1
- package/build/lib/proveauth/internal/auth-session.js +34 -7
- package/build/lib/proveauth/internal/auth-token-claims.d.ts +22 -3
- package/build/lib/proveauth/internal/device-passive-register-step.js +8 -9
- package/build/lib/proveauth/internal/device-passive-silent-step.js +13 -6
- package/build/lib/proveauth/internal/device-passive-step.js +10 -5
- package/build/lib/proveauth/internal/device-passive-stepup-step.js +1 -19
- package/build/lib/proveauth/internal/device-passive-verify-step.js +2 -18
- package/build/lib/proveauth/internal/main-authenticator.js +3 -0
- package/build/lib/proveauth/internal/mobile-instant-step.js +2 -2
- package/build/lib/proveauth/internal/mobile-instantlink-step.d.ts +0 -3
- package/build/lib/proveauth/internal/mobile-instantlink-step.js +22 -122
- package/build/lib/proveauth/internal/mobile-otp-step.js +3 -3
- package/build/lib/proveauth/internal/platform.d.ts +11 -0
- package/build/lib/proveauth/internal/report-error-step.js +5 -2
- package/build/lib/proveauth/internal/settings.d.ts +3 -0
- package/build/lib/proveauth/internal/settings.js +14 -0
- package/build/lib/proveauth/internal/user-mobileactive-step.js +1 -3
- package/build/lib/proveauth/internal/user-ppb-steps.d.ts +24 -0
- package/build/lib/proveauth/internal/user-ppb-steps.js +103 -0
- package/build/lib/proveauth/internal/user-present-step.js +1 -3
- package/build/lib/proveauth/internal/web-platform.d.ts +3 -1
- package/build/lib/proveauth/internal/web-platform.js +101 -0
- package/build/lib/proveauth/ppb.d.ts +9 -0
- package/build/lib/proveauth/ppb.js +2 -0
- package/build/lib/proveauth/version.d.ts +2 -2
- package/build/lib/proveauth/version.js +2 -2
- package/package.json +1 -1
|
@@ -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
|
};
|
|
@@ -6,6 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
15
|
exports.WebPlatform = exports.WebSocketMessageChannel = void 0;
|
|
7
16
|
const mobile_auth_1 = require("@prove-identity/mobile-auth");
|
|
8
17
|
const platform_1 = require("./platform");
|
|
18
|
+
const logger_1 = require("../common/logger");
|
|
9
19
|
const request_signer_v3_1 = __importDefault(require("./request-signer-v3"));
|
|
10
20
|
const web_device_auth_1 = __importDefault(require("./web-device-auth"));
|
|
11
21
|
class WebSocketMessageChannel {
|
|
@@ -25,6 +35,7 @@ class WebSocketMessageChannel {
|
|
|
25
35
|
exports.WebSocketMessageChannel = WebSocketMessageChannel;
|
|
26
36
|
class WebPlatform {
|
|
27
37
|
constructor() {
|
|
38
|
+
this.log = logger_1.LoggerFactory.getLogger('web-platform');
|
|
28
39
|
this.webauthn = {
|
|
29
40
|
getCredentials: (options) => {
|
|
30
41
|
return navigator.credentials.get(options);
|
|
@@ -53,6 +64,96 @@ class WebPlatform {
|
|
|
53
64
|
createRequestSigner(session) {
|
|
54
65
|
return new request_signer_v3_1.default(session);
|
|
55
66
|
}
|
|
67
|
+
ppbAuthenticate(options) {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
const operationMap = new Map([
|
|
70
|
+
['enroll', 'i'],
|
|
71
|
+
['verify', 't'],
|
|
72
|
+
]);
|
|
73
|
+
if (!options.authIdEndpointUrl) {
|
|
74
|
+
return Promise.reject('AuthID API endpoint URL is missing');
|
|
75
|
+
}
|
|
76
|
+
if (!options.authIdOperation) {
|
|
77
|
+
return Promise.reject('AuthID API operation is missing');
|
|
78
|
+
}
|
|
79
|
+
if (!operationMap.has(options.authIdOperation)) {
|
|
80
|
+
return Promise.reject('AuthID API operation is not recognized');
|
|
81
|
+
}
|
|
82
|
+
if (!options.authIdOperationId) {
|
|
83
|
+
return Promise.reject('AuthID operation ID is missing');
|
|
84
|
+
}
|
|
85
|
+
if (!options.authIdOneTimeSecret) {
|
|
86
|
+
return Promise.reject('AuthID operation secret is missing');
|
|
87
|
+
}
|
|
88
|
+
const componentName = 'authid-component';
|
|
89
|
+
try {
|
|
90
|
+
const authId = require('../external/@authid/web-component/authid-web-component');
|
|
91
|
+
if (!authId) {
|
|
92
|
+
return Promise.reject('Failed to load PPB Auth web component');
|
|
93
|
+
}
|
|
94
|
+
if (!window.customElements.get(componentName)) {
|
|
95
|
+
window.customElements.define(componentName, authId.AuthIDComponent);
|
|
96
|
+
}
|
|
97
|
+
yield window.customElements.whenDefined(componentName);
|
|
98
|
+
}
|
|
99
|
+
catch (e) {
|
|
100
|
+
this.log.error(e);
|
|
101
|
+
return Promise.reject(new Error('Failed to initialize PPB Auth web component'));
|
|
102
|
+
}
|
|
103
|
+
return new Promise((resolve, reject) => {
|
|
104
|
+
const existingComponent = document.querySelector(componentName);
|
|
105
|
+
if (existingComponent) {
|
|
106
|
+
this.log.trace('Removing existing component', componentName);
|
|
107
|
+
existingComponent.remove();
|
|
108
|
+
}
|
|
109
|
+
const authIdComponent = document.createElement(componentName);
|
|
110
|
+
const url = `${options.authIdEndpointUrl}/?` +
|
|
111
|
+
`${operationMap.get(options.authIdOperation)}=${options.authIdOperationId}&` +
|
|
112
|
+
`s=${options.authIdOneTimeSecret}`;
|
|
113
|
+
authIdComponent.setAttribute('data-url', url);
|
|
114
|
+
document.body.appendChild(authIdComponent);
|
|
115
|
+
const handleAuthDone = (success) => __awaiter(this, void 0, void 0, function* () {
|
|
116
|
+
window.removeEventListener('message', handleMessage);
|
|
117
|
+
this.log.trace('On PPB auth done');
|
|
118
|
+
resolve({ authIdSuccess: success });
|
|
119
|
+
});
|
|
120
|
+
const handleMessage = (event) => {
|
|
121
|
+
this.log.debug('PPB event', event.data);
|
|
122
|
+
if (event.data.success) {
|
|
123
|
+
const authIdComponent = document.querySelector(componentName);
|
|
124
|
+
if (authIdComponent) {
|
|
125
|
+
authIdComponent.remove();
|
|
126
|
+
}
|
|
127
|
+
handleAuthDone(true);
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
switch (event.data.pageName) {
|
|
131
|
+
case 'documentFailedPage':
|
|
132
|
+
case 'documentFailedNonMobilePage':
|
|
133
|
+
case 'networkErrorPage':
|
|
134
|
+
case 'livenessErrorPage':
|
|
135
|
+
case 'docScanWasmTimeoutPage':
|
|
136
|
+
case 'requestTimeoutPage':
|
|
137
|
+
case 'transactionNotValidPage':
|
|
138
|
+
case 'transactionMaxAttemptsPage':
|
|
139
|
+
case 'QRCodePage':
|
|
140
|
+
return;
|
|
141
|
+
case 'verifiedMatchFailPage':
|
|
142
|
+
case 'verifyDeclinedPage':
|
|
143
|
+
authIdComponent.remove();
|
|
144
|
+
case 'docScanResolutionTooLowPage':
|
|
145
|
+
case 'videoDeviceNotFoundPage':
|
|
146
|
+
case 'standardErrorPage':
|
|
147
|
+
case 'defaultFailedPage':
|
|
148
|
+
handleAuthDone(false);
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
window.addEventListener('message', handleMessage);
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
}
|
|
56
157
|
getBrowserName() {
|
|
57
158
|
const agent = navigator.userAgent;
|
|
58
159
|
let browserName;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type PpbOperation = 'enroll' | 'verify';
|
|
2
|
+
export interface PpbStartStep {
|
|
3
|
+
execute: (operation: PpbOperation) => Promise<void>;
|
|
4
|
+
}
|
|
5
|
+
export interface PpbFinishStep {
|
|
6
|
+
execute: (operation: PpbOperation, error?: Error) => Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export type PpbStartStepFn = (operation: PpbOperation) => Promise<void>;
|
|
9
|
+
export type PpbFinishStepFn = (operation: PpbOperation, error?: Error) => Promise<void>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const VERSION = "2.
|
|
2
|
-
export declare const API_CONTRACT_VERSION = "2.
|
|
1
|
+
export declare const VERSION = "2.15.1";
|
|
2
|
+
export declare const API_CONTRACT_VERSION = "2.15.1";
|
|
3
3
|
export declare const USER_AGENT_VERSIONS: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.USER_AGENT_VERSIONS = exports.API_CONTRACT_VERSION = exports.VERSION = void 0;
|
|
4
|
-
exports.VERSION = '2.
|
|
5
|
-
exports.API_CONTRACT_VERSION = '2.
|
|
4
|
+
exports.VERSION = '2.15.1';
|
|
5
|
+
exports.API_CONTRACT_VERSION = '2.15.1';
|
|
6
6
|
exports.USER_AGENT_VERSIONS = `ProveAuth/${exports.VERSION} Contract/${exports.API_CONTRACT_VERSION} WEB/1`;
|