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

[wallet-kit] Add support for signMessage #8690

Merged
merged 6 commits into from
Feb 28, 2023

Conversation

Jordan-Mysten
Copy link
Contributor

Description

This adds support for signMessage in the wallet kit ecosystem (adapters + UI + standard).

Test Plan

Validated TypeScript types


If your changes are not user-facing and not a breaking change, you can skip the following section. Otherwise, please indicate what changed, and then add to the Release Notes section as highlighted during the release process.

Type of Change (Check all that apply)

  • user-visible impact
  • breaking change for a client SDKs
  • breaking change for FNs (FN binary must upgrade)
  • breaking change for validators or node operators (must upgrade binaries)
  • breaking change for on-chain data layout
  • necessitate either a data wipe or data migration

Release notes

@vercel
Copy link

vercel bot commented Feb 27, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
explorer ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 28, 2023 at 1:27AM (UTC)
explorer-storybook ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 28, 2023 at 1:27AM (UTC)
wallet-adapter ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 28, 2023 at 1:27AM (UTC)

@vercel vercel bot temporarily deployed to Preview – wallet-adapter February 27, 2023 21:54 Inactive
@Jordan-Mysten Jordan-Mysten marked this pull request as ready for review February 27, 2023 22:13
messageWithIntent(IntentScope.PersonalMessage, message),
);

return {
// TODO: Should this include the intent, or just be the raw bytes that are signed?
Copy link
Collaborator

Choose a reason for hiding this comment

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

yes we should definitely include the intent bytes, otherwise one might ask you to sign a transaction masqueraded like a personal message.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This todo isn't for the message that the user is asked to sign, it's for if the return value includes the intent, or if we just automatically add the intent when verifying the message instead.

@@ -156,6 +156,11 @@ export type SignedTransaction = {
signature: SerializedSignature;
};

export type SignedMessage = {
Copy link
Collaborator

@kchalkias kchalkias Feb 27, 2023

Choose a reason for hiding this comment

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

I'd suggest renaming this to SignedPersonalMessage as this is the standard term; and avoid confusion with a transaction message (many times in crypto we generically use the term message to define any message type).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think in the SDK context it's fairly unambiguous, as we have signMessage + SignedMessage and signTransaction + SignedTransaction.

"@mysten/sui.js": minor
---

Change `signMessage` to return message bytes. Add support for sui:signMessage in the wallet standard
Copy link
Collaborator

@kchalkias kchalkias Feb 27, 2023

Choose a reason for hiding this comment

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

ditto, signPersonalMessage, let's use the term personalMessage everywhere

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sui:signMessage naming is designed to align with wallet standards from other chains, so would like to keep that the same. We could change the internal method names but then they don't align across our SDK, which seems non-ideal.

Copy link
Collaborator

@kchalkias kchalkias Feb 27, 2023

Choose a reason for hiding this comment

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

Not that I like what the other wallets do, as we're probably the first blockchain who puts the intent as part of the default L1 specs (not as a community proposal), but I'm fine assuming we have documentation that we refer to personal message and the only reason was compatibility with the industry. (because at the same time we are now incompatible with our rust specs re intents that we call it PersonalMessage)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I get the desire to keep alignment with rust, although we abstract over that by adding the intent automatically, so the PersonalMessage intent is effectively invisible to consumers of these APIs.

Copy link
Collaborator

Choose a reason for hiding this comment

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

yes that's fine, I think a small doc comment could slightly help here, but overall we're good with the PR

@vercel vercel bot temporarily deployed to Preview – wallet-adapter February 28, 2023 01:24 Inactive
@vercel vercel bot temporarily deployed to Preview – explorer-storybook February 28, 2023 01:24 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-adapter February 28, 2023 01:26 Inactive
@vercel vercel bot temporarily deployed to Preview – explorer-storybook February 28, 2023 01:27 Inactive
@Jordan-Mysten Jordan-Mysten merged commit 956ec28 into main Feb 28, 2023
@Jordan-Mysten Jordan-Mysten deleted the jordan--Add_signMessage_to_the_wallet_standard branch February 28, 2023 02:05
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