Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support signing non-hex messages #804

Merged
merged 1 commit into from
Jul 30, 2024
Merged

Conversation

Jon-edge
Copy link
Contributor

@Jon-edge Jon-edge commented Jul 23, 2024

Required for signing Bity orders

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

EdgeApp/edge-core-js#605

Description

none

const messageBuffer = hexToBuf(message)
const messageBuffer = isHex(message)
? hexToBuf(message)
: Buffer.from(message)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it's a good idea to use Buffer.from without specifying the encoding. Instead maybe explicitly test for different types of strings and use base16 and base64 to create the uint8array and to support arbitrary text by using Buffer.from(arg, 'ascii')

@Jon-edge Jon-edge force-pushed the jon/non-hex-eth-signing branch 4 times, most recently from 31989db to c0afe35 Compare July 29, 2024 17:46
Copy link
Contributor Author

@Jon-edge Jon-edge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dependencies updated. Now leaving signMessage unchanged, and implementing a generic signBytes()

@@ -143,8 +144,19 @@ export class EthereumEngine extends CurrencyEngine<
]

this.utils = {
signBytes: (bytes: Uint8Array, privateKeys: EthereumPrivateKeys) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove signBytes and signMessage from utils

@Jon-edge Jon-edge force-pushed the jon/non-hex-eth-signing branch 3 times, most recently from 9b0122d to 36edf19 Compare July 30, 2024 20:56
Required for signing Bity orders
@Jon-edge Jon-edge merged commit 185959e into master Jul 30, 2024
2 checks passed
@Jon-edge Jon-edge deleted the jon/non-hex-eth-signing branch July 30, 2024 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants