response-standardizer 1.3.7 → 1.3.9

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/dist/index.js CHANGED
@@ -11,11 +11,11 @@ let KEYCLOAK_PUBLIC_KEY = null;
11
11
  const initKeycloak = async (config) => {
12
12
  const KEYCLOAK_SERVICE = config.service ?? "localhost";
13
13
  const KEYCLOAK_REALM = config.realm ?? "master";
14
- const realmUrl = `http://${KEYCLOAK_SERVICE}/realms/${KEYCLOAK_REALM}`;
14
+ const realmUrl = `${KEYCLOAK_SERVICE}/realms/${KEYCLOAK_REALM}`;
15
15
  (0, exports.info)(`Keycloak PublicKey Url: ${realmUrl}`);
16
16
  const resp = await axios_1.default.get(realmUrl);
17
17
  if (resp.status === 200) {
18
- (0, exports.info)(`Keycloak: ${resp.data}`);
18
+ (0, exports.info)(`Keycloak Public Key: ${resp.data.public_key}`);
19
19
  const key = resp.data.public_key;
20
20
  KEYCLOAK_PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----\n${key.match(/.{1,64}/g)?.join("\n")}\n-----END PUBLIC KEY-----`;
21
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "response-standardizer",
3
- "version": "1.3.7",
3
+ "version": "1.3.9",
4
4
  "description": "Express middleware to standardize API responses",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -21,11 +21,11 @@ let KEYCLOAK_PUBLIC_KEY: any = null;
21
21
  export const initKeycloak = async (config: { service?: string; realm?: string }) => {
22
22
  const KEYCLOAK_SERVICE = config.service ?? "localhost";
23
23
  const KEYCLOAK_REALM = config.realm ?? "master";
24
- const realmUrl = `http://${KEYCLOAK_SERVICE}/realms/${KEYCLOAK_REALM}`;
24
+ const realmUrl = `${KEYCLOAK_SERVICE}/realms/${KEYCLOAK_REALM}`;
25
25
  info(`Keycloak PublicKey Url: ${realmUrl}`);
26
26
  const resp = await axios.get(realmUrl);
27
27
  if(resp.status === 200){
28
- info(`Keycloak: ${resp.data}`);
28
+ info(`Keycloak Public Key: ${resp.data.public_key}`);
29
29
  const key = resp.data.public_key;
30
30
  KEYCLOAK_PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----\n${key.match(/.{1,64}/g)?.join("\n")}\n-----END PUBLIC KEY-----`;
31
31
  }else{