cidaas-javascript-sdk 4.2.4 → 4.3.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.
Files changed (54) hide show
  1. package/CHANGELOG.md +41 -2
  2. package/README.md +9 -6
  3. package/dist/authentication/{index.d.ts → Authentication.d.ts} +2 -2
  4. package/dist/authentication/{index.js → Authentication.js} +2 -9
  5. package/dist/common/Common.model.d.ts +41 -0
  6. package/dist/common/Common.model.js +26 -0
  7. package/dist/{web-auth → common}/Helper.d.ts +6 -6
  8. package/dist/{web-auth → common}/Helper.js +10 -10
  9. package/dist/common/JwtHelper.d.ts +8 -0
  10. package/dist/{web-auth → common}/JwtHelper.js +8 -8
  11. package/dist/common/User.model.d.ts +134 -0
  12. package/dist/common/User.model.js +2 -0
  13. package/dist/consent-service/ConsentService.d.ts +97 -0
  14. package/dist/consent-service/ConsentService.js +127 -0
  15. package/dist/consent-service/ConsentService.model.d.ts +102 -0
  16. package/dist/consent-service/ConsentService.model.js +2 -0
  17. package/dist/index.d.ts +1 -1
  18. package/dist/index.js +1 -1
  19. package/dist/login-service/LoginService.d.ts +143 -0
  20. package/dist/login-service/LoginService.js +247 -0
  21. package/dist/login-service/LoginService.model.d.ts +142 -0
  22. package/dist/login-service/LoginService.model.js +13 -0
  23. package/dist/token-service/TokenService.d.ts +139 -0
  24. package/dist/token-service/TokenService.js +242 -0
  25. package/dist/token-service/TokenService.model.d.ts +149 -0
  26. package/dist/token-service/TokenService.model.js +43 -0
  27. package/dist/user-service/UserService.d.ts +317 -0
  28. package/dist/user-service/UserService.js +451 -0
  29. package/dist/user-service/UserService.model.d.ts +142 -0
  30. package/dist/user-service/UserService.model.js +10 -0
  31. package/dist/verification-service/VerificationService.d.ts +219 -0
  32. package/dist/verification-service/VerificationService.js +288 -0
  33. package/dist/verification-service/VerificationService.model.d.ts +158 -0
  34. package/dist/verification-service/VerificationService.model.js +2 -0
  35. package/dist/web-auth/WebAuth.d.ts +138 -178
  36. package/dist/web-auth/WebAuth.js +183 -177
  37. package/dist/web-auth/webauth.model.d.ts +66 -0
  38. package/dist/web-auth/webauth.model.js +2 -0
  39. package/package.json +2 -2
  40. package/dist/web-auth/ConsentService.d.ts +0 -123
  41. package/dist/web-auth/ConsentService.js +0 -136
  42. package/dist/web-auth/Entities.d.ts +0 -516
  43. package/dist/web-auth/Entities.js +0 -69
  44. package/dist/web-auth/JwtHelper.d.ts +0 -7
  45. package/dist/web-auth/LoginService.d.ts +0 -165
  46. package/dist/web-auth/LoginService.js +0 -246
  47. package/dist/web-auth/TokenService.d.ts +0 -143
  48. package/dist/web-auth/TokenService.js +0 -249
  49. package/dist/web-auth/UserService.d.ts +0 -345
  50. package/dist/web-auth/UserService.js +0 -471
  51. package/dist/web-auth/VerificationService.d.ts +0 -224
  52. package/dist/web-auth/VerificationService.js +0 -278
  53. /package/dist/authentication/{authentication.model.d.ts → Authentication.model.d.ts} +0 -0
  54. /package/dist/authentication/{authentication.model.js → Authentication.model.js} +0 -0
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GroupAllowed = exports.TokenTypeHint = exports.TokenIntrospectionRequest = exports.GrantType = void 0;
4
+ /** Type of grant used in token request */
5
+ var GrantType;
6
+ (function (GrantType) {
7
+ GrantType["AuthorizationCode"] = "authorization_code";
8
+ GrantType["Implicit"] = "implicit";
9
+ GrantType["RefreshToken"] = "refresh_token";
10
+ GrantType["Password"] = "password";
11
+ GrantType["ClientCredentials"] = "client_credentials";
12
+ GrantType["Internal"] = "internal";
13
+ GrantType["DeviceCode"] = "urn:ietf:params:oauth:grant-type:device_code";
14
+ })(GrantType = exports.GrantType || (exports.GrantType = {}));
15
+ class TokenIntrospectionRequest {
16
+ constructor() {
17
+ /** If true, all roles have to be included. If false, only 1 role from the list is needed */
18
+ this.strictRoleValidation = false;
19
+ /** If true, all group have to be included. If false, only 1 group from the list is needed */
20
+ this.strictGroupValidation = false;
21
+ /** If true, all scopes have to be included. If false, only 1 scope from the list is needed */
22
+ this.strictScopeValidation = false;
23
+ /** If true, all defined roles and/or groups and/or scopes validation has to be succesful. If false, only 1 of them is needed */
24
+ this.strictValidation = false;
25
+ }
26
+ }
27
+ exports.TokenIntrospectionRequest = TokenIntrospectionRequest;
28
+ /** Optional hint about the type of the submitted token. */
29
+ var TokenTypeHint;
30
+ (function (TokenTypeHint) {
31
+ TokenTypeHint["AccessToken"] = "access_token";
32
+ TokenTypeHint["RefreshToken"] = "refresh_token";
33
+ TokenTypeHint["IdToken"] = "id_token";
34
+ TokenTypeHint["Sid"] = "sid";
35
+ TokenTypeHint["Sso"] = "sso";
36
+ })(TokenTypeHint = exports.TokenTypeHint || (exports.TokenTypeHint = {}));
37
+ class GroupAllowed {
38
+ constructor() {
39
+ /** If true, all roles have to be included. If false, only 1 role from the list is needed */
40
+ this.strictRoleValidation = false;
41
+ }
42
+ }
43
+ exports.GroupAllowed = GroupAllowed;
@@ -0,0 +1,317 @@
1
+ import { ChangePasswordRequest, DeduplicationLoginRequest, DeleteUserAccountRequest, GetDeduplicationDetailsRequest, GetInviteUserDetailsRequest, GetUserProfileRequest, HandleResetPasswordRequest, InitiateLinkAccountRequest, InitiateResetPasswordRequest, RegisterDeduplicationRequest, RegisterRequest, ResetPasswordRequest, UserCheckExistsRequest, CompleteLinkAccountRequest, getCommunicationStatusRequest } from "./UserService.model";
2
+ import { HTTPRequestHeader } from "../common/Common.model";
3
+ import { CidaasUser } from "../common/User.model";
4
+ /**
5
+ * To get the user profile information by using cidaas internal api, call **getUserProfile()**.
6
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/2zfvjx3vtq6g6-get-user-info for more details.
7
+ * @example
8
+ * ```js
9
+ * const options = {
10
+ * access_token: 'your access token'
11
+ * }
12
+ * cidaas.getUserProfile(options)
13
+ * .then(function () {
14
+ * // the response will give you user profile information.
15
+ * }).catch(function (ex) {
16
+ * // your failure code here
17
+ * });
18
+ * ```
19
+ */
20
+ export declare function getUserProfile(options: GetUserProfileRequest): Promise<any>;
21
+ /**
22
+ * To register user, call **register()**. This method will create a new user.
23
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/427632e587203-register-a-new-user for more details.
24
+ * Note: Only requestId in the headers is required.
25
+ * @example
26
+ * ```js
27
+ * const headers = {
28
+ * requestId: 'your_received_requestId',
29
+ * captcha: 'captcha',
30
+ * acceptlanguage: 'acceptlanguage',
31
+ * bot_captcha_response: 'bot_captcha_response'
32
+ * };
33
+ *
34
+ * cidaas.register({
35
+ * email: 'xxx123@xxx.com',
36
+ * given_name: 'xxxxx',
37
+ * family_name: 'yyyyy',
38
+ * password: '123456',
39
+ * password_echo: '123456',
40
+ * provider: 'your provider', // FACEBOOK, GOOGLE, SELF
41
+ * acceptlanguage: 'your locale' // optional example: de-de, en-US
42
+ * }, headers).then(function (response) {
43
+ * // the response will give you client registration details.
44
+ * }).catch(function(ex) {
45
+ * // your failure code here
46
+ * });
47
+ *```
48
+ */
49
+ export declare function register(options: RegisterRequest, headers: HTTPRequestHeader): Promise<any>;
50
+ /**
51
+ * to get information about invitation details, call **getInviteUserDetails()**. This API allows to retrieve invitation details and prefill the registration form.
52
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/0b5efa5a2db5d-prefill-the-user-invitation for more details.
53
+ * Minimum cidaas version to use latest api is v3.100
54
+ * @example
55
+ * ```js
56
+ * const options = {
57
+ * invite_id: 'id of user invitation'
58
+ * callLatestAPI: 'true' // call latest api if parameter is given. By default, the older api will be called
59
+ * }
60
+ * cidaas.getInviteUserDetails(options)
61
+ * .then(function () {
62
+ * // the response will give you information about the invitation.
63
+ * }).catch(function (ex) {
64
+ * // your failure code here
65
+ * });
66
+ * ```
67
+ */
68
+ export declare function getInviteUserDetails(options: GetInviteUserDetailsRequest, headers?: HTTPRequestHeader): Promise<any>;
69
+ /**
70
+ * Once registration successful, verify the account based on the flow. To get the details, call **getCommunicationStatus()**.
71
+ * @example
72
+ * ```js
73
+ * cidaas.getCommunicationStatus({
74
+ * sub: 'your sub', // which you will get on the registration response
75
+ * }).then(function (response) {
76
+ * // the response will give you account details once its verified.
77
+ * }).catch(function(ex) {
78
+ * // your failure code here
79
+ * });
80
+ * ```
81
+ */
82
+ export declare function getCommunicationStatus(options: getCommunicationStatusRequest, headers?: HTTPRequestHeader): Promise<any>;
83
+ /**
84
+ * To initiate the password resetting, call **initiateResetPassword()**. This will send verification code to your email or mobile based on the resetMedium you mentioned.
85
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/6b29bac6002f4-initiate-password-reset for more details.
86
+ * @example
87
+ * ```js
88
+ * cidaas.initiateResetPassword({
89
+ * email: 'xxxxxx@xxx.com',
90
+ * processingType: ProcessingType.CODE,
91
+ * requestId: 'your requestId',
92
+ * resetMedium: ResetMedium.EMAIL
93
+ * }).then(function (response) {
94
+ * // the response will give you password reset details.
95
+ * }).catch(function(ex) {
96
+ * // your failure code here
97
+ * });
98
+ * ```
99
+ */
100
+ export declare function initiateResetPassword(options: InitiateResetPasswordRequest, headers?: HTTPRequestHeader): Promise<any>;
101
+ /**
102
+ * To handle the reset password by entering the verification code you received, call **handleResetPassword()**. This will check if your verification code was valid or not, and allows you to proceed to the next step.
103
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/3t8ztokeb7cfz-handle-reset-password for more details.
104
+ * @example
105
+ * ```js
106
+ * const handleResponseAsJson = 'true if the response need to be handled the old way (as json). In the current handling, the response information will be given as query parameter in redirect url.';
107
+ * cidaas.handleResetPassword({
108
+ * code: 'your code in email or sms or ivr',
109
+ * resetRequestId: 'your resetRequestId' // which you will get on initiate reset password response
110
+ * }, handleResponseAsJson).then(function (response) {
111
+ * // the response will give you valid verification code.
112
+ * }).catch(function(ex) {
113
+ * // your failure code here
114
+ * });
115
+ * ```
116
+ */
117
+ export declare function handleResetPassword(options: HandleResetPasswordRequest, handleResponseAsJson?: boolean, headers?: HTTPRequestHeader): Promise<any>;
118
+ /**
119
+ * To finish reseting the password, call **resetPassword()**. This will allow you to change your password.
120
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/qa9ny0gkzlf6y-accept-reset-password for more details.
121
+ * @example
122
+ * ```js
123
+ * const handleResponseAsJson = 'true if the response need to be handled the old way (as json). In the current handling, user will be redirected to success page after successful reset password.';
124
+ * cidaas.resetPassword({
125
+ * password: '123456',
126
+ * confirmPassword: '123456',
127
+ * exchangeId: 'your exchangeId', // which you will get on handle reset password response
128
+ * resetRequestId: 'your resetRequestId' // which you will get on handle reset password response
129
+ * }).then(function (response) {
130
+ * // the response will give you reset password details.
131
+ * }).catch(function(ex) {
132
+ * // your failure code here
133
+ * });
134
+ * ```
135
+ */
136
+ export declare function resetPassword(options: ResetPasswordRequest, handleResponseAsJson?: boolean, headers?: HTTPRequestHeader): Promise<any>;
137
+ /**
138
+ * To get the list of existing users in deduplication, call **getDeduplicationDetails()**.
139
+ * @example
140
+ * ```js
141
+ * this.cidaas.getDeduplicationDetails({
142
+ * track_id: 'your track id'
143
+ * }).then((response) => {
144
+ * // the response will give you deduplication details of users.
145
+ * }).catch((err) => {
146
+ * // your failure code here
147
+ * });
148
+ * ```
149
+ */
150
+ export declare function getDeduplicationDetails(options: GetDeduplicationDetailsRequest, headers?: HTTPRequestHeader): Promise<any>;
151
+ /**
152
+ * To use the existing users in deduplication, you need to call **deduplicationLogin()**.
153
+ * @example
154
+ * ```js
155
+ * this.cidaas.deduplicationLogin({
156
+ * sub: 'your sub',
157
+ * requestId: 'request id from deduplication initialisation after register',
158
+ * trackId: 'track id from deduplication initialisation after register'
159
+ * })
160
+ * ```
161
+ */
162
+ export declare function deduplicationLogin(options: DeduplicationLoginRequest): void;
163
+ /**
164
+ * To register new user in deduplication, call **registerDeduplication()**.
165
+ * @example
166
+ * ```js
167
+ * this.cidaas.registerDeduplication({
168
+ * track_id: 'track id from deduplication initialisation after register',
169
+ * }).then((response) => {
170
+ * // the response will give you new registered deduplication user.
171
+ * }).catch((err) => {
172
+ * // your failure code here
173
+ * });
174
+ * ```
175
+ */
176
+ export declare function registerDeduplication(options: RegisterDeduplicationRequest, headers?: HTTPRequestHeader): Promise<any>;
177
+ /**
178
+ * To change the password, call **changePassword()**. This will allow you to change your password.
179
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/8221883241464-change-password for more details.
180
+ * @example
181
+ * ```js
182
+ * cidaas.changePassword({
183
+ * old_password: 'your old password',
184
+ * new_password: 'your new password',
185
+ * confirm_password: 'your new password',
186
+ * sub: 'your sub',
187
+ * }, 'your access token')
188
+ * .then(function () {
189
+ * // your success code
190
+ * }).catch(function (ex) {
191
+ * // your failure code
192
+ * });
193
+ * ```
194
+ */
195
+ export declare function changePassword(options: ChangePasswordRequest, access_token: string): Promise<any>;
196
+ /**
197
+ * To update the user profile information, call **updateProfile()**.
198
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/i3uqnxcpxr19r-update-user-profile for more details.
199
+ * @example
200
+ * ```js
201
+ * cidaas.updateProfile({
202
+ * family_name: 'Doe',
203
+ * given_name: 'John',
204
+ * provider: 'self',
205
+ * acceptlanguage: 'your locale' // optional example: de-de, en-US
206
+ * }, 'your access token', 'your sub').then(function () {
207
+ * // the response will give you updated user profile info.
208
+ * }).catch(function (ex) {
209
+ * // your failure code here
210
+ * });
211
+ * ```
212
+ */
213
+ export declare function updateProfile(options: CidaasUser, access_token: string, sub: string): Promise<any>;
214
+ /**
215
+ * To initiate account linking, call **initiateLinkAccount()**.
216
+ * @example
217
+ * ```js
218
+ * const options = {
219
+ * master_sub: 'sub of the user who initiates the user link',
220
+ * user_name_to_link: 'username of the user which should get linked',
221
+ * user_name_type: 'type of user name to link. E.g. email'
222
+ * }
223
+ * const access_token = 'your access token'
224
+ * this.cidaas.initiateLinkAccount(options, access_token).then((response) => {
225
+ * // your success code
226
+ * }).catch((err) => {
227
+ * // your failure code here
228
+ * });
229
+ * ```
230
+ */
231
+ export declare function initiateLinkAccount(options: InitiateLinkAccountRequest, access_token: string): Promise<any>;
232
+ /**
233
+ * To complete account linking, call **completeLinkAccount()**.
234
+ * @example
235
+ * ```js
236
+ * const options = {
237
+ * code: 'code which is sent to account to be linked',
238
+ * link_request_id: 'comes from initiateLinkAccount'
239
+ * }
240
+ * const access_token = 'your access token'
241
+ * this.cidaas.completeLinkAccount(options, access_token).then((response) => {
242
+ * // your success code
243
+ * }).catch((err) => {
244
+ * // your failure code here
245
+ * });
246
+ * ```
247
+ */
248
+ export declare function completeLinkAccount(options: CompleteLinkAccountRequest, access_token: string): Promise<any>;
249
+ /**
250
+ * To get all the linked accounts, call **getLinkedUsers()**.
251
+ * @example
252
+ * ```js
253
+ * const acccess_token= 'your access token';
254
+ * const sub = 'your sub';
255
+ *
256
+ * cidaas.getLinkedUsers(access_token, sub)
257
+ * .then(function (response) {
258
+ * // type your code here
259
+ * })
260
+ * .catch(function (ex) {
261
+ * // your failure code here
262
+ * });
263
+ * ```
264
+ */
265
+ export declare function getLinkedUsers(access_token: string, sub: string): Promise<any>;
266
+ /**
267
+ * To unlink an account for a user, call **unlinkAccount()**.
268
+ * @example
269
+ * ```js
270
+ * const acccess_token= "your access token";
271
+ * const identityId = "comes from getLinkedUsers";
272
+ *
273
+ * cidaas.unlinkAccount(access_token, identityId)
274
+ * .then(function (response) {
275
+ * // type your code here
276
+ * })
277
+ * .catch(function (ex) {
278
+ * // your failure code here
279
+ * });
280
+ * ```
281
+ */
282
+ export declare function unlinkAccount(access_token: string, identityId: string): Promise<any>;
283
+ /**
284
+ * To delete the user account directly in the application, call **deleteUserAccount()**.
285
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/x133xdifl1sx9-schedule-user-deletion for more details.
286
+ * @example
287
+ * ```js
288
+ * options = {
289
+ * access_token: "your access token",
290
+ * sub: "your sub"
291
+ * }
292
+ *
293
+ * cidaas.deleteUserAccount(options).then(function (response) {
294
+ * // your success code
295
+ * }).catch(function(ex) {
296
+ * // your failure code here
297
+ * });
298
+ * ```
299
+ */
300
+ export declare function deleteUserAccount(options: DeleteUserAccountRequest): Promise<any>;
301
+ /**
302
+ * To check if user exists, call **userCheckExists()**.
303
+ * Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/4yh82qism78xf-find-user-by-identifier for more details.
304
+ * @example
305
+ * options = {
306
+ * requestId: "your request id",
307
+ * email: "your email"
308
+ * }
309
+ *
310
+ * cidaas.userCheckExists(options).then(function (response) {
311
+ * // your success code
312
+ * }).catch(function(ex) {
313
+ * // your failure code here
314
+ * });
315
+ * ```
316
+ */
317
+ export declare function userCheckExists(options: UserCheckExistsRequest, headers?: HTTPRequestHeader): Promise<any>;