Files
bump_android/app/src/main/java/com/example/bump/FirstFragment.kt
raphael 941cc2dc3f adds fernet key decryption analogous to python
- first fragment currently auto-starts process
  to decrypt static message
- token parsed from message correctly
- token validation not yet sucessfull
2021-12-13 23:41:08 +01:00

58 lines
1.7 KiB
Kotlin

package com.maenle.bump
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.navigation.fragment.findNavController
import com.example.bump.MessageProcessor
import com.maenle.bump.databinding.FragmentFirstBinding
/**
* A simple [Fragment] subclass as the default destination in the navigation.
*/
class FirstFragment : Fragment() {
private var _binding: FragmentFirstBinding? = null
// This property is only valid between onCreateView and
// onDestroyView.
private val binding get() = _binding!!
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
_binding = FragmentFirstBinding.inflate(inflater, container, false)
return binding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
binding.buttonFirst.setOnClickListener {
findNavController().navigate(R.id.action_FirstFragment_to_SecondFragment)
}
testDecryption()
}
fun testDecryption() {
val code = "dydoes-unknowledgeable-indiscretion-househusbands-pot-walloper-indiscretion-discophorous-transcriptions-dydoes-poodle-faker-transcriptions-budlike"
var mp = MessageProcessor()
if(mp.codeValid(code)) {
mp.codeSave(code)
}
mp.decrypt("M1dEAxKZ5HUHCJoRkgGOvAABhqCAAAAAAGG2eKTSlKXWLDQx5B_wssZsNwsanzQID2UyUm4KKuKYKgfwH5MG2N-qzt6K4mg3pfZmWPaiDB9PiqlX236k6zo9Yvvq")
}
override fun onDestroyView() {
super.onDestroyView()
_binding = null
}
}