AD
Boost Your Brand on BlueSky—Exclusive banner space to amplify your reach within the BlueSky community.
BSkyInfo LogoBskyInfo
All ToolsCategoriesCollectionsFeed DirectoryLabeler DirectoryArticlesGuidesGlossaryBluesky SDKsSponsor
Submit
All ToolsCategoriesCollectionsFeed DirectoryLabeler DirectoryGuidesGlossaryArticlesBluesky SDKsSponsorSubmit
  1. SDKs
  2. /Kotlin
  3. /kbsky
uakihir0

kbsky

A Kotlin SDK for Bluesky and AT Protocol by uakihir0

Kotlin multiplatform Bluesky/ATProtocol library.

GitHub Stats

48stars
7forks
8contributors
13open issues

Dates

Created:December 24, 2023
Last updated:May 6, 2025

README

The following content is from kbsky's GitHub repository. All rights reserved by the original author.

日本語

kbsky

Maven Central Version

badge badge badge badge badge

This library is a Bluesky/ATProtocol client library compatible with Kotlin Multiplatform. It depends on khttpclient and uses Ktor Client internally. Therefore, this library can be used on any platform supported by Kotlin Multiplatform and Ktor Client. The behavior on each platform depends on khttpclient. Also, due to limitations of KtorClient, on which khttpclient depends, the stream package is not available on Linux platforms.

Usage

Below is how to use it with Kotlin on the supported platforms using Gradle.
If you are using it on an Apple platform, please refer to kbsky-cocoapods.
Additionally, please check the test code as well.

Stable (Maven Central)

repositories {
    mavenCentral()
}

dependencies {
+   implementation("work.socialhub.kbsky:core:0.3.0")
+   implementation("work.socialhub.kbsky:auth:0.3.0")
+   implementation("work.socialhub.kbsky:stream:0.3.0")
}

Snapshot

repositories {
+   maven { url = uri("https://repo.repsy.io/mvn/uakihir0/public") }
}

dependencies {
+   implementation("work.socialhub.kbsky:core:0.4.0-SNAPSHOT")
+   implementation("work.socialhub.kbsky:auth:0.4.0-SNAPSHOT")
+   implementation("work.socialhub.kbsky:stream:0.4.0-SNAPSHOT")
}

Using as part of a regular Java project

All of the above can be added to and used in regular Java projects, too. All you have to do is to use the suffix -jvm when listing the dependency.

Here is a sample Maven configuration:

<dependency>
    <groupId>work.socialhub.kbsky</groupId>
    <artifactId>core-jvm</artifactId>
    <version>[VERSION]</version>
</dependency>

Starting a Session

Authentication with Password

To start a session by specifying a handle and password, do as follows:

val response = BlueskyFactory
    .instance(BSKY_SOCIAL.uri)
    .server()
    .createSession(
        ServerCreateSessionRequest().also {
            it.identifier = HANDLE
            it.password = PASSWORD
        }
    )

println(response.data.accessJwt)

To access various resources with the obtained access token, execute the following:

val auth = BearerTokenAuthProvider(accessJwt)

BlueskyFactory
    .instance(BSKY_SOCIAL.uri)
    .feed()
    .post(
        FeedPostRequest(auth).also {
            it.text = "Hello World!"
        }
    )
Authentication with OAuth

Authentication using a password is gradually being replaced with OAuth. For more details on OAuth authentication, please refer to Authentication via OAuth.

PLC Directory

val response = PLCDirectoryFactory
    .instance()
    .DIDDetails(did)

println(checkNotNull(response.data.alsoKnownAs)[0])

SubscribeRepos (stream)

val stream = ATProtocolStreamFactory
    .instance(
        apiUri = BSKY_SOCIAL.uri,
        streamUri = BSKY_NETWORK.uri
    )
    .sync()
    .subscribeRepos(
        SyncSubscribeReposRequest().also {
            it.filter = listOf(
                "app.bsky.feed.post"
            )
        }
    )

stream.eventCallback(
    object : EventCallback {
        override fun onEvent(
            cid: String?,
            uri: String?,
            record: RecordUnion
        ) {
            print(record)
        }
    })

License

MIT License

Author

Akihiro Urushihara

Topics

iosjsjvmkotlinkotlin-librarykotlin-multiplatformmacos

Related SDKs

christiandeangeozone

Kotlin Multiplatform bindings for Bluesky

111•Kotlin
caraestenATty

Telnet client for Bluesky + AT Protocol

59•Kotlin
tunjidheron

A graceful multiplatform bluesky client

279•Kotlin
bluesky-socialbluesky-video

34•Kotlin
0xZhangKeFread

Mastdon\Bluesky\RSS client, implementation based on Kotlin Multiplatform and Compose Multiplatform.

171•Kotlin
akiomikseiun

An experimental ATP/Bluesky client app for Android

71•Kotlin

Resources

GitHub Repository

License

MIT

Author

uakihir0
uakihir0

Activity

Last commit: May 6, 2025
Commit frequency: Unknown

Our Sponsors

Your Brand Here!

50K+ engaged viewers every month

Limited spots available!

📧 Contact us via email🦋 Contact us on Bluesky
BSkyInfo LogoBskyInfo

The Most Comprehensive Bluesky Tools Directory

Stay updated with the latest Bluesky tools and ecosystem news 🦋

Bluesky butterfly logo
Quick LinksSubmit a ToolSponsorAboutLegal Information
ToolsFeed DirectoryLabeler DirectorySchedulingAnalyticsAll ToolsCategoriesCollectionsTags
ResourcesArticlesBluesky GuidesBluesky GlossaryBluesky SDKsBluesky ResourcesSkyRaffleMeida Coverage
Our ProductsRaffleBlueAiTeach ToolsLaiewAI affiliate listFirsto

This website may contain affiliate links

© 2025 BskyInfo. All rights reserved.