This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //save data | |
| encryptedFile.openFileOutput().use { outputstream -> | |
| outputstream.write(et_data.text.toString().toByteArray()) | |
| } | |
| //read data | |
| encryptedFile.openFileInput().use { inputstream -> | |
| tv_result.text = String(inputstream.readBytes(), Charsets.UTF_8) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| override fun onAuthenticationSucceeded(result: AuthenticationResult) { | |
| super.onAuthenticationSucceeded(result) | |
| // key is unlocked | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| encryptedFile = EncryptedFile.Builder( | |
| secretFile, | |
| applicationContext, | |
| MasterKeys.getOrCreate(MasterKeys.AES256_GCM_SPEC), //master key | |
| EncryptedFile.FileEncryptionScheme.AES256_GCM_HKDF_4KB | |
| ) | |
| .setKeysetAlias("file_key") //optional | |
| .setKeysetPrefName("secret_file_shared_prefs") //optional | |
| .build() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val keySpecifications = KeyGenParameterSpec.Builder( | |
| "key_alias", | |
| KeyProperties.PURPOSE_ENCRYPT or KeyProperties.PURPOSE_DECRYPT | |
| ).apply { | |
| setKeySize(256) | |
| setBlockModes(KeyProperties.BLOCK_MODE_GCM) | |
| setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_NONE) | |
| }.build() | |
| val masterKey = MasterKeys.getOrCreate(keySpecifications) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Widget getMotionBuilder(MotionElement child, AnimationController animCont, | |
| {bool isExit = false}) { | |
| Animation transAnim; | |
| Widget builder; | |
| switch (child.mode) { | |
| case MotionMode.TRANSLATE_FADE: | |
| transAnim = getTransAnim(child, animCont, isExit); | |
| builder = FadeTransition( | |
| opacity: getOpacAnim(child, animCont, isExit), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @override | |
| Widget build(BuildContext context) { | |
| return Scaffold( | |
| body: Column( | |
| children: <Widget>[ | |
| Expanded( | |
| child: Padding( | |
| padding: const EdgeInsets.symmetric(horizontal: 35, vertical: 50), | |
| child: Motion<Column>( | |
| durationMs: 2500, |