-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathsigner-api.yml
More file actions
696 lines (683 loc) · 29.4 KB
/
signer-api.yml
File metadata and controls
696 lines (683 loc) · 29.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
openapi: "3.1.1"
info:
title: Signer API
version: "0.2.0"
description: API that allows commit modules to request generic signatures from validators
tags:
- name: Signer
- name: Management
paths:
/signer/v1/get_pubkeys:
get:
summary: Get a list of public keys for which signatures may be requested
description: >
This endpoint requires a valid JWT Bearer token.
The token **must include** the following claims:
- `exp` (integer): Expiration timestamp
- `module` (string): The ID of the module making the request, which must match a module ID in the Commit-Boost configuration file.
tags:
- Signer
security:
- BearerAuth: []
responses:
"200":
description: "All public keys available to the module: consensus pubkeys (BLS) and proxies (BLS pubkeys and ECDSA addresses)"
content:
application/json:
schema:
type: object
properties:
keys:
description: List of mappings between consensus pubkeys and their proxies
type: array
items:
type: object
properties:
consensus:
description: Consensus validator pubkey
$ref: "#/components/schemas/BlsPubkey"
proxy_bls:
description: BLS proxy pubkeys
type: array
items:
$ref: "#/components/schemas/BlsPubkey"
proxy_ecdsa:
description: ECDSA proxy addresses
type: array
items:
$ref: "#/components/schemas/EcdsaAddress"
"500":
description: Internal error
content:
application/json:
schema:
type: object
required:
- code
- message
properties:
code:
type: number
example: 500
message:
type: string
example: "Internal error"
/signer/v1/request_signature/bls:
post:
summary: Request a signature for a 32-byte blob of data (typically a hash), signed by the BLS private key for the requested public key.
description: >
This endpoint requires a valid JWT Bearer token.
The token **must include** the following claims:
- `exp` (integer): Expiration timestamp
- `module` (string): The ID of the module making the request, which must match a module ID in the Commit-Boost configuration file.
- `payload_hash` (string): The Keccak-256 hash of the JSON-encoded request body, with optional `0x` prefix. This is required to prevent JWT replay attacks.
tags:
- Signer
security:
- BearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [pubkey, object_root]
properties:
pubkey:
description: The 48-byte BLS public key, with optional `0x` prefix, of the proposer key that you want to request a signature from.
$ref: "#/components/schemas/BlsPubkey"
object_root:
description: The 32-byte data you want to sign, with optional `0x` prefix.
$ref: "#/components/schemas/B256"
nonce:
$ref: "#/components/schemas/Nonce"
example:
pubkey: "0xa3ffa9241f78279f1af04644cb8c79c2d8f02bcf0e28e2f186f6dcccac0a869c2be441fda50f0dea895cfce2e53f0989"
object_root: "0x3e9f4a78b5c21d64f0b8e3d9a7f5c02b4d1e67a3c8f29b5d6e4a3b1c8f72e6d9"
responses:
"200":
description: A successful signature response.
content:
application/json:
schema:
$ref: "#/components/schemas/BlsSignatureResponse"
example:
pubkey: "0x883827193f7627cd04e621e1e8d56498362a52b2a30c9a1c72036eb935c4278dee23d38a24d2f7dda62689886f0c39f4"
object_root: "0x0123456789012345678901234567890123456789012345678901234567890123"
module_signing_id: "0x6a33a23ef26a4836979edff86c493a69b26ccf0b4a16491a815a13787657431b"
signature: "0xa43e623f009e615faa3987368f64d6286a4103de70e9a81d82562c50c91eae2d5d6fb9db9fe943aa8ee42fd92d8210c1149f25ed6aa72a557d74a0ed5646fdd0e8255ec58e3e2931695fe913863ba0cdf90d29f651bce0a34169a6f6ce5b3115"
"400":
description: |
This can occur in several scenarios:
- The Commit-Boost configuration file does not contain a signing ID for the module that made the request.
- You requested an operation while using the Dirk signer mode instead of locally-managed signer mode, but Dirk doesn't support that operation.
- Something went wrong while preparing your request; the error text will provide more information.
content:
application/json:
schema:
type: object
required:
- code
- message
properties:
code:
type: number
example: 400
message:
type: string
example: "Bad request: Invalid pubkey format"
"401":
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.
content:
application/json:
schema:
type: object
required:
- code
- message
properties:
code:
type: number
example: 401
message:
type: string
example: "Unauthorized"
"404":
description: You either requested a route that doesn't exist, or you requested a signature from a key that does not exist.
content:
application/json:
schema:
type: object
required:
- code
- message
properties:
code:
type: number
example: 404
message:
type: string
example: "Unknown pubkey"
"429":
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.
content:
application/json:
schema:
type: object
required:
- code
- message
properties:
code:
type: number
example: 429
message:
type: string
example: "Too many requests"
"500":
description: Your request was valid, but something went wrong internally that prevented it from being fulfilled.
content:
application/json:
schema:
type: object
required:
- code
- message
properties:
code:
type: number
example: 500
message:
type: string
example: "Internal error"
"502":
description: The signer service is running in Dirk signer mode, but Dirk could not be reached.
content:
application/json:
schema:
type: object
required:
- code
- message
properties:
code:
type: number
example: 502
message:
type: string
example: "Bad gateway: Dirk signer service is unreachable"
/signer/v1/request_signature/proxy-bls:
post:
summary: Request a signature for a 32-byte blob of data (typically a hash), signed by the BLS private key for the requested proxy public key.
description: >
This endpoint requires a valid JWT Bearer token.
The token **must include** the following claims:
- `exp` (integer): Expiration timestamp
- `module` (string): The ID of the module making the request, which must match a module ID in the Commit-Boost configuration file.
- `payload_hash` (string): The Keccak-256 hash of the JSON-encoded request body, with optional `0x` prefix. This is required to prevent JWT replay attacks.
tags:
- Signer
security:
- BearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [proxy, object_root]
properties:
proxy:
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.
$ref: "#/components/schemas/BlsPubkey"
object_root:
description: The 32-byte data you want to sign, with optional `0x` prefix.
$ref: "#/components/schemas/B256"
nonce:
$ref: "#/components/schemas/Nonce"
example:
pubkey: "0xa3ffa9241f78279f1af04644cb8c79c2d8f02bcf0e28e2f186f6dcccac0a869c2be441fda50f0dea895cfce2e53f0989"
object_root: "0x3e9f4a78b5c21d64f0b8e3d9a7f5c02b4d1e67a3c8f29b5d6e4a3b1c8f72e6d9"
responses:
"200":
description: A successful signature response.
content:
application/json:
schema:
$ref: "#/components/schemas/BlsSignatureResponse"
example:
pubkey: "0x883827193f7627cd04e621e1e8d56498362a52b2a30c9a1c72036eb935c4278dee23d38a24d2f7dda62689886f0c39f4"
object_root: "0x0123456789012345678901234567890123456789012345678901234567890123"
module_signing_id: "0x6a33a23ef26a4836979edff86c493a69b26ccf0b4a16491a815a13787657431b"
signature: "0xa43e623f009e615faa3987368f64d6286a4103de70e9a81d82562c50c91eae2d5d6fb9db9fe943aa8ee42fd92d8210c1149f25ed6aa72a557d74a0ed5646fdd0e8255ec58e3e2931695fe913863ba0cdf90d29f651bce0a34169a6f6ce5b3115"
"400":
description: |
This can occur in several scenarios:
- The Commit-Boost configuration file does not contain a signing ID for the module that made the request.
- You requested an operation while using the Dirk signer mode instead of locally-managed signer mode, but Dirk doesn't support that operation.
- Something went wrong while preparing your request; the error text will provide more information.
content:
application/json:
schema:
type: object
required:
- code
- message
properties:
code:
type: number
example: 400
message:
type: string
example: "Bad request: Invalid pubkey format"
"401":
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.
content:
application/json:
schema:
type: object
required:
- code
- message
properties:
code:
type: number
example: 401
message:
type: string
example: "Unauthorized"
"404":
description: You either requested a route that doesn't exist, or you requested a signature from a key that does not exist.
content:
application/json:
schema:
type: object
required:
- code
- message
properties:
code:
type: number
example: 404
message:
type: string
example: "Unknown pubkey"
"429":
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.
content:
application/json:
schema:
type: object
required:
- code
- message
properties:
code:
type: number
example: 429
message:
type: string
example: "Too many requests"
"500":
description: Your request was valid, but something went wrong internally that prevented it from being fulfilled.
content:
application/json:
schema:
type: object
required:
- code
- message
properties:
code:
type: number
example: 500
message:
type: string
example: "Internal error"
"502":
description: The signer service is running in Dirk signer mode, but Dirk could not be reached.
content:
application/json:
schema:
type: object
required:
- code
- message
properties:
code:
type: number
example: 502
message:
type: string
example: "Bad gateway: Dirk signer service is unreachable"
/signer/v1/request_signature/proxy-ecdsa:
post:
summary: Request a signature for a 32-byte blob of data (typically a hash), signed by the ECDSA private key for the requested proxy Ethereum address.
description: >
This endpoint requires a valid JWT Bearer token.
The token **must include** the following claims:
- `exp` (integer): Expiration timestamp
- `module` (string): The ID of the module making the request, which must match a module ID in the Commit-Boost configuration file.
- `payload_hash` (string): The Keccak-256 hash of the JSON-encoded request body, with optional `0x` prefix. This is required to prevent JWT replay attacks.
tags:
- Signer
security:
- BearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [proxy, object_root]
properties:
proxy:
description: The 20-byte Ethereum address, with optional `0x` prefix, of the proxy key that you want to request a signature from.
$ref: "#/components/schemas/EcdsaAddress"
object_root:
description: The 32-byte data you want to sign, with optional `0x` prefix.
$ref: "#/components/schemas/B256"
nonce:
$ref: "#/components/schemas/Nonce"
example:
proxy: "0x71f65e9f6336770e22d148bd5e89b391a1c3b0bb"
object_root: "0x3e9f4a78b5c21d64f0b8e3d9a7f5c02b4d1e67a3c8f29b5d6e4a3b1c8f72e6d9"
responses:
"200":
description: A successful signature response.
content:
application/json:
schema:
$ref: "#/components/schemas/EcdsaSignatureResponse"
example:
address: "0x71f65e9f6336770e22d148bd5e89b391a1c3b0bb"
object_root: "0x3e9f4a78b5c21d64f0b8e3d9a7f5c02b4d1e67a3c8f29b5d6e4a3b1c8f72e6d9"
module_signing_id: "0x6a33a23ef26a4836979edff86c493a69b26ccf0b4a16491a815a13787657431b"
signature: "0x985b495f49d1b96db3bba3f6c5dd1810950317c10d4c2042bd316f338cdbe74359072e209b85e56ac492092d7860063dd096ca31b4e164ef27e3f8d508e656801c"
"400":
description: |
This can occur in several scenarios:
- The Commit-Boost configuration file does not contain a signing ID for the module that made the request.
- You requested an operation while using the Dirk signer mode instead of locally-managed signer mode, but Dirk doesn't support that operation.
- Something went wrong while preparing your request; the error text will provide more information.
content:
application/json:
schema:
type: object
required:
- code
- message
properties:
code:
type: number
example: 400
message:
type: string
example: "Bad request: Invalid pubkey format"
"401":
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.
content:
application/json:
schema:
type: object
required:
- code
- message
properties:
code:
type: number
example: 401
message:
type: string
example: "Unauthorized"
"404":
description: You either requested a route that doesn't exist, or you requested a signature from a key that does not exist.
content:
application/json:
schema:
type: object
required:
- code
- message
properties:
code:
type: number
example: 404
message:
type: string
example: "Unknown pubkey"
"429":
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.
content:
application/json:
schema:
type: object
required:
- code
- message
properties:
code:
type: number
example: 429
message:
type: string
example: "Too many requests"
"500":
description: Your request was valid, but something went wrong internally that prevented it from being fulfilled.
content:
application/json:
schema:
type: object
required:
- code
- message
properties:
code:
type: number
example: 500
message:
type: string
example: "Internal error"
"502":
description: The signer service is running in Dirk signer mode, but Dirk could not be reached.
content:
application/json:
schema:
type: object
required:
- code
- message
properties:
code:
type: number
example: 502
message:
type: string
example: "Bad gateway: Dirk signer service is unreachable"
/signer/v1/generate_proxy_key:
post:
summary: Request a proxy key be generated for a specific consensus pubkey
description: >
This endpoint requires a valid JWT Bearer token.
The token **must include** the following claims:
- `exp` (integer): Expiration timestamp
- `module` (string): The ID of the module making the request, which must match a module ID in the Commit-Boost configuration file.
- `payload_hash` (string): The Keccak-256 hash of the JSON-encoded request body, with optional `0x` prefix. This is required to prevent JWT replay attacks.
tags:
- Signer
security:
- BearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [pubkey, scheme]
properties:
pubkey:
description: a validator BLS public key for which to generate a proxy key
allOf:
- $ref: "#/components/schemas/BlsPubkey"
scheme:
description: signature scheme to generate proxy keypair for
type: string
enum: [bls, ecdsa]
examples:
Bls:
value:
pubkey: "0xa9e9cff900de07e295a044789fd4bdb6785eb0651ad282f9e76d12afd87e75180bdd64caf2e315b815d7322bd31ab48a"
scheme: "bls"
Ecdsa:
value:
pubkey: "0xa9e9cff900de07e295a044789fd4bdb6785eb0651ad282f9e76d12afd87e75180bdd64caf2e315b815d7322bd31ab48a"
scheme: "ecdsa"
responses:
"200":
description: Success
content:
application/json:
schema:
type: object
properties:
message:
type: object
properties:
delegator:
description: the validator BLS public key for which the proxy key was generated (the same one as requested)
allOf:
- $ref: "#/components/schemas/BlsPubkey"
proxy:
description: the generated proxy identifier (BLS pubkey or ECDSA address)
oneOf:
- $ref: "#/components/schemas/BlsPubkey"
- $ref: "#/components/schemas/EcdsaAddress"
signature:
description: The signature of the proxy delegation
allOf:
- $ref: "#/components/schemas/BlsSignature"
examples:
Bls:
value:
message:
delegator: "0xa9e9cff900de07e295a044789fd4bdb6785eb0651ad282f9e76d12afd87e75180bdd64caf2e315b815d7322bd31ab48a"
proxy: "0xb646318d81b7cff3f8aae5040eab11927b4a99542c02970a1ab8069a83e5b76b302705d0b5e0054831ce2af72088bf30"
signature: "0x88274f2d78d30ae429cc16f5c64657b491ccf26291c821cf953da34f16d60947d4f245decdce4a492e8d8f949482051b184aaa890d5dd97788387689335a1fee37cbe55c0227f81b073ce6e93b45f96169f497ed322d3d384d79ccaa7846d5ab"
Ecdsa:
value:
message:
delegator: "0xa9e9cff900de07e295a044789fd4bdb6785eb0651ad282f9e76d12afd87e75180bdd64caf2e315b815d7322bd31ab48a"
proxy: "0x71f65e9f6336770e22d148bd5e89b391a1c3b0bb"
signature: "0xb5b5b71d1701cc45086af3d3d86bf9d3c509442835e5b9f7734923edc9a6c538e743d70613cdef90b7e5b171fbbe6a29075b3f155e4bd66d81ff9dbc3b6d7fa677d169b2ceab727ffa079a31fe1fc0e478752e9da9566a9408e4db24ac6104db"
"404":
description: Unknown value (pubkey, etc.)
content:
application/json:
schema:
type: object
required:
- code
- message
properties:
code:
type: number
example: 404
message:
type: string
example: "Unknown pubkey"
"500":
description: Internal error
content:
application/json:
schema:
type: object
required:
- code
- message
properties:
code:
type: number
example: 500
message:
type: string
example: "Internal error"
components:
securitySchemes:
BearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
schemas:
B256:
type: string
format: hex
pattern: "^0x[a-fA-F0-9]{64}$"
example: "0x3e9f4a78b5c21d64f0b8e3d9a7f5c02b4d1e67a3c8f29b5d6e4a3b1c8f72e6d9"
BlsPubkey:
type: string
format: hex
pattern: "^0x[a-fA-F0-9]{96}$"
example: "0xa9e9cff900de07e295a044789fd4bdb6785eb0651ad282f9e76d12afd87e75180bdd64caf2e315b815d7322bd31ab48a"
EcdsaAddress:
type: string
format: hex
pattern: "^0x[a-fA-F0-9]{40}$"
example: "0x71f65e9f6336770e22d148bd5e89b391a1c3b0bb"
BlsSignature:
type: string
format: hex
pattern: "^0x[a-fA-F0-9]{192}$"
example: "0xa3ffa9241f78279f1af04644cb8c79c2d8f02bcf0e28e2f186f6dcccac0a869c2be441fda50f0dea895cfce2e53f0989a3ffa9241f78279f1af04644cb8c79c2d8f02bcf0e28e2f186f6dcccac0a869c2be441fda50f0dea895cfce2e53f0989"
EcdsaSignature:
type: string
format: hex
pattern: "^0x[a-fA-F0-9]{130}$"
example: "0x985b495f49d1b96db3bba3f6c5dd1810950317c10d4c2042bd316f338cdbe74359072e209b85e56ac492092d7860063dd096ca31b4e164ef27e3f8d508e656801c"
BlsSignatureResponse:
type: object
properties:
pubkey:
description: The BLS public key corresponding to the private key that was used to sign the request
$ref: "#/components/schemas/BlsPubkey"
object_root:
description: The 32-byte data that was signed, with `0x` prefix
$ref: "#/components/schemas/B256"
module_signing_id:
description: The signing ID of the module that requested the signature, as specified in the Commit-Boost configuration
$ref: "#/components/schemas/B256"
nonce:
$ref: "#/components/schemas/Nonce"
chain_id:
description: The chain ID that the signature is valid for, as specified in the Commit-Boost configuration
type: integer
example: 1
signature:
description: The BLS signature of the Merkle root hash of the provided `object_root` field and the requesting module's Signing ID. 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).
$ref: "#/components/schemas/BlsSignature"
EcdsaSignatureResponse:
type: object
properties:
address:
description: The ECDSA address corresponding to the private key that was used to sign the request
$ref: "#/components/schemas/EcdsaAddress"
object_root:
description: The 32-byte data that was signed, with `0x` prefix
$ref: "#/components/schemas/B256"
module_signing_id:
description: The signing ID of the module that requested the signature, as specified in the Commit-Boost configuration
$ref: "#/components/schemas/B256"
nonce:
$ref: "#/components/schemas/Nonce"
chain_id:
description: The chain ID that the signature is valid for, as specified in the Commit-Boost configuration
type: integer
example: 1
signature:
description: The ECDSA signature (in Ethereum RSV format) of the Merkle root hash of the provided `object_root` field and the requesting module's Signing ID. 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).
$ref: "#/components/schemas/EcdsaSignature"
Nonce:
type: integer
description: If your module tracks nonces per signature (e.g., to prevent replay attacks), this is the unique nonce to use for the signature. It should be an unsigned 64-bit integer in big-endian format. It must be between 0 and 2^64-2, inclusive. If your module doesn't use nonces, we suggest setting this to 2^64-1 instead of 0 because 0 is a legal nonce and will cause complications with your module if you ever want to use a nonce in the future.
minimum: 0
maximum: 18446744073709551614 // 2^64-2
example: 1