···6969 @Tagged(String.self) public enum RecordKey {}
7070 }
71717272+ public enum OAuth {
7373+ @TaggedTypes public enum _Tags {
7474+ @Tagged(String.self) public enum Scope {}
7575+ @Tagged(String.self) public enum AuthorizationCode {}
7676+ @Tagged(String.self) public enum ScopeString {}
7777+ @Tagged(String.self) public enum RequestURI {}
7878+ @Tagged(String.self) public enum Nonce {}
7979+ }
8080+ }
8181+7282 public struct URI: Sendable, Hashable, LosslessStringCodable {
7383 public typealias Authority = Atmosphere.Account.Identifier
7484···140150extension Atmosphere.Account.Client: DependencyKey {
141151 public static let liveValue = Atmosphere.Account.Client(
142152 resolveHandle: { handle in
143143- @Dependency(\.dnsResolverClient) var dnsResolver
144153 @Dependency(\.didClient) var didClient
145154146155 typealias HandleResolutionError = Atmosphere.Account.HandleResolutionError
···148157 // Try DNS first
149158 var dnsError: Error?
150159 var resolvedDID: DID?
160160+161161+ #if canImport(DNSResolverClient) && canImport(Network)
162162+ @Dependency(\.dnsResolverClient) var dnsResolver
151163 do {
152164 if let didString = try await dnsResolver.queryTXT(name: "_atproto.\(handle.rawValue)")["did"], let did = DID(didString) {
153165 resolvedDID = did
···156168 } catch {
157169 dnsError = error
158170 }
171171+ #else
172172+173173+ dnsError = UnimplementedFailure(description: "DNSResolver is unimplmented on this platform")
174174+ #endif
159175160176 // Try HTTPS fallback if DNS didn't resolve
161177 if resolvedDID == nil {
-12
Sources/ATProtoOAuth/ATProtoOAuth.swift
···1010import Dependencies
11111212public typealias OAuth = ATProto.OAuth
1313-extension ATProto {
1414- public enum OAuth {
1515- @TaggedTypes
1616- public enum _Tags {
1717- @Tagged(String.self) public enum AuthorizationCode {}
1818- @Tagged(String.self) public enum Scope {}
1919- @Tagged(String.self) public enum ScopeString {}
2020- @Tagged(String.self) public enum RequestURI {}
2121- @Tagged(String.self) public enum Nonce {}
2222- }
2323- }
2424-}
25132614extension DependencyValues {
2715 public var oauthScopes: [OAuth.Scope] {
+6-1
Sources/ATProtoOAuth/AuthorizationServer.swift
···110110 public static let code: Self = "code"
111111}
112112113113+extension OAuth.AuthorizationServer.GrantType {
114114+ public static let authorizationCode: Self = "authorization_code"
115115+ public static let refreshToken: Self = "refresh_token"
116116+}
117117+113118enum DefaultPortKey: DependencyKey {
114119 static let liveValue = 443
115120}
116121117122extension DependencyValues {
118118- var defaultPort: Int {
123123+ public var defaultPort: Int {
119124 get { self[DefaultPortKey.self] }
120125 set { self[DefaultPortKey.self] = newValue }
121126 }
···5656 public let applicationType: ApplicationType
5757 public let scope: ScopeString
5858 public let responseTypes: [AuthorizationServer.ResponseType]
5959+ public let grantTypes: [AuthorizationServer.GrantType]
5960 public let redirectURIS: [RedirectURI]
60616162 public typealias TokenEndpoint = AuthorizationServer.TokenEndpoint
···7273 case applicationType = "application_type"
7374 case scope = "scope"
7475 case responseTypes = "response_types"
7676+ case grantTypes = "grant_types"
7577 case redirectURIS = "redirect_uris"
7678 case tokenEndpointAuthMethod = "token_endpoint_auth_method"
7779 case tokenEndpointAuthSigningAlgorithm = "token_endpoint_signing_alg"
···1010import ATProto
11111212public extension OAuth {
1313- public typealias PAR = PushedAuthorizationRequest
1414- public enum PushedAuthorizationRequest {
1313+ typealias PAR = PushedAuthorizationRequest
1414+ enum PushedAuthorizationRequest {
1515 @TaggedTypes
1616 public enum _Tags {
1717 @Tagged(URL.self) public enum RequestEndpoint {}
···2626 public let state: OAuth.Nonce
2727 public let scope: OAuth.ScopeString
2828 public let responseType: OAuth.AuthorizationServer.ResponseType = .code
2929+ public let grantType: String = "refresh_token"
2930 public let loginHint: Atmosphere.Account.Identifier
30313132 public init(
···5253 case state
5354 case scope
5455 case responseType = "response_type"
5656+ case grantType = "grant_type"
5557 case loginHint = "login_hint"
5658 }
5759 }