Add getters factory for attachements (#4567)
* Add getter factory for attachements * Override guard in test * Add secret in env variables * Return custom message on expiration * Rename to signPayload --------- Co-authored-by: Thomas Trompette <thomast@twenty.com>
This commit is contained in:
@ -40,7 +40,6 @@ import { EmailService } from 'src/engine/integrations/email/email.service';
|
||||
import { InvalidatePassword } from 'src/engine/modules/auth/dto/invalidate-password.entity';
|
||||
import { EmailPasswordResetLink } from 'src/engine/modules/auth/dto/email-password-reset-link.entity';
|
||||
import { JwtData } from 'src/engine/modules/auth/types/jwt-data.type';
|
||||
import { UserWorkspaceService } from 'src/engine/modules/user-workspace/user-workspace.service';
|
||||
import { Workspace } from 'src/engine/modules/workspace/workspace.entity';
|
||||
|
||||
@Injectable()
|
||||
@ -56,7 +55,6 @@ export class TokenService {
|
||||
@InjectRepository(Workspace, 'core')
|
||||
private readonly workspaceRepository: Repository<Workspace>,
|
||||
private readonly emailService: EmailService,
|
||||
private readonly userWorkspaceService: UserWorkspaceService,
|
||||
) {}
|
||||
|
||||
async generateAccessToken(
|
||||
@ -528,4 +526,12 @@ export class TokenService {
|
||||
|
||||
return { success: true };
|
||||
}
|
||||
|
||||
async encodePayload(payload: any, options?: any): Promise<string> {
|
||||
return this.jwtService.sign(payload, options);
|
||||
}
|
||||
|
||||
async decodePayload(payload: any, options?: any): Promise<string> {
|
||||
return this.jwtService.decode(payload, options);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user