Skip to content

Commit 33be15f

Browse files
committed
Add GoDocs for public API
Signed-off-by: Noah Stride <noah.stride@goteleport.com>
1 parent a15c0da commit 33be15f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

signer.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,15 @@ type X509SVIDSigner struct {
2020
SVID *x509svid.SVID
2121
}
2222

23+
// Public returns the public key of the keypair associated with the signer's
24+
// X509 SVID. Implements the crypto.Signer interface.
2325
func (s *X509SVIDSigner) Public() crypto.PublicKey {
2426
return s.SVID.PrivateKey.Public()
2527
}
2628

29+
// Sign creates a signature of the given input using the keypair associated with
30+
// the signer's X509 SVID.
31+
// Implements the aws_signing_helper.Signer and crypto.Signer interfaces.
2732
func (s *X509SVIDSigner) Sign(rand io.Reader, digest []byte, opts crypto.SignerOpts) ([]byte, error) {
2833
// Note(strideynet):
2934
// As of the time of writing, it looks like the AWS signing helper will
@@ -94,17 +99,26 @@ func (s *X509SVIDSigner) SignatureAlgorithm() (string, error) {
9499
}
95100
}
96101

102+
// Certificate returns the leaf certificate e.g the one identifying the
103+
// workload.
104+
// Implements the aws_signing_helper.Signer interface.
97105
func (s *X509SVIDSigner) Certificate() (*x509.Certificate, error) {
98106
return s.SVID.Certificates[0], nil
99107
}
100108

109+
// CertificateChain returns any certificates needed to chain the leaf to
110+
// the trust anchor.
111+
// Implements the aws_signing_helper.Signer interface.
101112
func (s *X509SVIDSigner) CertificateChain() ([]*x509.Certificate, error) {
102113
if len(s.SVID.Certificates) < 1 {
103114
return s.SVID.Certificates[1:], nil
104115
}
105116
return nil, nil
106117
}
107118

119+
// Close should be called when the signer is no longer needed. It is a no-op
120+
// for this implementation.
121+
// Implements the aws_signing_helper.Signer interface.
108122
func (s *X509SVIDSigner) Close() {
109123
// Nothing to do here...
110124
}

0 commit comments

Comments
 (0)