| 23 | const cache = new LRUCache(options); |
| 24 | |
| 25 | async function getUserEmails(token: string) { |
| 26 | const res = await axios.get("https://api.github.com/user/emails", { |
| 27 | headers: { |
| 28 | Authorization: `token ${token}`, |
| 29 | }, |
| 30 | }); |
| 31 | |
| 32 | // Return only the primary email address |
| 33 | const primaryEmail = res.data.find( |
| 34 | (email: { primary: boolean }) => email.primary |
| 35 | ); |
| 36 | return primaryEmail ? primaryEmail.email : null; // Return the email or null if not found |
| 37 | } |
| 38 | |
| 39 | function generateRandomPassword(length: number): string { |
| 40 | const charset = |