2016-01-04 18:26:32 +00:00
|
|
|
package acme
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
2017-04-18 01:02:51 +00:00
|
|
|
"gopkg.in/square/go-jose.v1"
|
2016-01-04 18:26:32 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type directory struct {
|
|
|
|
NewAuthzURL string `json:"new-authz"`
|
|
|
|
NewCertURL string `json:"new-cert"`
|
|
|
|
NewRegURL string `json:"new-reg"`
|
|
|
|
RevokeCertURL string `json:"revoke-cert"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type registrationMessage struct {
|
|
|
|
Resource string `json:"resource"`
|
|
|
|
Contact []string `json:"contact"`
|
2017-04-18 01:02:51 +00:00
|
|
|
Delete bool `json:"delete,omitempty"`
|
2016-01-04 18:26:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Registration is returned by the ACME server after the registration
|
|
|
|
// The client implementation should save this registration somewhere.
|
|
|
|
type Registration struct {
|
2017-04-18 01:02:51 +00:00
|
|
|
Resource string `json:"resource,omitempty"`
|
|
|
|
ID int `json:"id"`
|
|
|
|
Key jose.JsonWebKey `json:"key"`
|
|
|
|
Contact []string `json:"contact"`
|
|
|
|
Agreement string `json:"agreement,omitempty"`
|
|
|
|
Authorizations string `json:"authorizations,omitempty"`
|
|
|
|
Certificates string `json:"certificates,omitempty"`
|
2016-01-04 18:26:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// RegistrationResource represents all important informations about a registration
|
|
|
|
// of which the client needs to keep track itself.
|
|
|
|
type RegistrationResource struct {
|
|
|
|
Body Registration `json:"body,omitempty"`
|
|
|
|
URI string `json:"uri,omitempty"`
|
|
|
|
NewAuthzURL string `json:"new_authzr_uri,omitempty"`
|
|
|
|
TosURL string `json:"terms_of_service,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type authorizationResource struct {
|
|
|
|
Body authorization
|
|
|
|
Domain string
|
|
|
|
NewCertURL string
|
|
|
|
AuthURL string
|
|
|
|
}
|
|
|
|
|
|
|
|
type authorization struct {
|
|
|
|
Resource string `json:"resource,omitempty"`
|
|
|
|
Identifier identifier `json:"identifier"`
|
|
|
|
Status string `json:"status,omitempty"`
|
|
|
|
Expires time.Time `json:"expires,omitempty"`
|
|
|
|
Challenges []challenge `json:"challenges,omitempty"`
|
|
|
|
Combinations [][]int `json:"combinations,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type identifier struct {
|
|
|
|
Type string `json:"type"`
|
|
|
|
Value string `json:"value"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type validationRecord struct {
|
|
|
|
URI string `json:"url,omitempty"`
|
|
|
|
Hostname string `json:"hostname,omitempty"`
|
|
|
|
Port string `json:"port,omitempty"`
|
|
|
|
ResolvedAddresses []string `json:"addressesResolved,omitempty"`
|
|
|
|
UsedAddress string `json:"addressUsed,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type challenge struct {
|
|
|
|
Resource string `json:"resource,omitempty"`
|
2017-04-18 01:02:51 +00:00
|
|
|
Type Challenge `json:"type,omitempty"`
|
2016-01-04 18:26:32 +00:00
|
|
|
Status string `json:"status,omitempty"`
|
|
|
|
URI string `json:"uri,omitempty"`
|
|
|
|
Token string `json:"token,omitempty"`
|
|
|
|
KeyAuthorization string `json:"keyAuthorization,omitempty"`
|
|
|
|
TLS bool `json:"tls,omitempty"`
|
|
|
|
Iterations int `json:"n,omitempty"`
|
|
|
|
Error RemoteError `json:"error,omitempty"`
|
|
|
|
ValidationRecords []validationRecord `json:"validationRecord,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type csrMessage struct {
|
|
|
|
Resource string `json:"resource,omitempty"`
|
|
|
|
Csr string `json:"csr"`
|
|
|
|
Authorizations []string `json:"authorizations"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type revokeCertMessage struct {
|
|
|
|
Resource string `json:"resource"`
|
|
|
|
Certificate string `json:"certificate"`
|
|
|
|
}
|
|
|
|
|
2018-05-04 21:39:27 +00:00
|
|
|
type deactivateAuthMessage struct {
|
|
|
|
Resource string `json:"resource,omitempty"`
|
|
|
|
Status string `jsom:"status"`
|
|
|
|
}
|
|
|
|
|
2016-01-04 18:26:32 +00:00
|
|
|
// CertificateResource represents a CA issued certificate.
|
2017-04-18 01:02:51 +00:00
|
|
|
// PrivateKey, Certificate and IssuerCertificate are all
|
|
|
|
// already PEM encoded and can be directly written to disk.
|
|
|
|
// Certificate may be a certificate bundle, depending on the
|
|
|
|
// options supplied to create it.
|
2016-01-04 18:26:32 +00:00
|
|
|
type CertificateResource struct {
|
2017-04-18 01:02:51 +00:00
|
|
|
Domain string `json:"domain"`
|
|
|
|
CertURL string `json:"certUrl"`
|
|
|
|
CertStableURL string `json:"certStableUrl"`
|
|
|
|
AccountRef string `json:"accountRef,omitempty"`
|
|
|
|
PrivateKey []byte `json:"-"`
|
|
|
|
Certificate []byte `json:"-"`
|
|
|
|
IssuerCertificate []byte `json:"-"`
|
|
|
|
CSR []byte `json:"-"`
|
2016-01-04 18:26:32 +00:00
|
|
|
}
|