@kya-os/checkpoint-shared 1.2.1 → 1.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.
Files changed (68) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +1 -1
  3. package/dist/beacon-types/index.d.mts +13 -2
  4. package/dist/beacon-types/index.d.ts +13 -2
  5. package/dist/beacon-types/index.js +35 -3
  6. package/dist/beacon-types/index.mjs +35 -4
  7. package/dist/browser-posture-report.d.mts +85 -0
  8. package/dist/browser-posture-report.d.ts +85 -0
  9. package/dist/browser-posture-report.js +1 -0
  10. package/dist/browser-posture-report.mjs +1 -0
  11. package/dist/browser-posture.d.mts +114 -0
  12. package/dist/browser-posture.d.ts +114 -0
  13. package/dist/browser-posture.js +4204 -0
  14. package/dist/browser-posture.mjs +4187 -0
  15. package/dist/browser.d.mts +35 -1
  16. package/dist/browser.d.ts +35 -1
  17. package/dist/browser.js +1 -1
  18. package/dist/browser.mjs +1 -1
  19. package/dist/canonical-signer/index.js +31 -2
  20. package/dist/canonical-signer/index.mjs +31 -2
  21. package/dist/deploy/index.d.mts +449 -2
  22. package/dist/deploy/index.d.ts +449 -2
  23. package/dist/deploy/index.js +238 -1
  24. package/dist/deploy/index.mjs +228 -2
  25. package/dist/errors/index.d.mts +104 -0
  26. package/dist/errors/index.d.ts +104 -0
  27. package/dist/errors/index.js +338 -0
  28. package/dist/errors/index.mjs +333 -0
  29. package/dist/gateway/index.d.mts +6 -1
  30. package/dist/gateway/index.d.ts +6 -1
  31. package/dist/gateway/index.js +4 -0
  32. package/dist/gateway/index.mjs +4 -1
  33. package/dist/index.d.mts +2388 -851
  34. package/dist/index.d.ts +2388 -851
  35. package/dist/index.js +2684 -686
  36. package/dist/index.mjs +2575 -669
  37. package/dist/mcpi/multibase-ed25519.d.mts +8 -0
  38. package/dist/mcpi/multibase-ed25519.d.ts +8 -0
  39. package/dist/mcpi/multibase-ed25519.js +125 -0
  40. package/dist/mcpi/multibase-ed25519.mjs +119 -0
  41. package/dist/signals/index.d.mts +158 -0
  42. package/dist/signals/index.d.ts +158 -0
  43. package/dist/signals/index.js +1667 -0
  44. package/dist/signals/index.mjs +1637 -0
  45. package/dist/test-fixtures/index.d.mts +37 -1
  46. package/dist/test-fixtures/index.d.ts +37 -1
  47. package/dist/test-fixtures/index.js +92 -1
  48. package/dist/test-fixtures/index.mjs +87 -2
  49. package/fixtures/client-ip-resolution.json +103 -0
  50. package/fixtures/detection/reason-codes.json +35 -0
  51. package/fixtures/detection/signal-exposure-example.json +62 -0
  52. package/fixtures/kya-http/README.md +112 -0
  53. package/fixtures/kya-http/challenge-proof.canonical.json +25 -0
  54. package/fixtures/kya-http/challenge.approval-quorum.json +37 -0
  55. package/fixtures/kya-http/challenge.delegation.fetcher-200.json +55 -0
  56. package/fixtures/kya-http/challenge.delegation.full.json +81 -0
  57. package/fixtures/kya-http/challenge.delegation.minimal.json +57 -0
  58. package/fixtures/kya-http/error-codes.json +35 -0
  59. package/fixtures/kya-http/fetcher-200-predicate.vectors.json +72 -0
  60. package/fixtures/kya-http/negative.challenges.json +54 -0
  61. package/fixtures/kya-http/pickup.transcript.json +96 -0
  62. package/fixtures/kya-http/pickup.transcript.quorum.json +156 -0
  63. package/fixtures/kya-http/protected-resource-metadata.full.json +30 -0
  64. package/fixtures/kya-http/protected-resource-metadata.global.json +28 -0
  65. package/fixtures/kya-http/registration.request.json +33 -0
  66. package/fixtures/kya-http/registration.response.json +32 -0
  67. package/package.json +42 -9
  68. package/src/data/compiled/merged-rules.json +8 -2
