2015-06-08 02:36:07 +02:00
|
|
|
package acme
|
|
|
|
|
2015-10-23 16:24:02 +02:00
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
2015-11-12 03:06:22 +02:00
|
|
|
"github.com/square/go-jose"
|
2015-10-23 16:24:02 +02:00
|
|
|
)
|
2015-06-08 23:54:15 +02:00
|
|
|
|
2015-09-26 22:59:16 +02:00
|
|
|
type directory struct {
|
|
|
|
NewAuthzURL string `json:"new-authz"`
|
|
|
|
NewCertURL string `json:"new-cert"`
|
|
|
|
NewRegURL string `json:"new-reg"`
|
|
|
|
RevokeCertURL string `json:"revoke-cert"`
|
|
|
|
}
|
|
|
|
|
2015-10-23 16:24:02 +02:00
|
|
|
type recoveryKeyMessage struct {
|
|
|
|
Length int `json:"length,omitempty"`
|
|
|
|
Client jose.JsonWebKey `json:"client,omitempty"`
|
|
|
|
Server jose.JsonWebKey `json:"client,omitempty"`
|
|
|
|
}
|
|
|
|
|
2015-06-08 02:36:07 +02:00
|
|
|
type registrationMessage struct {
|
2015-09-26 19:45:52 +02:00
|
|
|
Resource string `json:"resource"`
|
|
|
|
Contact []string `json:"contact"`
|
2015-10-23 16:24:02 +02:00
|
|
|
// RecoveryKey recoveryKeyMessage `json:"recoveryKey,omitempty"`
|
2015-06-08 02:36:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Registration is returned by the ACME server after the registration
|
|
|
|
// The client implementation should save this registration somewhere.
|
|
|
|
type Registration struct {
|
2015-09-26 19:45:52 +02:00
|
|
|
Resource string `json:"resource,omitempty"`
|
|
|
|
ID int `json:"id"`
|
|
|
|
Key struct {
|
2015-06-08 02:36:07 +02:00
|
|
|
Kty string `json:"kty"`
|
|
|
|
N string `json:"n"`
|
|
|
|
E string `json:"e"`
|
|
|
|
} `json:"key"`
|
2015-09-26 19:45:52 +02:00
|
|
|
Contact []string `json:"contact"`
|
|
|
|
Agreement string `json:"agreement,omitempty"`
|
|
|
|
Authorizations string `json:"authorizations,omitempty"`
|
|
|
|
Certificates string `json:"certificates,omitempty"`
|
2015-10-23 16:24:02 +02:00
|
|
|
// RecoveryKey recoveryKeyMessage `json:"recoveryKey,omitempty"`
|
2015-06-08 02:36:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// RegistrationResource represents all important informations about a registration
|
|
|
|
// of which the client needs to keep track itself.
|
|
|
|
type RegistrationResource struct {
|
2015-11-13 21:20:15 +02:00
|
|
|
Body Registration `json:"body,omitempty"`
|
|
|
|
URI string `json:"uri,omitempty"`
|
|
|
|
NewAuthzURL string `json:"new_authzr_uri,omitempty"`
|
|
|
|
TosURL string `json:"terms_of_service,omitempty"`
|
2015-06-08 02:36:07 +02:00
|
|
|
}
|
2015-06-08 23:54:15 +02:00
|
|
|
|
|
|
|
type authorizationResource struct {
|
|
|
|
Body authorization
|
|
|
|
Domain string
|
|
|
|
NewCertURL string
|
2015-06-13 03:56:34 +02:00
|
|
|
AuthURL string
|
2015-06-08 23:54:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
type authorization struct {
|
2015-09-26 19:45:52 +02:00
|
|
|
Resource string `json:"resource,omitempty"`
|
2015-06-08 23:54:15 +02:00
|
|
|
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"`
|
|
|
|
}
|
|
|
|
|
2015-12-10 20:58:11 +02:00
|
|
|
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"`
|
|
|
|
}
|
|
|
|
|
2015-06-08 23:54:15 +02:00
|
|
|
type challenge struct {
|
2015-12-10 20:58:11 +02:00
|
|
|
Resource string `json:"resource,omitempty"`
|
2016-01-15 06:06:25 +02:00
|
|
|
Type Challenge `json:"type,omitempty"`
|
2015-12-10 20:58:11 +02: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"`
|
2015-06-13 03:55:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
type csrMessage struct {
|
2015-09-26 19:45:52 +02:00
|
|
|
Resource string `json:"resource,omitempty"`
|
2015-06-13 04:10:32 +02:00
|
|
|
Csr string `json:"csr"`
|
|
|
|
Authorizations []string `json:"authorizations"`
|
2015-06-13 03:55:53 +02:00
|
|
|
}
|
|
|
|
|
2015-09-27 14:51:44 +02:00
|
|
|
type revokeCertMessage struct {
|
|
|
|
Resource string `json:"resource"`
|
|
|
|
Certificate string `json:"certificate"`
|
|
|
|
}
|
|
|
|
|
2015-06-13 03:55:53 +02:00
|
|
|
// CertificateResource represents a CA issued certificate.
|
|
|
|
// PrivateKey and Certificate are both already PEM encoded
|
2015-10-24 03:55:18 +02:00
|
|
|
// and can be directly written to disk. Certificate may
|
|
|
|
// be a certificate bundle, depending on the options supplied
|
|
|
|
// to create it.
|
2015-06-13 03:55:53 +02:00
|
|
|
type CertificateResource struct {
|
2015-10-19 00:40:59 +02:00
|
|
|
Domain string `json:"domain"`
|
|
|
|
CertURL string `json:"certUrl"`
|
|
|
|
CertStableURL string `json:"certStableUrl"`
|
|
|
|
PrivateKey []byte `json:"-"`
|
|
|
|
Certificate []byte `json:"-"`
|
2015-06-08 23:54:15 +02:00
|
|
|
}
|