Reputation: 288
I have one AWS KEY in my angular js file to upload file to AWS s3 but somehow someone will saw my AWS Key and secret key and it was hacked. so now i want to do some encryption for that string so it is not visible on client side on source file or anywhere else.
Thanks in advance.
i've tried atob() and btoa() but still i dont want to store my original kwy in any variable.
Upvotes: 2
Views: 153
Reputation:
You can't. Giving client-side code access to your AWS key would require you to make that key available to client-side code, and hence to anyone reading your code. There is no way to distinguish between the two cases.
If you need to allow client-side code to upload files to S3, use presigned URLs to authorize specific uploads. Under no circumstances should you ever give clients access to your AWS key.
Upvotes: 4