@@ -26,7 +26,10 @@ import (
2626)
2727
2828// BundleSigner is used to produce Sigstore Bundles from provenance statements.
29- type BundleSigner struct {}
29+ type BundleSigner struct {
30+ fulcioAddr string
31+ rekorAddr string
32+ }
3033
3134type sigstoreBundleAtt struct {
3235 cert []byte
@@ -45,7 +48,14 @@ func (s *sigstoreBundleAtt) Bytes() []byte {
4548
4649// NewDefaultBundleSigner creates a new BundleSigner instance.
4750func NewDefaultBundleSigner () * BundleSigner {
48- return & BundleSigner {}
51+ return NewBundleSigner (DefaultFulcioAddr , DefaultRekorAddr )
52+ }
53+
54+ func NewBundleSigner (fulcioAddr string , rekorAddr string ) * BundleSigner {
55+ return & BundleSigner {
56+ fulcioAddr : fulcioAddr ,
57+ rekorAddr : rekorAddr ,
58+ }
4959}
5060
5161// Sign signs the given provenance statement and returns the signed Sigstore Bundle.
@@ -78,7 +88,11 @@ func (s *BundleSigner) Sign(ctx context.Context, statement *intoto.Statement) (s
7888 rawToken := TokenStruct .RawToken
7989
8090 // signing opts.
81- bundleOpts , err := getDefaultBundleOptsWithIdentityToken (& rawToken )
91+ bundleOpts , err := getBundleOpts (
92+ & s .fulcioAddr ,
93+ & s .rekorAddr ,
94+ & rawToken ,
95+ )
8296 if err != nil {
8397 return nil , err
8498 }
@@ -104,20 +118,24 @@ func (s *BundleSigner) Sign(ctx context.Context, statement *intoto.Statement) (s
104118 return bundleAtt , nil
105119}
106120
107- // getDefaultBundleOptsWithIdentityToken provides the default opts for sigstoreSign.Bundle().
108- func getDefaultBundleOptsWithIdentityToken (identityToken * string ) (* sigstoreSign.BundleOptions , error ) {
121+ // getBundleOpts provides the opts for sigstoreSign.Bundle().
122+ func getBundleOpts (
123+ fulcioAddr * string ,
124+ rekorAddr * string ,
125+ identityToken * string ,
126+ ) (* sigstoreSign.BundleOptions , error ) {
109127 bundleOpts := & sigstoreSign.BundleOptions {}
110128
111129 fulcioOpts := & sigstoreSign.FulcioOptions {
112- BaseURL : "https://fulcio.sigstore.dev" ,
130+ BaseURL : * fulcioAddr ,
113131 }
114132 bundleOpts .CertificateProvider = sigstoreSign .NewFulcio (fulcioOpts )
115133 bundleOpts .CertificateProviderOptions = & sigstoreSign.CertificateProviderOptions {
116134 IDToken : * identityToken ,
117135 }
118136
119137 rekorOpts := & sigstoreSign.RekorOptions {
120- BaseURL : "https://rekor.sigstore.dev" ,
138+ BaseURL : * rekorAddr ,
121139 }
122140 bundleOpts .TransparencyLogs = append (bundleOpts .TransparencyLogs , sigstoreSign .NewRekor (rekorOpts ))
123141 return bundleOpts , nil
0 commit comments