Skip to content

Commit

Permalink
Remove @_spi(Experimental) from signInWithIdToken (#68)
Browse files Browse the repository at this point in the history
* Remove `@_spi(Experimental)`

* Fix example for SIWA
  • Loading branch information
grdsdev authored Oct 9, 2023
1 parent 4bf132d commit bd3f607
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
11 changes: 6 additions & 5 deletions Examples/Shared/Sources/SignInWithAppleView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@

import AuthenticationServices
import CryptoKit
import GoTrue
import SwiftUI
@_spi(Experimental) import GoTrue

struct SignInWithAppleView: View {
@Environment(\.goTrueClient) private var client
@State var nonce: String?

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 {
Expand All @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion Sources/GoTrue/GoTrueClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion Sources/GoTrue/Types.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
2 changes: 1 addition & 1 deletion Tests/GoTrueTests/GoTrueTests.swift
Original file line number Diff line number Diff line change
@@ -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")
Expand Down

0 comments on commit bd3f607

Please sign in to comment.