Skip to content

Commit

Permalink
Hotfix/verify (#448)
Browse files Browse the repository at this point in the history
  • Loading branch information
frankiebee authored Jan 7, 2025
2 parents 742868a + e4b8138 commit 00b7773
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@entropyxyz/sdk",
"version": "0.4.1-1",
"version": "0.4.1-2",
"license": "AGPL-3.0-only",
"description": "JS SDK for entropy blockchain ",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion src/utils/crypto/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export async function verify (sigData: SignatureData | AdaptedSignatureData): Pr

if (hashType.toLowerCase() === 'keccak') {
const recoveredPk = SigningKey.recoverPublicKey(keccak256(message), signature)
return recoveredPk === SigningKey.computePublicKey(verifyingKey)
return SigningKey.computePublicKey(recoveredPk) === verifyingKey
}

if (hashType.toLowerCase() === 'blake2_256') {
Expand Down
7 changes: 4 additions & 3 deletions tests/end-to-end.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,9 @@ test('End To End', async (t) => {
hash: 'blake2_256',
})
)
await run('verified signature blake2_256', entropy.verify(signatureData))
await run(`verified signature ${signatureDataFromAdapter.hashType}`, entropy.verify(signatureDataFromAdapter))

const v1 = await run('verified signature blake2_256', entropy.verify(signatureData))
const v2 = await run(`verified signature ${signatureDataFromAdapter.hashType}`, entropy.verify(signatureDataFromAdapter))
t.ok(v1, 'should be valid blake2_256 signature')
t.ok(v2, `should be valid ${signatureDataFromAdapter.hashType} signature`)
t.end()
})

0 comments on commit 00b7773

Please sign in to comment.