Skip to content

About

No description or website provided.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

daa-android-sdk

Android SDK for Circle Digital Asset Accounts (DAA). It runs Circle's passkey ceremony (strong customer authentication, SCA) in an Android app. It also holds the end customer's Android Keystore authorization key for the React Native SDK.

The SDK holds no API key and makes no calls to Circle's APIs. Your backend does that, for example with the Node SDK, and passes your app only the short-lived token for one ceremony.

Status: sandbox only. The Owner AuthKey and device-authorization signing are not yet approved for production use.

Documentation

Requirements

  • minSdk 23. Browser passkeys need Android 9 or later with a screen lock.

  • compileSdk 36 and Android Gradle Plugin 8.9.1 or later. The SDK depends on androidx.browser 1.9.0, which requires both. This does not change your minSdk or targetSdk. With an older compileSdk, the build fails in checkDebugAarMetadata (or checkReleaseAarMetadata) with:

    Dependency 'androidx.browser:browser:1.9.0' requires libraries and applications that
    depend on it to compile against version 36 or later of the
    Android APIs.
    

    Set compileSdk = 36 in your app module, and upgrade the Android Gradle Plugin if needed.

  • A GitHub token. See Install.

Install

The library is on GitHub Packages, which requires a token even for public packages, so your build fails without one. Create a GitHub personal access token (classic) with the read:packages scope. Put your GitHub username and the token in ~/.gradle/gradle.properties, not in your project, so that you do not commit the token:

gpr.user=<your GitHub username>
gpr.key=<your token>

Then add the repository and the dependency:

// settings.gradle.kts
dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
        maven("https://maven.pkg.github.com/circlefin/daa-android-sdk") {
            credentials {
                username = providers.gradleProperty("gpr.user").orNull
                password = providers.gradleProperty("gpr.key").orNull
            }
        }
    }
}
// app/build.gradle.kts
dependencies {
    implementation("com.circle.daa:daa-android-sdk:0.8.0")
}

Before 1.0.0, a minor version can break the API, so pin an exact version. If you also use the React Native SDK, use the version it pins.

Quick start

Set up the callback first. The Android SDK reference has the details:

  1. Choose an https callback URL on a domain you control, for example https://app.example.com/sca/callback. Circle registers only https callback URLs. No port and no IP address.
  2. Register the exact URL with Circle for each environment.
  3. Declare com.circle.daa.sdk.sca.DaaScaCallbackActivity in your manifest exactly as the Android SDK reference shows, with an autoVerify intent filter for the URL.
  4. Serve https://<host>/.well-known/assetlinks.json with your app's signing certificates. With Play App Signing, list the app signing key from Play Console, not your upload key.

Your backend sends the same URL as redirectUri when it opens each passkey registration or challenge. Then register the contract once, as a property of your activity, and launch it with the frame token from your backend:

private val sca = DaaScaConfig(DaaEnvironment.Sandbox, "https://app.example.com/sca/callback")

private val approve =
    registerForActivityResult(DaaScaApproveContract(sca)) { result ->
        when (result) {
            is DaaScaResult.Completed -> {
                // Send result.response to your backend exactly as returned.
            }
            DaaScaResult.Cancelled -> {
                // The end customer closed the ceremony. Let them try again.
            }
            is DaaScaResult.Failed -> {
                // See result.error in the Android SDK reference.
            }
        }
    }

fun onApprove(frameToken: String) = approve.launch(frameToken)

DaaScaEnrollContract registers a passkey the same way. Before you ship, read the Android SDK reference for results, errors, and keeping state across process death, and the SCA how-to for the backend steps.

What's in the package

  • DaaScaApproveContract, DaaScaEnrollContract, DaaSca: run Circle's hosted ceremony in an Auth Tab or a Custom Tab of a supported browser, never in a WebView, and return its result unchanged.
  • DaaSecureKey: the installation-scoped, non-exportable Android Keystore P-256 AuthKey, with signing only through validated device-authorization inputs. There is no general sign(bytes).
  • DaaRegistrationFlowKey, DaaSecureRandom: sign-in primitives that the React Native SDK uses.

Contributing

./gradlew build apiCheck   # compile, unit tests, lint, public API check
./gradlew ktlintFormat     # fix formatting

See CONTRIBUTING.md.

Support and security reporting

  • Integration questions: contact your Circle representative.
  • Bugs in this SDK: open a GitHub issue.
  • Security vulnerabilities: do not file a public issue. Report them privately through Circle's Vulnerability Disclosure Program. See SECURITY.md.

License

Apache License 2.0

About

No description or website provided.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages