github.com/stampzilla/stampzilla-go@v2.0.0-rc9+incompatible/nodes/stampzilla-server/store/certificates.go (about)

     1  package store
     2  
     3  import "time"
     4  
     5  type Certificate struct {
     6  	Serial     string         `json:"serial"`
     7  	Subject    RequestSubject `json:"subject"`
     8  	CommonName string         `json:"commonName"`
     9  	IsCA       bool           `json:"isCA"`
    10  	Usage      []string       `json:"usage"`
    11  	Revoked    bool           `json:"revoked"`
    12  	Issued     time.Time      `json:"issued"`
    13  	Expires    time.Time      `json:"expires"`
    14  
    15  	Fingerprints map[string]string `json:"fingerprints"`
    16  }
    17  
    18  func (store *Store) GetCertificates() []Certificate {
    19  	store.RLock()
    20  	defer store.RUnlock()
    21  	return store.Certificates
    22  }
    23  
    24  func (store *Store) UpdateCertificates(certs []Certificate) {
    25  	store.Lock()
    26  	store.Certificates = certs
    27  	store.Unlock()
    28  
    29  	store.runCallbacks("certificates")
    30  }