Skip to content

Commit a2abde9

Browse files
fnerdmanfnerdman
andauthored
fix: issuer auto detection logic in wrong method (#34)
Co-authored-by: fnerdman <frieder@flashbots.net>
1 parent 2ef3f5b commit a2abde9

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

proxy/atls_config.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,6 @@ func ParseAttestationType(attestationType string) (AttestationType, error) {
4646
}
4747
}
4848

49-
func CreateAttestationIssuer(log *slog.Logger, attestationType AttestationType) (atls.Issuer, error) {
50-
switch attestationType {
51-
case AttestationNone:
52-
return nil, nil
53-
case AttestationAzureTDX:
54-
return azure_tdx.NewIssuer(log), nil
55-
case AttestationDCAPTDX:
56-
return dcap_tdx.NewIssuer(log), nil
57-
default:
58-
return nil, errors.New("invalid attestation-type passed in")
59-
}
60-
}
61-
6249
// DetectAttestationType determines the attestation type based on environment
6350
func DetectAttestationType() AttestationType {
6451
// Check for TDX device files - these indicate DCAP TDX
@@ -78,12 +65,25 @@ func DetectAttestationType() AttestationType {
7865
return AttestationNone
7966
}
8067

81-
func CreateAttestationValidators(log *slog.Logger, attestationType AttestationType, jsonMeasurementsPath string) ([]atls.Validator, error) {
68+
func CreateAttestationIssuer(log *slog.Logger, attestationType AttestationType) (atls.Issuer, error) {
8269
if attestationType == AttestationAuto {
8370
attestationType = DetectAttestationType()
8471
log.With("detected_attestation", attestationType).Info("Auto-detected attestation type")
8572
}
8673

74+
switch attestationType {
75+
case AttestationNone:
76+
return nil, nil
77+
case AttestationAzureTDX:
78+
return azure_tdx.NewIssuer(log), nil
79+
case AttestationDCAPTDX:
80+
return dcap_tdx.NewIssuer(log), nil
81+
default:
82+
return nil, errors.New("invalid attestation-type passed in")
83+
}
84+
}
85+
86+
func CreateAttestationValidators(log *slog.Logger, attestationType AttestationType, jsonMeasurementsPath string) ([]atls.Validator, error) {
8787
if attestationType == AttestationNone {
8888
return nil, nil
8989
}

0 commit comments

Comments
 (0)