@request-shield/angular
v0.3.0
Published
Angular HttpClient interceptor that signs every API request, so copied requests replayed from cURL/Postman are rejected.
Maintainers
Readme
@request-shield/angular
Angular HttpClient interceptor for request-shield: every request to your API is signed with a
non-exportable WebCrypto key, so copying it into cURL/Postman doesn't work.
Live demo: copy a signed request into cURL and watch it get rejected.
npm install @request-shield/angular// app.config.ts
import { provideHttpClient, withInterceptors } from '@angular/common/http';
import { provideRequestShield, requestShieldInterceptor, createTurnstileTokenProvider } from '@request-shield/angular';
export const appConfig: ApplicationConfig = {
providers: [
provideRequestShield({
apiBase: environment.apiUrl,
getAttestationToken: createTurnstileTokenProvider({ siteKey: TURNSTILE_SITE_KEY }),
}),
provideHttpClient(withInterceptors([requestShieldInterceptor])),
],
};Your services keep using HttpClient unchanged. Requires Angular 16+.
Your server must verify the signatures: @request-shield/server (Node) or go get github.com/karammm/request-shield/server/go@latest (Go).
Full documentation.
