Skip to content

Conversation

sorah
Copy link
Contributor

@sorah sorah commented May 17, 2018

Acme::Client::Resources::Challenges.new may return a Hash instead of Challenges::* when it encountered unsupported challenge type.

When an user is iterating authz#challenges, they have to check a class of an element in prior to use.

Checking challenge#challenge_type is sometime useful than checking challenge#class when an user has a support of additional challenge_type which are uncovered in this gem.

(And I failed here... https://github.com/sorah/acmesmith/blob/5845dbadd7e9a1ad2ebd4731304d8f59b111ae68/lib/acmesmith/client.rb#L205 )

Acme::Client::Resources::Challenges.new may return a Hash instead of
Challenges::* when it encountered unsupported challenge type.

When an user is iterating authz#challenges, they have to check a class
of an element in prior to use.

Checking challenge#challenge_type is sometime useful than checking
challenge#class when an user has a support of additional challenge_type
which are uncovered in this gem.
def [](key)
to_h[key]
end

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why not simply calling #to_h within your app for that use case?

Also, would you prefer to keep them as a challenge object? I could implement an UnknownChallenge and this way you could call status, request_validation, etc, directly on it?

@sorah sorah closed this Aug 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants