From 255610622401ac6f2274805daf148fe74f1ad93c Mon Sep 17 00:00:00 2001 From: Bailey Townsend Date: Sat, 21 Mar 2026 14:44:27 -0500 Subject: [PATCH] lexicon changes and new xrpc query for day six --- .../codes/advent/{ => challenge}/day.json | 0 .../codes/advent/challenge/getCode.json | 24 +++++++++++++++++++ .../codes/advent/{ => challenge}/shhh.json | 0 shared/src/advent/challenges/day_six.rs | 2 +- web/src/handlers/custom/day_six.rs | 22 +++++++---------- 5 files changed, 34 insertions(+), 14 deletions(-) rename shared/lexicons/codes/advent/{ => challenge}/day.json (100%) create mode 100644 shared/lexicons/codes/advent/challenge/getCode.json rename shared/lexicons/codes/advent/{ => challenge}/shhh.json (100%) diff --git a/shared/lexicons/codes/advent/day.json b/shared/lexicons/codes/advent/challenge/day.json similarity index 100% rename from shared/lexicons/codes/advent/day.json rename to shared/lexicons/codes/advent/challenge/day.json diff --git a/shared/lexicons/codes/advent/challenge/getCode.json b/shared/lexicons/codes/advent/challenge/getCode.json new file mode 100644 index 0000000..545a368 --- /dev/null +++ b/shared/lexicons/codes/advent/challenge/getCode.json @@ -0,0 +1,24 @@ +{ + "defs": { + "main": { + "description": "A protected XRPC endpoint to get an at://advent challenge code for the user", + "output": { + "encoding": "application/json", + "schema": { + "properties": { + "code": { + "type": "string" + } + }, + "required": [ + "code" + ], + "type": "object" + } + }, + "type": "query" + } + }, + "id": "codes.advent.challenge.getCode", + "lexicon": 1 +} diff --git a/shared/lexicons/codes/advent/shhh.json b/shared/lexicons/codes/advent/challenge/shhh.json similarity index 100% rename from shared/lexicons/codes/advent/shhh.json rename to shared/lexicons/codes/advent/challenge/shhh.json diff --git a/shared/src/advent/challenges/day_six.rs b/shared/src/advent/challenges/day_six.rs index 9d7ef9b..0e39073 100644 --- a/shared/src/advent/challenges/day_six.rs +++ b/shared/src/advent/challenges/day_six.rs @@ -12,7 +12,7 @@ use serde_json::json; use sqlx::PgPool; pub const LXM_PART_ONE: &str = "codes.advent.challenge.exampleEndpoint"; -pub const LXM_PART_TWO: &str = "codes.advent.challenge.getChallengeCode"; +pub const LXM_PART_TWO: &str = "codes.advent.challenge.getCode"; pub struct DaySix { pub pool: PgPool, diff --git a/web/src/handlers/custom/day_six.rs b/web/src/handlers/custom/day_six.rs index 8bc552c..e7fdc11 100644 --- a/web/src/handlers/custom/day_six.rs +++ b/web/src/handlers/custom/day_six.rs @@ -100,18 +100,14 @@ pub async fn xrpc_handler( "Invalid DID in JWT iss claim", ) })?; - let did_doc = state - .handle_resolver - .resolve(&iss_did) - .await - .map_err(|e| { - log::error!("Failed to resolve DID for {}: {}", claims.iss, e); - xrpc_error( - StatusCode::INTERNAL_SERVER_ERROR, - "InternalError", - "Failed to resolve DID document", - ) - })?; + let did_doc = state.handle_resolver.resolve(&iss_did).await.map_err(|e| { + log::error!("Failed to resolve DID for {}: {}", claims.iss, e); + xrpc_error( + StatusCode::INTERNAL_SERVER_ERROR, + "InternalError", + "Failed to resolve DID document", + ) + })?; let (key_alg, key_bytes) = extract_signing_key_bytes(&did_doc).map_err(|e| { xrpc_error( @@ -134,7 +130,7 @@ pub async fn xrpc_handler( "SELECT * FROM challenges WHERE user_did = $1 AND day = $2", ) .bind(&claims.iss) - .bind(6i16) + .bind(6_i16) .fetch_optional(&state.postgres_pool) .await .map_err(|e| { -- 2.51.2