@nitra/cf-security 3.3.0 → 3.3.1

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/jwt.js +2 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nitra/cf-security",
3
- "version": "3.3.0",
3
+ "version": "3.3.1",
4
4
  "description": "check header in cloud functions",
5
5
  "type": "module",
6
6
  "exports": {
package/src/jwt.js CHANGED
@@ -13,7 +13,8 @@ export default async (req, allowedRoles) => {
13
13
  // Але якщо передали - то беремо контент з нього
14
14
  if (req.headers?.authorization) {
15
15
  // ігноруючи expired
16
- return verify(req.headers.authorization.split(' ')[1], { ignoreExpiration: true })
16
+ const token = await verify(req.headers.authorization.split(' ')[1], { ignoreExpiration: true })
17
+ return token.body
17
18
  } else {
18
19
  return { name: 'dev', 'https://hasura.io/jwt/claims': { 'x-hasura-allowed-roles': allowedRoles } }
19
20
  }