cidaas-javascript-sdk 4.3.3 → 5.0.0

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.
Files changed (51) hide show
  1. package/CHANGELOG.md +52 -5
  2. package/README.md +109 -93
  3. package/dist/authentication-service/AuthenticationService.d.ts +140 -0
  4. package/dist/authentication-service/AuthenticationService.js +210 -0
  5. package/dist/{authentication/Authentication.model.d.ts → authentication-service/AuthenticationService.model.d.ts} +18 -12
  6. package/dist/{authentication/Authentication.model.js → authentication-service/AuthenticationService.model.js} +2 -2
  7. package/dist/common/Common.model.d.ts +15 -19
  8. package/dist/common/Common.model.js +17 -17
  9. package/dist/common/ConfigUserProvider.d.ts +10 -0
  10. package/dist/common/ConfigUserProvider.js +28 -0
  11. package/dist/common/Helper.d.ts +7 -0
  12. package/dist/common/Helper.js +19 -0
  13. package/dist/common/User.model.d.ts +0 -4
  14. package/dist/consent-service/ConsentService.d.ts +99 -95
  15. package/dist/consent-service/ConsentService.js +125 -122
  16. package/dist/consent-service/ConsentService.model.d.ts +14 -16
  17. package/dist/device-service/DeviceService.d.ts +49 -0
  18. package/dist/device-service/DeviceService.js +79 -0
  19. package/dist/device-service/DeviceService.model.d.ts +6 -0
  20. package/dist/id-validation-service/IdValidationService.d.ts +28 -0
  21. package/dist/id-validation-service/IdValidationService.js +59 -0
  22. package/dist/id-validation-service/IdValidationService.model.d.ts +8 -0
  23. package/dist/id-validation-service/IdValidationService.model.js +2 -0
  24. package/dist/index.d.ts +22 -3
  25. package/dist/index.js +35 -18
  26. package/dist/login-service/LoginService.d.ts +143 -141
  27. package/dist/login-service/LoginService.js +225 -234
  28. package/dist/login-service/LoginService.model.d.ts +7 -51
  29. package/dist/login-service/LoginService.model.js +1 -1
  30. package/dist/public-service/PublicService.d.ts +57 -0
  31. package/dist/public-service/PublicService.js +73 -0
  32. package/dist/public-service/PublicService.model.d.ts +20 -0
  33. package/dist/public-service/PublicService.model.js +2 -0
  34. package/dist/token-service/TokenService.d.ts +104 -138
  35. package/dist/token-service/TokenService.js +164 -219
  36. package/dist/token-service/TokenService.model.d.ts +3 -44
  37. package/dist/token-service/TokenService.model.js +3 -16
  38. package/dist/user-service/UserService.d.ts +381 -315
  39. package/dist/user-service/UserService.js +552 -426
  40. package/dist/user-service/UserService.model.d.ts +48 -14
  41. package/dist/user-service/UserService.model.js +4 -4
  42. package/dist/verification-service/VerificationService.d.ts +281 -223
  43. package/dist/verification-service/VerificationService.js +343 -287
  44. package/dist/verification-service/VerificationService.model.d.ts +4 -5
  45. package/package.json +6 -4
  46. package/dist/authentication/Authentication.d.ts +0 -139
  47. package/dist/authentication/Authentication.js +0 -186
  48. package/dist/web-auth/WebAuth.d.ts +0 -665
  49. package/dist/web-auth/WebAuth.js +0 -955
  50. package/dist/web-auth/webauth.model.d.ts +0 -66
  51. /package/dist/{web-auth/webauth.model.js → device-service/DeviceService.model.js} +0 -0
