Giter VIP home page Giter VIP logo

kvault's People

Contributors

benjohnde avatar cladvd avatar gaebel avatar jha-vineet69 avatar raibaz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

kvault's Issues

iOS Memory Leak Issue

New Issue Checklist

  • I searched for existing GitHub issues

Info

I'm using KVault (version 1.2.1) for a Kotlin Multiplatform project.

Describe the bug

kVault iOS main part creates many memory leaks in our project. Most of the leaked objects have a type of CFDictionaryCreateMutable. Here are the places of the leaks:

>  KVault/kvault/src/iosMain/kotlin/com/liftric/kvault/KVault.kt:188   
>  KVault/kvault/src/iosMain/kotlin/com/liftric/kvault/KVault.kt:174
>  KVault/kvault/src/iosMain/kotlin/com/liftric/kvault/KVault.kt:176
>  KVault/kvault/src/iosMain/kotlin/com/liftric/kvault/KVault.kt:28
>  KVault/kvault/src/iosMain/kotlin/com/liftric/kvault/KVault.kt:158
>  KVault/kvault/src/iosMain/kotlin/com/liftric/kvault/KVault.kt:176
>  KVault/kvault/src/iosMain/kotlin/com/liftric/kvault/KVault.kt:116
>  KVault/kvault/src/iosMain/kotlin/com/liftric/kvault/KVault.kt:162

...
and so on. I think the problem occurs because of these CF[TYPE]s.

Please note that kVault does not create any memory leaks in Android.

### Expected behavior
kVault shouldn't create any memory leaks in iOS.

Does writing values to kmmPreference work asynchronously?

Hello,

When I want to read a string immediately after writing the sting to Kvault, it continues to return null. Is the KmmPreference.putString(key, value) method working asynchronously? Is there a lock mechanism for this?

Thank you

iOS Memory Leak 2

New Issue Checklist

  • I updated kVault to version: 1.4.1

Describe the bug

Thank you for your previous fix about the issue. Although new updated version seems to fix the significant number of leaks, there are still remaining leaks. Here are the places of the leaks:

>  KVault/kvault/src/iosMain/kotlin/com/liftric/kvault/KVault.kt:46
>  KVault/kvault/src/iosMain/kotlin/com/liftric/kvault/KVault.kt:196
>  KVault/kvault/src/iosMain/kotlin/com/liftric/kvault/KVault.kt:240
>  KVault/kvault/src/iosMain/kotlin/com/liftric/kvault/KVault.kt:254
>  KVault/kvault/src/iosMain/kotlin/com/liftric/kvault/KVault.kt:256
>  KVault/kvault/src/iosMain/kotlin/com/liftric/kvault/KVault.kt:268

May be using weak references could resolve this problem.

### Expected behavior
kVault shouldn't create any memory leaks in iOS.

[Question] Min SDK Version

Correct me if I wrong.
I can see the minSDK is 21, but the dependency androidx.security:security-crypto:1.1.0-alpha03 is using minSDK 23.
What happens if the device API 21 runs an app that uses Kvault? Does encrypt function work well?

Update documentation

The KDoc is targeting the iOS keychain. Change wording to something generally, and add platform specific documentation.

Test clear method thoroughly

Write remaining test case for the clear method. It has to be tested with two KVault's that have different identifiers (serviceName) โ€“ this should only delete the items from one KVault.

Works in praxis as expected. Though add this for completeness.

First step fails: gradle error

I have not been able to try out this project successfully. When I add the line "implementation("com.liftric:kvault:1.7.0")" to my apps build.gradle.kts I get a taskExecutionException. Any ideas to why the first step doesnt work?
This source of the error is:

Incompatible abi version. The current default is '1.4.2', found '1.5.0'. The library produced by 1.5.20 compiler?
I tried 1.5.30 as well, but the error remains.

API as an interface

Hello, it would be create if the lib exposes its API as an interface.

With that adjustment classes that depends on your API are testable b/c popular multiplatform mocking libraries are only support to mock interfaces [MockKMP] [Mockative].

Best

iOS Kotlin Tests not working

I am not able to run the Kotlin tests on the iOS simulator (arm64). Is this a known issue?

    kotlin.AssertionError at null:-1
com.liftric.kvault.KVaultTest.testDeleteObject FAILED
    kotlin.AssertionError at null:-1
com.liftric.kvault.KVaultTest.testExistsObject FAILED
    kotlin.AssertionError at null:-1
com.liftric.kvault.KVaultTest.testOverride FAILED
    kotlin.AssertionError at null:-1
com.liftric.kvault.KVaultTest.testSetGetAll FAILED
    kotlin.AssertionError at null:-1
com.liftric.kvault.KVaultTest.testSetGetBoolean FAILED
    kotlin.AssertionError at null:-1
