25 lines
1.1 KiB
TypeScript
25 lines
1.1 KiB
TypeScript
import { Repository } from 'typeorm';
|
|
import { ApiKey } from './entities/api-key.entity';
|
|
import { Tenant } from './entities/tenant.entity';
|
|
import { RedisService } from '../common/redis.service';
|
|
export declare class AuthService {
|
|
private readonly apiKeyRepository;
|
|
private readonly tenantRepository;
|
|
private readonly redisService;
|
|
private readonly logger;
|
|
constructor(apiKeyRepository: Repository<ApiKey>, tenantRepository: Repository<Tenant>, redisService: RedisService);
|
|
validateApiKey(key: string, origin?: string, referer?: string): Promise<{
|
|
tenant: Tenant;
|
|
apiKey: ApiKey;
|
|
rateLimit: number;
|
|
}>;
|
|
private validateRestrictions;
|
|
private isDomainAllowed;
|
|
hashSecret(secret: string): string;
|
|
seedDefaultKey(name: string, email: string, keyString: string): Promise<void>;
|
|
getApiKeys(tenantId: string): Promise<ApiKey[]>;
|
|
createApiKey(tenantId: string, name: string, rateLimit?: number, allowedOrigins?: string[]): Promise<ApiKey>;
|
|
getDefaultTenant(): Promise<Tenant>;
|
|
findOrCreateByFirebaseUid(uid: string, email: string, name: string, photoUrl?: string): Promise<Tenant>;
|
|
}
|