diff --git a/lib/challenge/wasm/wasm.go b/lib/challenge/wasm/wasm.go index 5c711be5..26c906e5 100644 --- a/lib/challenge/wasm/wasm.go +++ b/lib/challenge/wasm/wasm.go @@ -18,7 +18,7 @@ import ( //go:generate go tool github.com/a-h/templ/cmd/templ generate func init() { - chall.Register("hashx", &Impl{algorithm: "argon2id"}) + chall.Register("hashx", &Impl{algorithm: "hashx"}) chall.Register("sha256", &Impl{algorithm: "sha256"}) } @@ -37,7 +37,11 @@ func (i *Impl) Setup(mux *http.ServeMux) error { i.runner, err = wasm.NewRunner(context.Background(), fname, fin) - return err + if err != nil { + return err + } + + return nil } func (i *Impl) Issue(w http.ResponseWriter, r *http.Request, lg *slog.Logger, in *chall.IssueInput) (templ.Component, error) { diff --git a/lib/config.go b/lib/config.go index 3c220dc5..9d30b6de 100644 --- a/lib/config.go +++ b/lib/config.go @@ -175,7 +175,9 @@ func New(opts Options) (*Server, error) { for _, implKind := range challenge.Methods() { impl, _ := challenge.Get(implKind) - impl.Setup(mux) + if err := impl.Setup(mux); err != nil { + return nil, fmt.Errorf("failed to init challenge method %s: %w", implKind, err) + } } result.mux = mux