com.liftric.kvault.KVaultTest.testSetGetData FAILED
    kotlin.AssertionError at null:-1
com.liftric.kvault.KVaultTest.testSetGetDouble FAILED
    kotlin.AssertionError at null:-1
com.liftric.kvault.KVaultTest.testSetGetFloat FAILED
    kotlin.AssertionError at null:-1
com.liftric.kvault.KVaultTest.testSetGetInt FAILED
    kotlin.AssertionError at null:-1
com.liftric.kvault.KVaultTest.testSetGetLong FAILED
    kotlin.AssertionError at null:-1
com.liftric.kvault.KVaultTest.testSetGetString FAILED
    kotlin.AssertionError at null:-1

KVault initialization requires file name to change to avoid EncryptedSharedPreferences crash

Keep running into this error that gets fix after I change the file name: so I basically have a counter that I have to update in order to fix it, do you know why this could be happening?

single { KVault(get(), fileName = "fileName:1") }
0: system/security/keystore2/src/operation.rs:426: Finish failed.
                                                                                                        1: Error::Km(r#VERIFICATION_FAILED)) (public error code: 10 internal Keystore code: -30)
                                                                                                    	at android.security.KeyStore2.getKeyStoreException(KeyStore2.java:386)
                                                                                                    	at android.security.KeyStoreOperation.handleExceptions(KeyStoreOperation.java:78)
                                                                                                    	at android.security.KeyStoreOperation.finish(KeyStoreOperation.java:128)
                                                                                                    	at android.security.keystore2.KeyStoreCryptoOperationChunkedStreamer$MainDataStream.finish(KeyStoreCryptoOperationChunkedStreamer.java:228)
                                                                                                    	at android.security.keystore2.KeyStoreCryptoOperationChunkedStreamer.doFinal(KeyStoreCryptoOperationChunkedStreamer.java:181)
                                                                                                    	at android.security.keystore2.AndroidKeyStoreAuthenticatedAESCipherSpi$BufferAllOutputUntilDoFinalStreamer.doFinal(AndroidKeyStoreAuthenticatedAESCipherSpi.java:396)
                                                                                                    	at android.security.keystore2.AndroidKeyStoreCipherSpiBase.engineDoFinal(AndroidKeyStoreCipherSpiBase.java:618)

Accessing Context in Shared Android

For android, you have to pass the android context to KVault. How do I add the context to KVault from inside the shared module? Can you provide an example for this? This isn't really an issue, it's just unclear how to do it based on the documentation.

iOS integration tests

Think about temporary solution for iOS testing as long as the test target (klib) is not able to execute ktor on main thread: you are either stuck in mutation exception due to frozen thread or endless blocking.

KVault.set() uses sharedPreferences.commit() instead of sharedPreferences.apply()

SharedPreference provides two ways to write changes i.e., commit() and apply(). Where commit() is a synchronous call and can block Mainthread. Whereas apply() write in-memory first followed by asynchronously to the disk.
More details on apply() can be found here.

Can we add option to use apply() by introducing a new API KVault.setAsync(... , ...)?

Example or template for iOS

Hello

Is there an example for template for implementing this in iOS?

Do i need to enable KeyChain permissions in some way?

SharedPreferences `fileName` argument injection

Hi looking on Android implementation of KVault it looks like its API does not allow custom sharedPreferences name.

 encSharedPrefs = EncryptedSharedPreferences.create(
            context,
            "secure-shared-preferences", 
            masterKey,
            EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
            EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM
        )

The "secure-shared-preferences" is hardcoded. Is it possible to add a second argument to KVault constructor with default value, so that at least there will be an option to give a unique fileName.

Support Binary Data

Is there a way KVault could support storing binary data in the secure storage? iOS's keychain supports storing raw bytes. It doesn't look like EncryptedSharedPreferences on Android can store bytes, but you could encode it as Base64 on Android to support it on that side.

Not able to run the KVault library code in ios.

I have added KMM dependency in my code using given commands. But when am trying run the code in ios. Code returns an error:

error: Could not find "/Users/vivu/.gradle/caches/modules-2/files-2.1/com.liftric/kvault-iosx64/1.12.0/6429d98f1faefbf70ea32b3b296a41ece3a6084c/kvault.klib" in [/Users/vivu/Desktop/Wits_cloud-communication-poc/cloud-communication-poc/iosApp/Pods, /Users/vivu/.konan/klib, /Users/vivu/.konan/kotlin-native-prebuilt-macos-x86_64-1.8.21/klib/common, /Users/vivu/.konan/kotlin-native-prebuilt-macos-x86_64-1.8.21/klib/platform/ios_x64]
error: Compilation finished with errors

FAILURE: Build failed with an exception.

Please help me to get the solution.
Thanks in Advance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.