-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproof-of-play.yaml
More file actions
697 lines (665 loc) · 19 KB
/
proof-of-play.yaml
File metadata and controls
697 lines (665 loc) · 19 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
697
openapi: 3.0.3
info:
title: Trillboards Proof-of-Play API
version: 2.0.0
description: |
Cryptographically signed proofs of ad impressions for advertisers.
## Overview
This API provides cryptographically signed proof-of-play records for ad impressions.
Each proof contains an Ed25519 signature that can be independently verified by
third parties using our public key.
## Signature Verification
1. Fetch the public key from `/.well-known/public-key`
2. Build the payload: `version.timestamp.adId.impressionId.screenId.deviceId`
3. Verify using Ed25519: `verify(signature, payload, publicKey)`
## Signature Versions
- **v2 (current)**: Ed25519 signatures - third-party verifiable
- **v1 (deprecated)**: HMAC-SHA256 - requires shared secret
contact:
name: Trillboards API Support
url: https://trillboards.com/support
email: api@trillboards.com
license:
name: Proprietary
url: https://trillboards.com/terms
servers:
- url: https://api.trillboards.com/v1/advertiser/proof
description: Production
- url: http://localhost:4004/v1/advertiser/proof
description: Development
tags:
- name: Public Key
description: Public key for signature verification (no auth required)
- name: Proofs
description: Retrieve signed proof-of-play records
- name: Verification
description: Verify proof signatures
- name: Export
description: Batch export proofs
paths:
/.well-known/public-key:
get:
tags: [Public Key]
summary: Get public key for signature verification
description: |
Returns the Ed25519 public key used to sign all v2 proofs.
Third parties can use this key to independently verify signatures.
**No authentication required.**
operationId: getPublicKey
security: []
responses:
'200':
description: Public key information
content:
application/json:
schema:
$ref: '#/components/schemas/PublicKeyResponse'
example:
success: true
publicKey: "a5a9c43785680c62ebcd01ec49a0d6055fd140023df0f142c3e37c6abafce34f"
algorithm: "ed25519"
version: "v2"
keyId: "proof-v2-2026"
documentation: "https://api.trillboards.com/docs/proof-of-play"
/campaigns/{campaignId}/proof:
get:
tags: [Proofs]
summary: Get proofs for a campaign
description: |
Returns cryptographically signed proofs for all completed impressions
in the specified campaign. Supports cursor-based pagination for large datasets.
operationId: getCampaignProofs
security:
- bearerAuth: []
parameters:
- name: campaignId
in: path
required: true
description: Campaign/Advertisement ID
schema:
type: string
- name: startDate
in: query
description: Filter proofs after this date (ISO 8601)
schema:
type: string
format: date-time
- name: endDate
in: query
description: Filter proofs before this date (ISO 8601)
schema:
type: string
format: date-time
- name: limit
in: query
description: Maximum number of proofs to return (default 1000, max 10000)
schema:
type: integer
default: 1000
maximum: 10000
- name: cursor
in: query
description: Pagination cursor from previous response
schema:
type: string
responses:
'200':
description: Campaign proofs
content:
application/json:
schema:
$ref: '#/components/schemas/CampaignProofsResponse'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
/screens/{screenId}/proof:
get:
tags: [Proofs]
summary: Get proofs for a screen
description: Returns proofs for all completed impressions on the specified screen.
operationId: getScreenProofs
security:
- bearerAuth: []
parameters:
- name: screenId
in: path
required: true
description: Screen ID
schema:
type: string
- name: startDate
in: query
schema:
type: string
format: date-time
- name: endDate
in: query
schema:
type: string
format: date-time
- name: limit
in: query
schema:
type: integer
default: 500
maximum: 5000
- name: cursor
in: query
schema:
type: string
responses:
'200':
description: Screen proofs
content:
application/json:
schema:
$ref: '#/components/schemas/ScreenProofsResponse'
'401':
$ref: '#/components/responses/Unauthorized'
/campaigns/{campaignId}/audience-proof:
get:
tags: [Proofs]
summary: Get audience-enhanced proofs
description: |
Returns aggregated audience data with privacy protection.
Individual audience members are not exposed - only aggregate statistics.
operationId: getAudienceProofs
security:
- bearerAuth: []
parameters:
- name: campaignId
in: path
required: true
schema:
type: string
- name: startDate
in: query
schema:
type: string
format: date-time
- name: endDate
in: query
schema:
type: string
format: date-time
responses:
'200':
description: Audience proofs
content:
application/json:
schema:
$ref: '#/components/schemas/AudienceProofsResponse'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
/verify-proof:
post:
tags: [Verification]
summary: Verify a proof signature
description: |
Verify the cryptographic signature of a proof.
Supports both v1 (HMAC) and v2 (Ed25519) signatures.
**No authentication required** - third parties can verify proofs independently.
operationId: verifyProof
security: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/VerifyProofRequest'
example:
signature: "ed25519=a1b2c3..."
timestamp: 1705401600000
adId: "campaign-123"
impressionId: "imp-456"
screenId: "screen-789"
deviceId: "device-abc"
responses:
'200':
description: Verification result
content:
application/json:
schema:
$ref: '#/components/schemas/VerifyProofResponse'
'400':
description: Missing required fields
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/campaigns/{campaignId}/export-proof:
post:
tags: [Export]
summary: Export proofs in batch format
description: Export proofs as JSON or CSV for offline verification.
operationId: exportProofs
security:
- bearerAuth: []
parameters:
- name: campaignId
in: path
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
type: object
properties:
format:
type: string
enum: [json, csv]
default: json
startDate:
type: string
format: date-time
endDate:
type: string
format: date-time
responses:
'200':
description: Export data
content:
application/json:
schema:
$ref: '#/components/schemas/ExportProofsResponse'
text/csv:
schema:
type: string
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
/signature-info:
get:
tags: [Public Key]
summary: Get signature format documentation
description: Returns information about the signature format for integrators.
operationId: getSignatureInfo
security: []
responses:
'200':
description: Signature format info
content:
application/json:
schema:
$ref: '#/components/schemas/SignatureInfoResponse'
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
description: JWT token from /v1/user/login
schemas:
Proof:
type: object
required:
- impressionId
- adId
- timestamp
- signature
- signatureVersion
properties:
impressionId:
type: string
description: Unique impression identifier
adId:
type: string
description: Campaign/Advertisement ID
screenId:
type: string
description: Screen that displayed the ad
deviceId:
type: string
description: Device identifier
timestamp:
type: string
format: date-time
description: When the impression occurred
eventType:
type: string
enum: [impression, start, firstQuartile, midpoint, thirdQuartile, complete]
description: VAST event type
signature:
type: string
description: "Cryptographic signature (format: ed25519=<hex> or sha256=<hex>)"
example: "ed25519=a1b2c3d4e5f6..."
signatureVersion:
type: string
enum: [v1, v2]
description: Signature version (v2 = Ed25519, v1 = HMAC)
verifiedAt:
type: string
format: date-time
description: When the proof was generated
viewability:
$ref: '#/components/schemas/Viewability'
displayContext:
$ref: '#/components/schemas/DisplayContext'
audience:
$ref: '#/components/schemas/AudienceData'
Viewability:
type: object
properties:
viewable:
type: boolean
description: Whether the ad was viewable (IAB standards)
viewableTime:
type: number
description: Time the ad was viewable (milliseconds)
percentInView:
type: number
description: Percentage of ad visible (0-100)
DisplayContext:
type: object
properties:
mode:
type: string
enum: [fullscreen, l-bar, split]
description: Display mode
areaRatio:
type: number
description: Ratio of screen area used (0-1)
AudienceData:
type: object
properties:
faceCount:
type: integer
description: Number of faces detected
attentionScore:
type: number
description: Average attention score (0-1)
incomeLevel:
type: string
enum: [low, medium, high, premium]
Pagination:
type: object
properties:
limit:
type: integer
description: Requested limit
hasMore:
type: boolean
description: Whether more results exist
nextCursor:
type: string
nullable: true
description: Cursor for next page (null if no more results)
PublicKeyResponse:
type: object
properties:
success:
type: boolean
publicKey:
type: string
description: Hex-encoded Ed25519 public key
algorithm:
type: string
enum: [ed25519]
version:
type: string
keyId:
type: string
documentation:
type: string
format: uri
CampaignProofsResponse:
type: object
properties:
success:
type: boolean
data:
type: object
properties:
campaignId:
type: string
queryPeriod:
type: object
properties:
startDate:
type: string
endDate:
type: string
totalImpressions:
type: integer
nullable: true
description: Total count (only on first page)
proofsReturned:
type: integer
proofs:
type: array
items:
$ref: '#/components/schemas/Proof'
pagination:
$ref: '#/components/schemas/Pagination'
signatureVersion:
type: string
publicKeyUrl:
type: string
generatedAt:
type: string
format: date-time
ScreenProofsResponse:
type: object
properties:
success:
type: boolean
data:
type: object
properties:
screenId:
type: string
screenName:
type: string
location:
type: object
totalProofs:
type: integer
proofs:
type: array
items:
$ref: '#/components/schemas/Proof'
pagination:
$ref: '#/components/schemas/Pagination'
signatureVersion:
type: string
generatedAt:
type: string
format: date-time
AudienceProofsResponse:
type: object
properties:
success:
type: boolean
data:
type: object
properties:
campaignId:
type: string
queryPeriod:
type: object
totalImpressions:
type: integer
screenBreakdown:
type: array
items:
type: object
properties:
screenId:
type: string
impressions:
type: integer
period:
type: object
properties:
first:
type: string
format: date-time
last:
type: string
format: date-time
aggregateSignature:
type: string
signatureVersion:
type: string
privacyMode:
type: string
enum: [aggregated]
generatedAt:
type: string
format: date-time
VerifyProofRequest:
type: object
required:
- signature
- timestamp
properties:
signature:
type: string
description: "Signature to verify (format: ed25519=<hex> or sha256=<hex>)"
signatureVersion:
type: string
enum: [v1, v2]
description: Optional explicit version (auto-detected from prefix)
timestamp:
oneOf:
- type: integer
description: Unix timestamp (milliseconds)
- type: string
format: date-time
adId:
type: string
impressionId:
type: string
screenId:
type: string
deviceId:
type: string
VerifyProofResponse:
type: object
properties:
success:
type: boolean
verification:
type: object
properties:
valid:
type: boolean
description: Whether the signature is valid
version:
type: string
enum: [v1, v2]
reason:
type: string
description: Reason for invalid signature (if applicable)
publicKeyUrl:
type: string
verifiedAt:
type: string
format: date-time
ExportProofsResponse:
type: object
properties:
success:
type: boolean
data:
type: object
properties:
campaignId:
type: string
format:
type: string
proofCount:
type: integer
data:
type: array
items:
$ref: '#/components/schemas/Proof'
checksum:
type: string
description: SHA256 checksum of the export data
signatureVersion:
type: string
publicKeyUrl:
type: string
exportedAt:
type: string
format: date-time
expiresAt:
type: string
format: date-time
SignatureInfoResponse:
type: object
properties:
success:
type: boolean
signatureInfo:
type: object
properties:
currentVersion:
type: string
algorithm:
type: string
publicKey:
type: string
publicKeyUrl:
type: string
payloadFormat:
type: string
signaturePrefix:
type: string
verificationEndpoint:
type: string
documentation:
type: string
legacySupport:
type: object
ErrorResponse:
type: object
properties:
success:
type: boolean
enum: [false]
message:
type: string
error:
type: string
responses:
Unauthorized:
description: Missing or invalid authentication token
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
success: false
message: "Authentication required"
Forbidden:
description: Not authorized to access this resource
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
success: false
message: "Not authorized to access this campaign"
NotFound:
description: Resource not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
success: false
message: "Campaign not found"