feat: add encryptedKey column to Credential table for calendar integrations (#27154)
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
This commit is contained in:
1 parent
80e4b1af1f
commit
fc9c26e8dd
36 files changed
+308
-34
No files matched your search
@@ -17,6 +17,7 @@ import {
|
||||
import { LicenseKeySingleton } from "@calcom/ee/common/server/LicenseKeyService";
|
||||
import { getBillingProviderService } from "@calcom/features/ee/billing/di/containers/Billing";
|
||||
import { CredentialRepository } from "@calcom/features/credentials/repositories/CredentialRepository";
|
||||
import { buildCredentialCreateData } from "@calcom/features/credentials/services/CredentialDataService";
|
||||
import type { TrackingData } from "@calcom/lib/tracking";
|
||||
import { DeploymentRepository } from "@calcom/features/ee/deployment/repositories/DeploymentRepository";
|
||||
import createUsersAndConnectToOrg from "@calcom/features/ee/dsync/lib/users/createUsersAndConnectToOrg";
|
||||
@@ -730,12 +731,13 @@ export const getOptions = ({
|
||||
token_type: account.token_type,
|
||||
expires_at: account.expires_at,
|
||||
};
|
||||
const gcalCredential = await CredentialRepository.create({
|
||||
const gcalCredentialData = buildCredentialCreateData({
|
||||
userId: Number(user.id),
|
||||
key: credentialkey,
|
||||
appId: "google-calendar",
|
||||
type: "google_calendar",
|
||||
});
|
||||
const gcalCredential = await CredentialRepository.create(gcalCredentialData);
|
||||
const gCalService = createGoogleCalendarServiceWithGoogleType({
|
||||
...gcalCredential,
|
||||
user: null,
|
||||
@@ -748,12 +750,13 @@ export const getOptions = ({
|
||||
type: "google_video",
|
||||
}))
|
||||
) {
|
||||
await CredentialRepository.create({
|
||||
const googleMeetCredentialData = buildCredentialCreateData({
|
||||
type: "google_video",
|
||||
key: {},
|
||||
userId: Number(user.id),
|
||||
appId: "google-meet",
|
||||
});
|
||||
await CredentialRepository.create(googleMeetCredentialData);
|
||||
}
|
||||
|
||||
const oAuth2Client = new OAuth2Client(GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET);
|
||||
|
||||
Reference in new issue
Block a user