public AuthorizeChallenge DecodeChallenge(AuthorizationState authzState, string challengeType)
{
AssertInit();
AssertRegistration();
var authzChallenge = authzState.Challenges.FirstOrDefault(x => x.Type == challengeType);
if (authzChallenge == null)
throw new ArgumentOutOfRangeException(nameof(challengeType),
"no challenge found matching requested type")
.With("challengeType", challengeType);
var provider = ChallengeDecoderExtManager.GetProvider(challengeType);
if (provider == null)
throw new NotSupportedException("no provider exists for requested challenge type")
.With("challengeType", challengeType);
using (var decoder = provider.GetDecoder(authzState.IdentifierPart, authzChallenge.ChallengePart))
{
authzChallenge.Challenge = decoder.Decode(authzState.IdentifierPart, authzChallenge.ChallengePart, Signer);
if (authzChallenge.Challenge == null)
throw new InvalidDataException("challenge decoder produced no output");
}
return authzChallenge;
}