You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add Wasm-compatible adapters for implementing Signer trait that work in web browser. Add sample integrations. (#4017)
## 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.
let signature = EvmSignature::new(crypto_hash,&signer);
550
+
let js_signature = EvmSignature::from_str("0xe257048813b851f812ba6e508e972d8bb09504824692b027ca95d31301dbe8c7103a2f35ce9950d031d260f412dcba09c24027288872a67abe261c0a3e55c9121b").unwrap();
551
+
assert_eq!(signature, js_signature);
552
+
}
553
+
536
554
#[test]
537
555
fntest_signatures(){
538
556
use serde::{Deserialize,Serialize};
539
557
540
558
usecrate::crypto::{
541
559
secp256k1::evm::{EvmKeyPair,EvmSignature},
542
-
BcsSignable,TestString,
560
+
BcsSignable,CryptoHash,TestString,
543
561
};
544
562
545
563
#[derive(Debug,Serialize,Deserialize)]
@@ -551,10 +569,11 @@ mod tests {
551
569
let keypair2 = EvmKeyPair::generate();
552
570
553
571
let ts = TestString("hello".into());
572
+
let ts_cryptohash = CryptoHash::new(&ts);
554
573
let tsx = TestString("hellox".into());
555
574
let foo = Foo("hello".into());
556
575
557
-
let s = EvmSignature::new(&ts,&keypair1.secret_key);
576
+
let s = EvmSignature::new(ts_cryptohash,&keypair1.secret_key);
0 commit comments