UNPKG

oidc-provider

Version:

OAuth 2.0 Authorization Server implementation for Node.js with OpenID Connect

23 lines (18 loc) 587 B
import instance from '../helpers/weak_cache.js'; import noCache from '../shared/no_cache.js'; export default [ noCache, function challenge(ctx) { const { DPoPNonces, AttestChallenges } = instance(ctx.oidc.provider); ctx.body = {}; const nextNonce = DPoPNonces?.nextChallenge(); if (nextNonce) { ctx.set('dpop-nonce', nextNonce); } const nextChallenge = AttestChallenges?.nextChallenge(); if (nextChallenge) { ctx.set('oauth-client-attestation-challenge', nextChallenge); ctx.body.attestation_challenge = nextChallenge; } }, ];