Skip to content

Commit

Permalink
Add support for Intent sessions built on secp256r1 - remove prefix 2
Browse files Browse the repository at this point in the history
  • Loading branch information
marino39 committed Feb 1, 2024
1 parent cee69e1 commit 20da968
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions intents/intent.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,7 @@ func (intent *Intent) isValidSignatureSPECP256K1(session string, signature strin
// isValidSignatureSPECP256K1 checks if the signature is valid for the given secp256r1 session
func (intent *Intent) isValidSignatureSECP256R1(session string, signature string) bool {
// session
sessionHex, _ := strings.CutPrefix(session, "r1:")
sessionBuff := common.FromHex(sessionHex)
sessionBuff := common.FromHex(session)

// public key
// TODO: check if can use ecdh instead of unmarshal
Expand All @@ -177,8 +176,7 @@ func (intent *Intent) isValidSignatureSECP256R1(session string, signature string
messageHash2 := sha256.Sum256(messageHash)

// signature
signatureHex, _ := strings.CutPrefix(signature, "r1:")
signatureBytes := common.FromHex(signatureHex)
signatureBytes := common.FromHex(signature)
if len(signatureBytes) != 64 {
return false
}
Expand Down

0 comments on commit 20da968

Please sign in to comment.