@msm-platform/customer-react 0.2.0 → 0.3.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@msm-platform/customer-react",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "MSM's customer screens for React, and their server half for a partner's server",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -31,7 +31,7 @@
31
31
  "access": "public"
32
32
  },
33
33
  "dependencies": {
34
- "@msm-platform/customer-sdk": "^0.1.1",
34
+ "@msm-platform/customer-sdk": "^0.2.0",
35
35
  "libphonenumber-js": "^1.13.15"
36
36
  },
37
37
  "peerDependencies": {
@@ -1,44 +0,0 @@
1
- /**
2
- * Counts attempts in fixed windows. `hit` adds one attempt to `key` and
3
- * returns the window's count so far, this one included, and the milliseconds
4
- * until the window ends. It must be atomic across every server instance that
5
- * shares the store. A rejected or slow `hit` refuses the attempt (fail closed).
6
- */
7
- export interface LimiterStore {
8
- hit(key: string, windowMs: number): Promise<{
9
- count: number;
10
- resetMs: number;
11
- }>;
12
- }
13
- /**
14
- * The part of a node-redis client (`createClient` from `redis`) the Redis
15
- * store uses, so this package needs no Redis dependency of its own.
16
- */
17
- export interface RedisEvalClient {
18
- eval(script: string, options: {
19
- keys: string[];
20
- arguments: string[];
21
- }): Promise<unknown>;
22
- }
23
- /**
24
- * A limiter store in Redis, shared by every instance of the partner's server.
25
- * Each hit is one Lua script, so concurrent hits never lose a count.
26
- */
27
- export declare function redisLimiterStore(redis: RedisEvalClient): LimiterStore;
28
- /**
29
- * A limiter store in this process's memory. It counts per process, so use it
30
- * only for development, tests or a server that runs as exactly one instance.
31
- */
32
- export declare function memoryLimiterStore(): LimiterStore;
33
- /**
34
- * The limiter key for a phone, as the engine reads it: spaces, parentheses
35
- * and hyphens dropped, then `+` and 7 to 15 digits (E.164). Null for anything
36
- * the engine would refuse, which is refused before any count.
37
- */
38
- export declare function phoneKey(phone: string): string | null;
39
- /**
40
- * The limiter key for a client address: an IPv4 address as is, an IPv6
41
- * address by its /64 (one host usually holds the whole /64), and an
42
- * IPv4-mapped IPv6 address as its IPv4 address. Null when it is neither.
43
- */
44
- export declare function ipKey(address: string): string | null;
@@ -1,22 +0,0 @@
1
- /**
2
- * Checks the bot-check token the screens send with `botCheckToken` when they
3
- * ask for a code. Resolve true when it passes and false when it does not;
4
- * reject when the check cannot be made, which refuses the request with 503
5
- * (fail closed).
6
- */
7
- export type BotCheckVerifier = (token: string, context: {
8
- ip: string;
9
- request: Request;
10
- }) => Promise<boolean>;
11
- /**
12
- * Cloudflare Turnstile's server-side check (siteverify) with the partner's
13
- * secret key. In development use Cloudflare's test keys: the secret
14
- * `1x0000000000000000000000000000000AA` passes every token and
15
- * `2x0000000000000000000000000000000AA` fails every one.
16
- */
17
- export declare function turnstile(options: {
18
- secretKey: string;
19
- /** Milliseconds to wait for siteverify; default 5000. */
20
- timeoutMs?: number;
21
- fetch?: typeof globalThis.fetch;
22
- }): BotCheckVerifier;