import type { ApiKeyAudience, CreateApiKeyRequestDto, UpdateApiKeyRequestDto } from '@n8n/api-types'; import type { User } from '@n8n/db'; import { ApiKey, ApiKeyRepository } from '@n8n/db'; import type { ApiKeyScope, AuthPrincipal } from '@n8n/permissions'; import { type EntityManager } from '@n8n/typeorm'; import { JwtService } from './jwt.service'; export declare const API_KEY_AUDIENCE: ApiKeyAudience; export declare const API_KEY_ISSUER = "n8n"; export declare const PREFIX_LEGACY_API_KEY = "n8n_api_"; export declare class PublicApiKeyService { private readonly apiKeyRepository; private readonly jwtService; constructor(apiKeyRepository: ApiKeyRepository, jwtService: JwtService); createPublicApiKeyForUser(user: User, { label, expiresAt, scopes }: CreateApiKeyRequestDto): Promise; getRedactedApiKeys(caller: User, options?: { take?: number; skip?: number; ownership?: 'mine' | 'all'; label?: string; sortBy?: string; }): Promise<{ items: { apiKey: string; expiresAt: number | null; owner: { id: string; firstName: string; lastName: string; email: string; }; userId: string; label: string; scopes: ApiKeyScope[]; audience: import("n8n-workflow").ApiKeyAudience; lastUsedAt: Date | null; id: string; generateId(): void; createdAt: Date; updatedAt: Date; setUpdateDate(): void; }[]; counts: { mine: number; all: number; }; totals: { mine: number; all: number; }; }>; private countApiKeys; private applyApiKeyListSort; deleteApiKey(caller: User, apiKeyId: string): Promise; deleteAllApiKeysForUser(user: User, tx?: EntityManager): Promise; updateApiKeyForUser(user: User, apiKeyId: string, { label, scopes }: UpdateApiKeyRequestDto): Promise; private toRedactedApiKey; redactApiKey(apiKey: string): string; private generateApiKey; private getApiKeyExpiration; apiKeyHasValidScopesForRole(role: AuthPrincipal, apiKeyScopes: ApiKeyScope[]): boolean; apiKeyHasValidScopes(apiKey: string, endpointScope: ApiKeyScope): Promise; removeOwnerOnlyScopesFromApiKeys(user: User, tx?: EntityManager): Promise; }