From 4261a46f03af207032f803c1fb8e795c3b0d4ce7 Mon Sep 17 00:00:00 2001 From: Aniketh Varma Date: Sat, 5 Oct 2024 03:03:10 +0530 Subject: [PATCH] Setting `lowS: false` by default for verification of secp256k1 signatures (#811) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## What type of PR is this? (check all applicable) - [ ] โ™ป๏ธ Refactor - [x] โœจ New Feature - [ ] ๐Ÿ› Bug Fix - [ ] ๐Ÿ“ Documentation Update - [ ] ๐Ÿ‘ท Example Application - [ ] ๐Ÿง‘โ€๐Ÿ’ป Code Snippet - [ ] ๐ŸŽจ Design - [ ] ๐Ÿ“– Content - [ ] ๐Ÿงช Tests - [ ] ๐Ÿ”– Release - [ ] ๐Ÿšฉ Other ## Description This PR adds the feature of setting the `lowS` flag to be `false` by default for the verification of secp256k1 signatures. ## Related Tickets & Documents Resolves #714 ## Mobile & Desktop Screenshots/Recordings ## Added code snippets? - [x] ๐Ÿ‘ yes - [ ] ๐Ÿ™… no, because they aren't needed ## Added tests? - [ ] ๐Ÿ‘ yes - [ ] ๐Ÿ™… no, because they aren't needed - [x] ๐Ÿ™‹ no, because I need help ### No tests? Add a note ## Added to documentation? - [ ] ๐Ÿ“œ readme - [ ] ๐Ÿ“œ contributing.md - [ ] ๐Ÿ““ general documentation - [x] ๐Ÿ™… no documentation needed ### No docs? Add a note ## [optional] Are there any post-deployment tasks we need to perform? ## [optional] What gif best describes this PR or how it makes you feel? --- src/utils/secp256k1.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/secp256k1.ts b/src/utils/secp256k1.ts index f8279d522..d94ad94f1 100644 --- a/src/utils/secp256k1.ts +++ b/src/utils/secp256k1.ts @@ -110,7 +110,7 @@ export class Secp256k1 { const publicKeyBytes = Secp256k1.publicJwkToBytes(publicJwk); const hashedContent = await sha256.encode(content); - return secp256k1.verify(signature, hashedContent, publicKeyBytes); + return secp256k1.verify(signature, hashedContent, publicKeyBytes, { lowS: false }); } /**