diff --git a/Account/Sources/Account/Account.swift b/Account/Sources/Account/Account.swift index f334da27e..25762943c 100644 --- a/Account/Sources/Account/Account.swift +++ b/Account/Sources/Account/Account.swift @@ -20,6 +20,7 @@ import os.log import Secrets import Core import CommonErrors +import Feedly // Main thread only. diff --git a/Account/Sources/Account/AccountDelegates/FeedlyAccountDelegate+OAuth.swift b/Account/Sources/Account/AccountDelegates/FeedlyAccountDelegate+OAuth.swift index 9c54401af..9f9da295b 100644 --- a/Account/Sources/Account/AccountDelegates/FeedlyAccountDelegate+OAuth.swift +++ b/Account/Sources/Account/AccountDelegates/FeedlyAccountDelegate+OAuth.swift @@ -9,10 +9,14 @@ import Foundation import Web import Secrets +import Feedly /// Models the access token response from Feedly. -/// https://developer.feedly.com/v3/auth/#exchanging-an-auth-code-for-a-refresh-token-and-an-access-token -public struct FeedlyOAuthAccessTokenResponse: Decodable, OAuthAccessTokenResponse, Sendable { +/// +/// +/// Also see: +public struct FeedlyOAuthAccessTokenResponse: Decodable, Sendable { + /// The ID of the Feedly user. public var id: String diff --git a/Account/Sources/Account/Feedly/OAuthAuthorizationCodeGranting.swift b/Feedly/Sources/Feedly/OAuth/OAuth.swift similarity index 88% rename from Account/Sources/Account/Feedly/OAuthAuthorizationCodeGranting.swift rename to Feedly/Sources/Feedly/OAuth/OAuth.swift index fc556133e..516ced9fd 100644 --- a/Account/Sources/Account/Feedly/OAuthAuthorizationCodeGranting.swift +++ b/Feedly/Sources/Feedly/OAuth/OAuth.swift @@ -9,7 +9,6 @@ import Foundation import Web import Secrets -import Feedly /// Client-specific information for requesting an authorization code grant. /// Accounts are responsible for the scope. @@ -131,20 +130,14 @@ public struct OAuthAccessTokenRequest: Encodable, Sendable { } } -/// Models the minimum subset of properties of a response in section 4.1.4 of the OAuth 2.0 Authorization Framework -/// Concrete types model other parameters beyond the scope of the OAuth spec. -/// For example, Feedly provides the ID of the user who has consented to the grant. -/// https://tools.ietf.org/html/rfc6749#section-4.1.4 -public protocol OAuthAccessTokenResponse { - var accessToken: String { get } - var tokenType: String { get } - var expiresIn: Int { get } - var refreshToken: String? { get } - var scope: String { get } -} - /// The access and refresh tokens from a successful authorization grant. public struct OAuthAuthorizationGrant: Equatable { + public var accessToken: Credentials public var refreshToken: Credentials? + + public init(accessToken: Credentials, refreshToken: Credentials? = nil) { + self.accessToken = accessToken + self.refreshToken = refreshToken + } } diff --git a/Account/Sources/Account/Feedly/OAuthAuthorizationClient+Feedly.swift b/Feedly/Sources/Feedly/OAuth/OAuthAuthorizationClient+Feedly.swift similarity index 96% rename from Account/Sources/Account/Feedly/OAuthAuthorizationClient+Feedly.swift rename to Feedly/Sources/Feedly/OAuth/OAuthAuthorizationClient+Feedly.swift index 3bbb6701b..e45bf92f4 100644 --- a/Account/Sources/Account/Feedly/OAuthAuthorizationClient+Feedly.swift +++ b/Feedly/Sources/Feedly/OAuth/OAuthAuthorizationClient+Feedly.swift @@ -8,9 +8,8 @@ import Foundation import Secrets -import Feedly -extension OAuthAuthorizationClient { +public extension OAuthAuthorizationClient { static func feedlyCloudClient(secretsProvider: SecretsProvider) -> OAuthAuthorizationClient { /// Models private NetNewsWire client secrets. diff --git a/Feedly/Sources/Feedly/OAuth/OAuthRefreshAccessTokenRequest.swift b/Feedly/Sources/Feedly/OAuth/OAuthRefreshAccessTokenRequest.swift index cadfa4b22..73b92a9a8 100644 --- a/Feedly/Sources/Feedly/OAuth/OAuthRefreshAccessTokenRequest.swift +++ b/Feedly/Sources/Feedly/OAuth/OAuthRefreshAccessTokenRequest.swift @@ -8,7 +8,6 @@ import Foundation import Web -import Feedly /// Models section 6 of the OAuth 2.0 Authorization Framework /// https://tools.ietf.org/html/rfc6749#section-6