From 06d51a0dc8101300e4d07199ef169de7c592bdb5 Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Mon, 9 Oct 2023 11:03:59 -0300 Subject: [PATCH 1/2] Remove `@_spi(Experimental)` --- Examples/Shared/Sources/SignInWithAppleView.swift | 6 +++--- Sources/GoTrue/GoTrueClient.swift | 1 - Sources/GoTrue/Types.swift | 2 +- Tests/GoTrueTests/GoTrueTests.swift | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Examples/Shared/Sources/SignInWithAppleView.swift b/Examples/Shared/Sources/SignInWithAppleView.swift index 7f34f4a..b0392f0 100644 --- a/Examples/Shared/Sources/SignInWithAppleView.swift +++ b/Examples/Shared/Sources/SignInWithAppleView.swift @@ -7,8 +7,8 @@ import AuthenticationServices import CryptoKit +import GoTrue import SwiftUI -@_spi(Experimental) import GoTrue struct SignInWithAppleView: View { @Environment(\.goTrueClient) private var client @@ -36,8 +36,8 @@ struct SignInWithAppleView: View { try await client.signInWithIdToken( credentials: .init( provider: .apple, - idToken: idToken/*, - nonce: self.nonce*/ + idToken: idToken /* , + nonce: self.nonce */ ) ) } catch { diff --git a/Sources/GoTrue/GoTrueClient.swift b/Sources/GoTrue/GoTrueClient.swift index e6f4faf..6acb115 100644 --- a/Sources/GoTrue/GoTrueClient.swift +++ b/Sources/GoTrue/GoTrueClient.swift @@ -167,7 +167,6 @@ public final class GoTrueClient { /// Allows signing in with an ID token issued by certain supported providers. /// The ID token is verified for validity and a new session is established. - @_spi(Experimental) @discardableResult public func signInWithIdToken(credentials: OpenIDConnectCredentials) async throws -> Session { try await _signIn( diff --git a/Sources/GoTrue/Types.swift b/Sources/GoTrue/Types.swift index 3e2f6ac..9101014 100644 --- a/Sources/GoTrue/Types.swift +++ b/Sources/GoTrue/Types.swift @@ -44,7 +44,7 @@ public enum AnyJSON: Hashable, Codable, Sendable { } else if let number = try? container.decode(Double.self) { self = .number(number) } else if container.decodeNil() { - self = .null + self = .null } else { throw DecodingError.dataCorrupted( .init(codingPath: decoder.codingPath, debugDescription: "Invalid JSON value.") diff --git a/Tests/GoTrueTests/GoTrueTests.swift b/Tests/GoTrueTests/GoTrueTests.swift index 0421a0e..a0fae26 100644 --- a/Tests/GoTrueTests/GoTrueTests.swift +++ b/Tests/GoTrueTests/GoTrueTests.swift @@ -1,7 +1,7 @@ import Mocker import XCTest -@testable @_spi(Experimental) import GoTrue +@testable import GoTrue final class InMemoryLocalStorage: GoTrueLocalStorage, @unchecked Sendable { private let queue = DispatchQueue(label: "InMemoryLocalStorage") From 10474482ff9f941ba97f17d18baac8b6878910c7 Mon Sep 17 00:00:00 2001 From: Guilherme Souza Date: Mon, 9 Oct 2023 19:00:13 -0300 Subject: [PATCH 2/2] Fix example for SIWA --- Examples/Shared/Sources/SignInWithAppleView.swift | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Examples/Shared/Sources/SignInWithAppleView.swift b/Examples/Shared/Sources/SignInWithAppleView.swift index b0392f0..1bef081 100644 --- a/Examples/Shared/Sources/SignInWithAppleView.swift +++ b/Examples/Shared/Sources/SignInWithAppleView.swift @@ -16,8 +16,9 @@ struct SignInWithAppleView: View { var body: some View { SignInWithAppleButton { request in -// self.nonce = sha256(randomString()) -// request.nonce = nonce + let nonce = randomString() + self.nonce = nonce + request.nonce = sha256(nonce) request.requestedScopes = [.email, .fullName] } onCompletion: { result in Task { @@ -36,8 +37,8 @@ struct SignInWithAppleView: View { try await client.signInWithIdToken( credentials: .init( provider: .apple, - idToken: idToken /* , - nonce: self.nonce */ + idToken: idToken, + nonce: nonce ) ) } catch {