Skip to content

Commit

Permalink
Merge pull request #732 from supabase-community/rename-gotrue-new
Browse files Browse the repository at this point in the history
Rename GoTrue to Auth
  • Loading branch information
jan-tennert authored Sep 18, 2024
2 parents bbbb500 + 8622bd4 commit a65c086
Show file tree
Hide file tree
Showing 188 changed files with 474 additions and 392 deletions.
2 changes: 1 addition & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ postgrest:

auth:
- changed-files:
- any-glob-to-any-file: GoTrue/src/**
- any-glob-to-any-file: Auth/src/**

storage:
- changed-files:
Expand Down
70 changes: 70 additions & 0 deletions Auth/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Supabase-kt Auth

**Only available for versions 3.0.0 and above. For versions below 3.0.0, checkout the [old README](/GoTrue)**

Extends Supabase-kt with a multiplatform Auth client.

Supported targets:

| Target | **JVM** | **Android** | **JS** | **Wasm** | **Apple** | **Windows** | **Linux** |
|--------|---------|-------------|--------|----------|-----------|-------------|-----------|
| Status ||||| ☑️* | ☑️ | ☑️ |

> ☑️ = No built-in OAuth support. Linux has no support for persistent session storage.
\* **iOS and macOS are fully supported**

<details>

<summary>In-depth Kotlin targets</summary>

**JS**: Browser, NodeJS

**Wasm**: wasm-js

**Apple:**

- iOS: iosArm64, iosSimulatorArm64, iosX64

- tvOS: tvosArm64, tvosX64, tvosSimulatorArm64

- watchOS: watchosArm64, watchosX64, watchosSimulatorArm64

- MacOS: macosX64, macosArm64

**Windows**: mingwX64

**Linux**: linuxX64

</details>

# Installation

Newest version: [![](https://img.shields.io/github/release/supabase-community/supabase-kt?label=)](https://github.com/supabase-community/supabase-kt/releases)

```kotlin
dependencies {
implementation("io.github.jan-tennert.supabase:auth-kt:VERSION")
}
```

Install the plugin in your SupabaseClient. See the [documentation](https://supabase.com/docs/reference/kotlin/initializing) for more information

```kotlin
val supabase = createSupabaseClient(
supabaseUrl = "https://id.supabase.co",
supabaseKey = "apikey"
) {

//...

install(Auth) {
// settings
}

}
```

# Usage

See [Auth documentation](https://supabase.com/docs/reference/kotlin/auth-signup) for usage
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
android:exported="false"
tools:node="merge">
<meta-data
android:name="io.github.jan.supabase.gotrue.SupabaseInitializer"
android:name="io.github.jan.supabase.auth.SupabaseInitializer"
android:value="androidx.startup" />
</provider>
</application>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package io.github.jan.supabase.gotrue
package io.github.jan.supabase.auth

import android.content.Intent
import android.net.Uri
import androidx.browser.customtabs.CustomTabsIntent
import io.github.jan.supabase.SupabaseClient
import io.github.jan.supabase.annotations.SupabaseInternal
import io.github.jan.supabase.gotrue.user.UserSession
import io.github.jan.supabase.auth.user.UserSession
import kotlinx.coroutines.launch

internal fun openUrl(uri: Uri, action: ExternalAuthAction) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.github.jan.supabase.gotrue
package io.github.jan.supabase.auth

import androidx.browser.customtabs.CustomTabsIntent
import io.github.jan.supabase.gotrue.providers.ExternalAuthConfig
import io.github.jan.supabase.auth.providers.ExternalAuthConfig
import io.github.jan.supabase.plugins.CustomSerializationConfig

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.jan.supabase.gotrue
package io.github.jan.supabase.auth

import io.github.jan.supabase.annotations.SupabaseInternal

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@file:Suppress("RedundantSuspendModifier")
package io.github.jan.supabase.gotrue
package io.github.jan.supabase.auth

import android.net.Uri
import io.github.jan.supabase.SupabaseClient
import io.github.jan.supabase.gotrue.user.UserSession
import io.github.jan.supabase.auth.user.UserSession

internal actual suspend fun SupabaseClient.openExternalUrl(url: String) {
openUrl(Uri.parse(url), auth.config.defaultExternalAuthAction)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.jan.supabase.gotrue.providers
package io.github.jan.supabase.auth.providers

/**
* Configuration for external authentication providers like Google, Twitter, etc.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.jan.supabase.gotrue
package io.github.jan.supabase.auth

import android.content.Context
import androidx.lifecycle.DefaultLifecycleObserver
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import io.github.jan.supabase.gotrue.AuthConfig
import io.github.jan.supabase.auth.AuthConfig

actual fun AuthConfig.platformSettings() {
enableLifecycleCallbacks = false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.github.jan.supabase.gotrue
package io.github.jan.supabase.auth

import io.github.jan.supabase.SupabaseClient
import io.github.jan.supabase.gotrue.user.UserSession
import io.github.jan.supabase.auth.user.UserSession
import io.github.jan.supabase.logging.d
import kotlinx.coroutines.launch
import platform.Foundation.NSURL
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.jan.supabase.gotrue
package io.github.jan.supabase.auth

import io.github.jan.supabase.annotations.SupabaseInternal

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.github.jan.supabase.gotrue
package io.github.jan.supabase.auth

import io.github.jan.supabase.SupabaseClient
import io.github.jan.supabase.gotrue.providers.openUrl
import io.github.jan.supabase.auth.providers.openUrl
import platform.Foundation.NSURL

internal actual suspend fun SupabaseClient.openExternalUrl(url: String) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.jan.supabase.gotrue.providers
package io.github.jan.supabase.auth.providers

/**
* Configuration for external authentication providers like Google, Twitter, etc.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.jan.supabase.gotrue.providers
package io.github.jan.supabase.auth.providers

import platform.Foundation.NSURL

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.jan.supabase.gotrue
package io.github.jan.supabase.auth

import io.github.jan.supabase.annotations.SupabaseInternal

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import io.github.jan.supabase.gotrue.AuthConfig
import io.github.jan.supabase.auth.AuthConfig

actual fun AuthConfig.platformSettings() = Unit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.jan.supabase.gotrue
package io.github.jan.supabase.auth

import io.github.jan.supabase.SupabaseClient
import io.github.jan.supabase.annotations.SupabaseInternal
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
package io.github.jan.supabase.gotrue
package io.github.jan.supabase.auth

import io.github.jan.supabase.SupabaseClient
import io.github.jan.supabase.auth.admin.AdminApi
import io.github.jan.supabase.auth.exception.AuthRestException
import io.github.jan.supabase.auth.exception.AuthWeakPasswordException
import io.github.jan.supabase.auth.mfa.MfaApi
import io.github.jan.supabase.auth.providers.AuthProvider
import io.github.jan.supabase.auth.providers.ExternalAuthConfigDefaults
import io.github.jan.supabase.auth.providers.Google
import io.github.jan.supabase.auth.providers.OAuthProvider
import io.github.jan.supabase.auth.providers.builtin.Email
import io.github.jan.supabase.auth.providers.builtin.Phone
import io.github.jan.supabase.auth.providers.builtin.SSO
import io.github.jan.supabase.auth.user.UserInfo
import io.github.jan.supabase.auth.user.UserSession
import io.github.jan.supabase.auth.user.UserUpdateBuilder
import io.github.jan.supabase.exceptions.HttpRequestException
import io.github.jan.supabase.exceptions.RestException
import io.github.jan.supabase.gotrue.admin.AdminApi
import io.github.jan.supabase.gotrue.exception.AuthRestException
import io.github.jan.supabase.gotrue.exception.AuthWeakPasswordException
import io.github.jan.supabase.gotrue.mfa.MfaApi
import io.github.jan.supabase.gotrue.providers.AuthProvider
import io.github.jan.supabase.gotrue.providers.ExternalAuthConfigDefaults
import io.github.jan.supabase.gotrue.providers.Google
import io.github.jan.supabase.gotrue.providers.OAuthProvider
import io.github.jan.supabase.gotrue.providers.builtin.Email
import io.github.jan.supabase.gotrue.providers.builtin.Phone
import io.github.jan.supabase.gotrue.providers.builtin.SSO
import io.github.jan.supabase.gotrue.user.UserInfo
import io.github.jan.supabase.gotrue.user.UserSession
import io.github.jan.supabase.gotrue.user.UserUpdateBuilder
import io.github.jan.supabase.logging.SupabaseLogger
import io.github.jan.supabase.logging.e
import io.github.jan.supabase.plugins.CustomSerializationPlugin
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.jan.supabase.gotrue
package io.github.jan.supabase.auth

import io.github.jan.supabase.SupabaseClientBuilder
import io.github.jan.supabase.SupabaseSerializer
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.github.jan.supabase.gotrue
package io.github.jan.supabase.auth

import io.github.jan.supabase.auth.user.UserSession
import io.github.jan.supabase.encodeToJsonElement
import io.github.jan.supabase.gotrue.user.UserSession
import io.github.jan.supabase.logging.d
import kotlinx.serialization.json.jsonObject

Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
package io.github.jan.supabase.gotrue
package io.github.jan.supabase.auth

import io.github.jan.supabase.SupabaseClient
import io.github.jan.supabase.annotations.SupabaseExperimental
import io.github.jan.supabase.annotations.SupabaseInternal
import io.github.jan.supabase.auth.admin.AdminApi
import io.github.jan.supabase.auth.admin.AdminApiImpl
import io.github.jan.supabase.auth.exception.AuthRestException
import io.github.jan.supabase.auth.exception.AuthSessionMissingException
import io.github.jan.supabase.auth.exception.AuthWeakPasswordException
import io.github.jan.supabase.auth.mfa.MfaApi
import io.github.jan.supabase.auth.mfa.MfaApiImpl
import io.github.jan.supabase.auth.providers.AuthProvider
import io.github.jan.supabase.auth.providers.ExternalAuthConfigDefaults
import io.github.jan.supabase.auth.providers.OAuthProvider
import io.github.jan.supabase.auth.providers.builtin.OTP
import io.github.jan.supabase.auth.providers.builtin.SSO
import io.github.jan.supabase.auth.user.UserInfo
import io.github.jan.supabase.auth.user.UserSession
import io.github.jan.supabase.auth.user.UserUpdateBuilder
import io.github.jan.supabase.bodyOrNull
import io.github.jan.supabase.exceptions.BadRequestRestException
import io.github.jan.supabase.exceptions.RestException
import io.github.jan.supabase.exceptions.UnauthorizedRestException
import io.github.jan.supabase.exceptions.UnknownRestException
import io.github.jan.supabase.gotrue.admin.AdminApi
import io.github.jan.supabase.gotrue.admin.AdminApiImpl
import io.github.jan.supabase.gotrue.exception.AuthRestException
import io.github.jan.supabase.gotrue.exception.AuthSessionMissingException
import io.github.jan.supabase.gotrue.exception.AuthWeakPasswordException
import io.github.jan.supabase.gotrue.mfa.MfaApi
import io.github.jan.supabase.gotrue.mfa.MfaApiImpl
import io.github.jan.supabase.gotrue.providers.AuthProvider
import io.github.jan.supabase.gotrue.providers.ExternalAuthConfigDefaults
import io.github.jan.supabase.gotrue.providers.OAuthProvider
import io.github.jan.supabase.gotrue.providers.builtin.OTP
import io.github.jan.supabase.gotrue.providers.builtin.SSO
import io.github.jan.supabase.gotrue.user.UserInfo
import io.github.jan.supabase.gotrue.user.UserSession
import io.github.jan.supabase.gotrue.user.UserUpdateBuilder
import io.github.jan.supabase.logging.d
import io.github.jan.supabase.logging.e
import io.github.jan.supabase.logging.i
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@file:Suppress("UndocumentedPublicClass", "UndocumentedPublicFunction")
package io.github.jan.supabase.gotrue
package io.github.jan.supabase.auth

import io.github.jan.supabase.SupabaseClient
import io.github.jan.supabase.annotations.SupabaseInternal
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.jan.supabase.gotrue
package io.github.jan.supabase.auth

import kotlinx.atomicfu.AtomicRef
import kotlinx.atomicfu.atomic
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.jan.supabase.gotrue
package io.github.jan.supabase.auth

import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.jan.supabase.gotrue
package io.github.jan.supabase.auth

import kotlinx.serialization.json.JsonObjectBuilder
import kotlinx.serialization.json.put
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.jan.supabase.gotrue
package io.github.jan.supabase.auth

/**
* OTPs (One Time Passwords) are used to authenticate users via email or phone.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@file:Suppress("MatchingDeclarationName")
package io.github.jan.supabase.gotrue
package io.github.jan.supabase.auth

import korlibs.crypto.SHA256
import korlibs.crypto.SecureRandom
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.jan.supabase.gotrue
package io.github.jan.supabase.auth

/**
* Used to mark Postgrest filter DSL functions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.jan.supabase.gotrue
package io.github.jan.supabase.auth

import io.github.jan.supabase.annotations.SupabaseInternal

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.github.jan.supabase.gotrue
package io.github.jan.supabase.auth

import io.github.jan.supabase.gotrue.user.UserSession
import io.github.jan.supabase.auth.user.UserSession
import kotlinx.atomicfu.AtomicRef
import kotlinx.atomicfu.atomic

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.github.jan.supabase.gotrue
package io.github.jan.supabase.auth

import io.github.jan.supabase.gotrue.providers.AuthProvider
import io.github.jan.supabase.gotrue.user.UserSession
import io.github.jan.supabase.auth.providers.AuthProvider
import io.github.jan.supabase.auth.user.UserSession

/**
* Represents the status of the current session in [Auth]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.jan.supabase.gotrue
package io.github.jan.supabase.auth

/**
* Represents the scope of a sign-out action.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.github.jan.supabase.gotrue
package io.github.jan.supabase.auth

import io.github.jan.supabase.SupabaseClient
import io.github.jan.supabase.annotations.SupabaseInternal
import io.github.jan.supabase.gotrue.user.UserSession
import io.github.jan.supabase.auth.user.UserSession
import io.github.jan.supabase.logging.d
import io.ktor.client.request.HttpRequestBuilder
import kotlinx.coroutines.launch
Expand Down
Loading

0 comments on commit a65c086

Please sign in to comment.