aboutsummaryrefslogtreecommitdiff
path: root/messages.go
diff options
context:
space:
mode:
Diffstat (limited to 'messages.go')
-rw-r--r--messages.go143
1 files changed, 0 insertions, 143 deletions
diff --git a/messages.go b/messages.go
deleted file mode 100644
index c462c1d..0000000
--- a/messages.go
+++ /dev/null
@@ -1,143 +0,0 @@
-package acme
-
-import (
- "net"
- "time"
-
- "github.com/square/go-jose"
-)
-
-const (
- // LE1 Let's Encrypt V1
- LE1 = `https://acme-v01.api.letsencrypt.org/directory`
- // LES Let's Encrypt Staging
- LES = `https://acme-staging.api.letsencrypt.org/directory`
-)
-
-// Directory ...
-type Directory struct {
- NewReg string `json:"new-reg"`
- RecoverReg string `json:"recover-reg"`
- NewAuthz string `json:"new-authz"`
- NewCert string `json:"new-cert"`
- RevokeCert string `json:"revoke-cert"`
-}
-
-// Registration Objects
-type Registration struct {
- Resource Resource `json:"resource"` // new-reg
- Contact Contacts `json:"contact,omitempty"`
- Agreement string `json:"agreement,omitempty"`
- Authorizations string `json:"authorizations,omitempty"`
- Certificates string `json:"certificates,omitempty"`
- ID int `json:"id,omitempty"`
- Key *jose.JsonWebKey `json:"key,omitempty"`
- InitialIP *net.IP `json:"initialIp,omitempty"` // not in draft
- CreatedAt *time.Time `json:"createdAt,omitempty"`
-}
-
-// Authorization request
-type Authorization struct {
- Resource Resource `json:"resource"` // new-authz
- Identifier Identifier `json:"identifier"`
- Status Status `json:"status,omitempty"` // e.g. valid
- Expires *time.Time `json:"expires,omitempty"`
- Challenges []Challenge `json:"challenges,omitempty"`
- Combinations [][]int `json:"combinations,omitempty"`
-}
-
-func (a Authorization) Supported(sol map[ChalType]Solver) []Challenge {
- supported := func(com []int) bool {
- for _, n := range com {
- if _, ok := sol[a.Challenges[n].Type]; !ok {
- return false
- }
- }
- return true
- }
- for _, com := range a.Combinations {
- if supported(com) {
- c := make([]Challenge, len(com))
- for i, n := range com {
- c[i] = a.Challenges[n]
- }
- return c
- }
- }
- return nil
-}
-
-// Identifier ...
-type Identifier struct {
- Type IdentType `json:"type"` // dns
- Value string `json:"value"` // example.com
-}
-
-// Challege ...
-type Challenge struct {
- Resource Resource `json:"resource"` // challenge
- Type ChalType `json:"type"`
- Token string `json:"token,omitempty"`
- Status Status `json:"status,omitempty"` // e.g. valid
- URI string `json:"uri,omitempty"`
- Validated *time.Time `json:"validated,omitempty"`
- KeyAuthorization string `json:"keyAuthorization,omitempty"`
- Err *Problem `json:"error,omitempty"`
-}
-
-// Problem description
-type Problem struct {
- Type string `json:"type"`
- Detail string `json:"detail"`
- Instance string `json:"instance"`
- Err error `json:"-"`
-}
-
-func (p Problem) Error() string {
- return p.Detail
-}
-
-// Status of request
-type Status string
-
-// Statuses
-const (
- StatusUnknown Status = "unknown"
- StatusPending Status = "pending"
- StatusProcessing Status = "processing"
- StatusValid Status = "valid"
- StatusInvalid Status = "invalid"
- StatusRevoked Status = "revoked"
-)
-
-type Resource string
-
-const (
- ResNewReg Resource = "new-reg"
- ResRecoverReg Resource = "recover-reg"
- ResNewAuthz Resource = "new-authz"
- ResNewCert Resource = "new-cert"
- ResRevokeCert Resource = "revoke-cert"
- ResReg Resource = "reg"
- ResAuthz Resource = "authz"
- ResChallenge Resource = "challenge"
- ResCert Resource = "cert"
-)
-
-type IdentType string
-
-const IdentDNS IdentType = "dns"
-
-type ChalType string
-
-const (
- ChallengeHTTP ChalType = "http-01"
- ChallengeTLS ChalType = "tls-sni-01"
- ChallengePOP ChalType = "proofOfPossession-01"
- ChallengeDNS ChalType = "dns-01"
-)
-
-type CSR struct {
- Resource Resource `json:"resource"` // new-cert
- CSR string `json:"csr"`
-}