import type { DecodedToken } from './types/jwt'; import { Injectable } from '@nestjs/common'; import { JwtService } from '@nestjs/jwt'; import { omit } from 'radash'; @Injectable() export class AppService { constructor(private readonly jwtService: JwtService) {} public checkToken(token: string) { return this.jwtService.verify(token); } public refreshToken(token: string) { const payload = this.jwtService.decode(token); return this.jwtService.sign(omit(payload, ['iat', 'exp'])); } }