Expose GetCertificate function
This commit is contained in:
parent
fa0bc9998e
commit
1ed6855bde
@ -14,6 +14,7 @@ import (
|
||||
type FakeACME struct {
|
||||
FakeCreateOrder func(ctx context.Context, order *acme.Order) (*acme.Order, error)
|
||||
FakeGetOrder func(ctx context.Context, url string) (*acme.Order, error)
|
||||
FakeGetCertificate func(ctx context.Context, url string) ([][]byte, error)
|
||||
FakeWaitOrder func(ctx context.Context, url string) (*acme.Order, error)
|
||||
FakeFinalizeOrder func(ctx context.Context, finalizeURL string, csr []byte) (der [][]byte, err error)
|
||||
FakeAcceptChallenge func(ctx context.Context, chal *acme.Challenge) (*acme.Challenge, error)
|
||||
@ -40,6 +41,13 @@ func (f *FakeACME) GetOrder(ctx context.Context, url string) (*acme.Order, error
|
||||
return nil, fmt.Errorf("GetOrder not implemented")
|
||||
}
|
||||
|
||||
func (f *FakeACME) GetCertificate(ctx context.Context, url string) ([][]byte, error) {
|
||||
if f.FakeGetCertificate != nil {
|
||||
return f.FakeGetCertificate(ctx, url)
|
||||
}
|
||||
return nil, fmt.Errorf("GetCertificate not implemented")
|
||||
}
|
||||
|
||||
func (f *FakeACME) WaitOrder(ctx context.Context, url string) (*acme.Order, error) {
|
||||
if f.FakeWaitOrder != nil {
|
||||
return f.FakeWaitOrder(ctx, url)
|
||||
|
||||
@ -9,6 +9,7 @@ import (
|
||||
type Interface interface {
|
||||
CreateOrder(ctx context.Context, order *acme.Order) (*acme.Order, error)
|
||||
GetOrder(ctx context.Context, url string) (*acme.Order, error)
|
||||
GetCertificate(ctx context.Context, url string) ([][]byte, error)
|
||||
WaitOrder(ctx context.Context, url string) (*acme.Order, error)
|
||||
FinalizeOrder(ctx context.Context, finalizeURL string, csr []byte) (der [][]byte, err error)
|
||||
AcceptChallenge(ctx context.Context, chal *acme.Challenge) (*acme.Challenge, error)
|
||||
|
||||
@ -28,6 +28,11 @@ func (l *Logger) GetOrder(ctx context.Context, url string) (*acme.Order, error)
|
||||
return l.baseCl.GetOrder(ctx, url)
|
||||
}
|
||||
|
||||
func (l *Logger) GetCertificate(ctx context.Context, url string) ([][]byte, error) {
|
||||
glog.Infof("Calling GetCertificate")
|
||||
return l.baseCl.GetCertificate(ctx, url)
|
||||
}
|
||||
|
||||
func (l *Logger) WaitOrder(ctx context.Context, url string) (*acme.Order, error) {
|
||||
glog.Infof("Calling WaitOrder")
|
||||
return l.baseCl.WaitOrder(ctx, url)
|
||||
|
||||
4
third_party/crypto/acme/acme.go
vendored
4
third_party/crypto/acme/acme.go
vendored
@ -247,7 +247,7 @@ func (c *Client) FinalizeOrder(ctx context.Context, finalizeURL string, csr []by
|
||||
return nil, fmt.Errorf("acme: unexpected order status %q", o.Status)
|
||||
}
|
||||
|
||||
return c.getCert(ctx, o.CertificateURL)
|
||||
return c.GetCertificate(ctx, o.CertificateURL)
|
||||
}
|
||||
|
||||
// GetOrder retrieves an order identified by url.
|
||||
@ -818,7 +818,7 @@ func nonceFromHeader(h http.Header) string {
|
||||
return h.Get("Replay-Nonce")
|
||||
}
|
||||
|
||||
func (c *Client) getCert(ctx context.Context, url string) ([][]byte, error) {
|
||||
func (c *Client) GetCertificate(ctx context.Context, url string) ([][]byte, error) {
|
||||
res, err := c.get(ctx, url)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Loading…
Reference in New Issue
Block a user