
Shared cookies policy, config parsing and storage orchestration in a common core with native adapter hooks, feature-toggle evaluation, third-party cookie matching, and utility helpers (redaction/base64).
This project exists to test whether the DuckDuckGo Android cookies feature can be extracted into a Kotlin Multiplatform (KMP) core and reused by both Android and iOS while keeping native platform integrations.
This is a college study case / proof of concept, not an official DuckDuckGo initiative.
If policy and feature logic are shared once in KMP and only platform adapters stay native, cross-platform effort should decrease without losing native behavior where platform internals differ.
commonMain and is consumed from Android and iOS.cookies-kmp-core/src/commonMain: shared cookies domain logic.cookies-kmp-core/src/androidMain: Android actuals/adapters.cookies-kmp-core/src/appleMain: shared Apple adapters/contracts.cookies-kmp-core/src/iosMain: iOS adapters.cookies-kmp-core/src/macosMain: macOS adapters.cookies-kmp-core/src/commonTest: shared logic tests.This KMP project is included from the Android repo as a composite build and consumed as:
io.github.fernandafbmarques:cookies-kmp-core:0.1.1The DuckDuckGo Android repo consumes this project from source via Gradle composite build.
Add to duckduckgo/Android/settings.gradle:
includeBuild("/Users/mariafernandafreitasbarbosamarques/IdeaProjects/CookiesKMP") {
dependencySubstitution {
substitute(module("io.github.fernandafbmarques:cookies-kmp-core"))
.using(project(":cookies-kmp-core"))
}
}Then add in cookies/cookies-impl and cookies/cookies-store:
implementation "io.github.fernandafbmarques:cookies-kmp-core:0.1.1"High-level steps to publish this library publicly:
groupId.maven-publish and signing with group, artifactId, and version../gradlew publishAllPublicationsToMavenCentralRepository.com.duckduckgo.cookies to io.github.fernandafbmarques.com.vanniktech.maven.publish.io.github.fernandafbmarques:cookies-kmp-core:0.1.1 was successfully deployed to Maven Central.-SNAPSHOT versions are rejected by Central Portal and blocked in CI).cookies-store and cookies-impl pass.0.1.2) and maintain release notes per tag.io.github.fernandafbmarques:cookies-kmp-core from Maven Central.From Android repo root:
./gradlew :cookies-store:testDebugUnitTest :cookies-impl:testDebugUnitTest
./gradlew :cookies-kmp:cookies-kmp-core:testDebugUnitTestFrom this KMP repo root (Apple packaging):
./scripts/build_apple_xcframework.sh
./scripts/compute_spm_checksum.sh
# then update the Apple package manifest for a release tag:
./scripts/update_spm_manifest.sh 0.1.2 <checksum>See also:
BUSINESS_CASE.mdCODEX_CONTEXT.mdCODEX_WORKPLAN.mdKMP_UNIFIED_ROADMAP.mdapple-spm/CookiesKMP/Package.swiftThis project exists to test whether the DuckDuckGo Android cookies feature can be extracted into a Kotlin Multiplatform (KMP) core and reused by both Android and iOS while keeping native platform integrations.
This is a college study case / proof of concept, not an official DuckDuckGo initiative.
If policy and feature logic are shared once in KMP and only platform adapters stay native, cross-platform effort should decrease without losing native behavior where platform internals differ.
commonMain and is consumed from Android and iOS.cookies-kmp-core/src/commonMain: shared cookies domain logic.cookies-kmp-core/src/androidMain: Android actuals/adapters.cookies-kmp-core/src/appleMain: shared Apple adapters/contracts.cookies-kmp-core/src/iosMain: iOS adapters.cookies-kmp-core/src/macosMain: macOS adapters.cookies-kmp-core/src/commonTest: shared logic tests.This KMP project is included from the Android repo as a composite build and consumed as:
io.github.fernandafbmarques:cookies-kmp-core:0.1.1The DuckDuckGo Android repo consumes this project from source via Gradle composite build.
Add to duckduckgo/Android/settings.gradle:
includeBuild("/Users/mariafernandafreitasbarbosamarques/IdeaProjects/CookiesKMP") {
dependencySubstitution {
substitute(module("io.github.fernandafbmarques:cookies-kmp-core"))
.using(project(":cookies-kmp-core"))
}
}Then add in cookies/cookies-impl and cookies/cookies-store:
implementation "io.github.fernandafbmarques:cookies-kmp-core:0.1.1"High-level steps to publish this library publicly:
groupId.maven-publish and signing with group, artifactId, and version../gradlew publishAllPublicationsToMavenCentralRepository.com.duckduckgo.cookies to io.github.fernandafbmarques.com.vanniktech.maven.publish.io.github.fernandafbmarques:cookies-kmp-core:0.1.1 was successfully deployed to Maven Central.-SNAPSHOT versions are rejected by Central Portal and blocked in CI).cookies-store and cookies-impl pass.0.1.2) and maintain release notes per tag.io.github.fernandafbmarques:cookies-kmp-core from Maven Central.From Android repo root:
./gradlew :cookies-store:testDebugUnitTest :cookies-impl:testDebugUnitTest
./gradlew :cookies-kmp:cookies-kmp-core:testDebugUnitTestFrom this KMP repo root (Apple packaging):
./scripts/build_apple_xcframework.sh
./scripts/compute_spm_checksum.sh
# then update the Apple package manifest for a release tag:
./scripts/update_spm_manifest.sh 0.1.2 <checksum>See also:
BUSINESS_CASE.mdCODEX_CONTEXT.mdCODEX_WORKPLAN.mdKMP_UNIFIED_ROADMAP.mdapple-spm/CookiesKMP/Package.swift