datumesh-engine 0.3.1

The Datumesh engine: the value of a cell as of a time, from stored receipts or by evaluating functions; memoised, and signed for computed cells.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//! The JSON text of a signed receipt.

use datumesh_core::json::{self, Value};
use datumesh_core::Receipt;

/// The canonical JSON text of a whole receipt: its payload (canonical, without `sig`) with
/// `sig` added.
pub(crate) fn receipt_json(r: &Receipt) -> Vec<u8> {
    let mut members = vec![("sig".to_string(), Value::String(r.sig().to_string()))];
    if let Ok(Value::Object(m)) = json::parse(r.payload()) {
        members.extend(m);
    }
    Value::Object(members).to_jcs()
}