update websocket
This commit is contained in:
@@ -134,4 +134,8 @@ export class DateTimeUtils {
|
||||
second: second as SecondNumbers,
|
||||
}
|
||||
}
|
||||
|
||||
static getTimeFromDateTime(dateTime: DateTime): TimeType {
|
||||
return this.toTime(`${dateTime.hour}:${dateTime.minute}:${dateTime.second}`)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,9 +7,11 @@ export class JwtUtils {
|
||||
signToken(payload: string, expiresIn: string) {
|
||||
return sign(payload, process.env.JWT_SECRET!, { expiresIn })
|
||||
}
|
||||
//eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
signTokenRS256(payload: any, expiresIn: string) {
|
||||
const privateKey = process.env.JWT_RS256_PRIVATE_KEY!
|
||||
signTokenRS256(payload: string, expiresIn: string) {
|
||||
const privateKey = process.env.JWT_RS256_PRIVATE_KEY
|
||||
if (!privateKey) {
|
||||
throw new Error('JWT_RS256_PRIVATE_KEY is not defined')
|
||||
}
|
||||
return sign(payload, privateKey, {
|
||||
algorithm: 'RS256',
|
||||
expiresIn,
|
||||
@@ -17,7 +19,10 @@ export class JwtUtils {
|
||||
}
|
||||
|
||||
verifyTokenRS256(token: string) {
|
||||
const publicKey = process.env.JWT_RS256_PUBLIC_KEY!
|
||||
const publicKey = process.env.JWT_RS256_PUBLIC_KEY
|
||||
if (!publicKey) {
|
||||
throw new Error('JWT_RS256_PUBLIC_KEY is not defined')
|
||||
}
|
||||
return verify(token, publicKey, {
|
||||
algorithms: ['RS256'],
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user