crates/gunnar-front/src/shop_door.rs
//! **`ShopDoor`: a sold estate's signed shop-door client** (over `Fleet.Ask`; monetize H16 deleted the old `SoldEstate` door) — the ONE every product's front
//! calls the ONE monetize through: `monetize-estate-side::sold_door` (P4a, T16 / P4-REST, A28
//! M11), re-exported here. Gunnar's own copy (the same `unhex32`, `from_status`, `blocking` and
//! signature as Holger's) is gone; `tests/one_sold_door.rs` holds the shared client to the
//! calls and the signatures Gunnar's own sent. The words it shares with the shop are held equal
//! by `tests/shop_pairing_contract.rs`. Nothing of the shop ships in the front.
//!
//! What stays Gunnar's: the fed door with the bench's seam ([`crate::recharge::shop_door`]),
//! the kept bundle's words (nordisk-pairing `kept`) and what the front does with the answers.
pub use monetize_estate_side::sold_door::*;
/// The kept bundle's words (`monetize_shop_pairing::{BUNDLE_V, MATERIAL_VALID}`, the shop's
/// `SEED_FILE_PREFIX`): nordisk-pairing's, which reads the bundle.
pub use nordisk_pairing::kept::{BUNDLE_V, MATERIAL_VALID, SEED_FILE_PREFIX};
#[cfg(test)]
mod tests {
use super::*;
/// ★ **The bench's seam reaches the shop door** (mock 2026-10-17: the keep-booted front
/// pulled its update from the bench ONE box under the public roots, and every pull failed):
/// the FED front's door carries the feed's own `fleet_at` / `fleet_ca`, dialled there; a
/// public `fleet_at` is refused by name.
#[test]
fn the_fed_bench_seam_reaches_the_door_the_update_pulls_through() {
let pem = "-----BEGIN CERTIFICATE-----\nBENCH\n-----END CERTIFICATE-----";
let shop_key: String = monetize::sign::Signer::from_bytes(&[7; 32])
.public_key()
.iter()
.map(|b| format!("{b:02x}"))
.collect();
let settings = format!("door = \"https://monetize-test.ignalina.dk\"\ncompany = \"test2gunnarrs\"\nshop_pubkey = \"{shop_key}\"\n");
let feed = |at: &str| {
std::collections::BTreeMap::from([
(
crate::recharge::FEED_SHOP_DOOR.to_string(),
settings.clone(),
),
(format!("secret.{CLIENT_KEY_SECRET}"), "11".repeat(32)),
(
gunnar_server::feed::FEED_FLEET_AT.to_string(),
at.to_string(),
),
(
gunnar_server::feed::FEED_FLEET_CA.to_string(),
pem.to_string(),
),
])
};
let fed = crate::recharge::shop_door(&feed("10.0.2.2:35219"))
.expect("a sold front")
.expect("its door");
assert_eq!(
fed.seam,
Some(Seam {
at: "10.0.2.2:35219".into(),
ca_pem: Some(pem.into())
}),
"the fed seam reaches the door the update pulls through"
);
assert_eq!(
dialled(&fed.door, fed.seam.as_ref()),
"https://10.0.2.2:35219"
);
assert_eq!(
fed.shop_host(),
"monetize-test.ignalina.dk",
"only a `monetize.` prefix is the shop's door name"
);
let public = crate::recharge::shop_door(&feed("81.27.107.63:443"))
.expect("a sold front")
.unwrap_err();
assert!(
public.contains("fleet-seam-bench-only"),
"a public address is no seam: {public}"
);
}
}