()
| 10 | } |
| 11 | |
| 12 | private static createKey() { |
| 13 | const token = randomBytes(64).toString('hex'); |
| 14 | const hash = createHash('sha256') |
| 15 | .update(`${token}${process.env.NEXTAUTH_SECRET}`) |
| 16 | .digest('hex'); |
| 17 | return { token, hash }; |
| 18 | } |
| 19 | |
| 20 | static async getAccountByApiKey({ apiKey }: { apiKey: string }) { |
| 21 | const hash = this.decryptKey({ token: apiKey }); |