cidaas-javascript-sdk 2.0.11 → 2.1.2

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 ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "printWidth": 120,
3
+ "trailingComma": "all",
4
+ "singleQuote": true,
5
+ "tabWidth": 4
6
+ }
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.11",
3
+ "version": "2.1.2",
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": "^3.1.9-1",
20
+ "crypto-js": "^4.1.1",
21
21
  "oidc-client": "^1.11.5"
22
22
  },
23
23
  "devDependencies": {
24
- "compression-webpack-plugin": "^7.1.2",
25
- "jest": "26.6.3",
26
- "terser-webpack-plugin": "^5.1.1",
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.27.2",
29
- "webpack-cli": "^4.5.0",
30
- "webpack-dev-server": "^3.11.2",
31
- "webpack-hot-middleware": "^2.25.0",
32
- "webpack-merge": "^5.7.3"
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": [
@@ -450,6 +450,29 @@ WebAuth.prototype.loginWithCredentials = function (options) {
450
450
  }
451
451
  document.body.appendChild(form);
452
452
  form.submit();
453
+
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
+ const searchParams = new URLSearchParams(options);
464
+
465
+ const response = fetch(window.webAuthSettings.authority + "/login-srv/login", {
466
+ method: "POST",
467
+ redirect: "follow",
468
+ body: searchParams.toString(),
469
+ headers: {
470
+ "Content-Type": "application/x-www-form-urlencoded",
471
+ }
472
+ });
473
+
474
+ return response;
475
+
453
476
  } catch (ex) {
454
477
  throw new CustomException(ex, 417);
455
478
  }
@@ -726,6 +749,29 @@ WebAuth.prototype.initiateAccountVerification = function (options) {
726
749
  }
727
750
  };
728
751
 
752
+ // initiate verification and return response
753
+ WebAuth.prototype.initiateAccountVerificationAsynFn = async function (options) {
754
+ try {
755
+
756
+ const searchParams = new URLSearchParams(options);
757
+
758
+ const response = fetch(window.webAuthSettings.authority + "/verification-srv/account/initiate", {
759
+ method: "POST",
760
+ redirect: "follow",
761
+ body: searchParams.toString(),
762
+ headers: {
763
+ "Content-Type": "application/x-www-form-urlencoded",
764
+ }
765
+ });
766
+
767
+ return response;
768
+
769
+ } catch (ex) {
770
+ throw new CustomException(ex, 417);
771
+ }
772
+
773
+ };
774
+
729
775
  // verofy account
730
776
  WebAuth.prototype.verifyAccount = function (options) {
731
777
  var _serviceURL = window.webAuthSettings.authority + "/verification-srv/account/verify";
@@ -1202,6 +1248,12 @@ WebAuth.prototype.claimConsentContinue = function (options) {
1202
1248
  }
1203
1249
  };
1204
1250
 
1251
+ // revoke claim Consent
1252
+ WebAuth.prototype.revokeClaimConsent = function (options) {
1253
+ var _serviceURL = window.webAuthSettings.authority + "/consent-management-srv/consent/claim/revoke";
1254
+ return createPostPromise(options, _serviceURL, false);
1255
+ };
1256
+
1205
1257
 
1206
1258
  // get Deduplication details
1207
1259
  WebAuth.prototype.getDeduplicationDetails = function (options) {
@@ -1798,7 +1850,7 @@ WebAuth.prototype.userCheckExists = function (options) {
1798
1850
  return createPostPromise(options, _serviceURL, undefined);
1799
1851
  };
1800
1852
 
1801
- WebAuth.prototype.setAcceptLanguageHeader = function(acceptLanguage) {
1853
+ WebAuth.prototype.setAcceptLanguageHeader = function (acceptLanguage) {
1802
1854
  window.localeSettings = acceptLanguage;
1803
1855
  }
1804
1856
 
@@ -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<Response>;
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<Response>;
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>;