Skip to content

Commit

Permalink
fix(SPV-936): add wrapcheck for lockingscript error and remove unnece…
Browse files Browse the repository at this point in the history
…ssary comment
  • Loading branch information
wregulski committed Sep 11, 2024
1 parent 33d1b4d commit 80fa3dd
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions authentication.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ func GetSignedHex(dt *models.DraftTransaction, xPriv *bip32.ExtendedKey) (string
}

func prepareLockingScript(dst *models.Destination) (*script.Script, error) {
return script.NewFromHex(dst.LockingScript)
lockingScript, err := script.NewFromHex(dst.LockingScript)
if err != nil {
return nil, fmt.Errorf("failed to create locking script from hex for destination: %w", err)
}

return lockingScript, nil
}

func prepareUnlockingScript(xPriv *bip32.ExtendedKey, dst *models.Destination) (*p2pkh.P2PKH, error) {
Expand Down Expand Up @@ -171,7 +176,7 @@ func createSignatureCommon(payload *models.AuthPayload, bodyString string, priva
// getSigningMessage will build the signing message byte array
func getSigningMessage(xPub string, auth *models.AuthPayload) []byte {
message := fmt.Sprintf("%s%s%s%d", xPub, auth.AuthHash, auth.AuthNonce, auth.AuthTime)
return []byte(message) // Convert string to byte array
return []byte(message)
}

func setSignatureHeaders(header *http.Header, authData *models.AuthPayload) {
Expand Down

0 comments on commit 80fa3dd

Please sign in to comment.