Sign existing projection(s) with an exporter key; native proofs stay intact. No JSON-LD expansion, canonicalization or repository mutation occurs. The payload is serialized once and those bytes are handed to DSSE unchanged. # Examples ``` use atomic_canonical::{provenance_export::*, prov::{project, ProvActivityInput}}; use atomic_identity::KeyPair; # let input = ProvActivityInput { change_id_bas
(
projections: &[Value],
keypair: &KeyPair,
)
| 85 | /// # Ok::<(), Box<dyn std::error::Error>>(()) |
| 86 | /// ``` |
| 87 | pub fn sign_provenance_export( |
| 88 | projections: &[Value], |
| 89 | keypair: &KeyPair, |
| 90 | ) -> Result<Envelope, ExportError> { |
| 91 | let payload = ExportPayload { |
| 92 | schema: SCHEMA.into(), |
| 93 | coverage: COVERAGE.into(), |
| 94 | projections: projections.to_vec(), |
| 95 | }; |
| 96 | validate_profile(&payload)?; |
| 97 | let bytes = serde_json::to_vec(&payload)?; |
| 98 | bounded(&bytes)?; |
| 99 | crate::jcs::admit_document(&bytes)?; |
| 100 | let envelope = dsse::sign(PAYLOAD_TYPE, &bytes, &AtomicSigner(keypair))?; |
| 101 | // Base64 and the signature make the container larger than its payload. |
| 102 | // Refuse an export our own consumer would reject. |
| 103 | bounded(&envelope.to_json()?)?; |
| 104 | Ok(envelope) |
| 105 | } |
| 106 | |
| 107 | /// Verify transport and profile using an independently selected exporter key. |
| 108 | /// |