MCPcopy Create free account
hub / github.com/QuipNetwork/cpp-sdk / parseSignatureFromHex

Function parseSignatureFromHex

src/cli.cpp:57–66  ·  view source on GitHub ↗

Helper: parse a hex string into a Signature (vector >)

Source from the content-addressed store, hash-verified

55
56// Helper: parse a hex string into a Signature (vector<array<uint8_t, 32>>)
57static 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
69static Address deriveClassicalPublicKey(const PrivateKey &private_key) {

Callers

nothing calls this directly

Calls 1

fromHexFunction · 0.85

Tested by

no test coverage detected