From 378ffb6e34fdc05e383e0b40466469237c3f5c65 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Sat, 28 Nov 2015 10:15:48 +0100 Subject: wip --- messages.go | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ resource.go | 28 ++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 messages.go create mode 100644 resource.go diff --git a/messages.go b/messages.go new file mode 100644 index 0000000..c469c5b --- /dev/null +++ b/messages.go @@ -0,0 +1,52 @@ +package acme + +import jose "github.com/square/go-jose" + +const ( + // LEV1 Let's Encrytpt V1 + LEV1 = `https://acme-v01.api.letsencrypt.org/directory` + // LEStaging Let's Encrypt Staging + LEStaging = `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 string `json:"resource"` + Key jose.JsonWebKey `json:"key"` + Contact []string `json:"contact,omitempty"` + Agreement string `json:"agreement,omitempty"` + Authorizations string `json:"authorizations,omitempty"` + Certificates string `json:"certificates,omitempty"` +} + +// Authorization Objects +type Authorization struct { + Identifier Identifier `json:"identifier"` + Status string `json:"status,omitemtpy"` // valid + Expires string `json:"expires,omitempty"` // 2015-03-01 + Challenges []Challenge `json:"challenges"` + Combinations [][]int `json:"combinations,omitemtpy"` +} + +// Identifier ... +type Identifier struct { + Type string `json:"type"` // dns + Value string `json:"value"` // example.com +} + +// Challege ... +type Challege struct { + Type string `json:"type"` // http-01 + Status string `json:"status"` // valid + Validated string `json:"validated"` // 2014-12-01T12:05Z + KeyAuthorization string `json:"keyAuthorization"` +} diff --git a/resource.go b/resource.go new file mode 100644 index 0000000..b38cbca --- /dev/null +++ b/resource.go @@ -0,0 +1,28 @@ +package acme + +type ResourceValue interface { + Value() string +} + +type NewReg struct { + Contact []string `json:"contact"` +} + +type RecoverReg struct{} +type NewAuthz struct{} +type NewCert struct{} +type RevokeCert struct{} +type Register struct{} +type Authz struct{} +type Challenge struct{} +type Cert struct{} + +func (NewReg) Value() string { return "new-reg" } +func (RecoverReg) Value() string { return "recover-reg" } +func (NewAuthz) Value() string { return "new-authz" } +func (NewCert) Value() string { return "new-cert" } +func (RevokeCert) Value() string { return "revoke-cert" } +func (Register) Value() string { return "reg" } +func (Authz) Value() string { return "authz" } +func (Challenge) Value() string { return "challenge" } +func (Cert) Value() string { return "cert" } -- cgit v1.2.3