diff --git a/proj-android/PowerAuthLibrary/src/main/java/io/getlime/security/powerauth/sdk/impl/KVHelper.java b/proj-android/PowerAuthLibrary/src/main/java/io/getlime/security/powerauth/sdk/impl/KVHelper.java index 1fcc24a1..e22781c5 100644 --- a/proj-android/PowerAuthLibrary/src/main/java/io/getlime/security/powerauth/sdk/impl/KVHelper.java +++ b/proj-android/PowerAuthLibrary/src/main/java/io/getlime/security/powerauth/sdk/impl/KVHelper.java @@ -34,18 +34,35 @@ */ public class KVHelper { - public @NonNull Map map; + /** + * Map to use in the helper. + */ + public final @NonNull Map map; + /** + * Construct helper with given map. + * @param map Map to use in the helper. + */ public KVHelper(Map map) { this.map = map != null ? map : Collections.emptyMap(); } + /** + * Get a string value for given key. + * @param key Key to retrieve the string value. + * @return String for given key or null if no such item is stored in the map. + */ @Nullable public String valueAsString(@NonNull K key) { final Object v = map.get(key); return v instanceof String ? (String) v : null; } + /** + * Get a multiline string value for given key. The returned string doesn't contain CR-LF endings. + * @param key Key to retrieve the string value. + * @return Multiline string for given key or null if no such item is stored in the map. + */ @Nullable public String valueAsMultilineString(@NonNull K key) { final String s = valueAsString(key); @@ -55,11 +72,21 @@ public String valueAsMultilineString(@NonNull K key) { return s; } + /** + * Get a boolean value for given key. + * @param key Key to retrieve the boolean value. + * @return Boolean for given key or false if no such item is stored in the map. + */ public boolean valueAsBool(@NonNull K key) { final Object v = map.get(key); return v instanceof Boolean ? (Boolean) v : false; } + /** + * Get a map for given key. + * @param key Key to retrieve the map. + * @return Map for given key or false if no such item is stored. + */ @SuppressWarnings("unchecked") @Nullable public Map valueAsMap(@NonNull K key) { @@ -67,6 +94,11 @@ public Map valueAsMap(@NonNull K key) { return v instanceof Map ? (Map) v : null; } + /** + * Get a Date created from timestamp in seconds, stored for the given key. + * @param key Key to retrieve the timestamp. + * @return Date created from value for given key or null if no such item is stored in the map. + */ @Nullable public Date valueAsTimestamp(@NonNull K key) { final Object v = map.get(key); @@ -76,6 +108,12 @@ public Date valueAsTimestamp(@NonNull K key) { return null; } + /** + * Get a Date created from string value stored for the given key. + * @param key Key to retrieve the date. + * @param format Format of date. + * @return Date created from value for given key, or null if no such item is stored in the map. + */ @Nullable public Date valueAsDate(@NonNull K key, @NonNull String format) { final String v = valueAsString(key); diff --git a/proj-android/PowerAuthLibrary/src/main/java/io/getlime/security/powerauth/sdk/impl/VaultUnlockReason.java b/proj-android/PowerAuthLibrary/src/main/java/io/getlime/security/powerauth/sdk/impl/VaultUnlockReason.java index 2d970e20..fbfc65ea 100644 --- a/proj-android/PowerAuthLibrary/src/main/java/io/getlime/security/powerauth/sdk/impl/VaultUnlockReason.java +++ b/proj-android/PowerAuthLibrary/src/main/java/io/getlime/security/powerauth/sdk/impl/VaultUnlockReason.java @@ -31,8 +31,20 @@ @StringDef({ADD_BIOMETRY, FETCH_ENCRYPTION_KEY, SIGN_WITH_DEVICE_PRIVATE_KEY, RECOVERY_CODE}) public @interface VaultUnlockReason { + /** + * Add biometry factor is the reason for vault unlock. + */ String ADD_BIOMETRY = "ADD_BIOMETRY"; + /** + * Fetch encryption key is the reason for vault unlock. + */ String FETCH_ENCRYPTION_KEY = "FETCH_ENCRYPTION_KEY"; + /** + * Sign with device private key is the reason for vault unlock. + */ String SIGN_WITH_DEVICE_PRIVATE_KEY = "SIGN_WITH_DEVICE_PRIVATE_KEY"; + /** + * Get recovery code is the reason for vault unlock. + */ String RECOVERY_CODE = "RECOVERY_CODE"; } diff --git a/proj-android/build.gradle b/proj-android/build.gradle index 9b289b09..06a93eae 100644 --- a/proj-android/build.gradle +++ b/proj-android/build.gradle @@ -49,4 +49,8 @@ allprojects { mavenCentral() google() } + tasks.withType(Javadoc) { + options.addStringOption('Xdoclint:-html', '-quiet') + } } +