Skip to content

Conversation

@deuszx
Copy link
Contributor

@deuszx deuszx commented May 27, 2025

Motivation

We want to be able to sign block proposals using EVM-compatible wallets in the web browser.

Proposal

Add linera-web/signer directory with sample implementations of Signer trait for in-memory private key (in_memory.ts) and MetaMask integration (metamask.ts).

Pre-existing Wallet implementations in linera-web was adapted to work with the new abstractions.

Test Plan

CI/Manual testing.

Release Plan

  • Nothing to do / These changes follow the usual release cycle.

@deuszx deuszx force-pushed the web-signer-fn branch 6 times, most recently from 4ec9304 to 8c367a5 Compare June 3, 2025 08:36
@deuszx deuszx changed the title Web signer fn Add Wasm-compatible adapters for implementing Signer trait that work in web browser. Add sample integrations. Jun 3, 2025
@deuszx deuszx marked this pull request as ready for review June 3, 2025 14:20
@deuszx deuszx requested a review from Twey June 3, 2025 14:20
deuszx added 10 commits June 4, 2025 19:29
The root cause for problems here was serializing CryptoHash using
wasm_bindgen and serde. We can't serialize, because that adds new bytes
which are not present when verifying the signature. We are working with
the bytes - that CryptoHash wraps - directly. JsValue was a wrong type
to use as well. Now we use UInt8Array as that affects the logic inside
the ethers' signMessage method.

To summarize: CryptoHash had to be passed in as raw bytes it wraps.
@deuszx deuszx force-pushed the web-signer-fn branch 3 times, most recently from 13f6432 to 085ed8a Compare June 4, 2025 17:30
deuszx added 2 commits June 4, 2025 19:35
What's left is extracting JS Signer interface to a separate file and
include_str! it and extracting the MetaMask implementation to a separate
PR.
Copy link
Contributor

@Twey Twey left a comment

Choose a reason for hiding this comment

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

Looks good to me. Great work!

@deuszx deuszx added this pull request to the merge queue Jun 6, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 6, 2025
@deuszx deuszx added this pull request to the merge queue Jun 6, 2025
Merged via the queue into main with commit e7c2700 Jun 6, 2025
26 checks passed
@deuszx deuszx deleted the web-signer-fn branch June 6, 2025 19:08
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.

3 participants