fix: remove memory key generation

This commit is contained in:
Eli Bosley
2025-01-30 13:44:58 -05:00
parent e88593620b
commit e58410bd57
5 changed files with 1 additions and 13 deletions

View File

@@ -323,7 +323,6 @@ export function ContainerPortSchema(): z.ZodObject<Properties<ContainerPort>> {
export function CreateApiKeyInputSchema(): z.ZodObject<Properties<CreateApiKeyInput>> {
return z.object({
description: z.string().nullish(),
memory: z.boolean().nullish(),
name: z.string(),
overwrite: z.boolean().nullish(),
permissions: z.array(z.lazy(() => AddPermissionInputSchema())).nullish(),

View File

@@ -347,8 +347,6 @@ export enum ContainerState {
export type CreateApiKeyInput = {
description?: InputMaybe<Scalars['String']['input']>;
/** Whether to create the key in memory only (true), or on disk (false) - memory only keys will not persist through reboots of the API */
memory?: InputMaybe<Scalars['Boolean']['input']>;
name: Scalars['String']['input'];
/** This will replace the existing key if one already exists with the same name, otherwise returns the existing key */
overwrite?: InputMaybe<Scalars['Boolean']['input']>;

View File

@@ -29,8 +29,6 @@ input CreateApiKeyInput {
permissions: [AddPermissionInput!]
""" This will replace the existing key if one already exists with the same name, otherwise returns the existing key """
overwrite: Boolean
""" Whether to create the key in memory only (true), or on disk (false) - memory only keys will not persist through reboots of the API """
memory: Boolean
}
input AddPermissionInput {

View File

@@ -103,14 +103,12 @@ export class ApiKeyService implements OnModuleInit {
roles,
permissions,
overwrite = false,
memory = false,
}: {
name: string;
description: string | undefined;
roles?: Role[];
permissions?: Permission[] | AddPermissionInput[];
overwrite?: boolean;
memory?: boolean;
}): Promise<ApiKeyWithSecret> {
const trimmedName = name?.trim();
const sanitizedName = this.sanitizeName(trimmedName);
@@ -144,11 +142,7 @@ export class ApiKeyService implements OnModuleInit {
// Update createdAt date
apiKey.createdAt = new Date().toISOString();
if (memory) {
this.memoryApiKeys.push(apiKey as ApiKeyWithSecret)
} else {
await this.saveApiKey(apiKey as ApiKeyWithSecret);
}
await this.saveApiKey(apiKey as ApiKeyWithSecret);
return apiKey as ApiKeyWithSecret;
}

View File

@@ -60,7 +60,6 @@ export class ApiKeyResolver {
description: input.description ?? undefined,
roles: input.roles ?? [],
permissions: input.permissions ?? [],
memory: input.memory ?? false,
overwrite: input.overwrite ?? false
});