proper secret encrpytion
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const SecretSchema = z.object({
|
||||
value: z.string(),
|
||||
encryptionType: z.enum(["electron-safe-storage", "plaintext"]).optional(),
|
||||
});
|
||||
export type Secret = z.infer<typeof SecretSchema>;
|
||||
|
||||
/**
|
||||
* Zod schema for chat summary objects returned by the get-chats IPC
|
||||
*/
|
||||
@@ -53,7 +59,7 @@ export type LargeLanguageModel = z.infer<typeof LargeLanguageModelSchema>;
|
||||
* Zod schema for provider settings
|
||||
*/
|
||||
export const ProviderSettingSchema = z.object({
|
||||
apiKey: z.string().nullable(),
|
||||
apiKey: SecretSchema.optional(),
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -65,15 +71,10 @@ export const RuntimeModeSchema = z.enum(["web-sandbox", "local-node", "unset"]);
|
||||
export type RuntimeMode = z.infer<typeof RuntimeModeSchema>;
|
||||
|
||||
export const GitHubSecretsSchema = z.object({
|
||||
accessToken: z.string().nullable(),
|
||||
accessToken: SecretSchema.nullable(),
|
||||
});
|
||||
export type GitHubSecrets = z.infer<typeof GitHubSecretsSchema>;
|
||||
|
||||
export const GitHubSettingsSchema = z.object({
|
||||
secrets: GitHubSecretsSchema.nullable(),
|
||||
});
|
||||
export type GitHubSettings = z.infer<typeof GitHubSettingsSchema>;
|
||||
|
||||
export const GithubUserSchema = z.object({
|
||||
email: z.string(),
|
||||
});
|
||||
@@ -86,8 +87,8 @@ export const UserSettingsSchema = z.object({
|
||||
selectedModel: LargeLanguageModelSchema,
|
||||
providerSettings: z.record(z.string(), ProviderSettingSchema),
|
||||
runtimeMode: RuntimeModeSchema,
|
||||
githubSettings: GitHubSettingsSchema,
|
||||
githubUser: GithubUserSchema.optional(),
|
||||
githubAccessToken: SecretSchema.optional(),
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user