datumesh-core 0.3.3

Datumesh protocol core: strict JSON and JCS, canonical forms, cell URIs, receipts, keys, envelopes and offline verification.
Documentation
//! Fixtures of the resolver test kit. Generated by `tests/testkit_data.rs` from the spec-0.3.0
//! vectors and, for the entries marked `generated:`, signed with feature `sign` using the
//! vectors' seeds. Do not edit; regenerate with
//! `DATUMESH_TESTKIT_WRITE=1 cargo test -p datumesh-core --features testkit,sign --test testkit_data`.

/// Key documents: host, JCS text.
pub(super) const KEY_DOCUMENTS: &[(&str, &str)] = &[
    ("calc.example.net", r##"{"host":"calc.example.net","keys":[{"alg":"ed25519","id":"f7ec60a92abf4774","public":"ccd4faa3a0b8338bc796d3bfc30bda2f6e87d336a576b70dc9d47cbfe0e8830f","valid_from":"2020-01-01T00:00:00.000000Z"}],"proto":"datumesh/1"}"##),
    ("rates.example.org", r##"{"host":"rates.example.org","keys":[{"alg":"ed25519","id":"d712b32a2cc5cb7c","public":"843baeb22bfd0364fb1b7262b367fb3202e7886c69a070fecf8e343fedb1eabf","valid_from":"2020-01-01T00:00:00.000000Z","valid_to":"2024-06-01T00:00:00.000000Z"},{"alg":"ed25519","id":"d9a2df65559c4444","public":"3ecf7b3ff834cb6782f5405dfcb213b5e78c0f30188068c25568adc25a739b52","valid_from":"2024-06-01T00:00:00.000000Z"}],"proto":"datumesh/1"}"##),
];

/// Descriptors loaded: source, JCS text.
pub(super) const DESCRIPTORS: &[(&str, &str)] = &[
    ("receipt/stored-number recompute.descriptor (fx_rate, stored)", r##"{"code":{"body":"","lang":"stored"},"inputs":[],"signature":{"args":{"base":{"type":"string","valid":false},"date":{"type":"date","valid":true},"quote":{"type":"string","valid":false}},"returns":{"type":"number","unit":{"of":{"arg":"quote"},"per":{"arg":"base"}}}}}"##),
    ("function/computed-convert (convert, expr)", r##"{"code":{"body":"amount * rates.example.org/fx_rate(base: base, date: date, quote: quote)\n","lang":"expr"},"inputs":["rates.example.org/fx_rate"],"signature":{"args":{"amount":{"type":"number","unit":{"arg":"base"},"valid":false},"base":{"type":"string","valid":false},"date":{"type":"date","valid":true},"quote":{"type":"string","valid":false}},"returns":{"type":"number","unit":{"arg":"quote"}}}}"##),
];

/// Receipts loaded: name, source, JCS text.
pub(super) const RECEIPTS: &[(&str, &str, &str)] = &[
    ("stored-number", "receipt/stored-number", r##"{"asof":"2024-03-16T09:00:00.000000Z","cell":{"args":{"base":{"type":"string","value":"EUR"},"date":{"type":"date","value":"2024-03-15"},"quote":{"type":"string","value":"USD"}},"fn":"fx_rate","fn_hash":"7b58ecb8fd23b644c87951d0bd609790ff547cbb23fed27186c669ce2ce0aa80","ns":"rates.example.org"},"computed_by":"rates.example.org#d712b32a2cc5cb7c","inputs":[],"issued":"2024-03-16T09:00:00.000000Z","licence":"CC-BY-4.0","proto":"datumesh/1","publisher":"rates.example.org","sig":"ddf61d49ff6593f7b0d94c76f19fefdd27f47778740b3666fc1c3315ec00c5d216f887c4078deb05c83d4d743453c6fecc568473663b3282ac4eda8c3eadcf01","summary":"1 EUR was worth 1.0892 USD at the 15 March 2024 reference rate.","tx":"2024-03-15T16:00:00.000000Z","type":"number","valid":{"date":{"type":"date","value":"2024-03-15"}},"value":"1.0892"}"##),
    ("computed-with-lineage", "receipt/computed-with-lineage", r##"{"asof":"2024-03-16T09:00:00.000000Z","cell":{"args":{"amount":{"type":"number","value":"100"},"base":{"type":"string","value":"EUR"},"date":{"type":"date","value":"2024-03-15"},"quote":{"type":"string","value":"USD"}},"fn":"convert","fn_hash":"014fc97eb3a442ab28a96d89131ccfd11c9eec8187595578c212b392d0702c71","ns":"calc.example.net"},"computed_by":"calc.example.net#f7ec60a92abf4774","inputs":["19a5fe3a744c5792f747fb4c286ce396ab44b95922de4f07937502fe595b6f81"],"issued":"2024-03-16T09:00:01.250000Z","licence":"CC-BY-4.0","proto":"datumesh/1","publisher":"calc.example.net","sig":"3d1409f50334c98518bb2957688407708c2a53adaf43e2742fd9933ea1ab15a0f69fcc10b9e29c3e5c0bb7339ddc734e8cc35cec345a8a9c7b032555f02bf201","summary":"100 EUR converted to USD at the 15 March 2024 rate is 108.92.","tx":"2024-03-15T16:00:00.000000Z","type":"number","valid":{"date":{"type":"date","value":"2024-03-15"}},"value":"108.92"}"##),
    ("computed-two-inputs", "receipt/computed-two-inputs", r##"{"asof":"2024-03-16T09:00:00.000000Z","cell":{"args":{"amount":{"type":"number","value":"100"},"base":{"type":"string","value":"EUR"},"date":{"type":"date","value":"2024-03-15"},"quote":{"type":"string","value":"GBP"}},"fn":"convert","fn_hash":"014fc97eb3a442ab28a96d89131ccfd11c9eec8187595578c212b392d0702c71","ns":"calc.example.net"},"computed_by":"calc.example.net#f7ec60a92abf4774","inputs":["19a5fe3a744c5792f747fb4c286ce396ab44b95922de4f07937502fe595b6f81","9b34fa55582d96c85949bc64673dd89aa9c19b5c104362bbb3cd37e61ec699ac"],"issued":"2024-03-16T09:00:00.000000Z","licence":"CC-BY-4.0","proto":"datumesh/1","publisher":"calc.example.net","sig":"45f420e754b02ecd53aef711b0449c097fe0610f20a847582b231c6d85d271ffd652667b981c2c305f591dd06ca497c4b04536578cb94741ab333a9e6302730e","summary":"Two inputs, listed in ascending hash order.","tx":"2024-03-15T16:00:00.000000Z","type":"number","valid":{"date":{"type":"date","value":"2024-03-15"}},"value":"85.56"}"##),
    ("timeline-1", "generated: fx_rate EUR/CHF, first version", r##"{"asof":"2024-03-16T09:00:00.000000Z","cell":{"args":{"base":{"type":"string","value":"EUR"},"date":{"type":"date","value":"2024-03-15"},"quote":{"type":"string","value":"CHF"}},"fn":"fx_rate","fn_hash":"7b58ecb8fd23b644c87951d0bd609790ff547cbb23fed27186c669ce2ce0aa80","ns":"rates.example.org"},"computed_by":"rates.example.org#d712b32a2cc5cb7c","inputs":[],"issued":"2024-03-16T09:00:00.000000Z","licence":"CC-BY-4.0","proto":"datumesh/1","publisher":"rates.example.org","sig":"ae1a1fbcda2e46bb401c6b092f261083bf8dad3e72c207362df27f7406ba82adfac131c9a0aa586d0197ceec8db6777c18f71ec2903f637c3de68a78353df702","summary":"1 EUR was worth 0.9581 CHF at the 15 March 2024 reference rate.","tx":"2024-03-15T16:00:00.000000Z","type":"number","valid":{"date":{"type":"date","value":"2024-03-15"}},"value":"0.9581"}"##),
    ("timeline-2", "generated: fx_rate EUR/CHF, second version", r##"{"asof":"2024-03-18T10:00:00.000000Z","cell":{"args":{"base":{"type":"string","value":"EUR"},"date":{"type":"date","value":"2024-03-15"},"quote":{"type":"string","value":"CHF"}},"fn":"fx_rate","fn_hash":"7b58ecb8fd23b644c87951d0bd609790ff547cbb23fed27186c669ce2ce0aa80","ns":"rates.example.org"},"computed_by":"rates.example.org#d712b32a2cc5cb7c","inputs":[],"issued":"2024-03-18T10:00:00.000000Z","licence":"CC-BY-4.0","proto":"datumesh/1","publisher":"rates.example.org","sig":"6d11217e3080b25cc4107451a1a80635941aded12b68ba0f56ea933924b5666adf597d47794997d91d6f87378fa896755407c16503838f0c712801b7b99af407","summary":"1 EUR was worth 0.9579 CHF at the 15 March 2024 reference rate, as corrected on 18 March.","tx":"2024-03-18T10:00:00.000000Z","type":"number","valid":{"date":{"type":"date","value":"2024-03-15"}},"value":"0.9579"}"##),
];

/// Receipts verified but never loaded: name, source, text as given.
pub(super) const PROBES: &[(&str, &str, &str)] = &[
    ("timeline-0", "generated: fx_rate EUR/CHF before its first version", r##"{"asof":"2024-03-15T09:00:00.000000Z","cell":{"args":{"base":{"type":"string","value":"EUR"},"date":{"type":"date","value":"2024-03-15"},"quote":{"type":"string","value":"CHF"}},"fn":"fx_rate","fn_hash":"7b58ecb8fd23b644c87951d0bd609790ff547cbb23fed27186c669ce2ce0aa80","ns":"rates.example.org"},"computed_by":"rates.example.org#d712b32a2cc5cb7c","inputs":[],"issued":"2024-03-15T09:00:00.000000Z","licence":"CC-BY-4.0","proto":"datumesh/1","publisher":"rates.example.org","sig":"c65fa829a74e82c618b8d890f960178fa5b43a7b906daa65837588c62ee2ecb19187edb9ee2dc5a98c1c9ea8b90cdbb4d05d1b758e3cc564c0b55f57e7d20e01","summary":"A provisional 15 March 2024 EUR/CHF rate, recorded before any version the kit loads.","tx":"2024-03-14T16:00:00.000000Z","type":"number","valid":{"date":{"type":"date","value":"2024-03-15"}},"value":"0.96"}"##),
    ("timeline-1-later", "generated: fx_rate EUR/CHF first version, later asof", r##"{"asof":"2024-03-17T12:00:00.000000Z","cell":{"args":{"base":{"type":"string","value":"EUR"},"date":{"type":"date","value":"2024-03-15"},"quote":{"type":"string","value":"CHF"}},"fn":"fx_rate","fn_hash":"7b58ecb8fd23b644c87951d0bd609790ff547cbb23fed27186c669ce2ce0aa80","ns":"rates.example.org"},"computed_by":"rates.example.org#d712b32a2cc5cb7c","inputs":[],"issued":"2024-03-17T12:00:00.000000Z","licence":"CC-BY-4.0","proto":"datumesh/1","publisher":"rates.example.org","sig":"337e5e67077132be42c73f24e908360c615f67a341009cf5f65e09e62cd9bbe71538e5e165f4bce578d7a00e8c21a7e488c185425a378985f0bb9f8393972c0d","summary":"1 EUR was worth 0.9581 CHF at the 15 March 2024 reference rate, as known on 17 March.","tx":"2024-03-15T16:00:00.000000Z","type":"number","valid":{"date":{"type":"date","value":"2024-03-15"}},"value":"0.9581"}"##),
    ("first-input-missing", "generated: convert whose first input is not loaded", r##"{"asof":"2024-03-16T09:00:00.000000Z","cell":{"args":{"amount":{"type":"number","value":"100"},"base":{"type":"string","value":"EUR"},"date":{"type":"date","value":"2024-03-15"},"quote":{"type":"string","value":"CHF"}},"fn":"convert","fn_hash":"014fc97eb3a442ab28a96d89131ccfd11c9eec8187595578c212b392d0702c71","ns":"calc.example.net"},"computed_by":"calc.example.net#f7ec60a92abf4774","inputs":["0c3feb4c797f580d279287dbe11a41eed45cfd00c72c3e983dbd5e7ab69cacbf","19a5fe3a744c5792f747fb4c286ce396ab44b95922de4f07937502fe595b6f81"],"issued":"2024-03-16T09:00:00.000000Z","licence":"CC-BY-4.0","proto":"datumesh/1","publisher":"calc.example.net","sig":"289947af71868bb3b6ef94a1a63b53d174d091f6f15f13c1500cba47891318ea57a95151b75cf8c5f30e42ae792ea4a7831d6b846254325685704f4334c0ff0f","summary":"100 EUR converted to CHF at the 15 March 2024 rate is 95.81.","tx":"2024-03-15T16:00:00.000000Z","type":"number","valid":{"date":{"type":"date","value":"2024-03-15"}},"value":"95.81"}"##),
    ("instant-no-valid-time", "receipt/instant-no-valid-time", r##"{
  "sig": "5eeeab49c8290c66ff7274ebbe2b3f60b5bf9861f2b603ebe9dd9d5dae92c1aa7f008a19b3ad5541baff5f62892d891780a32c12b85522c14f87c29e63f6cc08",
  "value": "2024-03-15T16:29:59.874211Z",
  "valid": {},
  "type": "instant",
  "tx": "2024-03-15T16:00:00.000000Z",
  "summary": "The last trade in XAMS:ASML was at 16:29:59.874211 UTC.",
  "publisher": "rates.example.org",
  "proto": "datumesh/1",
  "licence": "CC-BY-4.0",
  "issued": "2024-03-16T09:00:00.000000Z",
  "inputs": [],
  "computed_by": "rates.example.org#d712b32a2cc5cb7c",
  "cell": {
    "ns": "rates.example.org",
    "fn_hash": "c9e0d9f0d0cb8b5be729b6e30a4e89fbfa2ff2e6b55f18632751b2f0f7acb923",
    "fn": "last_trade",
    "args": {
      "symbol": {
        "value": "XAMS:ASML",
        "type": "string"
      }
    }
  },
  "asof": "2024-03-16T09:00:00.000000Z"
}"##),
    ("tampered-value", "invalid/receipt-tampered-value", r##"{
  "sig": "ddf61d49ff6593f7b0d94c76f19fefdd27f47778740b3666fc1c3315ec00c5d216f887c4078deb05c83d4d743453c6fecc568473663b3282ac4eda8c3eadcf01",
  "value": "1.0893",
  "valid": {
    "date": {
      "value": "2024-03-15",
      "type": "date"
    }
  },
  "type": "number",
  "tx": "2024-03-15T16:00:00.000000Z",
  "summary": "1 EUR was worth 1.0892 USD at the 15 March 2024 reference rate.",
  "publisher": "rates.example.org",
  "proto": "datumesh/1",
  "licence": "CC-BY-4.0",
  "issued": "2024-03-16T09:00:00.000000Z",
  "inputs": [],
  "computed_by": "rates.example.org#d712b32a2cc5cb7c",
  "cell": {
    "ns": "rates.example.org",
    "fn_hash": "7b58ecb8fd23b644c87951d0bd609790ff547cbb23fed27186c669ce2ce0aa80",
    "fn": "fx_rate",
    "args": {
      "quote": {
        "value": "USD",
        "type": "string"
      },
      "date": {
        "value": "2024-03-15",
        "type": "date"
      },
      "base": {
        "value": "EUR",
        "type": "string"
      }
    }
  },
  "asof": "2024-03-16T09:00:00.000000Z"
}"##),
    ("duplicate-member", "invalid/receipt-duplicate-member", r##"{"asof": "2024-03-16T09:00:00.000000Z", "cell": {"args": {"base": {"type": "string", "value": "EUR"}, "date": {"type": "date", "value": "2024-03-15"}, "quote": {"type": "string", "value": "USD"}}, "fn": "fx_rate", "fn_hash": "7b58ecb8fd23b644c87951d0bd609790ff547cbb23fed27186c669ce2ce0aa80", "ns": "rates.example.org"}, "computed_by": "rates.example.org#d712b32a2cc5cb7c", "inputs": [], "issued": "2024-03-16T09:00:00.000000Z", "licence": "CC-BY-4.0", "proto": "datumesh/1", "publisher": "rates.example.org", "summary": "1 EUR was worth 1.0892 USD at the 15 March 2024 reference rate.", "tx": "2024-03-15T16:00:00.000000Z", "type": "number", "valid": {"date": {"type": "date", "value": "2024-03-15"}}, "value": "1.0892", "sig": "ddf61d49ff6593f7b0d94c76f19fefdd27f47778740b3666fc1c3315ec00c5d216f887c4078deb05c83d4d743453c6fecc568473663b3282ac4eda8c3eadcf01", "value": "9.9"}"##),
];