Skip to content

Commit

Permalink
[fix] Allow signing non-hex messages on all platforms (#523)
Browse files Browse the repository at this point in the history
  • Loading branch information
gregnazario authored Oct 3, 2024
1 parent 83b2092 commit 3254f59
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ All notable changes to the Aptos TypeScript SDK will be captured in this file. T

# Unreleased

- Remove usage of Buffer.from and replace with TextEncoder for greater compatibility

# 1.28.0 (2024-09-19)

- Support `Serialized Type` to Script txn. Now can use vector<String> for example.
Expand Down
4 changes: 2 additions & 2 deletions src/core/crypto/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ export const convertSigningMessage = (message: HexInput): HexInput => {
// if message is of type string, verify it is a valid Hex string
if (typeof message === "string") {
const isValid = Hex.isValid(message);
// If message is not a valid Hex string, convert it into a Buffer
// If message is not a valid Hex string, convert it
if (!isValid.valid) {
return Buffer.from(message, "utf8");
return new TextEncoder().encode(message);
}
// If message is a valid Hex string, return it
return message;
Expand Down

0 comments on commit 3254f59

Please sign in to comment.