Skip to content

Commit 0a72e4d

Browse files
committed
feat: added API checks and dumps
1 parent 6da980e commit 0a72e4d

File tree

7 files changed

+100
-0
lines changed

7 files changed

+100
-0
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ jobs:
3232
- name: Clean project
3333
run: ./gradlew clean
3434

35+
- name: API check
36+
run: ./gradlew apiCheck
37+
3538
- name: Run lint
3639
run: ./gradlew lint
3740

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ plugins {
44
alias(libs.plugins.compose) apply false
55
alias(libs.plugins.dokka) apply false
66
alias(libs.plugins.kotlin.jvm) apply false
7+
alias(libs.plugins.kotlin.binary.compatibility) apply false
78
alias(libs.plugins.maven.publish) apply false
89
}

gradle/libs.versions.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ dokka = "2.0.0"
1616
junit4 = "4.13.2"
1717
kotlin = "2.2.10"
1818
kotlinxCoroutines = "1.10.2"
19+
kotlinBinaryCompatibility = "0.18.1"
1920
ksp = "2.2.10-2.0.2"
2021
mavenPublishPlugin = "0.32.0"
2122
protobuf = "4.29.2"
@@ -67,6 +68,7 @@ kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
6768
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
6869
maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "mavenPublishPlugin" }
6970
protobuf = { id = "com.google.protobuf", version.ref = "protobufPlugin" }
71+
kotlin-binary-compatibility = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "kotlinBinaryCompatibility" }
7072

