Skip to content

Commit ff716a0

Browse files
committed
Updated the Signer API docs
1 parent d1ad9c9 commit ff716a0

File tree

2 files changed

+76
-122
lines changed

2 files changed

+76
-122
lines changed

api/signer-api.yml

Lines changed: 76 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ paths:
6060

6161
/signer/v1/request_signature:
6262
post:
63-
summary: Send a signature request
63+
summary: Request a signature for a 32-byte blob of data (typically a hash), signed by the requested BLS or ECDSA key.
6464
tags:
6565
- Signer
6666
security:
@@ -81,15 +81,15 @@ paths:
8181
type: string
8282
enum: [consensus, proxy_bls, proxy_ecdsa]
8383
pubkey:
84-
description: Public key of the validator for consensus signatures
84+
description: The 48-byte BLS public key, with optional `0x` prefix, of the proposer key that you want to request a signature from.
8585
$ref: "#/components/schemas/BlsPubkey"
8686
proxy:
87-
description: BLS proxy pubkey or ECDSA address for proxy signatures
87+
description: The 48-byte BLS public key (for `proxy_bls` mode) or the 20-byte Ethereum address (for `proxy_ecdsa` mode), with optional `0x` prefix, of the proxy key that you want to request a signature from.
8888
oneOf:
8989
- $ref: "#/components/schemas/BlsPubkey"
9090
- $ref: "#/components/schemas/EcdsaAddress"
9191
object_root:
92-
description: The root of the object to be signed
92+
description: The 32-byte data you want to sign, with optional `0x` prefix.
9393
type: string
9494
format: hex
9595
pattern: "^0x[a-fA-F0-9]{64}$"
@@ -112,7 +112,7 @@ paths:
112112
object_root: "0x3e9f4a78b5c21d64f0b8e3d9a7f5c02b4d1e67a3c8f29b5d6e4a3b1c8f72e6d9"
113113
responses:
114114
"200":
115-
description: Success
115+
description: A successful signature response. The returned signature is the Merkle root hash of the provided `object_root` field and the requesting module's Signing ID as specified in the Commit-Boost configuration. For details on this signature, see the [signature structure documentation](https://commit-boost.github.io/commit-boost-client/developing/prop-commit-signing.md#structure-of-a-signature).
116116
content:
117117
application/json:
118118
schema:
@@ -126,8 +126,45 @@ paths:
126126
value: "0xa3ffa9241f78279f1af04644cb8c79c2d8f02bcf0e28e2f186f6dcccac0a869c2be441fda50f0dea895cfce2e53f0989a3ffa9241f78279f1af04644cb8c79c2d8f02bcf0e28e2f186f6dcccac0a869c2be441fda50f0dea895cfce2e53f0989"
127127
ProxyEcdsa:
128128
value: "0x985b495f49d1b96db3bba3f6c5dd1810950317c10d4c2042bd316f338cdbe74359072e209b85e56ac492092d7860063dd096ca31b4e164ef27e3f8d508e656801c"
129+
"400":
130+
description: |
131+
This can occur in several scenarios:
132+
133+
- You requested an operation while using the Dirk signer mode instead of locally-managed signer mode, but Dirk doesn't support that operation.
134+
- Something went wrong while preparing your request; the error text will provide more information.
135+
content:
136+
application/json:
137+
schema:
138+
type: object
139+
required:
140+
- code
141+
- message
142+
properties:
143+
code:
144+
type: number
145+
example: 400
146+
message:
147+
type: string
148+
example: "Bad request: Invalid pubkey format"
149+
"401":
150+
description: The requesting module did not provide a JWT string in the request's authorization header, or the JWT string was not configured in the signer service's configuration file as belonging to the module.
151+
content:
152+
application/json:
153+
schema:
154+
type: object
155+
required:
156+
- code
157+
- message
158+
properties:
159+
code:
160+
type: number
161+
example: 401
162+
message:
163+
type: string
164+
example: "Unauthorized"
165+
129166
"404":
130-
description: Unknown value (pubkey, etc.)
167+
description: You either requested a route that doesn't exist, or you requested a signature from a key that does not exist.
131168
content:
132169
application/json:
133170
schema:
@@ -142,8 +179,24 @@ paths:
142179
message:
143180
type: string
144181
example: "Unknown pubkey"
182+
"429":
183+
description: Your module attempted and failed JWT authentication too many times recently, and is currently timed out. It cannot make any more requests until the timeout ends.
184+
content:
185+
application/json:
186+
schema:
187+
type: object
188+
required:
189+
- code
190+
- message
191+
properties:
192+
code:
193+
type: number
194+
example: 429
195+
message:
196+
type: string
197+
example: "Too many requests"
145198
"500":
146-
description: Internal error
199+
description: Your request was valid, but something went wrong internally that prevented it from being fulfilled.
147200
content:
148201
application/json:
149202
schema:
@@ -158,6 +211,22 @@ paths:
158211
message:
159212
type: string
160213
example: "Internal error"
214+
"502":
215+
description: The signer service is running in Dirk signer mode, but Dirk could not be reached.
216+
content:
217+
application/json:
218+
schema:
219+
type: object
220+
required:
221+
- code
222+
- message
223+
properties:
224+
code:
225+
type: number
226+
example: 502
227+
message:
228+
type: string
229+
example: "Bad gateway: Dirk signer service is unreachable"
161230

162231
/signer/v1/generate_proxy_key:
163232
post:

docs/docs/developing/prop-commit-signing.md

