feat: add non-interactive SSO login flow for embedded/iframe deployments (closes #69)

This commit is contained in:
Linus Rath
2026-03-21 20:45:19 +01:00
parent 7c3c3b5f7b
commit 83a0a1e235
18 changed files with 674 additions and 123 deletions
+18
View File
@@ -0,0 +1,18 @@
import { randomBytes, createHash } from 'node:crypto';
function base64urlEncode(buffer: Buffer): string {
return buffer.toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
}
export function generateCodeVerifierServer(): string {
return base64urlEncode(randomBytes(32));
}
export function generateCodeChallengeServer(verifier: string): string {
const hash = createHash('sha256').update(verifier).digest();
return base64urlEncode(hash);
}
export function generateStateServer(): string {
return base64urlEncode(randomBytes(32));
}