Skip to content

Conversation

@Manrich121
Copy link
Contributor

@Manrich121 Manrich121 commented Jan 30, 2024

PowerSync Kotlin SDK

Alpha Release paper doc

Screenshot 2024-02-26 at 09 31 17

Alpha version

  • PowerSync support for Android and iOS platforms in KMP
  • Support for async/Kotlin coroutines DB queries
  • Support watch queries
    • Platform-specific native bindings to sqlite3_update_hook and sqlite3_commit_hook
  • Convenience SupabaseConnector published under com.powersync:connector-supabase namespace
  • Custom gradle plugin for publishing to Sonatype Central
  • Initial support for building a Swift Framework with SKIE + KMMBridge and published via GitHub action

Todo's

  • Finish GitHub action to publish to Sonatype Central
  • Make repo and packages public
  • Remove GitHub auth for maven registry (here) in supabase-todolite app

Future work/ideas

  • Better error handling
  • Add KMP Logger like Kermit
  • Generate documentation, possibly using Dokka
  • Unit tests for com.powersync:core
  • Support JVM desktop
  • Support WASM
  • Management of DB connections on each platform (native)
  • Auto-versioning of gradle modules part of the publishing process
  • PowerSync gradle plugin for easily setting up PowerSync SDK in a KMP project
  • Integrate with SQLDelight's compiler to generate the schema and typesafe queries

val parts = jwt.split('.')
check(parts.size == 3) { "Invalid JWT" }

val payload = parts[1].decodeBase64String()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure this works with base64-url encoding, and without padding. See discussion:
powersync-ja/powersync.dart#58 (review)

Alternatively, just remove getExpiryDate and decodeJwt for the alpha.

Copy link
Contributor Author

@Manrich121 Manrich121 Feb 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From ktor's implementation, it does look like they handle padding and byte masks, normalizing the input before decoding.

https://github.com/ktorio/ktor/blob/main/ktor-utils/common/src/io/ktor/util/Base64.kt

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like padding is fine, but I don't see anything handling base64url characters (uses - and _ instead of + and /).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This functionality is unlikely to be used much so it's not a massive blocker, but I'd prefer to remove it rather than have a broken implementation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

stevensJourney
stevensJourney previously approved these changes Feb 28, 2024
Copy link
Contributor

@stevensJourney stevensJourney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good from my side.

@Manrich121 Manrich121 requested review from rkistner and removed request for DominicGBauer February 29, 2024 08:20
Comment on lines 26 to 33
maven {
url = uri("https://maven.pkg.github.com/powersync-ja/powersync-kotlin")
credentials {
username = localProperties.getProperty("GITHUB_USERNAME")
password = localProperties.getProperty("GITHUB_TOKEN")
}
}
}

This comment was marked as resolved.

@Manrich121 Manrich121 requested a review from rkistner February 29, 2024 15:09
val parts = jwt.split('.')
check(parts.size == 3) { "Invalid JWT" }

val payload = parts[1].decodeBase64String()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This functionality is unlikely to be used much so it's not a massive blocker, but I'd prefer to remove it rather than have a broken implementation

@Manrich121 Manrich121 requested a review from rkistner March 4, 2024 08:10
@Manrich121 Manrich121 merged commit 6ef581a into main Mar 4, 2024
@Manrich121 Manrich121 deleted the init-kmp branch March 4, 2024 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants