Skip to content

Commit b0e87df

Browse files
authored
Make properties and init public. (#26)
1 parent 6225971 commit b0e87df

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

Sources/OAuthKit/OAuth.swift

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public enum OAError: Error {
2727
public class OAuth: NSObject, ObservableObject, @unchecked Sendable {
2828

2929
/// Keys and values used to specify loading or runtime options.
30-
public struct Option: Hashable, Equatable, RawRepresentable, @unchecked Sendable {
30+
public struct Option: Hashable, Equatable, RawRepresentable, Sendable {
3131

3232
public var rawValue: String
3333

@@ -58,7 +58,7 @@ public class OAuth: NSObject, ObservableObject, @unchecked Sendable {
5858
}
5959

6060
/// Provides configuration data for an OAuth service provider.
61-
public struct Provider: Codable, Identifiable, Hashable {
61+
public struct Provider: Codable, Identifiable, Hashable, Sendable {
6262

6363
public var id: String
6464
public var icon: URL?
@@ -111,13 +111,21 @@ public class OAuth: NSObject, ObservableObject, @unchecked Sendable {
111111
/// A codable type that holds oauth token information.
112112
/// See: https://www.oauth.com/oauth2-servers/access-tokens/access-token-response/
113113
/// See: https://datatracker.ietf.org/doc/html/rfc6749#section-5.1
114-
public struct Token: Codable, Equatable, @unchecked Sendable {
115-
116-
let accessToken: String
117-
let refreshToken: String?
118-
let expiresIn: Int?
119-
let state: String?
120-
let type: String
114+
public struct Token: Codable, Equatable, Sendable {
115+
116+
public let accessToken: String
117+
public let refreshToken: String?
118+
public let expiresIn: Int?
119+
public let state: String?
120+
public let type: String
121+
122+
public init(accessToken: String, refreshToken: String?, expiresIn: Int?, state: String?, type: String) {
123+
self.accessToken = accessToken
124+
self.refreshToken = refreshToken
125+
self.expiresIn = expiresIn
126+
self.state = state
127+
self.type = type
128+
}
121129

122130
enum CodingKeys: String, CodingKey {
123131
case accessToken = "access_token"
@@ -129,7 +137,7 @@ public class OAuth: NSObject, ObservableObject, @unchecked Sendable {
129137
}
130138

131139
/// A codable type that holds authorization information that can be stored.
132-
public struct Authorization: Codable, Equatable {
140+
public struct Authorization: Codable, Equatable, Sendable {
133141

134142
/// The provider ID that issued the authorization.
135143
public let issuer: String
@@ -143,7 +151,7 @@ public class OAuth: NSObject, ObservableObject, @unchecked Sendable {
143151
/// - issuer: the provider ID that issued the authorization.
144152
/// - token: the access token
145153
/// - issued: the issued date
146-
init(issuer: String, token: Token, issued: Date = Date.now) {
154+
public init(issuer: String, token: Token, issued: Date = Date.now) {
147155
self.issuer = issuer
148156
self.token = token
149157
self.issued = issued
@@ -163,7 +171,7 @@ public class OAuth: NSObject, ObservableObject, @unchecked Sendable {
163171
}
164172

165173
/// Holds the OAuth state that is published to subscribers via the `state` property publisher.
166-
public enum State: Equatable, @unchecked Sendable {
174+
public enum State: Equatable, Sendable {
167175

168176
/// The state is empty and no authorizations or tokens have been issued.
169177
case empty

0 commit comments

Comments
 (0)