EddyVerbruggen / nativescript-secure-storage

:closed_lock_with_key: NativeScript plugin for secure local storage of fi. passwords
MIT License
111 stars 26 forks source link

how to test if the encryption is working #39

Closed crechberger closed 4 years ago

crechberger commented 4 years ago

Hi,

thanks for creating this wonderful plugin.

I have a question: How can I test if the encryption is working. If I run this code, it always displays me "abcd" on the console.

` import * as appSettings from "tns-core-modules/application-settings"; import { SecureStorage } from "nativescript-secure-storage"; let secureStorage = new SecureStorage();

const success = secureStorage.setSync({ key: 'a', value: 'abcd' }); // I would expect the following statement to return me some encrypted text, but it returns "abcd" console.log(appSettings.getString("a")); // following statement displays "abcd" console.log(secureStorage.getSync({ key: "a" })); `

Any ideas? Or am I getting the concept wrong?

EddyVerbruggen commented 4 years ago

If getSync would return encrypted data then how would you be able to read it? So that's not how it works.

You put readable data into secure storage, and get the same readable data back when reading from seccure storage.

Without inspecting the encrypted data directly on the filesystem you have no way of verifying it's actually encrypted. But the plugin is open source so you can check the sourcecode and study how the native libraries used go about encrypting the data.

crechberger commented 4 years ago

ok, thank you for your fast reply!