@eduzz/miau-client 0.0.16 → 0.0.18

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eduzz/miau-client",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "description": "Eduzz Miau Client",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
package/src/MiauClient.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import crypto from 'node:crypto';
2
+
1
3
  import { type RequestHandler } from 'express';
2
4
  import jwt from 'jsonwebtoken';
3
5
  import { JwksClient } from 'jwks-rsa';
@@ -34,7 +36,8 @@ export class MiauClient {
34
36
  constructor(props: MiauClientConfig) {
35
37
  this.apiUrl = props.apiUrl;
36
38
  const apiKey = props.appSecret.substring(7, 32);
37
- this.basicAuthToken = Buffer.from(`${apiKey}:${props.appSecret}`).toString('base64');
39
+ const hashedSecret = crypto.createHash('sha256').update(props.appSecret).digest('hex');
40
+ this.basicAuthToken = Buffer.from(`${apiKey}:${hashedSecret}`).toString('base64');
38
41
  }
39
42
 
40
43
  public async getPublicKey(kid: string) {
package/src/middleware.ts CHANGED
@@ -74,14 +74,12 @@ export const miauMiddleware = <T>(
74
74
  req.miauMetadata = permission?.metadata || {};
75
75
 
76
76
  if (requestAugmentation) {
77
- console.log('Request augmentation is being applied');
78
77
  requestAugmentation({ req, app: req.miauApplication, meta: req.miauMetadata as T });
79
78
  }
80
79
 
81
80
  next();
82
81
  } catch (err: HttpError | any) {
83
82
  if (err instanceof HttpError && err.status == 400 && fallbackMidlleware) {
84
- console.log('Using fallback middleware for 400 error');
85
83
  return fallbackMidlleware(req, res, next);
86
84
  }
87
85