Produces a secp256k1 signature from one of the caller org's wallets over a…
Produces a secp256k1 signature from one of the caller org's wallets over a 32-byte digest, through whichever custody backend that wallet uses.
POST /v1/wallet/{id}/sign
| Address | https://api.hanzo.ai/v1/wallet/{id}/sign |
| Method | POST |
| Operation | post_wallet_by_id_sign |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Produces a secp256k1 signature from one of the caller org's wallets over
a 32-byte digest, through whichever custody backend that wallet uses. Give it
either a digest (32 bytes as hex, signed verbatim) or a message (hashed
with Keccak256 first) — exactly one is required. The private key never leaves
its backend: KMS custody opens the sealed key in-process, MPC custody produces
a threshold signature on the ring. The answer carries the digest that was
signed alongside the signature, so a caller can verify what it got.
Request
3 fields, body application/json (required).
| Field | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | yes | |
digest | body | string | — | Digest is a pre-computed 32-byte digest as hex, with or without the 0x prefix. |
message | body | string | — | Message is arbitrary text to hash with Keccak256 and sign. |
Response
| Status | Body | Meaning |
|---|---|---|
200 | signature | ok |
200 body — 4 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
address | body | string | — | Address is the wallet's on-chain address, the one this signature recovers to. |
digest | body | string | — | Digest is the 32-byte digest that was signed, hex with an 0x prefix. |
signature | body | string | — | Signature is the 65-byte secp256k1 signature, hex with an 0x prefix. |
walletId | body | string | — | WalletID is the wallet that signed. |
Failure carries the platform error shape — see Errors.
Examples
hanzo wallets sign <id>import { Configuration, WalletApi } from 'hanzoai';
const api = new WalletApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postWalletByIdSign({ id: 'id', digest: "<digest>", message: "<message>" });from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import WalletApi
client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = WalletApi(client).post_wallet_by_id_sign(id='id', digest="<digest>", message="<message>")cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.WalletAPI.PostWalletByIdSign(context.Background()).Execute()
if err != nil {
return err
}use hanzo_cloud::apis::{configuration::Configuration, wallet_api};
let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();
let result = wallet_api::post_wallet_by_id_sign(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.WalletApi;
ApiClient client = new ApiClient();
client.setRequestInterceptor(b -> b.header("Authorization", "Bearer " + System.getenv("HANZO_API_KEY")));
var result = new WalletApi(client).postWalletByIdSign();The method above is the one at the current release of the document. [email protected] (npm) and [email protected] (PyPI) were generated from an earlier release, where this operation carried a different id, so it spells the method differently — regenerating the clients is what makes the two agree. SDKs →
curl -X POST https://api.hanzo.ai/v1/wallet/<id>/sign \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"digest": "<digest>",
"message": "<message>"
}'The door reaches wallet through the wallets tool, which names its 7 operations with its own verbs — this one among them, under a name only the door declares. describe explains any of them:
curl -X POST https://api.hanzo.ai/v1/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "describe",
"arguments": {
"op": "list_wallets"
}
}
}'How is this guide?