···66 &("codes.advent.supersecret.verification".parse().unwrap()),
77 &("1337".parse().unwrap()),
88 "ABCDE-FGHIJ",
99- "what did the muffin say to the other muffin?",
109 )
1110 .await
1211 .expect("failed to build car");
···33use atrium_api::types::string::{Nsid, RecordKey};
44use atrium_crypto::keypair::P256Keypair;
55use atrium_repo::{Repository, blockstore::{CarStore, MemoryBlockStore}};
66+use rand::seq::IndexedRandom;
67use serde::Serialize;
7889const CHALLENGE_DID: &str = "did:plc:3oktyyf7u4ecnvdwf3ogehpd";
9101111+const VERY_BAD_JOKE_SETUPS: &[&str] = &[
1212+ "what do you call a cow with two legs?",
1313+ "what do bees do if they need a ride?",
1414+ "what do you call a monkey that loves doritos?",
1515+ "why did the can crusher quit her job?",
1616+ "when’s the best time to go to the dentist?",
1717+ "why do seagulls fly over the sea?",
1818+ "what do you call a farm that makes bad jokes?",
1919+ "why do fish live in saltwater?",
2020+ "what kind of streets do ghosts haunt?",
2121+ "what do you call it when one cow spies on another?",
2222+ "what happens when a frog’s car breaks down?",
2323+ "what does a zombie vegetarian eat?",
2424+ "what do you call it when a snowman throws a tantrum?",
2525+ "why did the scarecrow win an award?",
2626+ "what did the buffalo say when his son left?",
2727+ "wait, you don’t want to hear a joke about potassium?",
2828+];
2929+1030#[derive(Debug, thiserror::Error)]
1131pub enum CarBuildError {
1232 #[error("Signing error: {0}")]
···3353 collection: &Nsid,
3454 rkey: &RecordKey,
3555 verification_code: &str,
3636- message: &str,
3756) -> Result<Vec<u8>, CarBuildError> {
3857 let did = CHALLENGE_DID.parse().unwrap();
3958···4766 // add record
4867 let key = format!("{}/{}", collection.as_str(), rkey.as_str());
4968 let created_at = &chrono::Utc::now().to_rfc3339();
6969+ let joke = VERY_BAD_JOKE_SETUPS.choose(&mut rand::rng()).unwrap_or(&"no joke");
5070 let record = ChallengeRecord {
5171 created_at,
5272 verification_code,
5353- message,
7373+ message: joke,
5474 };
5575 let (cb, _cid) = repo.add_raw(&key, record).await?;
5676 let sig = keypair.sign(&cb.bytes())?;
···7595 &("codes.advent.supersecret.verification".parse().unwrap()),
7696 &("1337".parse().unwrap()),
7797 "ABCDE-FGHIJ",
7878- "what did the muffin say to the other muffin?",
7998 )
8099 .await
81100 .expect("build a car");