Add initial version of time duration support in sign requests.

This commit is contained in:
Mariano Cano 2019-03-22 18:55:28 -07:00
parent 7b1f4a43cf
commit 00fed1c538
3 changed files with 124 additions and 6 deletions

View file

@ -36,6 +36,15 @@ type Authority interface {
GetFederation() ([]*x509.Certificate, error)
}
// TimeDuration is an alias of provisioner.TimeDuration
type TimeDuration = provisioner.TimeDuration
// ParseTimeDuration returns a new TimeDuration parsing the RFC 3339 time or
// time.Duration string.
func ParseTimeDuration(s string) (TimeDuration, error) {
return provisioner.ParseTimeDuration(s)
}
// Certificate wraps a *x509.Certificate and adds the json.Marshaler interface.
type Certificate struct {
*x509.Certificate
@ -154,8 +163,8 @@ type RootResponse struct {
type SignRequest struct {
CsrPEM CertificateRequest `json:"csr"`
OTT string `json:"ott"`
NotAfter time.Time `json:"notAfter"`
NotBefore time.Time `json:"notBefore"`
NotAfter TimeDuration `json:"notAfter"`
NotBefore TimeDuration `json:"notBefore"`
}
// ProvisionersResponse is the response object that returns the list of