| @@ -12,19 +12,21 @@ import ( · 11 unmodified lines |
| 12 | // CredentialFileName returns the filename used to persist Codex OAuth credentials. | 12 | // CredentialFileName returns the filename used to persist Codex OAuth credentials. |
| 13 | // When planType is available (e.g. "plus", "team"), it is appended after the email | 13 | // When planType is available (e.g. "plus", "team"), it is appended after the email |
| 14 | // as a suffix to disambiguate subscriptions. | 14 | // as a suffix to disambiguate subscriptions. |
| 15 | func CredentialFileName(email, planType string, includeProviderPrefix bool) string { | 15 | func CredentialFileName(email, planType, hashAccountID string, includeProviderPrefix bool) string { |
| 16 | email = strings.TrimSpace(email) | 16 | email = strings.TrimSpace(email) |
| 17 | plan := normalizePlanTypeForFilename(planType) | 17 | plan := normalizePlanTypeForFilename(planType) |
| 18 | | 18 | |
| 19 | prefix := "" | 19 | prefix := "" |
| 20 | if includeProviderPrefix { | 20 | if includeProviderPrefix { |
| 21 | prefix = "codex-" | 21 | prefix = "codex" |
| 22 | } | 22 | } |
| 23 | | 23 | |
| 24 | if plan == "" { | 24 | if plan == "" { |
| 25 | return fmt.Sprintf("%s%s.json", prefix, email) | 25 | return fmt.Sprintf("%s-%s.json", prefix, email) |
| | 26 | } else if plan == "team" { |
| | 27 | return fmt.Sprintf("%s-%s-%s-%s.json", prefix, hashAccountID, email, plan) |
| 26 | } | 28 | } |
| 27 | return fmt.Sprintf("%s%s-%s.json", prefix, email, plan) | 29 | return fmt.Sprintf("%s-%s-%s.json", prefix, email, plan) |
| 28 | } | 30 | } |
| 29 | | 31 | |
| 30 | func normalizePlanTypeForFilename(planType string) string { | 32 | func normalizePlanTypeForFilename(planType string) string { |