Encrypt Hardcover Api Token and fix failing tests

This commit is contained in:
Rob Walsh
2026-03-03 11:51:38 -07:00
parent 225ef8c919
commit 4ae68d01de
6 changed files with 71 additions and 40 deletions
+5 -1
View File
@@ -8,6 +8,7 @@ import { requireAuth, AuthenticatedRequest } from '@/lib/middleware/auth';
import { prisma } from '@/lib/db';
import { fetchHardcoverList } from '@/lib/services/hardcover-sync.service';
import { getJobQueueService } from '@/lib/services/job-queue.service';
import { getEncryptionService } from '@/lib/services/encryption.service';
import { z } from 'zod';
import { RMABLogger } from '@/lib/utils/logger';
@@ -150,12 +151,15 @@ export async function POST(request: NextRequest) {
);
}
const encryptionService = getEncryptionService();
const encryptedToken = encryptionService.encrypt(apiToken);
const shelf = await prisma.hardcoverShelf.create({
data: {
userId: req.user.id,
name: listName,
listId,
apiToken,
apiToken: encryptedToken,
bookCount,
coverUrls:
initialBooks.length > 0 ? JSON.stringify(initialBooks) : null,