Lack of documentation.
Hi. I am currently using android and have try to use versions 1.0.0, 2.0.0-alpha-01, 2.0.0-alpha-04. Nothing is working. I see 3 versions of documented features: in description, in release notes, in comments to issues. And no one of this versions is working for me. What a mess!
Please make it structured and clear on how to use this code.
Instead of crying you could create a issue with actual information and not just "Not working!!1!11 😠😠"
If you need help with configuration that's fine! But not giving any information about your project/setup whatever is just useless.
The project is in progress, that's why there is a new major release in alpha state. Because methods, configuration etc. can change currently, there is no up-to-date documentation. (And you commenting on completly different/unrelated issues, doesn't help)
Be polite and I'll help you setting things up but I need information for this.
@DatL4g I am trying to get my strings obfuscated. I use Android project. I tried to create sekret.properties and write my data there - I don't see generated classes. Than I saw about use class Sekret to get value. I tried Sekret.myValue("123"), Sekret().myValue("123") it is not working I get Unresolved reference: Sekret. The docs tells nothing how to deal with is!
You mentioned here https://github.com/DatL4g/Sekret/issues/4#issuecomment-2094836257 that i need to generate new gradle file and include it in my settings.gradle. (Docs still tells nothing about it, this is a new info!). I have done it, got a new module in my project structure but still have Unresolved reference: Sekret.
Please update the docs so I as a user would have full and clear info on how to use this library.
It's documented: https://github.com/DatL4g/Sekret#add-generated-sekret-module Generate Sekret file: https://github.com/DatL4g/Sekret#generate-secrets
@DatL4g My bad for missing that part. Now when I try to run generateSekret it tells me No sekret properties file found. But I have it.
The sekret.properties should be placed in the module where the plugin is applied.
This way you can use this plugin in multiple modules.
As you said that you have an Android project, you probably have a app/ directory with the build script, so it belongs here.
Or you specify the path in the sekret configuration:
sekret {
properties {
// not sure how this looks in plain gradle files
propertiesFile.set(rootProject.layout.projectDirectory.file("sekret.properties"))
}
}
@DatL4g Okay. Now there are not errors for tasks but I still have Unresolved reference: Sekret. I see that new classes are generated but I can't use them. Maybe it's because my sekret module is placed inside App module and I should move sekret module up?
The location is correct for the same reason as the properties, to support multiple modules. Probably just a build cache problem, you can check if the build works fine or not.
Otherwise add implementation(project("sekret")) or implementation(project(":sekret")) to your build script
@DatL4g I have placed implementation(project(":sekret")) but still have Unresolved reference: Sekret. Here my include row: include ':app', ':sekret'
Trying rebuild the project and got:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
> Could not resolve project :sekret.
Required by:
project :app
> No matching configuration of project :sekret was found. The consumer was configured to find a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.3.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
- None of the consumable configurations have attributes.
Change the include to include ':app', ':app:sekret' and then you can remove the implementation
Change the include to
include ':app', ':app:sekret'and then you can remove theimplementation
Got:
* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin 'dev.datlag.sekret'.
> A problem occurred configuring project ':app:sekret'.
> Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl.
> Namespace not specified. Specify a namespace in the module's build file. See https://d.android.com/r/tools/upgrade-assistant/set-namespace for information about setting the namespace.
If you've specified the package attribute in the source AndroidManifest.xml, you can use the AGP Upgrade Assistant to migrate to the namespace value in the build file. Refer to https://d.android.com/r/tools/upgrade-assistant/agp-upgrade-assistant for general information about using the AGP Upgrade Assistant.
Maybe generated module miss namespace.
Yes the namespace is not generated (yet), you can edit the generated gradle file to your needs
Yes the namespace is not generated (yet), you can edit the generated gradle file to your needs
Okay. I placed setting in this module from template project from android studio and now I have my Sekret class. It have fields named like my constants, but what key should I use? What is required from me?
@DatL4g After launching the app I got
java.lang.UnsatisfiedLinkError: No implementation found for java.lang.String com.example.testapp.Sekret.ehqkdssd9a(java.lang.String) (tried Java_com_example_testapp_Sekret_ehqkdssd9a and Java_com_example_testapp_Sekret_ehqkdssd9a__Ljava_lang_String_2) - is the library loaded, e.g. System.loadLibrary?
NativeLoader.loadLibrary("sekret", System.getProperty("compose.application.resources.dir")?.let { File(it) })
Not working for me
To load the library on Android just call NativeLoader.loadLibrary("sekret")
Make sure the library is generated and copied.
Create a jniLibs folder next to your AndroidManifest.xml
sekret {
properties {
nativeCopy {
androidJNIFolder.set(project.layout.projectDirectory.dir("src/main/jniLibs"))
}
}
}
Then generate by calling ./gradlew createSekretNativeBinary and copy ./gradlew copySekretNativeBinary
@DatL4g Thanks, I got it to work. The library looks great, thanks for your work.
A few things I noticed:
-
The Enigma library spends 1.5-2ms when decrypting a string, yours 0.5ms when receiving. But the initial loading of the library takes 30ms. If the file becomes large, then reading 1 value becomes 10ms, which is quite significant because 16ms is the limit frame, which means this can potentially take up the necessary thread time for image rendering and slow down the visual performance of the application. Perhaps there is a way to improve this point?
-
I noticed that with obfuscation, the Sekret class and its methods are not obfuscated. This reduces the security because it reveals what is being used to hide rows. Is there any way to obfuscate this class like everyone else in the project?
-
Is there a way to test that all lines are written correctly and there will be no problems in production? I'm talking about the automated method. This can probably be done manually using tests.