Helper: parse a hex string into a Signature (vector >)
| 55 | |
| 56 | // Helper: parse a hex string into a Signature (vector<array<uint8_t, 32>>) |
| 57 | static Signature parseSignatureFromHex(const std::string &hex) { |
| 58 | std::vector<uint8_t> bytes = fromHex(hex); |
| 59 | if (bytes.size() % 32 != 0) |
| 60 | throw std::runtime_error("Invalid signature length"); |
| 61 | Signature sig(bytes.size() / 32); |
| 62 | for (size_t i = 0; i < sig.size(); ++i) { |
| 63 | std::copy_n(bytes.begin() + i * 32, 32, sig[i].begin()); |
| 64 | } |
| 65 | return sig; |
| 66 | } |
| 67 | |
| 68 | // Helper: derive classical public key from private key using ethers.js |
| 69 | static Address deriveClassicalPublicKey(const PrivateKey &private_key) { |