A Minecraft Fabric mod that connects the game with ATProtocol ⛏️
8
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(oauth): wire up identity resolution in OAuthManager

Pass ClientAtProtoClient into OAuthManager and implement resolveIdentity()
using the existing handle→DID→PDS resolution chain. This fixes the
NotImplementedError that was blocking the OAuth flow from completing.

👾 Generated with [Letta Code](https://letta.com)

Co-Authored-By: Letta Code <noreply@letta.com>

+31 -7
+1 -1
src/client/kotlin/com/jollywhoppers/AtprotoconnectClient.kt
··· 44 44 logger.info("Client-side session manager initialized") 45 45 46 46 // Initialize OAuth manager 47 - oAuthManager = OAuthManager() 47 + oAuthManager = OAuthManager(atProtoClient) 48 48 logger.info("OAuth manager initialized") 49 49 50 50 // Initialize client-side commands
+30 -6
src/client/kotlin/com/jollywhoppers/atproto/oauth/OAuthManager.kt
··· 26 26 * 10. Verify the returned DID matches the expected identity 27 27 * 11. Store the OAuth session 28 28 */ 29 - class OAuthManager { 29 + class OAuthManager( 30 + private val identityClient: com.jollywhoppers.atproto.client.ClientAtProtoClient 31 + ) { 30 32 private val logger = LoggerFactory.getLogger("atproto-connect:oauth") 31 33 private val json = Json { 32 34 ignoreUnknownKeys = true ··· 305 307 306 308 /** 307 309 * Resolves a handle or DID to (did, handle, pdsUrl). 310 + * Delegates to the existing ClientAtProtoClient identity resolution. 308 311 */ 309 - private fun resolveIdentity(identifier: String): Triple<String, String, String> { 310 - // For now, delegate to the existing client-side identity resolution. 311 - // This will be replaced with a direct implementation that doesn't depend 312 - // on the existing ClientAtProtoClient. 313 - throw NotImplementedError("Identity resolution will be wired up in the integration step") 312 + private suspend fun resolveIdentity(identifier: String): Triple<String, String, String> { 313 + val did: String 314 + val handle: String 315 + val pdsUrl: String 316 + 317 + if (identifier.startsWith("did:")) { 318 + // Already a DID — resolve it to find the PDS 319 + did = identifier 320 + pdsUrl = identityClient.resolveDID(did).getOrElse { 321 + throw IllegalStateException("Could not resolve DID $did: ${it.message}") 322 + } 323 + // Try to derive handle from DID (reverse resolution not available, 324 + // so we use the identifier as-is and let the auth server confirm) 325 + handle = identifier 326 + } else { 327 + // It's a handle — resolve to DID, then to PDS 328 + did = identityClient.resolveHandle(identifier).getOrElse { 329 + throw IllegalStateException("Could not resolve handle $identifier: ${it.message}") 330 + } 331 + handle = identifier 332 + pdsUrl = identityClient.resolveDID(did).getOrElse { 333 + throw IllegalStateException("Could not resolve PDS for DID $did: ${it.message}") 334 + } 335 + } 336 + 337 + return Triple(did, handle, pdsUrl) 314 338 } 315 339 316 340 // ============================================================================