Skip to content

Commit 07e6dc4

Browse files
committed
clarified api documentation
1 parent 65799b5 commit 07e6dc4

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

certificate.go

+14-14
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ const (
9595
KeyTypeRSA
9696
)
9797

98-
// TLSCertificate returns Certificate as tls.Certificate.
98+
// TLSCertificate returns the Certificate as tls.Certificate.
9999
// A key pair and certificate will be generated at first call of any Certificate functions.
100-
// Error is returned if generation fails.
100+
// Error is not nil if generation fails.
101101
func (c *Certificate) TLSCertificate() (tls.Certificate, error) {
102102
err := c.ensureGenerated()
103103
if err != nil {
@@ -106,9 +106,9 @@ func (c *Certificate) TLSCertificate() (tls.Certificate, error) {
106106
return *c.GeneratedCert, nil
107107
}
108108

109-
// X509Certificate returns Certificate as x509.Certificate.
109+
// X509Certificate returns the Certificate as x509.Certificate.
110110
// A key pair and certificate will be generated at first call of any Certificate functions.
111-
// Error is returned if generation fails.
111+
// Error is not nil if generation fails.
112112
func (c *Certificate) X509Certificate() (x509.Certificate, error) {
113113
err := c.ensureGenerated()
114114
if err != nil {
@@ -118,9 +118,9 @@ func (c *Certificate) X509Certificate() (x509.Certificate, error) {
118118
return *cert, err
119119
}
120120

121-
// PublicKey returns crypto.PublicKey associated to Certificate.
121+
// PublicKey returns crypto.PublicKey associated to the Certificate.
122122
// A key pair and certificate will be generated at first call of any Certificate functions.
123-
// Error is returned if generation fails.
123+
// Error is not nil if generation fails.
124124
func (c *Certificate) PublicKey() (crypto.PublicKey, error) {
125125
err := c.ensureGenerated()
126126
if err != nil {
@@ -129,9 +129,9 @@ func (c *Certificate) PublicKey() (crypto.PublicKey, error) {
129129
return c.GeneratedCert.PrivateKey.(crypto.Signer).Public(), nil
130130
}
131131

132-
// PEM returns Certificate as certificate and private key PEM buffers.
132+
// PEM returns the Certificate as certificate and private key PEM buffers.
133133
// A key pair and certificate will be generated at first call of any Certificate functions.
134-
// Error is returned if generation fails.
134+
// Error is not nil if generation fails.
135135
func (c *Certificate) PEM() (cert []byte, key []byte, err error) {
136136
err = c.ensureGenerated()
137137
if err != nil {
@@ -169,9 +169,9 @@ func (c *Certificate) PEM() (cert []byte, key []byte, err error) {
169169
return
170170
}
171171

172-
// WritePEM writes Certificate as certificate and private key PEM files.
172+
// WritePEM writes the Certificate as certificate and private key PEM files.
173173
// A key pair and certificate will be generated at first call of any Certificate functions.
174-
// Error is returned if generation fails.
174+
// Error is not nil if generation fails.
175175
func (c *Certificate) WritePEM(certFile, keyFile string) error {
176176
err := c.ensureGenerated()
177177
if err != nil {
@@ -240,11 +240,11 @@ func (c *Certificate) ensureGenerated() error {
240240
return nil
241241
}
242242

243-
// Generate forces re-generation of key pair and certificate according to current state of Certificate.
243+
// Generate forces re-generation of key pair and certificate according to current state of the Certificate.
244244
// Usually it is automatically called when necessary, e.g. PEM() will internally call Generate().
245-
// It can be called explicitly when Certificate fields have been changed since certificate was last generated,
246-
// or if a new certificate is needed.
247-
// Error is returned if generation fails.
245+
// It can be called explicitly after changing Certificate fields since certificate was last generated,
246+
// or when a new certificate with same values is needed.
247+
// Error is not nil if generation fails.
248248
func (c *Certificate) Generate() error {
249249
// Traverse the certificate hierarchy recursively to ensure issuing CAs have been generated as well.
250250
if c.Issuer != nil {

0 commit comments

Comments
 (0)