109 points · by jonluca · 6y ago · 39 comments
Also it helps if you don't have to use objects (with keys) to transfer data. What I mean is that there's little reason to use
{
"alias": "b6WJEDTp",
"member_nickname": "faRw33",
"created_at": "4d",
"is_auth": "Y",
"board_id": 114961,
<snip>
when you instead can use a simple array [
"b6WJEDTp",
"faRw33",
"4d",
"Y",
114961,
<snip>
if you have some post-processing to transform array indices into object keys.Both of these approaches also cut down on the amount of data transferred over the wire, so it saves data and helps speed up the site for users too.
(Of course I must admit that this is only suitable for private APIs, not APIs published to explicitly allow third parties to use.)
Have you tried looking at, say, Gmail's XHR requests and responses?
Better to use protobufs at this point.
Edit: maybe the reason they use public key for transmission is because you can't reverse that, and that would potentially be where your anonymous complaints your complaints (or whatever you do on blind) would be?
In practice: possibly, because many companies use TLS proxies that probably aren't doing that?
I think you don't have to resort to symmetric encryption here, even keeping performance in mind. What you do is generate a new asymmetric keypair on the client for every session, then send the public key over to the server. Then the server encrypts every response with that public key, allowing only the client to decrypt it.
Doing that, one can only read a session's network traffic, both ways, if they can read values of variables on the client -- but if one can do that, you can read everything anyway. ;)
EDIT: forgot to talk about performance -- you just use a so-called "envelope", where the sending party first encrypts the data symmetrically with a randomly generated key, then encrypts that random key with the asymmetric crypto. The pair (symmetrically encrypted data and the asymmetrically encrypted key) is sent to the receiver, which can use its private key to decrypt the symmetric key, with which it decrypts the data.
from the silly comments of "infinite scrolling" being definitive proof of a solid rest api behind and that php is or is not capable of either (the writing is too ambiguous). to the roundabout amateur obfuscation (the author calls encryption) that is entirely akin to the JavaScript that disabled right click to "copyright" the page's content in the 90s.
sigh