UNPKG

@sourceloop/ctrl-plane-tenant-management-service

Version:

Tenant Management microservice for SaaS control plane

43 lines (42 loc) 2.13 kB
import { ILogger } from '@sourceloop/core'; import { Lead } from '../models'; import { NotificationService } from './notifications'; import { CryptoHelperService } from './crypto-helper.service'; import { LeadTokenRepository } from '../repositories'; /** * Helper service for authenticating leads. */ export declare class LeadAuthenticator { private notificationService; private cryptoHelperService; private leadTokenRepository; private logger; /** * Constructs a new instance of the LeadAuthenticatorService. * @param {NotificationService} notificationService - Service for sending notifications. * @param {CryptoHelperService} cryptoHelperService - Service for cryptographic operations. * @param {ILogger} logger - Logger service for logging messages. */ constructor(notificationService: NotificationService, cryptoHelperService: CryptoHelperService, leadTokenRepository: LeadTokenRepository, logger: ILogger); /** * The function `triggerValidationMail` sends a validation email to a lead with a * generated temporary token to validate his email id. * @param {Lead} lead - The `lead` parameter is an object that represents a lead. * It likely contains information about a potential customer or user, such as their * name, email address, and other relevant details. */ triggerValidationMail(lead: Lead): Promise<string>; /** * The function `_generateTempToken` generates a temporary token for a lead with * specified permissions. * @param {Lead} lead - The `lead` parameter is an object that represents a lead. * It contains properties such as `id`, `userTenantId`, and `email`. These * properties are used to generate a temporary token. * @param {string[]} permissions - The `permissions` parameter is an optional array * of strings that represents the permissions associated with the lead. These * permissions determine what actions the lead is allowed to perform within the * system using the generated token * @returns a signed token. */ private _generateTempToken; }