From 20da968f0e32ef226bf80376159f9aa66a06562a Mon Sep 17 00:00:00 2001 From: Marcin Gorzynski Date: Thu, 1 Feb 2024 14:42:54 +0100 Subject: [PATCH] Add support for Intent sessions built on secp256r1 - remove prefix 2 --- intents/intent.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/intents/intent.go b/intents/intent.go index f758eb1..d4e1c50 100644 --- a/intents/intent.go +++ b/intents/intent.go @@ -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 @@ -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 }