()
| 50 | |
| 51 | /** Opaque refresh token; only its hash is persisted. */ |
| 52 | export function generateRefreshToken(): { token: string; tokenHash: string } { |
| 53 | const token = randomBytes(32).toString("base64url"); |
| 54 | return { token, tokenHash: hashRefreshToken(token) }; |
| 55 | } |
| 56 | |
| 57 | export function hashRefreshToken(token: string): string { |
| 58 | return createHash("sha256").update(token).digest("hex"); |
no test coverage detected