@thinkingcat/auth-utils 1.0.45 → 1.0.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +7 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -164,10 +164,16 @@ function createNextAuthJWT(payload, serviceId) {
164
164
  const services = payload.services || [];
165
165
  const service = services.find((s) => s.serviceId === serviceId);
166
166
  const effectiveRole = service?.role || payload.role || 'ADMIN';
167
+ // name 필드 결정: payload.name이 있으면 사용, 없으면 decryptedEmail 또는 maskedEmail 사용
168
+ // email은 암호화되어 있을 수 있으므로 직접 사용하지 않음
169
+ const displayName = payload.name
170
+ || payload.decryptedEmail
171
+ || payload.maskedEmail
172
+ || 'User';
167
173
  const jwt = {
168
174
  id: (payload.id || payload.sub),
169
175
  email: payload.email,
170
- name: (payload.name || payload.email || 'User'), // name이 없으면 email 또는 기본값 사용
176
+ name: displayName,
171
177
  role: effectiveRole, // Role enum 타입 (string으로 캐스팅)
172
178
  services: payload.services,
173
179
  phoneVerified: payload.phoneVerified ?? false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkingcat/auth-utils",
3
- "version": "1.0.45",
3
+ "version": "1.0.46",
4
4
  "description": "Authentication utilities for ThinkingCat SSO services with conditional logging",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",