[removed] hiding contents of key

前端 未结 8 1306
梦谈多话
梦谈多话 2020-12-22 14:04

In the code below I want to hide the contents of the key(speaker) key being viewed by browser console.

var App_Version         


        
8条回答
  •  南方客
    南方客 (楼主)
    2020-12-22 14:53

    If var Speaker = "password"; is hardcoded somewhere in your client code, you are out of luck. See Password encryption at client side, and Howto hide Credentials in a pure Javascript HTML Web App and Is it worth hashing passwords on the client side because everyone will say not to hide/obfuscate a password on the client-side.


    However, If you really, really just want to remove the password altogether from your client code, then use a server-side script to "proxy" your AJAX request and silently add the password as a POST parameter (for example) in transit to the true destination. See Angular REST API security


    If you are adamant about using some kind of crypto on the client-side, I found angularjs-crypto which is an "AngularJS module for decryption/encryption of JSON in HTTP requests/responses". It is based on crypto-js. I still strongly against taking a hardcoded password and encrypting it on the client-side, however.

提交回复
热议问题