mirror of
https://github.com/kalarina-bit/Sparkledns.git
synced 2026-11-22 07:36:09 +00:00
Receive the sign-in callback on skysparkle.cc
The site now returns through an intent:// link that names this package, so no separate subdomain or domain verification is needed and no other app can receive the one-time code.
This commit is contained in:
@@ -38,15 +38,15 @@
|
|||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
<!-- End of the Skysparkle sign-in: the site sends the browser back with a one-time code.
|
<!-- End of the Skysparkle sign-in: the site sends the browser back with a one-time code
|
||||||
A verified App Link (app.skysparkle.cc/.well-known/assetlinks.json names this app's
|
through an intent:// link that names this package, so Android hands it only to this
|
||||||
signing key), so no other app can catch the code. A separate subdomain, because
|
app. No autoVerify: a link with a package needs no domain verification, and plain
|
||||||
Chrome keeps links to the site you are already on inside the browser -->
|
visits to skysparkle.cc stay in the browser -->
|
||||||
<intent-filter android:autoVerify="true">
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
<data android:scheme="https" android:host="app.skysparkle.cc" android:path="/app/callback" />
|
<data android:scheme="https" android:host="skysparkle.cc" android:path="/app/callback" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
|||||||
@@ -25,14 +25,14 @@ import java.security.SecureRandom
|
|||||||
// Sign-in with a Skysparkle account: the app gets its access key without copying it by hand.
|
// Sign-in with a Skysparkle account: the app gets its access key without copying it by hand.
|
||||||
//
|
//
|
||||||
// OAuth for native apps (RFC 8252) with PKCE (RFC 7636): the account page opens in the browser,
|
// OAuth for native apps (RFC 8252) with PKCE (RFC 7636): the account page opens in the browser,
|
||||||
// so the password never passes through the app. After "Connect" the site sends the browser to
|
// so the password never passes through the app. After "Connect" the site opens
|
||||||
// https://app.skysparkle.cc/app/callback?code=…&state=…, a verified App Link that only this app
|
// https://skysparkle.cc/app/callback?code=…&state=… through an intent:// link that names this
|
||||||
// (signed with our key) receives, and the app trades the one-time code for a new key. Only this
|
// package, so Android delivers it only to this app, and the app trades the one-time code for a
|
||||||
// app knows the verifier, so even a code that leaked somewhere else is useless.
|
// new key. Only this app knows the verifier, so even a code that leaked somewhere is useless.
|
||||||
object SkysparkleSignIn {
|
object SkysparkleSignIn {
|
||||||
private const val CONNECT_URL = "https://skysparkle.cc/app/connect"
|
private const val CONNECT_URL = "https://skysparkle.cc/app/connect"
|
||||||
private const val TOKEN_URL = "https://skysparkle.cc/api/app/token"
|
private const val TOKEN_URL = "https://skysparkle.cc/api/app/token"
|
||||||
private const val CALLBACK_HOST = "app.skysparkle.cc"
|
private const val CALLBACK_HOST = "skysparkle.cc"
|
||||||
private const val CALLBACK_PATH = "/app/callback"
|
private const val CALLBACK_PATH = "/app/callback"
|
||||||
|
|
||||||
// The browser step must be finished within this time (the site keeps codes for 5 minutes)
|
// The browser step must be finished within this time (the site keeps codes for 5 minutes)
|
||||||
|
|||||||
Reference in New Issue
Block a user