@request-shield/angular 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +5 -3
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -3,6 +3,8 @@
3
3
  Angular `HttpClient` interceptor for [request-shield](https://github.com/karammm/request-shield): every request to your API is signed with a
4
4
  non-exportable WebCrypto key, so copying it into cURL/Postman doesn't work.
5
5
 
6
+ **[Live demo](https://karammm.github.io/request-shield/)**: copy a signed request into cURL and watch it get rejected.
7
+
6
8
  ```bash
7
9
  npm install @request-shield/angular
8
10
  ```
@@ -10,13 +12,13 @@ npm install @request-shield/angular
10
12
  ```ts
11
13
  // app.config.ts
12
14
  import { provideHttpClient, withInterceptors } from '@angular/common/http';
13
- import { provideRequestShield, requestShieldInterceptor } from '@request-shield/angular';
15
+ import { provideRequestShield, requestShieldInterceptor, createTurnstileTokenProvider } from '@request-shield/angular';
14
16
 
15
17
  export const appConfig: ApplicationConfig = {
16
18
  providers: [
17
19
  provideRequestShield({
18
20
  apiBase: environment.apiUrl,
19
- getAttestationToken: () => getTurnstileToken(),
21
+ getAttestationToken: createTurnstileTokenProvider({ siteKey: TURNSTILE_SITE_KEY }),
20
22
  }),
21
23
  provideHttpClient(withInterceptors([requestShieldInterceptor])),
22
24
  ],
@@ -24,5 +26,5 @@ export const appConfig: ApplicationConfig = {
24
26
  ```
25
27
 
26
28
  Your services keep using `HttpClient` unchanged. Requires Angular 16+.
27
- Your server must verify the signatures: `go get github.com/karammm/request-shield/server/go`.
29
+ Your server must verify the signatures: [`@request-shield/server`](https://www.npmjs.com/package/@request-shield/server) (Node) or `go get github.com/karammm/request-shield/server/go@latest` (Go).
28
30
  [Full documentation](https://github.com/karammm/request-shield#readme).
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@request-shield/angular",
3
- "version": "0.1.0",
4
- "description": "Angular HttpClient interceptor for request-shield.",
3
+ "version": "0.2.0",
4
+ "description": "Angular HttpClient interceptor that signs every API request, so copied requests replayed from cURL/Postman are rejected.",
5
5
  "keywords": [
6
6
  "angular",
7
7
  "http-interceptor",
@@ -38,7 +38,7 @@
38
38
  "build": "tsc -p tsconfig.json"
39
39
  },
40
40
  "dependencies": {
41
- "@request-shield/core": "^0.1.0"
41
+ "@request-shield/core": "^0.2.0"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@angular/common": ">=16",