(sigs *Signatures)
| 457 | func (rs *signaturesSection) Name() string { return "signatures" } |
| 458 | |
| 459 | func newSignaturesSection(sigs *Signatures) (*signaturesSection, error) { |
| 460 | var ss signaturesSection |
| 461 | enc := cbor.NewEncoder(&ss) |
| 462 | |
| 463 | enc.EncodeArrayHeader(2) |
| 464 | |
| 465 | enc.EncodeArrayHeader(len(sigs.Authorities)) |
| 466 | for _, auth := range sigs.Authorities { |
| 467 | if err := auth.EncodeTo(enc); err != nil { |
| 468 | return nil, err |
| 469 | } |
| 470 | } |
| 471 | |
| 472 | enc.EncodeArrayHeader(len(sigs.VouchedSubsets)) |
| 473 | for _, vs := range sigs.VouchedSubsets { |
| 474 | mes := []*cbor.MapEntryEncoder{ |
| 475 | cbor.GenerateMapEntry(func(keyE *cbor.Encoder, valueE *cbor.Encoder) { |
| 476 | keyE.EncodeTextString("authority") |
| 477 | valueE.EncodeUint(vs.Authority) |
| 478 | }), |
| 479 | cbor.GenerateMapEntry(func(keyE *cbor.Encoder, valueE *cbor.Encoder) { |
| 480 | keyE.EncodeTextString("sig") |
| 481 | valueE.EncodeByteString(vs.Sig) |
| 482 | }), |
| 483 | cbor.GenerateMapEntry(func(keyE *cbor.Encoder, valueE *cbor.Encoder) { |
| 484 | keyE.EncodeTextString("signed") |
| 485 | valueE.EncodeByteString(vs.Signed) |
| 486 | }), |
| 487 | } |
| 488 | if err := enc.EncodeMap(mes); err != nil { |
| 489 | return nil, err |
| 490 | } |
| 491 | } |
| 492 | |
| 493 | return &ss, nil |
| 494 | } |
| 495 | |
| 496 | func addExchange(is *indexSection, rs *responsesSection, e *Exchange) error { |
| 497 | offset, length, err := rs.addResponse(e.Response) |
no test coverage detected