import { Options } from '@loopback/repository'; import { AccessTokenService } from './access-token.service'; import { BaseUserService } from './base-user.service'; import { RefreshTokenWithRelations } from '../models'; import { BaseUserProfile } from '../models/base-user-profile.model'; import { BaseUserRepository, RefreshTokenRepository } from '../repositories'; import { TokenObject } from '../types'; /** * Handles refreshing of auth tokens. */ export declare class RefreshTokenService { private readonly refreshTokenSecret; private readonly refreshTokenExpiresInMs; private readonly refreshIssuer; private readonly baseUserRepository; private readonly refreshTokenRepository; private readonly userService; private readonly accessTokenService; private readonly accessTokenExpiresInMs; constructor(refreshTokenSecret: string, refreshTokenExpiresInMs: number, refreshIssuer: string, baseUserRepository: BaseUserRepository, refreshTokenRepository: RefreshTokenRepository, userService: BaseUserService, accessTokenService: AccessTokenService, accessTokenExpiresInMs: number); /** * Generate a refresh token, bind it with the given user profile, then store them in backend. * @param userProfile - The user profile for which the token should be generated. * @param token - The access token of the user. * @returns An object containing the access and the refresh token. */ generateToken(userProfile: BaseUserProfile, token: string): Promise; /** * Refresh the access token bound with the given refresh token. * @param refreshTokenValue - The refresh token value used to refresh the token. * @param options - Additional options eg. Transaction. * @returns An object containing the new access and the new refresh token. */ refreshToken(refreshTokenValue: string, options?: Options): Promise; private refreshTokenIsExpired; /** * Revokes the family of the given token. * That means that every refresh token that comes from the same original login gets deleted. * @param refreshTokenValue - The value of the token that should be revoked. */ revokeTokenFamily(refreshTokenValue: string): Promise; /** * Verify the validity of a refresh token, and make sure it exists in backend. * @param refreshToken - The refresh token that should be verified. * @param options - Additional options eg. Transaction. * @returns The found refresh token with its relations or an error. */ verifyToken(refreshToken: string, options?: Options): Promise; }