aboutsummaryrefslogtreecommitdiff
path: root/messages.go
diff options
context:
space:
mode:
Diffstat (limited to 'messages.go')
-rw-r--r--messages.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/messages.go b/messages.go
index 26caeac..0b3e4dc 100644
--- a/messages.go
+++ b/messages.go
@@ -47,6 +47,30 @@ type Authorization struct {
Combinations [][]int `json:"combinations,omitempty"`
}
+func (a Authorization) Supported(sol map[ChallengeType]Solver) []Challenge {
+ supported := func(c []int) bool {
+ for _, com := range c {
+ ch := a.Challenges[com]
+ if _, ok := sol[ch.Type]; !ok {
+ return false
+ }
+ }
+ return true
+ }
+ for _, com := range a.Combinations {
+ if supported(com) {
+ var c []Challenge
+ for _, n := range com {
+ ch := a.Challenges[n]
+ ch.Solver = sol[ch.Type]
+ c = append(c, ch)
+ }
+ return c
+ }
+ }
+ return nil
+}
+
// Identifier ...
type Identifier struct {
Type IdentType `json:"type"` // dns