certificates icon indicating copy to clipboard operation
certificates copied to clipboard

Wire ACME extensions

Open hslatman opened this issue 1 year ago • 2 comments

hslatman avatar Jan 08 '24 21:01 hslatman

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jan 08 '24 21:01 CLAassistant

@maraino about the DB interface: I tried it before, but without changing a lot more, you'll end up with WireDB being used as the type in every struct, function and method that has to operate on the current DB interface, which I considered worse than just having these methods defined in the interface, and would basically result in what exists today.

This would've been a nice solution that I think can work, but isn't allowed in Go (today, at least; ref):

type DB interface {
    // DB methods
}
type WireDB interface {
    DB 
    // Wire methods
}
type NewDB interface {
    DB | WireDB
}

Alternatives would be:

  • Have the top level DB interface provide all methods, as it does now, and check at runtime that all(/only) the required methods are available, which could be based on some conditional logic taking into account the enabled challenge types. But that way it would still take the implementer to at least define the method in their implementation, so it's not a great solution.
  • Make the methods in the DB interface depend on a build tag.
  • Others ...?

It's not the cleanest solution, but implementers could always return some "not implemented" error. It's not as strong of a guarantee as having an interface, but it works.

So, time for the build tag?

hslatman avatar Mar 06 '24 15:03 hslatman