()
| 35 | |
| 36 | /** OAuth `state` parameter — a CSRF token bound to this flow. */ |
| 37 | export function generateState(): string { |
| 38 | return base64UrlEncode(randomBytes(32)); |
| 39 | } |
| 40 | |
| 41 | function base64UrlEncode(buf: Buffer): string { |
| 42 | return buf.toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, ""); |
no test coverage detected