Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate SHA256 Hashing on iOS (Swift) #84

Open
4 of 8 tasks
nelsonic opened this issue Jun 20, 2017 · 9 comments
Open
4 of 8 tasks

Investigate SHA256 Hashing on iOS (Swift) #84

nelsonic opened this issue Jun 20, 2017 · 9 comments

Comments

@nelsonic
Copy link
Member

nelsonic commented Jun 20, 2017

It appears to be possible to create a SHA256 Hash in Swift:
https://stackoverflow.com/questions/25388747/sha256-in-swift

Todo

  • Convert Task/Timer to JSON - https://developer.apple.com/swift/blog/?id=37
  • Convert JSON to String
  • SHA256 Hash the String
  • write a test to check for the output for the SHA256 Hash functions 👍
  • Use the Hash as the ID in SQL-Lite DB locally on device
  • Put hash into JSON Object as id field
  • Send Strigified JSON to API (including id:hash)

Background Reading

Note: the reason for using a SHA256 instead of another hashing algorithm is: dwyl/learn-cryptography#2

@nelsonic
Copy link
Member Author

@sohilpandya please remember to add a Time Estimate to issues before diving in. 😉

@sohilpandya
Copy link
Member

Thanks for that @nelsonic.

I've estimated 1.5 days for this, already spent ~3 hours on the first couple if items alongside the background reading. :)

update

  • I am trying to implement this whole method on just the starting of a timer.
  • Once the flow has been implemented for this, I can replicate it for when a timer ends.

sohilpandya pushed a commit that referenced this issue Jun 22, 2017
we need to use some objc-c code so needed to use something called a bridging header which would allow us to use some obcj-c code in swift
converting the json string to the hash in startTimer
related to #84, #87
@sohilpandya
Copy link
Member

@nelsonic wanted a clarification on the following point:

Use the Hash as the ID in SQL-Lite DB locally on device

At this moment we are storing the following information in core data:
screen shot 2017-06-23 at 10 35 48 1

I will be adding an additional field in the core data called id which will contain the hash.

  • Every time a timer is started we create this item in the core data. It will contain the hash.

Now when the user stops a timer, we are updating this item in the core data, would we update the hash too? as at the moment, the user starts a timer the hash contains the following infomation

{
  "project_name": "iOS",
  "start_date": "Stringified Date",
  "isTaskRunning": "true"
}

But when the timer is stopped it should have an additional field of "end_date":"Stringified Date"

This will mean that the hash will be different when the timer is started and when the timer is stopped.

@nelsonic
Copy link
Member Author

@sohilpandya apologies if this is unclear. no, we are not updating the hash we are going to save a new revision. I am working on NHS today, but as soon as I have some time spare I will document exactly how this needs to work on both iOS and PWA so it's much clearerer. 👍

Meanwhile could you please write-up a "complete beginners" intro to automated UI testing in: https://github.com/dwyl/learn-apple-watch-development/ thanks! 🎉

@sohilpandya
Copy link
Member

Thanks for that! I'll probably like to catch up about it early Monday morning if we can, I will look into dwyl/learn-apple-watch-development#40 for the time being. 👍

@sohilpandya
Copy link
Member

@nelsonic can we catch up at some point today to talk about this?

@nelsonic
Copy link
Member Author

@sohilpandya dang. only saw this now... I expect to do some work on this on the train on Thursday. we should setup a hangout to catchup. 👍

@sohilpandya
Copy link
Member

Hey @nelsonic That would be awesome, I'm planning to start working full steam from tomorrow so be great if we could catch up first thing tomorrow if that is possible?

@sohilpandya
Copy link
Member

sohilpandya commented Jul 4, 2017

We only have one table, some of the main bits of information it contains:

core data
project_name
task_start_date
task_end_date
is_running

Here is the current flow of all the times we are storing to the core data

  • saving new project (create)
  • start a new timer (create)
  • stopping a new timer (update)

@sohilpandya sohilpandya mentioned this issue Jul 21, 2017
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants