Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 35 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tetherto/wdk-wallet-tron",
"version": "1.0.0-beta.4",
"version": "1.0.0-beta.5",
"description": "A simple package to manage BIP-32 wallets for the tron blockchain.",
"keywords": [
"wdk",
Expand Down
2 changes: 1 addition & 1 deletion src/wallet-account-read-only-tron.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export default class WalletAccountReadOnlyTron extends WalletAccountReadOnly {

const recoveredAddress = await Trx.verifyMessageV2(message, signature)

return address.toLowerCase() === recoveredAddress.toLowerCase()
return address === recoveredAddress
}

/**
Expand Down
8 changes: 8 additions & 0 deletions tests/wallet-account-read-only-tron.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ describe('WalletAccountReadOnlyTron', () => {
expect(result).toBe(false)
})

test('should return false for an address with invalid casing', async () => {
const lowercasedAddressAccount = new WalletAccountReadOnlyTron(ADDRESS.toLowerCase())

const result = await lowercasedAddressAccount.verify(MESSAGE, SIGNATURE)

expect(result).toBe(false)
})

test('should throw on a malformed signature', async () => {
await expect(account.verify(MESSAGE, '0xinvalid'))
.rejects.toThrow(/invalid BytesLike value/)
Expand Down