Adds encrypted credential storage using a new keyring system: - New `encryptedKey` column with AES-256-GCM encryption - Decryption in getCalendarsEvents with fallback to legacy `key` - buildCredentialCreateData service for credential creation - Phase 1: Google Calendar only, other integrations follow
37 lines
679 B
TypeScript
37 lines
679 B
TypeScript
import type { Prisma } from "../client";
|
|
|
|
export const credentialForCalendarServiceSelect = {
|
|
id: true,
|
|
appId: true,
|
|
type: true,
|
|
userId: true,
|
|
user: {
|
|
select: {
|
|
email: true,
|
|
},
|
|
},
|
|
teamId: true,
|
|
key: true,
|
|
encryptedKey: true,
|
|
invalid: true,
|
|
delegationCredentialId: true,
|
|
} satisfies Prisma.CredentialSelect;
|
|
|
|
export const safeCredentialSelect = {
|
|
id: true,
|
|
type: true,
|
|
/** Omitting to avoid frontend leaks */
|
|
// key: true,
|
|
// encryptedKey: true,
|
|
userId: true,
|
|
user: {
|
|
select: {
|
|
email: true,
|
|
},
|
|
},
|
|
teamId: true,
|
|
appId: true,
|
|
invalid: true,
|
|
delegationCredentialId: true,
|
|
} satisfies Prisma.CredentialSelect;
|