Commit Graph

26 Commits

Author SHA1 Message Date
Beaudan Brown 9beea2cbd3 Enforce curlies completely and lint with new settings 2019-09-05 11:48:10 +10:00
Beaudan ca31649207 Trial value wasn't being initialised big enough for very low difficulty, also development should not have been there but I don't think it was doing anything 2019-06-12 17:26:08 +10:00
Beaudan f01d8088b7 Remove development PoW 2019-06-03 13:38:15 +10:00
Beaudan e520bf109a Persist PoW difficulty and update if get response from snodes 2019-06-03 13:37:34 +10:00
Beaudan Campbell-Brown ee813a1126 Update libloki/proof-of-work.js 2019-04-11 13:04:44 +10:00
Beaudan b9c11a229b Fix tests by handling millisecond ttl better 2019-04-11 12:14:01 +10:00
Beaudan db8f8ba36f Multiple all ttl values by 1000 and stop dividing timestamp by 1000 so they are both milliseconds 2019-04-11 10:56:17 +10:00
Mikunj 6bd2d3962e Linted files 2019-01-16 16:18:08 +11:00
Mikunj 4de69bee4b Reduced PoW difficulty to 100 on production. 2019-01-11 13:13:41 +11:00
sachaaaaa 8c01bea913 variables name consistency and remove superfluous initialisation 2019-01-08 13:56:15 +11:00
sachaaaaa e3138f8fde add yarn pow-metrics 2018-12-20 15:58:18 +11:00
Beaudan 6113f13d3a Rip the worker logic out of message_receiver and add the functionality for it to work with pow. Fix pow tests to work with those changes 2018-12-13 17:13:52 +11:00
Beaudan f6ab6495ae Updated the nonce trials variables to be constants for production and development 2018-12-10 14:28:39 +11:00
Beaudan 7782c58d14 Slight refactor of PoW file to make easier to test plus some tests for the PoW functionality 2018-12-10 14:13:54 +11:00
Beaudan b515fc41e7 Removed some repetetive logs, made the polling time a variable and lower the polling time and PoW difficulty if we are in debug mode 2018-11-26 16:01:13 +11:00
Beaudan 3aa135fdb4 Grabbing last hash from server response. only requesting messages after the lasthash. Keeping track of lasthash for array of nodes (currently hardcoded for one) 2018-11-14 13:09:33 +11:00
Beaudan c59b196487 Now reading messages and adding them to conversations. Some cleaning of unreachable code. Modified the message data to be encoded as base64 string before sending to server
Sending our public key in header of message

Now attaching our key to the source field when sending messages, allows messages to be decrypted with the fallback cypher

Now polling the server for messages every 5 seconds

Sending the source device with messages

Added mock respond function to request to leave it that same as the websocket stuff. RetrieveMessages now just returns the result

Polling now continues if the server responds with an error. Returning only the result from sendMessage and retrieveMessages

Revert commenting of unreachable code

Refactored http logic into own file

Revert a change to websocket-resources
2018-11-13 10:13:19 +11:00
sachaaaaa bf69e9e897 re-lint proof-of-work 2018-11-02 14:43:57 +11:00
sachaaaaa 8a354c8e5c Revert dodgy linting on proof-of-work.js 2018-11-02 14:31:43 +11:00
sachaaaaa 4b9fcb98d4 Linting and other housekeeping stuff 2018-11-01 11:10:30 +11:00
Beaudan 4598fd222a Cleaned up newNonce stuff. Now doing target calculation with BigIntegers 2018-10-31 16:08:46 +11:00
Beaudan 7f12746d8c Made NONCE_LEN a more globally scoped variable 2018-10-30 12:13:08 +11:00
Beaudan fe3898b9d8 Reintroduced function to compare Uint8Arrays again because < isn't working as expected (<3 javascript). Fixed some bugs with the way the Uint8Arrays were being manipulated and made some of the logic more clear 2018-10-30 12:12:25 +11:00
Beaudan d4180b3ca6 Some syntax tidying up, plus fixed bug with message data not being a uint8array after IPC message 2018-10-29 11:43:06 +11:00
Beaudan dfa8b59bc3 Using let and const properly, updated number to uint function, general cleaning 2018-10-18 17:30:50 +11:00
Beaudan ee57c698d7 Client side proof of work attached to messages
Skeleton calcPoW function that prepares payload for hashingFunction to increment Uint8Array nonce

Util function for converting a number to its Uint8Array representation

Actually perform calculate PoW nonce for every message

Adding bytebuffer as dependency and updated package-lock

Move PoW to new file and execute it in child process

TODO: Move send message logic to callback after child process has finished calculating the PoW

Refactored nonce calculation to function to be awaited

More readable timestamp grab plus converted to seconds

Nonce is now returned as a base64 string and included in request header

Also converted timestamp and ttl to string when including them in the header

Added a couple comments and tidied up some nonce logic
2018-10-18 15:35:10 +11:00