V
V
Vihtori Mallat2017-07-05 12:41:00
Working with date/time
Vihtori Mallat, 2017-07-05 12:41:00

How to safely pass a timestamp from a Cordova application to a server?

An abstract example. The courier went from point O to point A, received the container and delivers it to point B. The payment depends on the time and distance between A and B.
At the moment, the application sends requests to the server ("left", "received", "delivered") . The server saves the timestamp.
If there is no connection at point A, the "received" request cannot be sent in a timely manner, which entails an incorrect calculation of the cost.
If a timestamp is passed in the request, and the request itself is executed as far as possible, there is a possibility of transmitting deliberately incorrect data, which, again, can lead to an incorrect calculation of the cost.
It is necessary to insure against the transmission of false data.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolai Kargin, 2017-07-11
@kgnk

Look at the problem from the wrong side, apparently, the timestamp is formed on the basis of GPS data, which is very easy to fake and it becomes completely indifferent when exactly the label was sent.
Apparently, in addition to couriers, there are also suppliers with recipients in the application? Couriers are interested in cheating the system to maximize profits, while suppliers and recipients are interested in minimizing costs.
The model of my solution looks something like this:
Upon receipt of the goods, the supplier scans a QR code with a hash confirming the transfer of the goods. Time is recorded on both sides. When transferring goods, a similar operation occurs only with the hash of receiving the goods. All data is sent as soon as possible.
The server checks the time delta of the goods transfer to the courier from the supplier from both sides. Similarly with the transfer of goods from the courier to the recipient. If the discrepancy is more than a few minutes, someone can be banned immediately. As a result, no one will benefit from cheating the system, and you have real timestamps.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question