@@ -0,0 +1,114 @@
1
+ import { JWK } from 'jose';
2
+ export { JWK } from 'jose';
3
+ import { z } from 'zod';
4
+
5
+ declare const BrowserPostureReportSchema: z.ZodObject<{
6
+ projectId: z.ZodString;
7
+ sessionId: z.ZodString;
8
+ verdict: z.ZodEnum<["human", "agent-driven", "insufficient"]>;
9
+ score: z.ZodNullable<z.ZodNumber>;
10
+ scorerVersion: z.ZodNumber;
11
+ reasons: z.ZodArray<z.ZodString, "many">;
12
+ issuedAt: z.ZodNumber;
13
+ expiresAt: z.ZodNumber;
14
+ source: z.ZodLiteral<"verified-posture">;
15
+ }, "strip", z.ZodTypeAny, {
16
+ verdict: "agent-driven" | "human" | "insufficient";
17
+ score: number | null;
18
+ reasons: string[];
19
+ projectId: string;
20
+ sessionId: string;
21
+ scorerVersion: number;
22
+ issuedAt: number;
23
+ expiresAt: number;
24
+ source: "verified-posture";
25
+ }, {
26
+ verdict: "agent-driven" | "human" | "insufficient";
27
+ score: number | null;
28
+ reasons: string[];
29
+ projectId: string;
30
+ sessionId: string;
31
+ scorerVersion: number;
32
+ issuedAt: number;
33
+ expiresAt: number;
34
+ source: "verified-posture";
35
+ }>;
36
+ declare function browserPostureReport(posture: BrowserPosture): {
37
+ projectId: string;
38
+ sessionId: string;
39
+ verdict: "agent-driven" | "human" | "insufficient";
40
+ score: number | null;
41
+ scorerVersion: number;
42
+ reasons: string[];
43
+ issuedAt: number;
44
+ expiresAt: number;
45
+ source: "verified-posture";
46
+ };
47
+
48
+ declare const UNSIGNED_BROWSER_AGENT: {
49
+ readonly agentType: "Browser agent (unsigned)";
50
+ readonly detectionClass: "ai_agent";
51
+ readonly verificationMethod: "behavioral";
52
+ };
53
+ declare const behavioralConfidence: (score: number | null) => number;
54
+ declare const POSTURE_TTL_SECONDS = 120;
55
+ declare const POSTURE_ISSUER = "checkpoint:browser-posture:v1";
56
+ declare const POSTURE_TYPE = "checkpoint-posture+jwt";
57
+ declare const BrowserPostureSchema: z.ZodObject<{
58
+ v: z.ZodLiteral<1>;
59
+ project_id: z.ZodString;
60
+ origin: z.ZodString;
61
+ session_id: z.ZodString;
62
+ binding: z.ZodString;
63
+ verdict: z.ZodEnum<["agent-driven", "human", "insufficient"]>;
64
+ score: z.ZodNullable<z.ZodNumber>;
65
+ scorer_version: z.ZodNumber;
66
+ reasons: z.ZodArray<z.ZodString, "many">;
67
+ iat: z.ZodNumber;
68
+ exp: z.ZodNumber;
69
+ }, "strip", z.ZodTypeAny, {
70
+ v: 1;
71
+ project_id: string;
72
+ origin: string;
73
+ session_id: string;
74
+ binding: string;
75
+ verdict: "agent-driven" | "human" | "insufficient";
76
+ score: number | null;
77
+ scorer_version: number;
78
+ reasons: string[];
79
+ iat: number;
80
+ exp: number;
81
+ }, {
82
+ v: 1;
83
+ project_id: string;
84
+ origin: string;
85
+ session_id: string;
86
+ binding: string;
87
+ verdict: "agent-driven" | "human" | "insufficient";
88
+ score: number | null;
89
+ scorer_version: number;
90
+ reasons: string[];
91
+ iat: number;
92
+ exp: number;
93
+ }>;
94
+ type BrowserPosture = z.infer<typeof BrowserPostureSchema>;
95
+ interface BrowserPostureConfig {
96
+ publicKey: JWK;
97
+ keyId: string;
98
+ origin: string;
99
+ sessionCookieName?: string;
100
+ protectedRoutes?: Array<{
101
+ path: string;
102
+ scopes: string[];
103
+ }>;
104
+ }
105
+ declare function postureCookieName(projectId: string): string;
106
+ declare function readPostureCookie(header: string | null | undefined, name: string): string | undefined;
107
+ declare function postureSessionBinding(sessionId: string): Promise<string>;
108
+ declare function signBrowserPosture(posture: BrowserPosture, privateKey: JWK, keyId: string): Promise<string>;
109
+ declare function verifyBrowserPosture(token: string | undefined, config: BrowserPostureConfig, projectId: string, browserSessionId: string | undefined, now?: number): Promise<BrowserPosture | undefined>;
110
+ declare function postureFromCookies(header: string | null | undefined, config: BrowserPostureConfig, projectId: string): Promise<BrowserPosture | undefined>;
111
+ declare function postureRequiredScopes(config: BrowserPostureConfig, path: string): string[] | undefined;
112
+ declare function validateBrowserPostureConfig(config: BrowserPostureConfig, projectId: string | undefined): void;
113
+
114
+ export { type BrowserPosture, type BrowserPostureConfig, BrowserPostureReportSchema, BrowserPostureSchema, POSTURE_ISSUER, POSTURE_TTL_SECONDS, POSTURE_TYPE, UNSIGNED_BROWSER_AGENT, behavioralConfidence, browserPostureReport, postureCookieName, postureFromCookies, postureRequiredScopes, postureSessionBinding, readPostureCookie, signBrowserPosture, validateBrowserPostureConfig, verifyBrowserPosture };