Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions fodid-cloud/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fiftyone-fodid-cloud"
version = "4.5.2"
version = "4.5.3"
description = "Cloud engine that unpacks the 51Degrees identifier (51Did / FODid) block from the cloud JSON response into typed data."
edition.workspace = true
rust-version.workspace = true
Expand All @@ -15,7 +15,7 @@ fiftyone-pipeline-core = { version = "4.5.2", path = "../pipeline-core" }
# the cloud path never uses, so this crate builds for wasm32-wasip1.
fiftyone-pipeline-engines = { version = "4.5.2", path = "../pipeline-engines", default-features = false }
fiftyone-cloud-request-engine = { version = "4.5.2", path = "../cloud-request-engine", default-features = false }
fodid = { version = "4.5.2", path = "../fodid" }
fodid = { version = "4.5.3", path = "../fodid" }
serde_json.workspace = true
once_cell.workspace = true

Expand All @@ -29,7 +29,7 @@ reqwest-client = ["fiftyone-cloud-request-engine/reqwest-client"]
# The tests create a real signed 51Did envelope to stand in for the cloud,
# which needs the OWID creator types fodid exposes under its creator
# feature.
fodid = { version = "4.5.2", path = "../fodid", features = ["creator"] }
fodid = { version = "4.5.3", path = "../fodid", features = ["creator"] }

[package.metadata.docs.rs]
# Build the documentation on docs.rs with every feature enabled, so the
Expand Down
2 changes: 1 addition & 1 deletion fodid/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fodid"
version = "4.5.2"
version = "4.5.3"
description = "Reader for the 51Did (51Degrees Identifier) value returned by the 51Degrees cloud service. Parses the OWID envelope and unpacks the usage flags, License Id and 32-byte probabilistic hash."
keywords = ["51degrees", "fodid", "51did", "identifier", "owid"]
categories = ["parser-implementations", "cryptography"]
Expand Down
39 changes: 39 additions & 0 deletions fodid/tests/fodid_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,45 @@ fn unsupported_version_is_the_owid_unsupported_version_status() {
assert_failed(&result, Status::Owid(ParseStatus::UnsupportedVersion));
}

#[test]
fn date_past_the_year_9999_reads_as_15_february_10186() {
// The four byte minute count of the wire format runs to 0xFFFFFFFF,
// which is 04:15 on 15 February 10186. Runtimes whose date type stops
// at the end of the year 9999 (.NET and Python) refuse such a count
// with ImplementationCapacityExceeded, whereas chrono's range reaches
// the year 262142, so here the same bytes read fine and the date is
// the one the sender wrote. The bytes are changed after signing, which
// is fine because reading never looks at the signature.
use base64::Engine as _;
use chrono::{Datelike as _, Timelike as _};

let fixture = Fixture::new();
let mut bytes = fixture
.signed_owid(canonical_payload())
.as_byte_array()
.unwrap();
// The four little endian date bytes sit after the version byte, the
// domain and its terminator.
let at = 1 + TEST_DOMAIN.len() + 1;
bytes[at..at + 4].copy_from_slice(&[0xFF; 4]);
let base64 = base64::engine::general_purpose::STANDARD.encode(&bytes);

let result = FodId::from_base64(&base64);
let fod_id = assert_parsed(&result);
let date = fod_id.date();
assert_eq!(
(
date.year(),
date.month(),
date.day(),
date.hour(),
date.minute()
),
(10186, 2, 15, 4, 15)
);
assert_eq!(fod_id.match_key(), &canonical_hash());
}

#[test]
fn error_display_names_the_status_and_keeps_the_owid_source() {
use std::error::Error as _;
Expand Down
2 changes: 1 addition & 1 deletion owid-rust
Loading