cidaas-javascript-sdk 2.0.11 → 2.1.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.
- package/.prettierrc +6 -0
- package/README.md +49 -0
- package/package.json +10 -10
- package/src/main/web-auth/webauth.js +71 -13
- package/types/main/web-auth/webauth.d.ts +3 -0
package/.prettierrc
ADDED
package/README.md
CHANGED
|
@@ -1818,7 +1818,56 @@ this.cidaas.consentContinue({
|
|
|
1818
1818
|
sub: 'your sub',
|
|
1819
1819
|
});
|
|
1820
1820
|
```
|
|
1821
|
+
##### Accept claim
|
|
1821
1822
|
|
|
1823
|
+
To accept Claim Consent, call ****acceptClaimConsent()****
|
|
1824
|
+
|
|
1825
|
+
##### Sample code
|
|
1826
|
+
```js
|
|
1827
|
+
this.cidaas.acceptClaimConsent({
|
|
1828
|
+
q: 'your sub',
|
|
1829
|
+
client_id: 'your client id',
|
|
1830
|
+
accepted: "accepted claims with array eg: []"
|
|
1831
|
+
}).then((response) => {
|
|
1832
|
+
// type your code here
|
|
1833
|
+
}).catch((err) => {
|
|
1834
|
+
// your failure code here
|
|
1835
|
+
});
|
|
1836
|
+
```
|
|
1837
|
+
|
|
1838
|
+
##### Response
|
|
1839
|
+
```json
|
|
1840
|
+
{
|
|
1841
|
+
"success":true,
|
|
1842
|
+
"status":200,
|
|
1843
|
+
"data": true
|
|
1844
|
+
}
|
|
1845
|
+
```
|
|
1846
|
+
|
|
1847
|
+
##### Revoke claim
|
|
1848
|
+
|
|
1849
|
+
To revoke Claim Consent, call ****revokeClaimConsent()****
|
|
1850
|
+
|
|
1851
|
+
##### Sample code
|
|
1852
|
+
```js
|
|
1853
|
+
this.cidaas.revokeClaimConsent({
|
|
1854
|
+
sub: 'your sub',
|
|
1855
|
+
revoked_claims: "revoked claims with array eg: []"
|
|
1856
|
+
}).then((response) => {
|
|
1857
|
+
// type your code here
|
|
1858
|
+
}).catch((err) => {
|
|
1859
|
+
// your failure code here
|
|
1860
|
+
});
|
|
1861
|
+
```
|
|
1862
|
+
|
|
1863
|
+
##### Response
|
|
1864
|
+
```json
|
|
1865
|
+
{
|
|
1866
|
+
"success":true,
|
|
1867
|
+
"status":200,
|
|
1868
|
+
"data": true
|
|
1869
|
+
}
|
|
1870
|
+
```
|
|
1822
1871
|
#### Deduplication
|
|
1823
1872
|
|
|
1824
1873
|
##### Get deduplication details
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cidaas-javascript-sdk",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"author": "cidaas by Widas ID GmbH",
|
|
5
5
|
"description": "Cidaas native javascript sdk",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,19 +17,19 @@
|
|
|
17
17
|
"build-types": "npx -p typescript tsc src/**/*.js --declaration --allowJs --emitDeclarationOnly --outDir types"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"crypto-js": "^
|
|
20
|
+
"crypto-js": "^4.1.1",
|
|
21
21
|
"oidc-client": "^1.11.5"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"compression-webpack-plugin": "^
|
|
25
|
-
"jest": "
|
|
26
|
-
"terser-webpack-plugin": "^5.
|
|
24
|
+
"compression-webpack-plugin": "^9.0.0",
|
|
25
|
+
"jest": "27.3.1",
|
|
26
|
+
"terser-webpack-plugin": "^5.2.4",
|
|
27
27
|
"typescript": "^4.5.4",
|
|
28
|
-
"webpack": "^5.
|
|
29
|
-
"webpack-cli": "^4.
|
|
30
|
-
"webpack-dev-server": "^3.
|
|
31
|
-
"webpack-hot-middleware": "^2.25.
|
|
32
|
-
"webpack-merge": "^5.
|
|
28
|
+
"webpack": "^5.59.1",
|
|
29
|
+
"webpack-cli": "^4.9.1",
|
|
30
|
+
"webpack-dev-server": "^4.3.1",
|
|
31
|
+
"webpack-hot-middleware": "^2.25.1",
|
|
32
|
+
"webpack-merge": "^5.8.0"
|
|
33
33
|
},
|
|
34
34
|
"jest": {
|
|
35
35
|
"collectCoverageFrom": [
|
|
@@ -435,21 +435,47 @@ WebAuth.prototype.getRequestId = function () {
|
|
|
435
435
|
// login with username and password
|
|
436
436
|
WebAuth.prototype.loginWithCredentials = function (options) {
|
|
437
437
|
try {
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
438
|
+
var form = document.createElement('form');
|
|
439
|
+
form.action = window.webAuthSettings.authority + "/login-srv/login";
|
|
440
|
+
form.method = 'POST';
|
|
441
|
+
for (var key in options) {
|
|
442
|
+
if (options.hasOwnProperty(key)) {
|
|
443
|
+
var hiddenField = document.createElement("input");
|
|
444
|
+
hiddenField.setAttribute("type", "hidden");
|
|
445
|
+
hiddenField.setAttribute("name", key);
|
|
446
|
+
hiddenField.setAttribute("value", options[key]);
|
|
447
|
+
|
|
448
|
+
form.appendChild(hiddenField);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
document.body.appendChild(form);
|
|
452
|
+
form.submit();
|
|
447
453
|
|
|
448
|
-
|
|
454
|
+
} catch (ex) {
|
|
455
|
+
throw new CustomException(ex, 417);
|
|
456
|
+
}
|
|
457
|
+
};
|
|
458
|
+
|
|
459
|
+
// login with username and password and return response
|
|
460
|
+
WebAuth.prototype.loginWithCredentialsAsynFn = async function (options) {
|
|
461
|
+
try {
|
|
462
|
+
|
|
463
|
+
let formData = new FormData();
|
|
464
|
+
for (let key in options) {
|
|
465
|
+
if (options.hasOwnProperty(key)) {
|
|
466
|
+
formData.append(key, options[key]);
|
|
449
467
|
}
|
|
450
468
|
}
|
|
451
|
-
|
|
452
|
-
|
|
469
|
+
|
|
470
|
+
const response = await fetch(window.webAuthSettings.authority + "/login-srv/login", {
|
|
471
|
+
method: "POST",
|
|
472
|
+
body: formData
|
|
473
|
+
});
|
|
474
|
+
|
|
475
|
+
const actualResponse = await response.json();
|
|
476
|
+
|
|
477
|
+
return actualResponse;
|
|
478
|
+
|
|
453
479
|
} catch (ex) {
|
|
454
480
|
throw new CustomException(ex, 417);
|
|
455
481
|
}
|
|
@@ -726,6 +752,32 @@ WebAuth.prototype.initiateAccountVerification = function (options) {
|
|
|
726
752
|
}
|
|
727
753
|
};
|
|
728
754
|
|
|
755
|
+
// initiate verification and return response
|
|
756
|
+
WebAuth.prototype.initiateAccountVerificationAsynFn = async function (options) {
|
|
757
|
+
try {
|
|
758
|
+
|
|
759
|
+
let formData = new FormData();
|
|
760
|
+
|
|
761
|
+
for (let key in options) {
|
|
762
|
+
if (options.hasOwnProperty(key)) {
|
|
763
|
+
formData.append(key, options[key]);
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
const response = await fetch(window.webAuthSettings.authority + "/verification-srv/account/initiate", {
|
|
768
|
+
method: "POST",
|
|
769
|
+
body: formData
|
|
770
|
+
});
|
|
771
|
+
|
|
772
|
+
const actualResponse = await response.json();
|
|
773
|
+
|
|
774
|
+
return actualResponse;
|
|
775
|
+
|
|
776
|
+
} catch (ex) {
|
|
777
|
+
throw new CustomException(ex, 417);
|
|
778
|
+
}
|
|
779
|
+
};
|
|
780
|
+
|
|
729
781
|
// verofy account
|
|
730
782
|
WebAuth.prototype.verifyAccount = function (options) {
|
|
731
783
|
var _serviceURL = window.webAuthSettings.authority + "/verification-srv/account/verify";
|
|
@@ -1202,6 +1254,12 @@ WebAuth.prototype.claimConsentContinue = function (options) {
|
|
|
1202
1254
|
}
|
|
1203
1255
|
};
|
|
1204
1256
|
|
|
1257
|
+
// revoke claim Consent
|
|
1258
|
+
WebAuth.prototype.revokeClaimConsent = function (options) {
|
|
1259
|
+
var _serviceURL = window.webAuthSettings.authority + "/consent-management-srv/consent/claim/revoke";
|
|
1260
|
+
return createPostPromise(options, _serviceURL, false);
|
|
1261
|
+
};
|
|
1262
|
+
|
|
1205
1263
|
|
|
1206
1264
|
// get Deduplication details
|
|
1207
1265
|
WebAuth.prototype.getDeduplicationDetails = function (options) {
|
|
@@ -1798,7 +1856,7 @@ WebAuth.prototype.userCheckExists = function (options) {
|
|
|
1798
1856
|
return createPostPromise(options, _serviceURL, undefined);
|
|
1799
1857
|
};
|
|
1800
1858
|
|
|
1801
|
-
WebAuth.prototype.setAcceptLanguageHeader = function(acceptLanguage) {
|
|
1859
|
+
WebAuth.prototype.setAcceptLanguageHeader = function (acceptLanguage) {
|
|
1802
1860
|
window.localeSettings = acceptLanguage;
|
|
1803
1861
|
}
|
|
1804
1862
|
|
|
@@ -20,6 +20,7 @@ declare class WebAuth {
|
|
|
20
20
|
validateAccessToken(options: any): Promise<any>;
|
|
21
21
|
getRequestId(): Promise<any>;
|
|
22
22
|
loginWithCredentials(options: any): void;
|
|
23
|
+
loginWithCredentialsAsynFn(options: any): Promise<any>;
|
|
23
24
|
loginWithSocial(options: any, queryParams: any): void;
|
|
24
25
|
registerWithSocial(options: any, queryParams: any): void;
|
|
25
26
|
getMissingFields(options: any): Promise<any>;
|
|
@@ -31,6 +32,7 @@ declare class WebAuth {
|
|
|
31
32
|
getInviteUserDetails(options: any): Promise<any>;
|
|
32
33
|
getCommunicationStatus(options: any): Promise<any>;
|
|
33
34
|
initiateAccountVerification(options: any): void;
|
|
35
|
+
initiateAccountVerificationAsynFn(options: any): Promise<any>;
|
|
34
36
|
verifyAccount(options: any): Promise<any>;
|
|
35
37
|
initiateResetPassword(options: any): Promise<any>;
|
|
36
38
|
handleResetPassword(options: any): void;
|
|
@@ -81,6 +83,7 @@ declare class WebAuth {
|
|
|
81
83
|
scopeConsentContinue(options: any): void;
|
|
82
84
|
acceptClaimConsent(options: any): Promise<any>;
|
|
83
85
|
claimConsentContinue(options: any): void;
|
|
86
|
+
revokeClaimConsent(options: any): Promise<any>;
|
|
84
87
|
getDeduplicationDetails(options: any): Promise<any>;
|
|
85
88
|
deduplicationLogin(options: any): void;
|
|
86
89
|
registerDeduplication(options: any): Promise<any>;
|