{"id":36416976,"url":"https://github.com/ch4rl3x/settings-multiplatform","last_synced_at":"2026-01-11T17:00:02.981Z","repository":{"id":231595049,"uuid":"782162913","full_name":"ch4rl3x/settings-multiplatform","owner":"ch4rl3x","description":"A Kotlin Multiplatform AndroidX DataStore","archived":false,"fork":false,"pushed_at":"2025-10-15T18:59:27.000Z","size":192,"stargazers_count":7,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-16T19:18:19.085Z","etag":null,"topics":["android","datastore","datastore-android","datastore-preferences","ios","kotlin-coroutines","kotlin-flow","kotlin-multiplatform","preferences","preferences-datastore","settings","sharedpreferences"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ch4rl3x.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-04-04T18:56:48.000Z","updated_at":"2025-10-12T16:49:38.000Z","dependencies_parsed_at":"2024-04-15T13:57:23.183Z","dependency_job_id":"9e3cab47-f2e4-4eb0-b487-c159eaaec68d","html_url":"https://github.com/ch4rl3x/settings-multiplatform","commit_stats":null,"previous_names":["ch4rl3x/settings-multiplatform"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/ch4rl3x/settings-multiplatform","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ch4rl3x%2Fsettings-multiplatform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ch4rl3x%2Fsettings-multiplatform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ch4rl3x%2Fsettings-multiplatform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ch4rl3x%2Fsettings-multiplatform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ch4rl3x","download_url":"https://codeload.github.com/ch4rl3x/settings-multiplatform/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ch4rl3x%2Fsettings-multiplatform/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28314253,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T14:58:17.114Z","status":"ssl_error","status_checked_at":"2026-01-11T14:55:53.580Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","datastore","datastore-android","datastore-preferences","ios","kotlin-coroutines","kotlin-flow","kotlin-multiplatform","preferences","preferences-datastore","settings","sharedpreferences"],"created_at":"2026-01-11T17:00:02.886Z","updated_at":"2026-01-11T17:00:02.967Z","avatar_url":"https://github.com/ch4rl3x.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca href=\"https://www.codefactor.io/repository/github/ch4rl3x/settings-multiplatform\"\u003e\u003cimg src=\"https://www.codefactor.io/repository/github/ch4rl3x/settings-multiplatform/badge\" alt=\"CodeFactor\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://repo1.maven.org/maven2/de/charlex/settings/settings-datastore/\"\u003e\u003cimg src=\"https://img.shields.io/maven-central/v/de.charlex.settings/settings-datastore\" alt=\"Maven Central\" /\u003e\u003c/a\u003e\n\n# Settings Multiplatform\n\n`settings-multiplatform` provides a type-safe, multiplatform abstraction over AndroidX DataStore, letting you define preferences as objects (rather than string keys), and optionally enabling encryption.\n\n\u003e [!NOTE]\n\u003e Settings Multiplatform now support Encryption in version 2.1.0-beta02\n\n## 🔍 What it solves\n\nWorking with DataStore typically means you operate with string keys and primitive types, which is error-prone and lacks compile-time safety.\nWhen you migrate logic to a multiplatform structure (Android + iOS / Kotlin Multiplatform), managing platform-specific preferences becomes cumbersome.\n\n`settings-multiplatform` solves these issues by:\n\n* Exposing preference definitions as typed objects (e.g. `stringPreference`, `intPreference`) instead of raw string keys \n* Handling both Android and iOS usage through a shared API \n* Optionally supporting encrypted preferences on supported platforms \n\n## 🛠 Key Features\n\n* ✅ Type safety: No more string key typos — you reference `Preferences.preferenceString` instead of `\"preference_string\"` \n* ✅ Simple usage API, same interface across platforms \n* ✅ Optional encryption layer (Android \u0026 iOS) for sensitive settings \n\n## Dependency\n\nAdd the library to your module `build.gradle`\n```gradle\ndependencies {\n    implementation 'de.charlex.settings:settings-datastore:\u003cversion\u003e'\n    implementation 'de.charlex.settings:settings-datastore-encryption:\u003cversion\u003e'\n}\n```\n\n## Usage\n\n### Declaring Preferences\n\n```kotlin\nobject Preferences {\n    val preferenceInt = intPreference(\"preference_int\", 1)\n    val preferenceString = stringPreference(\"preference_string\", \"default\")\n    val preferenceFloat = floatPreference(\"preference_float\", 1.1f)\n    val preferenceLong = longPreference(\"preference_long\", 1L)\n    val preferenceBoolean = boolenPreference(\"preference_boolean\", true)\n}\n\nobject EncryptedPreferences {\n    val encryptedPreferenceInt = encryptedIntPreference(\"encrypted_preference_int\", 1)\n    val encryptedPreferenceString = encryptedStringPreference(\"encrypted_preference_string\", \"default\")\n    val encryptedPreferenceFloat = encryptedFloatPreference(\"encrypted_preference_float\", 1.1f)\n    val encryptedPreferenceLong = encryptedLongPreference(\"encrypted_preference_long\", 1L)\n    val encryptedPreferenceBoolean = encryptedBoolenPreference(\"encrypted_preference_boolean\", true)\n}\n```\n\n### Using Preferences\n\n#### src@android\n```kotlin\nval settingsDatastore = SettingsDataStore.create(\n  context = context,\n  name = \"multiplatform-datastore.preferences_pb\",\n  security = AESSecurity //Optional\n)\n```\n\n#### src@ios\n```kotlin\nval settingsDatastore = SettingsDataStore.create(\n  name = \"multiplatform-datastore.preferences_pb\",\n  security = AESSecurity //Optional\n)\n```\n\n#### Usage\n```kotlin\n//Read\nval exampleString: Flow\u003cString\u003e = settingsDatastore.get(Preferences.PreferenceString)\nval encryptedExampleString: Flow\u003cString\u003e = settingsDatastore.get(EncryptedPreferences.encryptedPreferenceString)\n\n//Write\ncoroutineScope.launch {\n  settings.put(Preferences.preferenceString, \"my value\")\n  settings.put(EncryptedPreferences.encryptedPreferenceString, \"shoulb be encrypted\")\n}\n\n```\n\nLicense\n--------\n\n    Copyright 2024 Alexander Karkossa\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fch4rl3x%2Fsettings-multiplatform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fch4rl3x%2Fsettings-multiplatform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fch4rl3x%2Fsettings-multiplatform/lists"}