We have an existing API that used by some of our external apps (Docker Containers, etc) to call back to our server. It's secured using an HMAC (Shared Secret) system. This works great when making calls from one server to another.
But, we are about to begin the process of slowly converting our website form .NET Web Forms to Angular (v6), and we are hoping that Angular will be able to use the same API's and the same security.
What we envision is a single Angular library, called something like AngularAPICall, that is instantiated at the start of every session which accepts the public key and the shared secret as parameters. Then, everytime Angular needs to call back to the server, it makes a call to a method inside AngularAPICall, which uses the public key and the shared secret to create the needed hash values and build the API call headers.
But, we're unsure of how to keep the Shared Secret safe and secure when using it on a natively client-side platform like Angular. Where / how do we store the Shared Secret? Putting it in the web.config won't do any good. And in addition to storing it, how do we pass it into the client side library AngularAPICall and keep it secure? And how do we persist it so that it's maintained between calls?
Or... are we going about this the wrong way? Should we re-think how we handle our API security for use in Angular?