Skip to content

Commit

Permalink
response returns errors when signer2 provided but signing fails
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Pickett committed Apr 18, 2024
1 parent 1592b86 commit 94b3d5a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 4 additions & 2 deletions pkg/challenge/challenge.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,10 @@ func (o *OuterChallenge) Respond(signer crypto.Signer, signer2 crypto.Signer, re

var signature2 []byte
if signer2 != nil {
//nolint: errcheck - we allow nil signer2
signature2, _ = echelper.SignWithTimeout(signer2, innerResponse, signingTimeoutDuration, signingTimeoutInterval)
signature2, err = echelper.SignWithTimeout(signer2, innerResponse, signingTimeoutDuration, signingTimeoutInterval)
if err != nil {
return nil, fmt.Errorf("signing challenge 2: %w", err)
}
}

sealed, pub, err := echelper.SealNaCl(innerResponse, &o.innerChallenge.PublicEncryptionKey)
Expand Down
3 changes: 0 additions & 3 deletions pkg/challenge/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ func (o *OuterResponse) Open(privateEncryptionKey *[32]byte) (*InnerResponse, er

// no sig 2 provided, return what we have
if o.Sig2 == nil || len(o.Sig2) <= 0 {
// if there is no sig2, set public signing key 2 to nil just in case so that
// the consumer does not falsely assume it was used to perform a signature
innerResponse.PublicSigningKey2 = nil
return &innerResponse, nil
}

Expand Down

0 comments on commit 94b3d5a

Please sign in to comment.