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
16 changes: 8 additions & 8 deletions crates/trusted-server-core/src/ec/kv_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ pub(crate) fn validated_stored_domain(domain: &str) -> Option<String> {
impl KvEntry {
/// Creates a new live entry from the current request context.
///
/// `domain` is the publisher's apex domain (e.g. `"autoblog.com"`),
/// `domain` is the publisher's apex domain (e.g. `"example.com"`),
/// used to initialize the [`KvPubProperties`] origin and first visit.
#[must_use]
pub fn new(consent: &ConsentContext, geo: Option<&GeoInfo>, now: u64, domain: &str) -> Self {
Expand Down Expand Up @@ -960,18 +960,18 @@ mod tests {
fn pub_properties_roundtrip() {
let consent = sample_consent_context();
let geo = sample_geo_info();
let entry = KvEntry::new(&consent, Some(&geo), 1000, "autoblog.com");
let entry = KvEntry::new(&consent, Some(&geo), 1000, "example.com");

let json = serde_json::to_string(&entry).expect("should serialize");
let deserialized: KvEntry = serde_json::from_str(&json).expect("should deserialize");

let props = deserialized
.pub_properties
.expect("should have pub_properties");
assert_eq!(props.origin_domain, "autoblog.com");
assert_eq!(props.origin_domain, "example.com");
assert_eq!(props.seen_domains.len(), 1);
assert!(
props.seen_domains.contains("autoblog.com"),
props.seen_domains.contains("example.com"),
"should have origin domain"
);
}
Expand Down Expand Up @@ -1008,17 +1008,17 @@ mod tests {
#[test]
fn pub_properties_deserializes_new_seen_domains_list_shape() {
let json = r#"{
"origin_domain": "autoblog.com",
"seen_domains": ["autoblog.com"]
"origin_domain": "example.com",
"seen_domains": ["example.com"]
}"#;

let props: KvPubProperties =
serde_json::from_str(json).expect("should deserialize new seen_domains list shape");

assert_eq!(props.origin_domain, "autoblog.com");
assert_eq!(props.origin_domain, "example.com");
assert_eq!(props.seen_domains.len(), 1);
assert!(
props.seen_domains.contains("autoblog.com"),
props.seen_domains.contains("example.com"),
"should include listed domain"
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -602,8 +602,8 @@ Partners are defined in config (`[[ec.partners]]` in TOML) and loaded into an in
"known_browser": true
},
"pub_properties": {
"origin_domain": "autoblog.com",
"seen_domains": ["autoblog.com"]
"origin_domain": "example.com",
"seen_domains": ["example.com"]
},
"network": {
"cluster_size": 2
Expand Down
Loading