7173
# Convention Plugins
7274
safebox-android-library = { id = "safebox.android.library" }
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
public final class com/harrytmthy/safebox/SafeBoxCrypto {
2+
public static final field INSTANCE Lcom/harrytmthy/safebox/SafeBoxCrypto;
3+
public final fun createSecret ()Ljava/lang/String;
4+
public final fun decrypt (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
5+
public final fun decryptOrNull (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
6+
public final fun encrypt (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
7+
public final fun encryptOrNull (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
8+
}
9+
10+
public abstract interface class com/harrytmthy/safebox/cryptography/CipherProvider {
11+
public abstract fun decrypt ([B)[B
12+
public abstract fun encrypt ([B)[B
13+
}
14+
15+
public final class com/harrytmthy/safebox/factory/SafeBoxCryptoFactory {
16+
public static final field INSTANCE Lcom/harrytmthy/safebox/factory/SafeBoxCryptoFactory;
17+
public final fun createChaCha20Providers (Landroid/content/Context;Ljava/lang/String;)Lkotlin/Pair;
18+
}
19+

safebox-crypto/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
plugins {
1818
alias(libs.plugins.safebox.android.library)
1919
alias(libs.plugins.safebox.publishing)
20+
alias(libs.plugins.kotlin.binary.compatibility)
2021
}
2122

2223
android {

safebox/api/safebox.api

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
public final class com/harrytmthy/safebox/SafeBox : android/content/SharedPreferences {
2+
public static final field Companion Lcom/harrytmthy/safebox/SafeBox$Companion;
3+
public synthetic fun <init> (Lcom/harrytmthy/safebox/engine/SafeBoxEngine;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
4+
public fun contains (Ljava/lang/String;)Z
5+
public static final fun create (Landroid/content/Context;Ljava/lang/String;)Lcom/harrytmthy/safebox/SafeBox;
6+
public static final fun create (Landroid/content/Context;Ljava/lang/String;Lcom/harrytmthy/safebox/cryptography/CipherProvider;Lcom/harrytmthy/safebox/cryptography/CipherProvider;)Lcom/harrytmthy/safebox/SafeBox;
7+
public static final fun create (Landroid/content/Context;Ljava/lang/String;Lcom/harrytmthy/safebox/cryptography/CipherProvider;Lcom/harrytmthy/safebox/cryptography/CipherProvider;Lkotlinx/coroutines/CoroutineDispatcher;)Lcom/harrytmthy/safebox/SafeBox;
8+
public static final fun create (Landroid/content/Context;Ljava/lang/String;Lcom/harrytmthy/safebox/cryptography/CipherProvider;Lcom/harrytmthy/safebox/cryptography/CipherProvider;Lkotlinx/coroutines/CoroutineDispatcher;Lcom/harrytmthy/safebox/state/SafeBoxStateListener;)Lcom/harrytmthy/safebox/SafeBox;
9+
public static final fun create (Landroid/content/Context;Ljava/lang/String;Lkotlinx/coroutines/CoroutineDispatcher;)Lcom/harrytmthy/safebox/SafeBox;
10+
public static final fun create (Landroid/content/Context;Ljava/lang/String;Lkotlinx/coroutines/CoroutineDispatcher;Lcom/harrytmthy/safebox/state/SafeBoxStateListener;)Lcom/harrytmthy/safebox/SafeBox;
11+
public fun edit ()Landroid/content/SharedPreferences$Editor;
12+
public static final fun get (Ljava/lang/String;)Lcom/harrytmthy/safebox/SafeBox;
13+
public fun getAll ()Ljava/util/Map;
14+
public fun getBoolean (Ljava/lang/String;Z)Z
15+
public fun getFloat (Ljava/lang/String;F)F
16+
public fun getInt (Ljava/lang/String;I)I
17+
public fun getLong (Ljava/lang/String;J)J
18+
public static final fun getOrNull (Ljava/lang/String;)Lcom/harrytmthy/safebox/SafeBox;
19+
public fun getString (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
20+
public fun getStringSet (Ljava/lang/String;Ljava/util/Set;)Ljava/util/Set;
21+
public fun registerOnSharedPreferenceChangeListener (Landroid/content/SharedPreferences$OnSharedPreferenceChangeListener;)V
22+
public final fun setCastFailureStrategy (Lcom/harrytmthy/safebox/strategy/ValueFallbackStrategy;)V
23+
public fun unregisterOnSharedPreferenceChangeListener (Landroid/content/SharedPreferences$OnSharedPreferenceChangeListener;)V
24+
}
25+
26+
public final class com/harrytmthy/safebox/SafeBox$Companion {
27+
public final fun create (Landroid/content/Context;Ljava/lang/String;)Lcom/harrytmthy/safebox/SafeBox;
28+
public final fun create (Landroid/content/Context;Ljava/lang/String;Lcom/harrytmthy/safebox/cryptography/CipherProvider;Lcom/harrytmthy/safebox/cryptography/CipherProvider;)Lcom/harrytmthy/safebox/SafeBox;
29+
public final fun create (Landroid/content/Context;Ljava/lang/String;Lcom/harrytmthy/safebox/cryptography/CipherProvider;Lcom/harrytmthy/safebox/cryptography/CipherProvider;Lkotlinx/coroutines/CoroutineDispatcher;)Lcom/harrytmthy/safebox/SafeBox;
30+
public final fun create (Landroid/content/Context;Ljava/lang/String;Lcom/harrytmthy/safebox/cryptography/CipherProvider;Lcom/harrytmthy/safebox/cryptography/CipherProvider;Lkotlinx/coroutines/CoroutineDispatcher;Lcom/harrytmthy/safebox/state/SafeBoxStateListener;)Lcom/harrytmthy/safebox/SafeBox;
31+
public final fun create (Landroid/content/Context;Ljava/lang/String;Lkotlinx/coroutines/CoroutineDispatcher;)Lcom/harrytmthy/safebox/SafeBox;
32+
public final fun create (Landroid/content/Context;Ljava/lang/String;Lkotlinx/coroutines/CoroutineDispatcher;Lcom/harrytmthy/safebox/state/SafeBoxStateListener;)Lcom/harrytmthy/safebox/SafeBox;
33+
public static synthetic fun create$default (Lcom/harrytmthy/safebox/SafeBox$Companion;Landroid/content/Context;Ljava/lang/String;Lcom/harrytmthy/safebox/cryptography/CipherProvider;Lcom/harrytmthy/safebox/cryptography/CipherProvider;Lkotlinx/coroutines/CoroutineDispatcher;Lcom/harrytmthy/safebox/state/SafeBoxStateListener;ILjava/lang/Object;)Lcom/harrytmthy/safebox/SafeBox;
34+
public static synthetic fun create$default (Lcom/harrytmthy/safebox/SafeBox$Companion;Landroid/content/Context;Ljava/lang/String;Lkotlinx/coroutines/CoroutineDispatcher;Lcom/harrytmthy/safebox/state/SafeBoxStateListener;ILjava/lang/Object;)Lcom/harrytmthy/safebox/SafeBox;
35+
public final fun get (Ljava/lang/String;)Lcom/harrytmthy/safebox/SafeBox;
36+
public final fun getOrNull (Ljava/lang/String;)Lcom/harrytmthy/safebox/SafeBox;
37+
}
38+
39+
public final class com/harrytmthy/safebox/migration/SafeBoxMigrationHelper {
40+
public static final field INSTANCE Lcom/harrytmthy/safebox/migration/SafeBoxMigrationHelper;
41+
public static final fun migrate (Landroid/content/SharedPreferences;Landroid/content/SharedPreferences;)V
42+
public static final fun migrate (Landroid/content/SharedPreferences;Landroid/content/SharedPreferences;Z)V
43+
public static synthetic fun migrate$default (Landroid/content/SharedPreferences;Landroid/content/SharedPreferences;ZILjava/lang/Object;)V
44+
}
45+
46+
public final class com/harrytmthy/safebox/state/SafeBoxGlobalStateObserver {
47+
public static final field INSTANCE Lcom/harrytmthy/safebox/state/SafeBoxGlobalStateObserver;
48+
public static final fun addListener (Ljava/lang/String;Lcom/harrytmthy/safebox/state/SafeBoxStateListener;)V
49+
public static final fun getCurrentState (Ljava/lang/String;)Lcom/harrytmthy/safebox/state/SafeBoxState;
50+
public static final fun removeListener (Ljava/lang/String;Lcom/harrytmthy/safebox/state/SafeBoxStateListener;)V
51+
}
52+
53+
public final class com/harrytmthy/safebox/state/SafeBoxState : java/lang/Enum {
54+
public static final field IDLE Lcom/harrytmthy/safebox/state/SafeBoxState;
55+
public static final field STARTING Lcom/harrytmthy/safebox/state/SafeBoxState;
56+
public static final field WRITING Lcom/harrytmthy/safebox/state/SafeBoxState;
57+
public static fun getEntries ()Lkotlin/enums/EnumEntries;
58+
public static fun valueOf (Ljava/lang/String;)Lcom/harrytmthy/safebox/state/SafeBoxState;
59+
public static fun values ()[Lcom/harrytmthy/safebox/state/SafeBoxState;
60+
}
61+
62+
public abstract interface class com/harrytmthy/safebox/state/SafeBoxStateListener {
63+
public abstract fun onStateChanged (Lcom/harrytmthy/safebox/state/SafeBoxState;)V
64+
}
65+
66+
public final class com/harrytmthy/safebox/strategy/ValueFallbackStrategy : java/lang/Enum {
67+
public static final field ERROR Lcom/harrytmthy/safebox/strategy/ValueFallbackStrategy;
68+
public static final field WARN Lcom/harrytmthy/safebox/strategy/ValueFallbackStrategy;
69+
public static fun getEntries ()Lkotlin/enums/EnumEntries;
70+
public static fun valueOf (Ljava/lang/String;)Lcom/harrytmthy/safebox/strategy/ValueFallbackStrategy;
71+
public static fun values ()[Lcom/harrytmthy/safebox/strategy/ValueFallbackStrategy;
72+
}
73+

safebox/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
plugins {
1818
alias(libs.plugins.safebox.android.library)
1919
alias(libs.plugins.safebox.publishing)
20+
alias(libs.plugins.kotlin.binary.compatibility)
2021
}
2122

2223
android {

0 commit comments

Comments
 (0)