aboutsummaryrefslogtreecommitdiff
path: root/store.go
blob: 27ab95513e99c3f157262273c86d1df118cf42fd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package gemini

import (
	"crypto/x509"
)

// CertificateStore maps hostnames to certificates.
type CertificateStore struct {
	store map[string]*x509.Certificate // map of hostnames to certificates
}

func NewCertificateStore() *CertificateStore {
	return &CertificateStore{
		store: map[string]*x509.Certificate{},
	}
}

func (c *CertificateStore) Put(hostname string, cert *x509.Certificate) {
	c.store[hostname] = cert
}

func (c *CertificateStore) Get(hostname string) *x509.Certificate {
	return c.store[hostname]
}