Skip to content

Commit

Permalink
split key failure
Browse files Browse the repository at this point in the history
Summary:

Test Plan:
  • Loading branch information
imdominicreed committed Jan 10, 2025
1 parent 767e621 commit e29072b
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions sdk/tdf.go
Original file line number Diff line number Diff line change
Expand Up @@ -1056,19 +1056,31 @@ func (r *Reader) buildKey(_ context.Context, results []KAOResult) error {
func (r *Reader) doPayloadKeyUnwrap(ctx context.Context) error { //nolint:gocognit // Better readability keeping it as is
kasClient := newKASClient(r.dialOptions, r.tokenSource, &r.kasSessionKey)

var kaoResults []KAOResult
reqFail := func(err error, req *kas.RewrapRequestBody) {
for _, kao := range req.GetKeyAccessObjectRequests() {
kaoResults = append(kaoResults, KAOResult{
KeyAccessObjectID: kao.GetKeyAccessObjectId(),
Error: err,
})
}

}

Check failure on line 1068 in sdk/tdf.go

View workflow job for this annotation

GitHub Actions / go (sdk)

unnecessary trailing newline (whitespace)

reqs, err := createRewrapRequest(ctx, r)
if err != nil {
return err
}
var kaoResults []KAOResult
for _, req := range reqs {
policyRes, err := kasClient.unwrap(ctx, req)
if err != nil {
return err
reqFail(err, req)
}
result, ok := policyRes["policy"]
if !ok {
return fmt.Errorf("could not find policy in rewrap response")
err = fmt.Errorf("could not find policy in rewrap response")
reqFail(err, req)
return err
}
kaoResults = append(kaoResults, result...)
}
Expand Down

0 comments on commit e29072b

Please sign in to comment.