@jcbuisson/express-x 1.7.0 → 1.7.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.7.0",
3
+ "version": "1.7.2",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "src/index.mjs",
@@ -1,9 +1,6 @@
1
1
 
2
2
  import bcrypt from 'bcryptjs'
3
3
 
4
- import { getConnectionDataItem } from './context.mjs'
5
- import { MyCustomError } from './server.mjs'
6
-
7
4
 
8
5
  // hash password of user record
9
6
  export const hashPassword = (passwordField) => async (context) => {
@@ -25,25 +22,3 @@ export function protect(field) {
25
22
  return (context)
26
23
  }
27
24
  }
28
-
29
-
30
- export async function isAuthenticated(context) {
31
- // extract sessionId from connection data
32
- const sessionId = await getConnectionDataItem(context, 'sessionId')
33
- if (!sessionId) throw new MyCustomError("not authenticated", 'not-authenticated')
34
- }
35
-
36
- export const isNotExpired = async (context) => {
37
- const expireAt = await getConnectionDataItem(context, 'expireAt')
38
- if (expireAt) {
39
- const expireAtDate = new Date(expireAt)
40
- const now = new Date()
41
- if (now > expireAtDate) {
42
- // expiration date is met: clear connection data & throw exception
43
- await resetConnection(context)
44
- throw new MyCustomError("session expired", 'session-expired')
45
- }
46
- } else {
47
- throw new MyCustomError("session expired", 'session-expired')
48
- }
49
- }
package/src/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
 
2
- import { expressX, MyCustomError } from './server.mjs'
3
- import { hashPassword, protect, isAuthenticated, isNotExpired } from './common-hooks.mjs'
2
+ import { expressX } from './server.mjs'
3
+ import { hashPassword, protect } from './common-hooks.mjs'
4
4
  import { getContextConnection, resetConnection, getConnectionDataItem, setConnectionDataItem, removeConnectionDataItem, sendServiceEventToClient } from './context.mjs'
5
5
 
6
6
  export {
7
- expressX, MyCustomError,
7
+ expressX,
8
8
 
9
9
  getContextConnection,
10
10
  resetConnection,