Is it correct to assume that the idtoken offers no more security than replacing it with a (possibly salted) SHA2 hash of itself in any follow-up communication with the backend server?
The indended flow would be the following:
- The Android app obtains an idtoken from Google
- The app sends the idtoken to the self-hosted backend server, where it is verified by the backend with the use of gitkitclient.VerifyGitkitToken
- The backend creates a SHA2 hash of the token together with the expiry date and the associated user id, and stores it for future reference in a lookup table
- The Android app creates the same SHA2 hash of the idtoken and passes it along in the header in any future communication with the backend, instead of using the idtoken for the follow-up communication.
Does this decrease in any way the security of the system?
If a transparent proxy with https inspection (and the according certificates installed on the device, ie legitimately in a corporate environment) would sniff the traffic, it would make no difference if the idtoken is obtained or the SHA2 hash of it, that transparent proxy would be able to act (possibly in a rouge way) on behalf of the Android app for the entire lifetime of the idtoken, right?
My issue is that calling gitkitclient.VerifyGitkitToken on every follow-up communication with the server is too expensive, and not necessary once the validity of the idtoken has been ascertained.
I also don't want the idtoken to be stored on the server for future reference, instead prefer having a hash of it. Is a SHA224 hash of the idtoken enough and is it safe to assume that it would not result in any collisions?