|
| 1 | +import { getEnv } from './env'; |
| 2 | +import { requiredEnvVar } from './helpers'; |
| 3 | + |
| 4 | +// ensure env is setup |
| 5 | +getEnv(); |
| 6 | + |
| 7 | +/** |
| 8 | + * Session cookie key |
| 9 | + */ |
| 10 | +export const SECURE_SESSION_SECRET_KEY = requiredEnvVar('SECURE_SESSION_SECRET_KEY'); |
| 11 | +export const SECURE_SESSION_EXPIRATION_IN_SECONDS = 604800; // 7days |
| 12 | +export const MAX_SECURE_SESSION_EXPIRATION_IN_SECONDS = 15552000; // 6 * 30days -> 6 months |
| 13 | + |
| 14 | +/** |
| 15 | + * JWT |
| 16 | + */ |
| 17 | +export const JWT_SECRET = requiredEnvVar('JWT_SECRET'); |
| 18 | +/** Register token expiration, in minutes */ |
| 19 | +export const REGISTER_TOKEN_EXPIRATION_IN_MINUTES = 60; |
| 20 | +/** Login token expiration, in minutes */ |
| 21 | +export const LOGIN_TOKEN_EXPIRATION_IN_MINUTES = 30; |
| 22 | + |
| 23 | +/** Password reset token Secret */ |
| 24 | +export const PASSWORD_RESET_JWT_SECRET: string = requiredEnvVar('PASSWORD_RESET_JWT_SECRET'); |
| 25 | +/** Password reset token expiration, in minutes */ |
| 26 | +export const PASSWORD_RESET_JWT_EXPIRATION_IN_MINUTES = 1440; // 24 hours |
| 27 | + |
| 28 | +/** Email change token Secret */ |
| 29 | +export const EMAIL_CHANGE_JWT_SECRET: string = requiredEnvVar('EMAIL_CHANGE_JWT_SECRET'); |
| 30 | +/** Email change token expiration, in minutes */ |
| 31 | +export const EMAIL_CHANGE_JWT_EXPIRATION_IN_MINUTES = 1440; // 24 hours |
| 32 | + |
| 33 | +/** Graasp apps authentication */ |
| 34 | +export const APPS_JWT_SECRET = requiredEnvVar('APPS_JWT_SECRET'); |
| 35 | + |
| 36 | +// TODO: remove mobile auth variables as it is deprecated and not supported anymore |
| 37 | +/** |
| 38 | + * Mobile auth |
| 39 | + */ |
| 40 | +export const AUTH_TOKEN_JWT_SECRET = requiredEnvVar('AUTH_TOKEN_JWT_SECRET'); |
| 41 | +/** Auth token expiration, in minutes */ |
| 42 | +export const AUTH_TOKEN_EXPIRATION_IN_MINUTES = 10080; // 7 days |
| 43 | + |
| 44 | +export const REFRESH_TOKEN_JWT_SECRET = requiredEnvVar('REFRESH_TOKEN_JWT_SECRET'); |
| 45 | +/** Refresh token expiration, in minutes */ |
| 46 | +export const REFRESH_TOKEN_EXPIRATION_IN_MINUTES = 86400; // 60 days |
0 commit comments