@@ -12,9 +12,8 @@ export interface InitiateAccountVerificationRequest {
12
12
  verificationMedium?: string;
13
13
  /**
14
14
  * can be either CODE, LINK, or GENERAL
15
- * BREAKING TODO: change type to ProcessingType only in next major version
16
- * */
17
- processingType?: ProcessingType | string;
15
+ */
16
+ processingType?: ProcessingType;
18
17
  /** Request id returned from the authorization call */
19
18
  requestId?: string;
20
19
  /** Unique identifier of client app, can be found in app setting under admin ui */
@@ -50,12 +49,12 @@ export interface GetMFAListRequest {
50
49
  /**
51
50
  * Masked sub (id of user)
52
51
  * Either sub or q have to be provided, depends on what is given from the query parameter.
53
- * */
52
+ */
54
53
  sub?: string;
55
54
  /**
56
55
  * Masked sub (id of user)
57
56
  * Either sub or q have to be provided, depends on what is given from the query parameter.
58
- * */
57
+ */
59
58
  q?: string;
60
59
  }
61
60
  export interface CancelMFARequest {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cidaas-javascript-sdk",
3
- "version": "4.3.3",
3
+ "version": "5.0.0",
4
4
  "author": "cidaas by Widas ID GmbH",
5
5
  "description": "Cidaas native javascript sdk",
6
6
  "license": "MIT",
@@ -14,7 +14,8 @@
14
14
  "dev": "tsc && webpack --config webpack.dev.js",
15
15
  "build": "tsc && webpack --config webpack.prod.js",
16
16
  "test": "jest --transformIgnorePatterns \"node_modules/(?!@toolz/allow)/\" --env=jsdom",
17
- "test:coverage": "jest --coverage --env=jsdom"
17
+ "test:coverage": "jest --coverage --env=jsdom",
18
+ "typedoc": "typedoc"
18
19
  },
19
20
  "files": [
20
21
  "dist",
@@ -27,7 +28,7 @@
27
28
  },
28
29
  "dependencies": {
29
30
  "@toolz/is-a-regular-object": "^1.0.1",
30
- "oidc-client-ts": "^2.4.1"
31
+ "oidc-client-ts": "^3.1.0"
31
32
  },
32
33
  "devDependencies": {
33
34
  "@babel/core": "^7.22.9",
@@ -46,7 +47,8 @@
46
47
  "ts-jest": "^29.1.1",
47
48
  "ts-loader": "^9.4.2",
48
49
  "ts-node": "10.9.1",
49
- "typescript": "^4.5.4",
50
+ "typedoc": "^0.27.5",
51
+ "typescript": "^5.7.2",
50
52
  "webpack": "^5.59.1",
51
53
  "webpack-cli": "^4.9.1",
52
54
  "webpack-dev-server": "^4.3.1",
@@ -1,139 +0,0 @@
1
- import { OidcManager, OidcSettings, LoginRedirectOptions, LogoutRedirectOptions, PopupSignInOptions, PopupSignOutOptions, SilentSignInOptions, LogoutResponse } from './Authentication.model';
2
- export * from './Authentication.model';
3
- export declare class Authentication {
4
- webAuthSettings: OidcSettings;
5
- userManager: OidcManager;
6
- constructor(webAuthSettings: OidcSettings, userManager: OidcManager);
7
- /**
8
- * To login through cidaas sdk, call **loginWithBrowser()**. This will redirect you to the hosted login page.
9
- * once login successful, it will automatically redirects you to the redirect url whatever you mentioned in the options.
10
- * @example
11
- * ```js
12
- * cidaas.loginWithBrowser();
13
- * ```
14
- *
15
- * To register through cidaas sdk, call **registerWithBrowser()**. This will redirect you to the hosted registration page.
16
- * * @example
17
- * ```js
18
- * cidaas.registerWithBrowser();
19
- * ```
20
- *
21
- * @param {string} view_type either 'login' or 'register'
22
- * @param {LoginRedirectOptions} options optional login options to override the webauth configuration
23
- */
24
- loginOrRegisterWithBrowser(view_type: string, options?: LoginRedirectOptions): Promise<void>;
25
- /**
26
- * Once login successful, it will automatically redirects you to the redirect url whatever you mentioned in the options.
27
- * To complete the login process, call **loginCallback()**. This will parses the access_token, id_token and whatever in hash in the redirect url.
28
- * @example
29
- * ```js
30
- * cidaas.loginCallback().then(function (response) {
31
- * // the response will give you login details.
32
- * }).catch(function(ex) {
33
- * // your failure code here
34
- * });
35
- * ```
36
- * @param {string} url optional url to read sign in state from
37
- */
38
- loginCallback(url?: string): Promise<import("oidc-client-ts").User>;
39
- /**
40
- * To use the **logout()** method, you need set the redirect url, if not it will automatically redirect to the login page
41
- * @example
42
- * ```js
43
- * cidaas.logout();
44
- * ```
45
- * @param {LogoutRedirectOptions} options optional logout options to override webauth configurations
46
- */
47
- logout(options?: LogoutRedirectOptions): Promise<void>;
48
- /**
49
- * **logoutCallback()** will parses the details of userState after logout.
50
- * @example
51
- * ```js
52
- * cidaas.logoutCallback().then(function (response) {
53
- * // the response will give you userState details.
54
- * }).catch(function(ex) {
55
- * // your failure code here
56
- * });
57
- * ```
58
- * @param {string} url optional url to read signout state from,
59
- */
60
- logoutCallback(url?: string): Promise<LogoutResponse>;
61
- /**
62
- * **popupSignIn()** will open the hosted login page in pop up window.
63
- * @example
64
- * ```js
65
- * cidaas.popupSignIn().then(function (response) {
66
- * // the response will give you user details after finishing popupSignInCallback().
67
- * }).catch(function(ex) {
68
- * // your failure code here
69
- * });
70
- * ```
71
- * @param {LogoutRedirectOptions} options optional popup sign-in options to override webauth configurations
72
- */
73
- popupSignIn(options?: PopupSignInOptions): Promise<import("oidc-client-ts").User>;
74
- /**
75
- * To complete the popup login process, call **popupSignInCallback()** from the popup login window.
76
- * Popup window will be closed after doing callback
77
- * @example
78
- * ```js
79
- * cidaas.popupSignInCallback();
80
- * ```
81
- * @param {string} url optional url to read sign-in callback state from
82
- * @param {boolean} keepOpen true to keep the popup open even after sign in, else false
83
- */
84
- popupSignInCallback(url?: string, keepOpen?: boolean): Promise<void>;
85
- /**
86
- * **popupSignOut()** will open the hosted logout page in pop up window.
87
- * @example
88
- * ```js
89
- * cidaas.popupSignOut().then(function() {
90
- * // success callback in main application window after finishing popupSignOutCallback().
91
- * }).catch(function(ex) {
92
- * // your failure code here
93
- * });
94
- * ```
95
- *
96
- * @param {PopupSignOutOptions} options optional options to over-ride logout options using popup window
97
- */
98
- popupSignOut(options?: PopupSignOutOptions): Promise<void>;
99
- /**
100
- * calling **popupSignOutCallback()** from the popup window complete popup logout process.
101
- * Popup window won't be closed after doing callback
102
- * @example
103
- * ```js
104
- * cidaas.popupSignOutCallback().then(function() {
105
- * // success callback in popup window after finishing popupSignOutCallback().
106
- * }).catch(function(ex) {
107
- * // your failure code here
108
- * });
109
- * ```
110
- *
111
- * @param {string} url optional url to override to check for sign out state
112
- * @param {boolean} keepOpen true to keep the popup open even after sign out, else false
113
- */
114
- popupSignOutCallback(url?: string, keepOpen?: boolean): Promise<void>;
115
- /**
116
- * **silentSignIn()** will open the hosted login page in an iframe.
117
- * this function could only be called from the same domain. Cross Domain is not supported for security purpose.
118
- * @example
119
- * ```js
120
- * cidaas.silentSignIn().then(function (response) {
121
- * // the response will give you user details.
122
- * }).catch(function(ex) {
123
- * // your failure code here
124
- * });
125
- * ```
126
- * @param {SilentSignInOptions} options options to over-ride the client config for silent sign in
127
- */
128
- silentSignIn(options?: SilentSignInOptions): Promise<import("oidc-client-ts").User>;
129
- /**
130
- * To complete the silent login process, call **silentSignInCallback()** from the iframe. This will complete the login process in iframe.
131
- * @example
132
- * ```js
133
- * cidaas.silentSignInCallback();
134
- *
135
- * ```
136
- * @param {string} url optional url to read sign in state from
137
- */
138
- silentSignInCallback(url?: string): Promise<void>;
139
- }
@@ -1,186 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.Authentication = void 0;
18
- __exportStar(require("./Authentication.model"), exports);
19
- class Authentication {
20
- constructor(webAuthSettings, userManager) {
21
- this.webAuthSettings = webAuthSettings;
22
- this.userManager = userManager;
23
- }
24
- /**
25
- * To login through cidaas sdk, call **loginWithBrowser()**. This will redirect you to the hosted login page.
26
- * once login successful, it will automatically redirects you to the redirect url whatever you mentioned in the options.
27
- * @example
28
- * ```js
29
- * cidaas.loginWithBrowser();
30
- * ```
31
- *
32
- * To register through cidaas sdk, call **registerWithBrowser()**. This will redirect you to the hosted registration page.
33
- * * @example
34
- * ```js
35
- * cidaas.registerWithBrowser();
36
- * ```
37
- *
38
- * @param {string} view_type either 'login' or 'register'
39
- * @param {LoginRedirectOptions} options optional login options to override the webauth configuration
40
- */
41
- loginOrRegisterWithBrowser(view_type, options) {
42
- var _a;
43
- if (!this.webAuthSettings.extraQueryParams) {
44
- this.webAuthSettings.extraQueryParams = {};
45
- }
46
- this.webAuthSettings.extraQueryParams.view_type = view_type;
47
- if (this.webAuthSettings.response_type.indexOf("id_token") == -1 && ((_a = this.webAuthSettings.scope) === null || _a === void 0 ? void 0 : _a.indexOf("openid")) != -1 && !this.webAuthSettings.extraQueryParams.nonce) {
48
- this.webAuthSettings.extraQueryParams.nonce = new Date().getTime().toString();
49
- }
50
- return this.userManager.signinRedirect(Object.assign({ extraQueryParams: this.webAuthSettings.extraQueryParams, redirect_uri: this.webAuthSettings.redirect_uri }, (options && Object.assign({}, options) || {})));
51
- }
52
- /**
53
- * Once login successful, it will automatically redirects you to the redirect url whatever you mentioned in the options.
54
- * To complete the login process, call **loginCallback()**. This will parses the access_token, id_token and whatever in hash in the redirect url.
55
- * @example
56
- * ```js
57
- * cidaas.loginCallback().then(function (response) {
58
- * // the response will give you login details.
59
- * }).catch(function(ex) {
60
- * // your failure code here
61
- * });
62
- * ```
63
- * @param {string} url optional url to read sign in state from
64
- */
65
- loginCallback(url) {
66
- return this.userManager.signinRedirectCallback(url);
67
- }
68
- /**
69
- * To use the **logout()** method, you need set the redirect url, if not it will automatically redirect to the login page
70
- * @example
71
- * ```js
72
- * cidaas.logout();
73
- * ```
74
- * @param {LogoutRedirectOptions} options optional logout options to override webauth configurations
75
- */
76
- logout(options) {
77
- return this.userManager.signoutRedirect(options);
78
- }
79
- /**
80
- * **logoutCallback()** will parses the details of userState after logout.
81
- * @example
82
- * ```js
83
- * cidaas.logoutCallback().then(function (response) {
84
- * // the response will give you userState details.
85
- * }).catch(function(ex) {
86
- * // your failure code here
87
- * });
88
- * ```
89
- * @param {string} url optional url to read signout state from,
90
- */
91
- logoutCallback(url) {
92
- return this.userManager.signoutRedirectCallback(url);
93
- }
94
- /**
95
- * **popupSignIn()** will open the hosted login page in pop up window.
96
- * @example
97
- * ```js
98
- * cidaas.popupSignIn().then(function (response) {
99
- * // the response will give you user details after finishing popupSignInCallback().
100
- * }).catch(function(ex) {
101
- * // your failure code here
102
- * });
103
- * ```
104
- * @param {LogoutRedirectOptions} options optional popup sign-in options to override webauth configurations
105
- */
106
- popupSignIn(options) {
107
- return this.userManager.signinPopup(options);
108
- }
109
- /**
110
- * To complete the popup login process, call **popupSignInCallback()** from the popup login window.
111
- * Popup window will be closed after doing callback
112
- * @example
113
- * ```js
114
- * cidaas.popupSignInCallback();
115
- * ```
116
- * @param {string} url optional url to read sign-in callback state from
117
- * @param {boolean} keepOpen true to keep the popup open even after sign in, else false
118
- */
119
- popupSignInCallback(url, keepOpen) {
120
- return this.userManager.signinPopupCallback(url, keepOpen);
121
- }
122
- /**
123
- * **popupSignOut()** will open the hosted logout page in pop up window.
124
- * @example
125
- * ```js
126
- * cidaas.popupSignOut().then(function() {
127
- * // success callback in main application window after finishing popupSignOutCallback().
128
- * }).catch(function(ex) {
129
- * // your failure code here
130
- * });
131
- * ```
132
- *
133
- * @param {PopupSignOutOptions} options optional options to over-ride logout options using popup window
134
- */
135
- popupSignOut(options) {
136
- return this.userManager.signoutPopup(options);
137
- }
138
- /**
139
- * calling **popupSignOutCallback()** from the popup window complete popup logout process.
140
- * Popup window won't be closed after doing callback
141
- * @example
142
- * ```js
143
- * cidaas.popupSignOutCallback().then(function() {
144
- * // success callback in popup window after finishing popupSignOutCallback().
145
- * }).catch(function(ex) {
146
- * // your failure code here
147
- * });
148
- * ```
149
- *
150
- * @param {string} url optional url to override to check for sign out state
151
- * @param {boolean} keepOpen true to keep the popup open even after sign out, else false
152
- */
153
- popupSignOutCallback(url, keepOpen = true) {
154
- url = url !== null && url !== void 0 ? url : this.webAuthSettings.post_logout_redirect_uri;
155
- return this.userManager.signoutPopupCallback(url, keepOpen);
156
- }
157
- /**
158
- * **silentSignIn()** will open the hosted login page in an iframe.
159
- * this function could only be called from the same domain. Cross Domain is not supported for security purpose.
160
- * @example
161
- * ```js
162
- * cidaas.silentSignIn().then(function (response) {
163
- * // the response will give you user details.
164
- * }).catch(function(ex) {
165
- * // your failure code here
166
- * });
167
- * ```
168
- * @param {SilentSignInOptions} options options to over-ride the client config for silent sign in
169
- */
170
- silentSignIn(options) {
171
- return this.userManager.signinSilent(Object.assign({ silentRequestTimeoutInSeconds: 60 }, (options && Object.assign({}, options) || {})));
172
- }
173
- /**
174
- * To complete the silent login process, call **silentSignInCallback()** from the iframe. This will complete the login process in iframe.
175
- * @example
176
- * ```js
177
- * cidaas.silentSignInCallback();
178
- *
179
- * ```
180
- * @param {string} url optional url to read sign in state from
181
- */
182
- silentSignInCallback(url) {
183
- return this.userManager.signinSilentCallback(url);
184
- }
185
- }
186
- exports.Authentication = Authentication;