Lines changed: 0 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -58,118 +58,3 @@ where:
5858
The data signed in a proposer commitment is the 32-byte root of this tree (the green `Root` box). Note that calculating this will involve calculating the Merkle Root of two separate trees: first the blue data subtree (with the original request data and the signing ID) to establish the blue `Root` value, and then again with a tree created from that value and the `Domain`.
5959

6060
Many languages provide libraries for computing the root of an SSZ Merkle tree, such as [fastssz for Go](https://github.com/ferranbt/fastssz) or [tree_hash for Rust](https://docs.rs/tree_hash/latest/tree_hash/). When verifying proposer commitment signatures, use a library that supports Merkle tree root hashing, the `compute_domain()` operation, and validation for signatures generated by your key of choice.
61-
62-
63-
## Requesting a Proposer Commitment from the Signer
64-
65-
Prior to requesting a signature from the signer service, first ensure that Commit Boost has been [configured](#configuring-a-module-for-proposer-commitments) with your module's signing ID and JWT secret.
66-
67-
The signer service can be accessed by an HTTP API. In Docker mode, this will be within the `cb_signer` container at the `/signer/v1/request_signature` route (for example, using the default port of `20000`, the endpoint will be `http://cb_signer:20000/signer/v1/request_signature`). Submitting a request must be done via the `POST` method.
68-
69-
70-
### Headers
71-
72-
- Set `Content-Type` set to `application/json`.
73-
- Set `Accept` to `application/json`, as responses are quoted strings. Other formats are not currently supported.
74-
- Set `Authorization` to a standard JWT string representing your module's JWT authentication information. For the claims, you can add a `module` claim indicating the human-readable name of your module.
75-
76-
77-
### BLS Proposer Keys
78-
79-
If requesting a signature directly from a proposer pubkey, use the following body specification:
80-
81-
```json
82-
{
83-
"type": "consensus",
84-
"pubkey": "0x1234abcd...",
85-
"object_root": "0x01020304..."
86-
}
87-
```
88-
89-
where:
90-
91-
- `pubkey` is the 48-byte BLS public key, with optional `0x` prefix, of the proposer key that you want to request a signature from.
92-
- `object_root` is the 32-byte data you want to sign, with optional `0x` prefix.
93-
94-
95-
### BLS Proxy Keys
96-
97-
If requesting a signature indirectly from a proposer key via a [proxy key](./commit-module.md#with-a-proxy-key), use the following body specification:
98-
99-
```json
100-
{
101-
"type": "proxy_bls",
102-
"proxy": "0x1234abcd...",
103-
"object_root": "0x01020304..."
104-
}
105-
```
106-
107-
where:
108-
109-
- `proxy` is the 48-byte BLS public key, with optional `0x` prefix, of the proxy key that you want to request a signature from.
110-
- `object_root` is the 32-byte data you want to sign, with optional `0x` prefix.
111-
112-
113-
### ECDSA Proxy Keys
114-
115-
**NOTE:** ECDSA proxy key support is not available when using Dirk.
116-
117-
If requesting a signature indirectly from an Ethereum private key via a [proxy key](./commit-module.md#with-a-proxy-key), use the following body specification:
118-
119-
```json
120-
{
121-
"type": "proxy_ecdsa",
122-
"proxy": "0x1234abcd...",
123-
"object_root": "0x01020304..."
124-
}
125-
```
126-
127-
where:
128-
129-
- `proxy` is the 20-byte Ethereum address of the proxy key, with optional `0x` prefix, of the ECDSA private key that you want to request a signature from.
130-
- `object_root` is the 32-byte data you want to sign, with optional `0x` prefix.
131-
132-
133-
### Response
134-
135-
The response for any of the above will be one of the following, provided in plaintext format (not JSON).
136-
137-
138-
#### `200 OK`
139-
140-
A successful signing request, with the signature provided as a plaintext quoted hex-encoded string, with a `0x` prefix. For example, the response body would look like:
141-
```
142-
"0xa43e623f009e615faa3987368f64d6286a4103de70e9a81d82562c50c91eae2d5d6fb9db9fe943aa8ee42fd92d8210c1149f25ed6aa72a557d74a0ed5646fdd0e8255ec58e3e2931695fe913863ba0cdf90d29f651bce0a34169a6f6ce5b3115"
143-
```
144-
145-
#### `401 Unauthorized`
146-
147-
Your module did not provide a JWT string in the request's authorization header, or the JWT string was not configured in the signer service's configuration file as belonging to your module.
148-
149-
150-
#### `400 Bad Request`
151-
152-
This can occur in several scenarios:
153-
154-
- You requested an operation while using the Dirk signer mode instead of locally-managed signer mode, but Dirk doesn't support that operation.
155-
- Something went wrong while preparing your request; the error text will provide more information.
156-
157-
158-
#### `502 Bad Gateway`
159-
160-
The signer service is running in Dirk signer mode, but Dirk could not be reached.
161-
162-
163-
#### `404 Not Found`
164-
165-
You either requested a route that doesn't exist, or you requested a signature from a key that does not exist.
166-
167-
168-
#### `429 Too Many Requests`
169-
170-
Your module attempted and failed JWT authentication too many times recently, and is currently timed out. It cannot make any more requests until the timeout ends.
171-
172-
173-
#### `500 Internal Server Error`
174-
175-
Your request was valid, but something went wrong internally that prevented it from being fulfilled.

0 commit comments

Comments
 (0)