Skip to content

worldcoin/idkit-kotlin

Repository files navigation

IDKit (Kotlin)

The IDKit library provides a simple Kotlin interface for prompting users for World ID proofs. For our Web and React Native SDKs, check out the IDKit JS library.

Usage

package com.worldcoin.idkit_kotlin

val session = Session.create(
    appID = AppID("app_ce4cb73cb75fc3b73b71ffb4de178410"),
    action = "test-action"
)

// Generate the connect URL (you would typically display this as a QR code)
val connectUrl = session.connectUrl
println("Scan this URL with the World App: $connectUrl")

// Monitor the session status
session.status().collect { status ->
    when (status) {
        is Status.WaitingForConnection -> {
            println("Waiting for the user to scan the QR Code")
        }
        is Status.AwaitingConfirmation -> {
            println("Awaiting user confirmation")
        }
        is Status.Confirmed -> {
            println("Got proof: ${status.proof}")
        }
        is Status.Failed -> {
            println("Got error: ${status.error.message}")
        }
    }
}

Network Behavior

The SDK automatically retries on temporary network errors (connection issues, server errors). This ensures seamless recovery when the app returns from background, especially on Android 15+ where background network access is restricted.

The session will emit Status.Failed if no successful response is received within 15 minutes (matching the Bridge session lifetime).

Installation

GitHub Packages (recommended)

This library is published to GitHub Packages. GitHub requires authentication to download packages, even for public repositories. Configure a Personal Access Token (classic) with the read:packages scope and your GitHub username in your Gradle configuration.

Add the repository and credentials in your project's settings.gradle or root build.gradle:

dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
        maven {
            url = uri("https://maven.pkg.github.com/worldcoin/idkit-kotlin")
            credentials {
                username = System.getenv("GITHUB_USER")
                password = System.getenv("GITHUB_TOKEN") // PAT with read:packages
            }
        }
    }
}

Then add the dependency:

implementation("com.worldcoin:idkit-kotlin:3.0.0")

About World ID

World ID is the privacy-first identity protocol that brings global proof of personhood to the internet. More on World ID in the announcement blog post.

World ID lets you seamlessly integrate authentication into your app that verifies accounts belong to real persons through Sign in with Worldcoin. For additional flexibility and cases where you need extreme privacy, Anonymous Actions lets you verify users in a way that cannot be tracked across verifications.

Follow the Quick Start guide for the easiest way to get started.

📄 Documentation

All the technical docs for the Wordcoin SDK, World ID Protocol, examples, guides can be found at https://docs.world.org/

Release

When publishing, you need to provide your Sonatype OSS credentials and signing GPG key, put them in your user’s home gradle.properties (~/.gradle/gradle.properties):

mavenCentralUsername=username
mavenCentralPassword=the_password

signing.keyId=12345678
signing.password=some_password
signing.secretKeyRingFile=/Users/yourusername/.gnupg/secring.gpg
  1. Before you release please make sure that you have removed the -SNAPSHOT from the libraryVersion (idkit-kotlin/build.gradle.kts).

  2. To complete the release please perform the following:

./gradlew clean
./gradlew :idkit-kotlin:build
./gradlew :idkit-kotlin:publish
  1. Bump the major libraryVersion and bring the -SNAPSHOT back.

Publishing Commands

To Maven Central

./gradlew publishToMavenCentral

To GitHub Packages

./gradlew publishAllPublicationsToGitHubPackagesRepository

To both

./gradlew publish

About

Kotlin toolkit to interact with the World ID protocol.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages