···11This will be explaing the car format and will have a download link to a car file we create that they can download.
22We can create a new web handler like. /day/3/{did} and it downloads the car file.
33-Inside the car export is just one record with the verficiation code33+Inside the car export is just one record with the verficiation code
44+55+TODO: detect not-logged-in and if not, don't render this button:
66+77+<a id="download-car" href="#" class="btn btn-primary">Download your CAR file</a>
88+99+<script>
1010+ const carData = atob("{{car_base64}}");
1111+ const bytes = new Uint8Array(carData.length);
1212+ for (let i = 0; i < carData.length; i++) bytes[i] = carData.charCodeAt(i);
1313+ document.getElementById('download-car').addEventListener('click', (e) => {
1414+ e.preventDefault();
1515+ const blob = new Blob([bytes], {type: 'application/vnd.ipld.car'});
1616+ const url = URL.createObjectURL(blob);
1717+ const a = document.createElement('a');
1818+ a.href = url; a.download = 'day3.car'; a.click();
1919+ URL.revokeObjectURL(url);
2020+ });
2121+</script>
+5-9
shared/examples/day_three_build_car.rs
···11-use shared::advent::challenges::day_three::repo::{ChallengeRecord, manufacture_car};
11+use shared::advent::challenges::day_three::repo::manufacture_car;
2233#[tokio::main]
44async fn main() {
55 let car_bytes = manufacture_car(
66- "did:plc:somebodyyyy".parse().unwrap(),
77- "codes.advent.supersecret.verification",
88- "1337",
99- ChallengeRecord {
1010- created_at: "2026-01-01T12:00:00Z".into(),
1111- verification_code: "ABCDE-FGHIJ".to_string(),
1212- message: "what did the muffin say to the other muffin?".into(),
1313- },
66+ &("codes.advent.supersecret.verification".parse().unwrap()),
77+ &("1337".parse().unwrap()),
88+ "ABCDE-FGHIJ",
99+ "what did the muffin say to the other muffin?",
1410 )
1511 .await
1612 .expect("failed to build car");