DSSEEnvelopeFromBundleBytes extracts a DSSE envelope from the protojson-encoded bytes of a Sigstore bundle. It validates that the bundle carries a DSSE envelope with at least one signature, since callers (and DSSEEnvelopeFromBundle) assume that invariant.
(bundle []byte)
| 103 | // It validates that the bundle carries a DSSE envelope with at least one signature, since callers |
| 104 | // (and DSSEEnvelopeFromBundle) assume that invariant. |
| 105 | func DSSEEnvelopeFromBundleBytes(bundle []byte) (*dsse.Envelope, error) { |
| 106 | var attBundle protobundle.Bundle |
| 107 | if err := protojson.Unmarshal(bundle, &attBundle); err != nil { |
| 108 | return nil, fmt.Errorf("unmarshalling bundle: %w", err) |
| 109 | } |
| 110 | if len(attBundle.GetDsseEnvelope().GetSignatures()) == 0 { |
| 111 | return nil, fmt.Errorf("invalid attestation bundle: missing DSSE signature") |
| 112 | } |
| 113 | return DSSEEnvelopeFromBundle(&attBundle), nil |
| 114 | } |
| 115 | |
| 116 | // FixSignatureInBundle removes any additional base64 encoding from the signature in the bundle. |
| 117 | // Kept for backward compatibility with attestations stored before the fix for |
no test coverage detected