Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

533 B
Raw Blame
import { createHash } from 'crypto'

function verifyS256Challenge(codeVerifier: string, codeChallenge: string): boolean {
    const hash = createHash('sha256').update(codeVerifier).digest()
    const computed = hash.toString('base64url')
    return computed === codeChallenge
}

export const mcpOAuthPkce = {
    verify(codeVerifier: string, codeChallenge: string, method: string): boolean {
        if (method !== 'S256') {
            return false
        }
        return verifyS256Challenge(codeVerifier, codeChallenge)
    },
}