From 1d367607820a97bb71d7ae704e7c7996f33200a3 Mon Sep 17 00:00:00 2001 From: Danny Kim Date: Fri, 25 Sep 2026 19:43:09 +0000 Subject: [PATCH] Signed files keep their signature a string for every YAML parser (#4) Co-authored-by: Danny Kim Co-committed-by: Danny Kim --- Cargo.lock | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++- Cargo.toml | 2 +- src/sign.rs | 2 + 3 files changed, 115 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7f28ff9..f6bda88 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,6 +19,64 @@ dependencies = [ "sha3", ] +[[package]] +name = "alloy-sol-macro" +version = "1.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60dd79f578c3912f1fc2a150dbeb8110b8cfb976c60f98ebf6de9d5da5965a2b" +dependencies = [ + "alloy-sol-macro-expander", + "alloy-sol-macro-input", + "proc-macro-error3", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "alloy-sol-macro-expander" +version = "1.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9edb8520f2f94275e1caa73c85207dcc78ec402a9a4c429240f9a0783a8f16c0" +dependencies = [ + "alloy-sol-macro-input", + "const-hex", + "heck", + "indexmap", + "proc-macro-error3", + "proc-macro2", + "quote", + "sha3", + "syn 2.0.119", + "syn-solidity", +] + +[[package]] +name = "alloy-sol-macro-input" +version = "1.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66af2d9344882172993be5f5cbfd349fdfa52cb548f7af8715b446fb35ef6001" +dependencies = [ + "const-hex", + "dunce", + "heck", + "macro-string 0.2.0", + "proc-macro2", + "quote", + "syn 2.0.119", + "syn-solidity", +] + +[[package]] +name = "alloy-sol-types" +version = "1.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e6f87cf007caa54e95455875fbd25879b008d0d9c7c340a2c258b3a3400a28c" +dependencies = [ + "alloy-primitives", + "alloy-sol-macro", +] + [[package]] name = "anyhow" version = "1.0.104" @@ -204,6 +262,12 @@ dependencies = [ "crypto-common 0.2.2", ] +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + [[package]] name = "ecdsa" version = "0.16.9" @@ -382,6 +446,17 @@ version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" +[[package]] +name = "macro-string" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59a9dbbfc75d2688ed057456ce8a3ee3f48d12eec09229f560f3643b9f275653" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "macro-string" version = "0.3.0" @@ -396,9 +471,10 @@ dependencies = [ [[package]] name = "md-ens-signature" version = "0.1.0" -source = "git+https://github.com/capsulizers/md-ens-signature?rev=051a5f611eeba8d61c66dbe5074a2e56517897a7#051a5f611eeba8d61c66dbe5074a2e56517897a7" +source = "git+https://github.com/capsulizers/md-ens-signature?rev=86878b144154c894948c595d2f0d66fbbd36ae4b#86878b144154c894948c595d2f0d66fbbd36ae4b" dependencies = [ "alloy-primitives", + "alloy-sol-types", "anyhow", "k256", "sha2", @@ -454,6 +530,28 @@ dependencies = [ "syn 3.0.6", ] +[[package]] +name = "proc-macro-error-attr3" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82366fd7d8b7a440d66d13418820c69df9b3908bcb1a0476d7f5ce5d12f5a04d" +dependencies = [ + "proc-macro2", + "quote", +] + +[[package]] +name = "proc-macro-error3" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b511283ea8a74b4b39447b128c5d00f03a356b7424554b13e298a5550100d9ac" +dependencies = [ + "proc-macro-error-attr3", + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "proc-macro2" version = "1.0.107" @@ -704,6 +802,18 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "syn-solidity" +version = "1.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb6a2e3c7f7a3e4e83d1752cec5d1e357ced0cf96e85419b6a07f227db3def3a" +dependencies = [ + "paste", + "proc-macro2", + "quote", + "syn 2.0.119", +] + [[package]] name = "typenum" version = "1.20.1" @@ -824,7 +934,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f19d63da8e478a370ef8192d90ccb517965b7747d6b46cd2d831dd0ef4d2541" dependencies = [ "anyhow", - "macro-string", + "macro-string 0.3.0", "prettyplease", "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index b820222..433272a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,7 @@ crate-type = ["cdylib", "rlib"] [dependencies] wit-bindgen = "=0.62.0" quick-xml = { version = "0.37", default-features = false } -md-ens-signature = { git = "https://github.com/capsulizers/md-ens-signature", rev = "051a5f611eeba8d61c66dbe5074a2e56517897a7" } +md-ens-signature = { git = "https://github.com/capsulizers/md-ens-signature", rev = "86878b144154c894948c595d2f0d66fbbd36ae4b" } [lints.clippy] panic = "deny" diff --git a/src/sign.rs b/src/sign.rs index 2fe171d..7e93542 100644 --- a/src/sign.rs +++ b/src/sign.rs @@ -79,6 +79,8 @@ mod tests { .map_err(|_| ErrorCode::Internal)?; assert!(signed.starts_with("---\ntitle: Notes\n")); assert!(signed.ends_with("---\n# Notes\n\nHello\n")); + // YAML reads a bare 0x... as an integer, so the signature stays a string. + assert!(signed.contains("\nsignature: \"0x")); let fields = read_signature(&signed).ok_or(ErrorCode::Internal)?; assert_eq!(fields.signer, "laptop.alice.eth"); let key = parse_key(KEY).ok_or(ErrorCode::Internal)?;