@nethserver/ns8-ui-lib 0.1.3 → 0.1.4

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.
@@ -7590,6 +7590,18 @@ var UtilService = {
7590
7590
 
7591
7591
 
7592
7592
  return key;
7593
+ },
7594
+
7595
+ /**
7596
+ * Decode a jwt token to parse its payload
7597
+ */
7598
+ decodeJwtPayload(token) {
7599
+ var base64Url = token.split(".")[1];
7600
+ var base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
7601
+ var jsonPayload = decodeURIComponent(window.atob(base64).split("").map(function (c) {
7602
+ return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2);
7603
+ }).join(""));
7604
+ return JSON.parse(jsonPayload);
7593
7605
  }
7594
7606
 
7595
7607
  }