Skip to content

Instantly share code, notes, and snippets.

@target-san
target-san / reown-parse-sign-msg-output.rs
Created August 10, 2025 14:11
Try parse "sign message" result as ERC-6492 payload
//! Compatible with `cargo eval`
//! ```cargo
//! [dependencies]
//! alloy-primitives = { version = "1.3.0", features=["k256"] }
//! alloy-sol-types = "1.3.0"
//! anyhow = "1.0.98"
//! ```
use alloy_primitives::{Address, Bytes, Signature};
use alloy_sol_types::SolValue as _;
@target-san
target-san / parse-reown-sig.rs
Created August 8, 2025 15:10
Parse `reown` signed message with `alloy-primitives`
//! Compatible with `cargo eval`
//! ```cargo
//! [dependencies]
//! alloy-primitives = { version = "1.3.0", features=["k256"] }
//! anyhow = "1.0.98"
//! ```
use alloy_primitives::{eip191_hash_message, keccak256, Address, Bytes, Signature, B256};
use anyhow::{Result, ensure, anyhow, bail};
const ADDRESS: &str = "0x181cD97461ACf9e863fE5cCf8f432E0Fbba678bC";
@target-san
target-san / subprocess-test.rs
Last active April 19, 2025 18:34
Implement Rust test which launches itself as a separate subprocess
//! ```cargo
//! [dependencies]
//! tempfile = "3.19"
//! ```
use std::env::var_os;
use std::fs::File;
use std::io::{Read, Seek, SeekFrom};
use std::process::{Command, Stdio};
use tempfile::tempfile;