From 7c36507cd7361efbe15545a8f3a2f6c169c0ea34 Mon Sep 17 00:00:00 2001 From: Sergey Chernyshev Date: Sun, 22 Feb 2026 20:17:43 -0500 Subject: [PATCH 1/2] Refactor credential listing to only expose necessary data for UI --- src/UserDO.ts | 9 ++++++++- src/index.ts | 2 +- src/schemas/credential.ts | 9 ++++++++- test/userdo.spec.ts | 31 +++++++++++++++++++++++++++++++ 4 files changed, 48 insertions(+), 3 deletions(-) diff --git a/src/UserDO.ts b/src/UserDO.ts index d08034a..56c1ae9 100644 --- a/src/UserDO.ts +++ b/src/UserDO.ts @@ -190,7 +190,14 @@ export class UserDO extends DurableObject { for (const row of credentialsMapping) { const stub = this.env.CREDENTIAL.get(this.env.CREDENTIAL.idFromName(row.provider as string)); const providerCreds = await stub.list(this.ctx.id.toString()); - credentials.push(...providerCreds.map((c: any) => ({ provider: row.provider, ...c }))); + credentials.push( + ...providerCreds.map((c: any) => ({ + provider: row.provider, + subject_id: c.subject_id, + email: c.profile_data?.email, + created_at: c.created_at, + })), + ); } return credentials; } diff --git a/src/index.ts b/src/index.ts index e339e57..8233803 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1055,7 +1055,7 @@ function renderCredentialsList(credentials: any[], currentProvider?: string): st ${c.provider.charAt(0).toUpperCase() + c.provider.slice(1)} ${isCurrent ? 'logged in' : ''} -
${c.profile_data?.email || c.subject_id}
+
${c.email || c.subject_id}