feat: add signHash and signAuthorization#156
feat: add signHash and signAuthorization#156ggonzalez94 wants to merge 5 commits intoopen-wallet-standard:mainfrom
Conversation
|
@ggonzalez94 is attempting to deploy a commit to the MoonPay Team on Vercel. A member of the Team first needs to authorize it. |
Add raw 32-byte hash signing (secp256k1 chains) and EIP-7702 authorization signing (EVM chains) across Rust core, Node, and Python bindings. Both paths support owner-mode and API-key-mode with full policy evaluation. Refactors key_ops to share policy enforcement via enforce_policy_and_decrypt_key_with_raw_hex, eliminating duplicated boilerplate across sign_with_api_key, sign_message_with_api_key, and the new sign_hash_with_api_key. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
parse_quantity_bytes now checks the decimal string length against a conservative upper bound (3 * max_len + 1 digits) before entering the O(n·m) byte-conversion loop. Prevents CPU abuse from million-digit nonce or chain_id strings. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
45da1d2 to
f8cdecb
Compare
|
Found the CI failure — |
njdawn
left a comment
There was a problem hiding this comment.
lgtm, can merge after ci is fixed.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
should be good now |
|
@njdawn CI should be green now — anything else needed before we can merge this? |
…eip7702 # Conflicts: # bindings/node/__test__/index.spec.mjs # bindings/python/tests/test_bindings.py # ows/crates/ows-lib/src/key_ops.rs
|
updated with main and resolved conflicts after #148 was merged |
|
+1 to merge — CI is green, conflicts resolved, fmt fixed. |
Fixes #155
Summary
Adds two new signing operations to OWS:
signHash— sign a raw 32-byte hash on any secp256k1-backed chain. No prefix, no domain separator. Needed for protocols that compute their own digest (EIP-7702, custom schemes).signAuthorization— convenience for EIP-7702 authorization tuples. Computeskeccak256(0x05 || rlp([chain_id, address, nonce]))and signs it. EVM-only.Both work through owner-mode (passphrase) and agent-mode (API key + policy evaluation). The policy engine sees the full preimage for authorization signing, so executable policies can inspect the RLP tuple.
Also refactors
key_opsto eliminate duplicated policy-enforcement boilerplate acrosssign_with_api_key,sign_message_with_api_key, and the newsign_hash_with_api_key— they all shareenforce_policy_and_decrypt_key_with_raw_hexnow.Changes span Rust core, Node bindings, Python bindings, spec, and SDK docs.
Test plan