cidaas-javascript-sdk 4.2.3 → 4.3.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 (55) hide show
  1. package/CHANGELOG.md +23 -3
  2. package/README.md +3 -0
  3. package/dist/authentication/{index.d.ts → Authentication.d.ts} +2 -2
  4. package/dist/authentication/{index.js → Authentication.js} +21 -10
  5. package/dist/authentication/Authentication.model.js +23 -0
  6. package/dist/common/Common.model.d.ts +37 -0
  7. package/dist/common/Common.model.js +26 -0
  8. package/dist/{web-auth → common}/Helper.d.ts +6 -6
  9. package/dist/{web-auth → common}/Helper.js +17 -12
  10. package/dist/common/JwtHelper.d.ts +8 -0
  11. package/dist/{web-auth → common}/JwtHelper.js +13 -9
  12. package/dist/common/User.model.d.ts +134 -0
  13. package/dist/common/User.model.js +2 -0
  14. package/dist/consent-service/ConsentService.d.ts +96 -0
  15. package/dist/consent-service/ConsentService.js +127 -0
  16. package/dist/consent-service/ConsentService.model.d.ts +102 -0
  17. package/dist/consent-service/ConsentService.model.js +2 -0
  18. package/dist/index.d.ts +1 -1
  19. package/dist/index.js +20 -3
  20. package/dist/login-service/LoginService.d.ts +143 -0
  21. package/dist/login-service/LoginService.js +247 -0
  22. package/dist/login-service/LoginService.model.d.ts +138 -0
  23. package/dist/login-service/LoginService.model.js +13 -0
  24. package/dist/token-service/TokenService.d.ts +139 -0
  25. package/dist/token-service/TokenService.js +242 -0
  26. package/dist/token-service/TokenService.model.d.ts +149 -0
  27. package/dist/token-service/TokenService.model.js +43 -0
  28. package/dist/user-service/UserService.d.ts +317 -0
  29. package/dist/user-service/UserService.js +451 -0
  30. package/dist/user-service/UserService.model.d.ts +142 -0
  31. package/dist/user-service/UserService.model.js +10 -0
  32. package/dist/verification-service/VerificationService.d.ts +218 -0
  33. package/dist/verification-service/VerificationService.js +288 -0
  34. package/dist/verification-service/VerificationService.model.d.ts +158 -0
  35. package/dist/verification-service/VerificationService.model.js +2 -0
  36. package/dist/web-auth/WebAuth.d.ts +110 -177
  37. package/dist/web-auth/WebAuth.js +98 -123
  38. package/dist/web-auth/webauth.model.d.ts +50 -0
  39. package/dist/web-auth/webauth.model.js +2 -0
  40. package/package.json +1 -1
  41. package/dist/authentication/authentication.model.js +0 -18
  42. package/dist/web-auth/ConsentService.d.ts +0 -123
  43. package/dist/web-auth/ConsentService.js +0 -133
  44. package/dist/web-auth/Entities.d.ts +0 -516
  45. package/dist/web-auth/Entities.js +0 -59
  46. package/dist/web-auth/JwtHelper.d.ts +0 -7
  47. package/dist/web-auth/LoginService.d.ts +0 -165
  48. package/dist/web-auth/LoginService.js +0 -243
  49. package/dist/web-auth/TokenService.d.ts +0 -143
  50. package/dist/web-auth/TokenService.js +0 -246
  51. package/dist/web-auth/UserService.d.ts +0 -345
  52. package/dist/web-auth/UserService.js +0 -468
  53. package/dist/web-auth/VerificationService.d.ts +0 -224
  54. package/dist/web-auth/VerificationService.js +0 -275
  55. /package/dist/authentication/{authentication.model.d.ts → Authentication.model.d.ts} +0 -0
