diff --git a/shared/challenges_markdown/one/part_one.md b/shared/challenges_markdown/one/part_one.md index e0d6013..35c28ab 100644 --- a/shared/challenges_markdown/one/part_one.md +++ b/shared/challenges_markdown/one/part_one.md @@ -16,6 +16,8 @@ writing code will also be a good exercise to get your feet wet. Some tools that turn on developer mode for the more advance options. - [various sdks](https://atproto.com/sdks) - atproto.com has a list of various sdks if you'd like to write the code to solve these challenges. +- [http ref](https://docs.bsky.app/docs/category/http-reference) - You can also make calls directly to the PDS via HTTP + endpoints. You will find most SDks match the naming conventions of the endpoints listed in the http ref. We are going to start simple. Everyone knows they have a handle, but `did` you know you also have a unique id called a [did](https://atproto.com/specs/did)? This is a unique identifier for your identity that never changes. This comes in diff --git a/shared/challenges_markdown/two/part_one.md b/shared/challenges_markdown/two/part_one.md index d810f11..5ea3a33 100644 --- a/shared/challenges_markdown/two/part_one.md +++ b/shared/challenges_markdown/two/part_one.md @@ -17,6 +17,10 @@ record of a Bluesky "like" } ``` +This is what makes up the public data on the atmosphere. All of your account's Bluesky +posts, [tangled](https://tangled.org/) repos, +[standard.site](https://standard.site/) docs, everything like that is stored publicly on your repo as an atproto record. + The records are stored in collections and have record keys. This is usually expressed by an at-uri like `at://did:plc:rnpkyqnmsw4ipey6eotbdnnf/app.bsky.feed.like/3mhbs2cnrl22r`. @@ -26,6 +30,12 @@ This uri can be broken down into 3 parts: - `app.bsky.feed.like` is the collection - `3mhbs2cnrl22r` is the record key -Using what you learned from day 1 find the following record `{{at_uri}}` and enter the verification code +You will also notice that the record has a `$type` field, `app.bsky.feed.like` for the above record. This is +the [lexicon schema](https://atproto.com/specs/lexicon) for the record. There will be more on this later, but for now +it's important to know it's a [NSID](https://atproto.com/guides/glossary#nsid-namespaced-id) of the atproto app and +shows how the record should look. + +Using what you learned from day 1 about finding the users PDS and their repo, find the following record `{{at_uri}}` and +enter the verification code found in the record for it below diff --git a/shared/challenges_markdown/two/part_two.md b/shared/challenges_markdown/two/part_two.md index 046cd2d..f54b35d 100644 --- a/shared/challenges_markdown/two/part_two.md +++ b/shared/challenges_markdown/two/part_two.md @@ -1,3 +1,13 @@ +Great! You now know where to find records, now it's time to learn how to write records. When writing atproto records you +can use 3 methods for this: + +- [com.atproto.repo.createRecord](https://docs.bsky.app/docs/api/com-atproto-repo-create-record) Creates a new atproto + record, errors if it has the same record key already in the collection +- [com.atproto.repo.putRecord](https://docs.bsky.app/docs/api/com-atproto-repo-put-record) Updates an existing + atproto record if a record exists with the same record key, if not creates a new record +- [com.atproto.repo.applyWrites](https://docs.bsky.app/docs/api/com-atproto-repo-apply-writes) Batch endpoint for writes + that allows you to create, update, or delete multiple records. + Great job beating Part 1! Now onto Part 2. Keeping it simple proof of concept, blah, blah will have a real one here another time. Add a new field `partTwo` to the diff --git a/shared/src/advent/challenges/day_two.rs b/shared/src/advent/challenges/day_two.rs index 8e0a157..06ddae9 100644 --- a/shared/src/advent/challenges/day_two.rs +++ b/shared/src/advent/challenges/day_two.rs @@ -33,6 +33,10 @@ impl AdventChallenge for DayTwo { true } + fn requires_manual_verification_part_two(&self) -> bool { + true + } + /// Create a record via the challenge agent and return the at_uri as additional context async fn build_additional_context( &self, @@ -112,20 +116,16 @@ impl AdventChallenge for DayTwo { )); }; - let expected_code = - challenge - .verification_code_one - .ok_or(AdventError::ShouldNotHappen( - "no verification code for day 2 challenge".to_string(), - ))?; + let expected_code = challenge + .verification_code_one + .ok_or(AdventError::ShouldNotHappen( + "no verification code for day 2 challenge".to_string(), + ))?; Ok(if submitted_code == expected_code { ChallengeCheckResponse::Correct } else { - ChallengeCheckResponse::Incorrect(format!( - "The code {} is incorrect", - submitted_code - )) + ChallengeCheckResponse::Incorrect(format!("The code {} is incorrect", submitted_code)) }) } @@ -150,7 +150,7 @@ impl AdventChallenge for DayTwo { cid: None, collection: advent::challenge::Day::NSID.parse().unwrap(), repo: did.parse().unwrap(), - rkey: "1".parse().unwrap(), + rkey: "2".parse().unwrap(), } .into(), )