Skip to content

Commit 736f250

Browse files
fix(sdk): uses kas sessions key (#2940)
### Proposed Changes * #2906 accidentally removes using the kas sessions key causing a regression in tdf3 decrypt performance. this PR uses the session key ### Checklist - [ ] I have added or updated unit tests - [ ] I have added or updated integration tests (if appropriate) - [ ] I have added or updated documentation ### Testing Instructions
1 parent a960eca commit 736f250

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

sdk/tdf.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,10 @@ func allowListFromKASRegistry(ctx context.Context, logger *slog.Logger, kasRegis
758758

759759
// LoadTDF loads the tdf and prepare for reading the payload from TDF
760760
func (s SDK) LoadTDF(reader io.ReadSeeker, opts ...TDFReaderOption) (*Reader, error) {
761+
if s.kasSessionKey != nil {
762+
opts = append([]TDFReaderOption{withSessionKey(s.kasSessionKey)}, opts...)
763+
}
764+
761765
config, err := newTDFReaderConfig(opts...)
762766
if err != nil {
763767
return nil, fmt.Errorf("newTDFReaderConfig failed: %w", err)
@@ -768,11 +772,6 @@ func (s SDK) LoadTDF(reader io.ReadSeeker, opts ...TDFReaderOption) (*Reader, er
768772
if err != nil {
769773
return nil, fmt.Errorf("archive.NewTDFReader failed: %w", err)
770774
}
771-
772-
if s.kasSessionKey != nil {
773-
opts = append([]TDFReaderOption{withSessionKey(s.kasSessionKey)}, opts...)
774-
}
775-
776775
useGlobalFulfillableObligations := len(config.fulfillableObligationFQNs) == 0 && len(s.fulfillableObligationFQNs) > 0
777776
if useGlobalFulfillableObligations {
778777
config.fulfillableObligationFQNs = s.fulfillableObligationFQNs

0 commit comments

Comments
 (0)