@@ -1,165 +0,0 @@
1
- import { IUserEntity, LoginFormRequestEntity, PhysicalVerificationLoginRequest, IChangePasswordEntity } from "./Entities";
2
- export declare namespace LoginService {
3
- /**
4
- * To login with your credentials, call **loginWithCredentials()**. After successful login, this will redirect you to the redirect_url that you mentioned earlier while initialising the sdk.
5
- * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/5gphdk6vapp56-classic-login#call-login-api for more details.
6
- * @example
7
- * ```js
8
- * cidaas.loginWithCredentials({
9
- * username: 'xxxx@gmail.com',
10
- * username_type: 'email',
11
- * password: '123456',
12
- * requestId: 'your requestId',
13
- * });
14
- * ```
15
- */
16
- function loginWithCredentials(options: LoginFormRequestEntity): void;
17
- /**
18
- * To login with social providers, call **loginWithSocial()**. This will redirect you to the facebook login page.
19
- * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/9mi5uqxhqlsm5-social-login#call-social-login-api for more details
20
- * @example
21
- * ```js
22
- * cidaas.loginWithSocial({
23
- * provider: 'facebook',
24
- * requestId: 'your requestId',
25
- * });
26
- * ```
27
- */
28
- function loginWithSocial(options: {
29
- provider: string;
30
- requestId: string;
31
- }, queryParams: {
32
- dc: string;
33
- device_fp: string;
34
- }): void;
35
- /**
36
- * To register with social providers, call **registerWithSocial()**. This will redirect you to the facebook login page.
37
- * @example
38
- * Note: giving the queryParams is not required.
39
- * ```js
40
- * queryParams = {
41
- * dc: dc,
42
- * device_fp: device_fp
43
- *
44
- * cidaas.registerWithSocial({
45
- * provider: 'facebook',
46
- * requestId: 'your requestId',
47
- * }, queryParams);
48
- * ```
49
- */
50
- function registerWithSocial(options: {
51
- provider: string;
52
- requestId: string;
53
- }, queryParams: {
54
- dc: string;
55
- device_fp: string;
56
- }): void;
57
- /**
58
- * To authenticate without using password, call **passwordlessLogin()**.
59
- * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/k1lwsraxk0rjc-login-passwordless-request for more details.
60
- * @example
61
- * ```js
62
- * cidaas.passwordlessLogin({
63
- * requestId: 'your requestId',
64
- * sub: 'your user sub',
65
- * statusId: 'status id from authenticateMFA()'
66
- * verificationType: 'your verificationType. e.g. email'
67
- * });
68
- * ```
69
- */
70
- function passwordlessLogin(options: PhysicalVerificationLoginRequest): void;
71
- /**
72
- * To continue after Consent acceptance, call **consentContinue()**.
73
- * @example
74
- * ```js
75
- * cidaas.consentContinue({
76
- * name: 'your consent name',
77
- * version: 'your consent version',
78
- * client_id: 'your client id',
79
- * track_id: 'your track id',
80
- * sub: 'your sub'
81
- * });
82
- * ```
83
- */
84
- function consentContinue(options: {
85
- track_id: string;
86
- }): void;
87
- /**
88
- * To continue after MFA completion, call **mfaContinue()**.
89
- * @example
90
- * ```js
91
- * cidaas.mfaContinue({
92
- * trackingCode: 'your tracking Code',
93
- * track_id: 'your track id',
94
- * sub: 'your sub',
95
- * requestId: 'your request id'
96
- * });
97
- * ```
98
- */
99
- function mfaContinue(options: PhysicalVerificationLoginRequest & {
100
- track_id: string;
101
- }): void;
102
- /**
103
- * to handle changing password by first login attempt after registration, call **firstTimeChangePassword()**.
104
- * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/fd8f478d96f58-continue-authentication-flow-after-prechecks for more details.
105
- * @example
106
- * ```js
107
- * cidaas.firstTimeChangePassword({
108
- * sub: 'your sub',
109
- * old_password: 'your old password',
110
- * new_password: 'your new password',
111
- * confirm_password: 'your new password',
112
- * loginSettingsId: 'loginSettingsId'
113
- * });
114
- * ```
115
- */
116
- function firstTimeChangePassword(options: IChangePasswordEntity): void;
117
- /**
118
- * For progressive registration, call **progressiveRegistration()**. While logging in If the API returns 417 with the error message MissingRequiredFields, call the **getMissingFields** to get the list of missing fileds and proceed with progressive registration. In the sample request only the required fields are added, however you must provide the missing fields along with the required fields.
119
- * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/l7sknp2pytryr-progressive-registration for more details.
120
- * @example
121
- * ```js
122
- * const options = {
123
- * sub: 'your sub',
124
- * }
125
- * const headers = {
126
- * trackId: 'the track id received while logging in',
127
- * requestId: 'request id of the session',
128
- * acceptlanguage: 'your locale/browser locale (OPTIONAL)',
129
- * }
130
- * cidaas.progressiveRegistration(options, headers)
131
- * .then(function(response) {
132
- * // type your code here
133
- * })
134
- * .catch(function (ex) {
135
- * // your failure code here
136
- * });
137
- * ```
138
- */
139
- function progressiveRegistration(options: IUserEntity, headers: {
140
- requestId: string;
141
- trackId: string;
142
- acceptlanguage: string;
143
- }): Promise<unknown>;
144
- /**
145
- * To automatically do user login after successful registration, call **loginAfterRegister()**. Make sure to turn on "auto login after register" switch on the admin ui to activate loginAfterRegister flow.
146
- * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/qwwamc2f378wi-auto-login-after-register for more details.
147
- * @example
148
- * ```js
149
- * cidaas.loginAfterRegister({
150
- * device_id: 'your device id',
151
- * dc: 'device capacity'
152
- * rememberMe: false,
153
- * trackId: 'your track id',
154
- * device_fp: 'device fingerprint'
155
- * });
156
- * ```
157
- */
158
- function loginAfterRegister(options: {
159
- device_id?: string;
160
- dc?: string;
161
- rememberMe?: boolean;
162
- trackId?: string;
163
- device_fp?: string;
164
- }): void;
165
- }
@@ -1,243 +0,0 @@
1
- import { Helper, CustomException } from "./Helper";
2
- export var LoginService;
3
- (function (LoginService) {
4
- /**
5
- * To login with your credentials, call **loginWithCredentials()**. After successful login, this will redirect you to the redirect_url that you mentioned earlier while initialising the sdk.
6
- * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/5gphdk6vapp56-classic-login#call-login-api for more details.
7
- * @example
8
- * ```js
9
- * cidaas.loginWithCredentials({
10
- * username: 'xxxx@gmail.com',
11
- * username_type: 'email',
12
- * password: '123456',
13
- * requestId: 'your requestId',
14
- * });
15
- * ```
16
- */
17
- function loginWithCredentials(options) {
18
- try {
19
- const url = window.webAuthSettings.authority + "/login-srv/login";
20
- let form = Helper.createForm(url, options);
21
- document.body.appendChild(form);
22
- form.submit();
23
- }
24
- catch (ex) {
25
- throw new CustomException(ex, 417);
26
- }
27
- }
28
- LoginService.loginWithCredentials = loginWithCredentials;
29
- ;
30
- /**
31
- * To login with social providers, call **loginWithSocial()**. This will redirect you to the facebook login page.
32
- * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/9mi5uqxhqlsm5-social-login#call-social-login-api for more details
33
- * @example
34
- * ```js
35
- * cidaas.loginWithSocial({
36
- * provider: 'facebook',
37
- * requestId: 'your requestId',
38
- * });
39
- * ```
40
- */
41
- function loginWithSocial(options, queryParams) {
42
- try {
43
- var _serviceURL = window.webAuthSettings.authority + "/login-srv/social/login/" + options.provider.toLowerCase() + "/" + options.requestId;
44
- if (queryParams && queryParams.dc && queryParams.device_fp) {
45
- _serviceURL = _serviceURL + "?dc=" + queryParams.dc + "&device_fp=" + queryParams.device_fp;
46
- }
47
- window.location.href = _serviceURL;
48
- }
49
- catch (ex) {
50
- console.log(ex);
51
- }
52
- }
53
- LoginService.loginWithSocial = loginWithSocial;
54
- ;
55
- /**
56
- * To register with social providers, call **registerWithSocial()**. This will redirect you to the facebook login page.
57
- * @example
58
- * Note: giving the queryParams is not required.
59
- * ```js
60
- * queryParams = {
61
- * dc: dc,
62
- * device_fp: device_fp
63
- *
64
- * cidaas.registerWithSocial({
65
- * provider: 'facebook',
66
- * requestId: 'your requestId',
67
- * }, queryParams);
68
- * ```
69
- */
70
- function registerWithSocial(options, queryParams) {
71
- try {
72
- var _serviceURL = window.webAuthSettings.authority + "/login-srv/social/register/" + options.provider.toLowerCase() + "/" + options.requestId;
73
- if (queryParams && queryParams.dc && queryParams.device_fp) {
74
- _serviceURL = _serviceURL + "?dc=" + queryParams.dc + "&device_fp=" + queryParams.device_fp;
75
- }
76
- window.location.href = _serviceURL;
77
- }
78
- catch (ex) {
79
- console.log(ex);
80
- }
81
- }
82
- LoginService.registerWithSocial = registerWithSocial;
83
- ;
84
- /**
85
- * To authenticate without using password, call **passwordlessLogin()**.
86
- * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/k1lwsraxk0rjc-login-passwordless-request for more details.
87
- * @example
88
- * ```js
89
- * cidaas.passwordlessLogin({
90
- * requestId: 'your requestId',
91
- * sub: 'your user sub',
92
- * statusId: 'status id from authenticateMFA()'
93
- * verificationType: 'your verificationType. e.g. email'
94
- * });
95
- * ```
96
- */
97
- function passwordlessLogin(options) {
98
- try {
99
- const url = window.webAuthSettings.authority + "/login-srv/verification/login";
100
- let form = Helper.createForm(url, options);
101
- document.body.appendChild(form);
102
- form.submit();
103
- }
104
- catch (ex) {
105
- throw new CustomException(ex, 417);
106
- }
107
- }
108
- LoginService.passwordlessLogin = passwordlessLogin;
109
- ;
110
- /**
111
- * To continue after Consent acceptance, call **consentContinue()**.
112
- * @example
113
- * ```js
114
- * cidaas.consentContinue({
115
- * name: 'your consent name',
116
- * version: 'your consent version',
117
- * client_id: 'your client id',
118
- * track_id: 'your track id',
119
- * sub: 'your sub'
120
- * });
121
- * ```
122
- */
123
- function consentContinue(options) {
124
- try {
125
- const url = window.webAuthSettings.authority + "/login-srv/precheck/continue/" + options.track_id;
126
- let form = Helper.createForm(url, options);
127
- document.body.appendChild(form);
128
- form.submit();
129
- }
130
- catch (ex) {
131
- throw new CustomException(ex, 417);
132
- }
133
- }
134
- LoginService.consentContinue = consentContinue;
135
- ;
136
- /**
137
- * To continue after MFA completion, call **mfaContinue()**.
138
- * @example
139
- * ```js
140
- * cidaas.mfaContinue({
141
- * trackingCode: 'your tracking Code',
142
- * track_id: 'your track id',
143
- * sub: 'your sub',
144
- * requestId: 'your request id'
145
- * });
146
- * ```
147
- */
148
- function mfaContinue(options) {
149
- try {
150
- const url = window.webAuthSettings.authority + "/login-srv/precheck/continue/" + options.track_id;
151
- let form = Helper.createForm(url, options);
152
- document.body.appendChild(form);
153
- form.submit();
154
- }
155
- catch (ex) {
156
- throw new CustomException(ex, 417);
157
- }
158
- }
159
- LoginService.mfaContinue = mfaContinue;
160
- ;
161
- /**
162
- * to handle changing password by first login attempt after registration, call **firstTimeChangePassword()**.
163
- * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/fd8f478d96f58-continue-authentication-flow-after-prechecks for more details.
164
- * @example
165
- * ```js
166
- * cidaas.firstTimeChangePassword({
167
- * sub: 'your sub',
168
- * old_password: 'your old password',
169
- * new_password: 'your new password',
170
- * confirm_password: 'your new password',
171
- * loginSettingsId: 'loginSettingsId'
172
- * });
173
- * ```
174
- */
175
- function firstTimeChangePassword(options) {
176
- try {
177
- const url = window.webAuthSettings.authority + "/login-srv/precheck/continue/" + options.loginSettingsId;
178
- let form = Helper.createForm(url, options);
179
- document.body.appendChild(form);
180
- form.submit();
181
- }
182
- catch (ex) {
183
- throw new CustomException(ex, 417);
184
- }
185
- }
186
- LoginService.firstTimeChangePassword = firstTimeChangePassword;
187
- ;
188
- /**
189
- * For progressive registration, call **progressiveRegistration()**. While logging in If the API returns 417 with the error message MissingRequiredFields, call the **getMissingFields** to get the list of missing fileds and proceed with progressive registration. In the sample request only the required fields are added, however you must provide the missing fields along with the required fields.
190
- * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/l7sknp2pytryr-progressive-registration for more details.
191
- * @example
192
- * ```js
193
- * const options = {
194
- * sub: 'your sub',
195
- * }
196
- * const headers = {
197
- * trackId: 'the track id received while logging in',
198
- * requestId: 'request id of the session',
199
- * acceptlanguage: 'your locale/browser locale (OPTIONAL)',
200
- * }
201
- * cidaas.progressiveRegistration(options, headers)
202
- * .then(function(response) {
203
- * // type your code here
204
- * })
205
- * .catch(function (ex) {
206
- * // your failure code here
207
- * });
208
- * ```
209
- */
210
- function progressiveRegistration(options, headers) {
211
- var serviceURL = window.webAuthSettings.authority + "/login-srv/progressive/update/user";
212
- return Helper.createHttpPromise(options, serviceURL, undefined, "POST", undefined, headers);
213
- }
214
- LoginService.progressiveRegistration = progressiveRegistration;
215
- ;
216
- /**
217
- * To automatically do user login after successful registration, call **loginAfterRegister()**. Make sure to turn on "auto login after register" switch on the admin ui to activate loginAfterRegister flow.
218
- * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/qwwamc2f378wi-auto-login-after-register for more details.
219
- * @example
220
- * ```js
221
- * cidaas.loginAfterRegister({
222
- * device_id: 'your device id',
223
- * dc: 'device capacity'
224
- * rememberMe: false,
225
- * trackId: 'your track id',
226
- * device_fp: 'device fingerprint'
227
- * });
228
- * ```
229
- */
230
- function loginAfterRegister(options) {
231
- try {
232
- const url = window.webAuthSettings.authority + "/login-srv/login/handle/afterregister/" + options.trackId;
233
- let form = Helper.createForm(url, options);
234
- document.body.appendChild(form);
235
- form.submit();
236
- }
237
- catch (ex) {
238
- throw new CustomException(ex, 417);
239
- }
240
- }
241
- LoginService.loginAfterRegister = loginAfterRegister;
242
- ;
243
- })(LoginService || (LoginService = {}));
@@ -1,143 +0,0 @@
1
- import { AccessTokenRequest, TokenIntrospectionEntity } from "./Entities";
2
- export declare namespace TokenService {
3
- /**
4
- * To get a new token with the grant type refresh_token, call **renewToken()**.
5
- * The refresh token to create a new token. The refresh token is received while creating an access token using the token endpoint and later can be used to fetch a new token without using credentials
6
- * @example
7
- * ```js
8
- * const options = {
9
- * refresh_token: "your refresh token",
10
- * }
11
- *
12
- * cidaas.renewToken(options)
13
- * .then(function (response) {
14
- * // type your code here
15
- * })
16
- * .catch(function (ex) {
17
- * // your failure code here
18
- * });
19
- * ```
20
- */
21
- function renewToken(options: AccessTokenRequest): Promise<unknown>;
22
- /**
23
- * To get a new token with the grant type authorization_code, call **getAccessToken()** with code to create a new token.
24
- * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/4ff850f48629a-generate-token for more details.
25
- * @example
26
- * ```js
27
- * const options = {
28
- * code: "your code to be exchanged with access token",
29
- * }
30
- *
31
- * cidaas.getAccessToken(options)
32
- * .then(function (response) {
33
- * // type your code here
34
- * })
35
- * .catch(function (ex) {
36
- * // your failure code here
37
- * });
38
- * ```
39
- */
40
- function getAccessToken(options: AccessTokenRequest): Promise<unknown>;
41
- /**
42
- * To validate an access token, call **validateAccessToken()**.
43
- * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/26ff31e2937f1-introspect-with-bearer-token for more details.
44
- * @example
45
- * ```js
46
- * const options = {
47
- * token: "your access token",
48
- * token_type_hint: "accepted token type hints are access_token, id_token, refresh_token, sso",
49
- * }
50
- *
51
- * cidaas.validateAccessToken(options)
52
- * .then(function (response) {
53
- * // type your code here
54
- * })
55
- * .catch(function (ex) {
56
- * // your failure code here
57
- * });
58
- * ```
59
- */
60
- function validateAccessToken(options: TokenIntrospectionEntity): Promise<unknown>;
61
- /**
62
- * To get precheck result after login, call **loginPrecheck()**. If there is missing information, user will be redirected to either accepting consent, changing password, continuing MFA process, or do progressive registration
63
- * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/aappczju1t3uh-precheck-information for more details.
64
- * @example
65
- * ```js
66
- * const options = {
67
- * trackId: "your track id from login",
68
- * locale: "your preferred locale",
69
- * }
70
- *
71
- * cidaas.loginPrecheck(options)
72
- * .then(function (response) {
73
- * // type your code here
74
- * })
75
- * .catch(function (ex) {
76
- * // your failure code here
77
- * });
78
- * ```
79
- */
80
- function loginPrecheck(options: {
81
- track_id: string;
82
- locale: string;
83
- }): Promise<unknown>;
84
- /**
85
- * To get the missing fields after login, call **getMissingFields()**.
86
- * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/aappczju1t3uh-precheck-information for more details.
87
- * @example
88
- * ```js
89
- * const trackId = "your track id from login";
90
- * cidaas.getMissingFields(trackId)
91
- * .then(function (response) {
92
- * // type your code here
93
- * })
94
- * .catch(function (ex) {
95
- * // your failure code here
96
- * });
97
- * ```
98
- */
99
- function getMissingFields(trackId: string): Promise<unknown>;
100
- /**
101
- * To initiate device code, call **initiateDeviceCode()**.
102
- * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/b6d284f55be5e-authorization-request for more details.
103
- * @example
104
- * ```js
105
- * const clientId = "your client id";
106
- * cidaas.initiateDeviceCode(clientId)
107
- * .then(function (response) {
108
- * // type your code here
109
- * })
110
- * .catch(function (ex) {
111
- * // your failure code here
112
- * });
113
- * ```
114
- */
115
- function initiateDeviceCode(clientId?: string): Promise<unknown>;
116
- /**
117
- * To verify device code, call **deviceCodeVerify()**.
118
- * @example
119
- * ```js
120
- * const code = "your code which has been send after initiateDeviceCode()";
121
- * cidaas.deviceCodeVerify(code)
122
- * .then(function (response) {
123
- * // type your code here
124
- * })
125
- * .catch(function (ex) {
126
- * // your failure code here
127
- * });
128
- * ```
129
- */
130
- function deviceCodeVerify(code: string): void;
131
- /**
132
- * To check access token without having to call cidaas api, call **offlineTokenCheck()**. THe function will return true if the token is valid & false if the token is invalid.
133
- * @example
134
- * ```js
135
- * cidaas.offlineTokenCheck('your access token');
136
- * ```
137
- */
138
- function offlineTokenCheck(accessToken: string): {
139
- isExpiryDateValid: boolean;
140
- isScopesValid: boolean;
141
- isIssuerValid: boolean;
142
- };
143
- }