@jcbuisson/express-x 1.5.1 → 1.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jcbuisson/express-x",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "src/index.mjs",
@@ -12,23 +12,6 @@ export async function hashPassword(context) {
12
12
  }
13
13
 
14
14
 
15
- export async function authenticate(context) {
16
- console.log('authenticate hook', context.transport, context.name, context.action, context?.connection?.accessToken)
17
- return context
18
-
19
- if (context.transport === 'ws') {
20
- // for WS transport, just check that connection.accessToken is set and valid
21
- if (!context?.connection?.accessToken) throw new Error("WS connection is not secured by a JWT access token")
22
- // TODO: check token validity
23
-
24
- } else if (context.transport === 'http') {
25
- // for HTTP transport, check that the associated request has a header with a valid JWT
26
- // TODO: check headers for access token
27
- }
28
- return (context)
29
- }
30
-
31
-
32
15
  // remove `field` from `result`
33
16
  export function protect(field) {
34
17
  return async (context) => {
package/src/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  import { expressX } from './server.mjs'
3
- import { hashPassword, protect, } from './common-hooks.mjs'
3
+ import { hashPassword, protect, isAuthenticated } from './common-hooks.mjs'
4
4
 
5
5
  export {
6
6
  expressX,