-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Introduce settings to require GMS attestation, Verified Boot Green, or a particular digest of an app signing key. For now just set these to false, for production these should be true and bound to a particluar application. - Change default wallet server URL so things work out-of-the-box in the emulator. An upcoming PR will add UI to change this. - Don't store message-encryption key in Configuration, use Storage instead. Also fix some build errors for unit-tests in identity-android and identity-android-legacy. Signed-off-by: David Zeuthen <zeuthen@google.com>
- Loading branch information
Showing
12 changed files
with
267 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
identity/src/main/java/com/android/identity/flow/environment/Configuration.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,45 @@ | ||
package com.android.identity.flow.environment | ||
|
||
import kotlinx.serialization.json.Json | ||
import kotlinx.serialization.json.jsonArray | ||
|
||
import com.android.identity.util.Logger | ||
import kotlinx.serialization.json.jsonPrimitive | ||
|
||
/** | ||
* Simple interface to access configuration parameters. | ||
* | ||
* Parameters can be organized in tree-like structures with dots separating the names of the | ||
* nodes in that tree, i.e. "componentClass.componentName.valueName". | ||
*/ | ||
interface Configuration { | ||
companion object { | ||
private val TAG = "Configuration" | ||
} | ||
|
||
fun getProperty(name: String): String? | ||
|
||
fun getBool(name: String, defaultValue: Boolean = false): Boolean { | ||
val value = getProperty(name) | ||
if (value == null) { | ||
Logger.d(TAG, "getBool: No value configuration value with key $name, return default value $defaultValue") | ||
return defaultValue | ||
} | ||
if (value == "true") { | ||
return true | ||
} else if (value == "false") { | ||
return false | ||
} | ||
Logger.d(TAG, "getBool: Unexpected value '$value' with key $name, return default value $defaultValue") | ||
return defaultValue | ||
} | ||
|
||
fun getStringList(key: String): List<String> { | ||
val value = getProperty(key) | ||
if (value == null) { | ||
Logger.d(TAG, "getStringList: No value configuration value with key $key") | ||
return emptyList() | ||
} | ||
return Json.parseToJsonElement(value).jsonArray.map { elem -> elem.jsonPrimitive.content } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.