Skip to content

Commit 10043c8

Browse files
author
Aleix Morgadas
committed
changed PublicAccount ensuring convertedData type
1 parent 49f8393 commit 10043c8

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/model/account/PublicAccount.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,8 @@ export class PublicAccount {
8080
// Convert signature key to Uint8Array
8181
const convertedSignature = convert.hexToUint8(signature);
8282

83-
let convertedData;
84-
85-
// Convert data to hex if data is not hex
86-
if (!convert.isHexString(data)) {
87-
convertedData = convert.utf8ToHex(data);
88-
}
89-
9083
// Convert to Uint8Array
91-
convertedData = convert.hexToUint8(convertedData);
84+
const convertedData = convert.hexToUint8(convert.isHexString(data) ? data : convert.utf8ToHex(data));
9285

9386
return KeyPair.verify(convert.hexToUint8(this.publicKey), convertedData, convertedSignature);
9487
}

0 commit comments

Comments
 (0)