@pithy-sh/core 0.11.0 → 0.12.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 (142) hide show
  1. package/dist/audit/recorder.d.ts +10 -2
  2. package/dist/audit/recorder.d.ts.map +1 -1
  3. package/dist/capability/capability.d.ts +12 -0
  4. package/dist/capability/capability.d.ts.map +1 -1
  5. package/dist/capability/capability.js +2 -0
  6. package/dist/capability/purge.d.ts +80 -0
  7. package/dist/capability/purge.d.ts.map +1 -0
  8. package/dist/capability/purge.js +76 -0
  9. package/dist/cli/commandCatalog.generated.d.ts +54 -2
  10. package/dist/cli/commandCatalog.generated.d.ts.map +1 -1
  11. package/dist/cli/commandCatalog.generated.js +55 -0
  12. package/dist/cli/commandFacts.d.ts +1 -0
  13. package/dist/cli/commandFacts.d.ts.map +1 -1
  14. package/dist/cli/commandFacts.js +1 -0
  15. package/dist/controlPlane/capability.d.ts.map +1 -1
  16. package/dist/controlPlane/capability.js +7 -0
  17. package/dist/controlPlane/data/connection.d.ts +2 -12
  18. package/dist/controlPlane/data/connection.d.ts.map +1 -1
  19. package/dist/controlPlane/data/connection.js +1 -1
  20. package/dist/controlPlane/discovery/adminRoute.d.ts +29 -0
  21. package/dist/controlPlane/discovery/adminRoute.d.ts.map +1 -1
  22. package/dist/controlPlane/discovery/adminRoute.js +3 -0
  23. package/dist/controlPlane/error/errors.d.ts +4 -3
  24. package/dist/controlPlane/error/errors.d.ts.map +1 -1
  25. package/dist/controlPlane/http/handlers.d.ts +79 -0
  26. package/dist/controlPlane/http/handlers.d.ts.map +1 -1
  27. package/dist/controlPlane/http/handlers.js +37 -3
  28. package/dist/controlPlane/http/responses.d.ts +98 -0
  29. package/dist/controlPlane/http/responses.d.ts.map +1 -1
  30. package/dist/controlPlane/http/responses.js +41 -1
  31. package/dist/controlPlane/http/routes.d.ts +1 -0
  32. package/dist/controlPlane/http/routes.d.ts.map +1 -1
  33. package/dist/controlPlane/http/routes.js +17 -3
  34. package/dist/controlPlane/scope/scope.d.ts +13 -3
  35. package/dist/controlPlane/scope/scope.d.ts.map +1 -1
  36. package/dist/controlPlane/scope/scope.js +14 -4
  37. package/dist/createBackend.d.ts.map +1 -1
  38. package/dist/createBackend.js +2 -0
  39. package/dist/crypto/envelope.d.ts +86 -0
  40. package/dist/crypto/envelope.d.ts.map +1 -0
  41. package/dist/crypto/envelope.js +129 -0
  42. package/dist/crypto/fieldKeys.d.ts +41 -0
  43. package/dist/crypto/fieldKeys.d.ts.map +1 -0
  44. package/dist/crypto/fieldKeys.js +56 -0
  45. package/dist/data/codecs.d.ts +23 -10
  46. package/dist/data/codecs.d.ts.map +1 -1
  47. package/dist/data/codecs.js +50 -36
  48. package/dist/error/extend.d.ts +6 -5
  49. package/dist/error/extend.d.ts.map +1 -1
  50. package/dist/error/http.d.ts +24 -0
  51. package/dist/error/http.d.ts.map +1 -1
  52. package/dist/error/payload.d.ts +48 -0
  53. package/dist/error/payload.d.ts.map +1 -1
  54. package/dist/error/payload.js +16 -0
  55. package/dist/error/pithyError.d.ts +18 -7
  56. package/dist/error/pithyError.d.ts.map +1 -1
  57. package/dist/error/pithyError.js +6 -0
  58. package/dist/index.d.ts +1 -1
  59. package/dist/index.d.ts.map +1 -1
  60. package/dist/index.js +2 -2
  61. package/dist/logger/logger.d.ts +12 -5
  62. package/dist/logger/logger.d.ts.map +1 -1
  63. package/dist/logger/record.d.ts +14 -0
  64. package/dist/logger/record.d.ts.map +1 -1
  65. package/dist/privacy/blindIndex.d.ts +27 -0
  66. package/dist/privacy/blindIndex.d.ts.map +1 -0
  67. package/dist/privacy/blindIndex.js +57 -0
  68. package/dist/privacy/classes.d.ts +142 -0
  69. package/dist/privacy/classes.d.ts.map +1 -0
  70. package/dist/privacy/classes.js +209 -0
  71. package/dist/privacy/classify.d.ts +336 -0
  72. package/dist/privacy/classify.d.ts.map +1 -0
  73. package/dist/privacy/classify.js +1024 -0
  74. package/dist/privacy/encrypted.d.ts +210 -0
  75. package/dist/privacy/encrypted.d.ts.map +1 -0
  76. package/dist/privacy/encrypted.js +350 -0
  77. package/dist/privacy/encryptedColumns.d.ts +64 -0
  78. package/dist/privacy/encryptedColumns.d.ts.map +1 -0
  79. package/dist/privacy/encryptedColumns.js +134 -0
  80. package/dist/privacy/fieldRotation.d.ts +34 -0
  81. package/dist/privacy/fieldRotation.d.ts.map +1 -0
  82. package/dist/privacy/fieldRotation.js +186 -0
  83. package/dist/privacy/inventory.d.ts +12 -0
  84. package/dist/privacy/inventory.d.ts.map +1 -0
  85. package/dist/privacy/inventory.js +154 -0
  86. package/dist/privacy/posture.d.ts +114 -0
  87. package/dist/privacy/posture.d.ts.map +1 -0
  88. package/dist/privacy/posture.js +136 -0
  89. package/dist/privacy/redact.d.ts +7 -0
  90. package/dist/privacy/redact.d.ts.map +1 -0
  91. package/dist/privacy/redact.js +404 -0
  92. package/dist/privacy/report.d.ts +58 -0
  93. package/dist/privacy/report.d.ts.map +1 -0
  94. package/dist/privacy/report.js +15 -0
  95. package/dist/privacy/retirement.d.ts +68 -0
  96. package/dist/privacy/retirement.d.ts.map +1 -0
  97. package/dist/privacy/retirement.js +72 -0
  98. package/dist/privacy/sealed.d.ts +87 -0
  99. package/dist/privacy/sealed.d.ts.map +1 -0
  100. package/dist/privacy/sealed.js +221 -0
  101. package/dist/privacy/types.d.ts +559 -0
  102. package/dist/privacy/types.d.ts.map +1 -0
  103. package/dist/privacy/types.js +2 -0
  104. package/dist/version.generated.d.ts +1 -1
  105. package/dist/version.generated.js +1 -1
  106. package/package.json +1 -1
  107. package/src/audit/recorder.ts +10 -2
  108. package/src/capability/capability.ts +15 -0
  109. package/src/capability/purge.ts +124 -0
  110. package/src/cli/commandCatalog.generated.ts +59 -0
  111. package/src/cli/commandFacts.ts +1 -0
  112. package/src/controlPlane/capability.ts +11 -0
  113. package/src/controlPlane/discovery/adminRoute.ts +11 -0
  114. package/src/controlPlane/error/errors.ts +4 -3
  115. package/src/controlPlane/http/handlers.ts +57 -4
  116. package/src/controlPlane/http/responses.ts +100 -0
  117. package/src/controlPlane/http/routes.ts +31 -1
  118. package/src/controlPlane/scope/scope.ts +14 -3
  119. package/src/controlPlane/token/base64url.ts +1 -1
  120. package/src/createBackend.ts +4 -0
  121. package/src/crypto/envelope.ts +196 -0
  122. package/src/crypto/fieldKeys.ts +76 -0
  123. package/src/data/codecs.ts +69 -37
  124. package/src/error/extend.ts +6 -5
  125. package/src/error/payload.ts +42 -0
  126. package/src/error/pithyError.ts +21 -7
  127. package/src/index.ts +1 -0
  128. package/src/logger/logger.ts +12 -5
  129. package/src/privacy/blindIndex.ts +81 -0
  130. package/src/privacy/classes.ts +277 -0
  131. package/src/privacy/classify.ts +1447 -0
  132. package/src/privacy/encrypted.ts +513 -0
  133. package/src/privacy/encryptedColumns.ts +185 -0
  134. package/src/privacy/fieldRotation.ts +234 -0
  135. package/src/privacy/inventory.ts +147 -0
  136. package/src/privacy/posture.ts +205 -0
  137. package/src/privacy/redact.ts +423 -0
  138. package/src/privacy/report.ts +64 -0
  139. package/src/privacy/retirement.ts +102 -0
  140. package/src/privacy/sealed.ts +323 -0
  141. package/src/privacy/types.ts +804 -0
  142. package/src/version.generated.ts +1 -1
@@ -70,6 +70,16 @@ export declare const KitPublicErrorPayload: z.ZodDiscriminatedUnion<[z.ZodObject
70
70
  params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
71
71
  code: z.ZodLiteral<"auth/session_not_fresh">;
72
72
  status: z.ZodLiteral<403>;
73
+ }, z.core.$strip>, z.ZodObject<{
74
+ message: z.ZodString;
75
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
76
+ code: z.ZodLiteral<"auth/account_suspended">;
77
+ status: z.ZodLiteral<403>;
78
+ }, z.core.$strip>, z.ZodObject<{
79
+ message: z.ZodString;
80
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
81
+ code: z.ZodLiteral<"auth/account_deleted">;
82
+ status: z.ZodLiteral<403>;
73
83
  }, z.core.$strip>, z.ZodObject<{
74
84
  message: z.ZodString;
75
85
  params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
@@ -824,6 +834,20 @@ export declare const KitErrorPayload: z.ZodDiscriminatedUnion<[z.ZodObject<{
824
834
  detail: z.ZodOptional<z.ZodString>;
825
835
  code: z.ZodLiteral<"auth/session_not_fresh">;
826
836
  status: z.ZodLiteral<403>;
837
+ }, z.core.$strip>, z.ZodObject<{
838
+ message: z.ZodString;
839
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
840
+ action: z.ZodOptional<z.ZodString>;
841
+ detail: z.ZodOptional<z.ZodString>;
842
+ code: z.ZodLiteral<"auth/account_suspended">;
843
+ status: z.ZodLiteral<403>;
844
+ }, z.core.$strip>, z.ZodObject<{
845
+ message: z.ZodString;
846
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
847
+ action: z.ZodOptional<z.ZodString>;
848
+ detail: z.ZodOptional<z.ZodString>;
849
+ code: z.ZodLiteral<"auth/account_deleted">;
850
+ status: z.ZodLiteral<403>;
827
851
  }, z.core.$strip>, z.ZodObject<{
828
852
  message: z.ZodString;
829
853
  params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
@@ -1853,6 +1877,16 @@ export declare const PublicErrorPayload: z.ZodUnion<readonly [z.ZodDiscriminated
1853
1877
  params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
1854
1878
  code: z.ZodLiteral<"auth/session_not_fresh">;
1855
1879
  status: z.ZodLiteral<403>;
1880
+ }, z.core.$strip>, z.ZodObject<{
1881
+ message: z.ZodString;
1882
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
1883
+ code: z.ZodLiteral<"auth/account_suspended">;
1884
+ status: z.ZodLiteral<403>;
1885
+ }, z.core.$strip>, z.ZodObject<{
1886
+ message: z.ZodString;
1887
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
1888
+ code: z.ZodLiteral<"auth/account_deleted">;
1889
+ status: z.ZodLiteral<403>;
1856
1890
  }, z.core.$strip>, z.ZodObject<{
1857
1891
  message: z.ZodString;
1858
1892
  params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
@@ -2623,6 +2657,20 @@ export declare const ErrorPayload: z.ZodUnion<readonly [z.ZodDiscriminatedUnion<
2623
2657
  detail: z.ZodOptional<z.ZodString>;
2624
2658
  code: z.ZodLiteral<"auth/session_not_fresh">;
2625
2659
  status: z.ZodLiteral<403>;
2660
+ }, z.core.$strip>, z.ZodObject<{
2661
+ message: z.ZodString;
2662
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
2663
+ action: z.ZodOptional<z.ZodString>;
2664
+ detail: z.ZodOptional<z.ZodString>;
2665
+ code: z.ZodLiteral<"auth/account_suspended">;
2666
+ status: z.ZodLiteral<403>;
2667
+ }, z.core.$strip>, z.ZodObject<{
2668
+ message: z.ZodString;
2669
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
2670
+ action: z.ZodOptional<z.ZodString>;
2671
+ detail: z.ZodOptional<z.ZodString>;
2672
+ code: z.ZodLiteral<"auth/account_deleted">;
2673
+ status: z.ZodLiteral<403>;
2626
2674
  }, z.core.$strip>, z.ZodObject<{
2627
2675
  message: z.ZodString;
2628
2676
  params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
@@ -1 +1 @@
1
- {"version":3,"file":"payload.d.ts","sourceRoot":"","sources":["../../src/error/payload.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;;;GAQG;AAEH,uFAAuF;AACvF,eAAO,MAAM,eAAe;;;;iBAQqD,CAAC;AAClF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAsrD9D;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAItB,CAAC;AACJ,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD,mGAAmG;AACnG,MAAM,MAAM,SAAS,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC"}
@@ -97,6 +97,16 @@ const AuthSessionNotFreshPublic = z.object({
97
97
  status: z.literal(403).describe("Forbidden — a real, current credential was presented and is not sufficient for this particular decision. Not 401, which is what a caller with no credential gets: a client that cannot tell the two apart does not know whether to re-authenticate or to retry."),
98
98
  ...publicFields
99
99
  }).describe("The session is authentic but the holder authenticated too long ago to attach a provider (403).");
100
+ const AuthAccountSuspendedPublic = z.object({
101
+ code: z.literal("auth/account_suspended").describe("The account this credential belongs to is suspended, so the request is refused whatever it carries. An operator suspended it on purpose, with a reason, and the reason is the `message`. When the suspension has an end, `params.suspendedUntil` names it as ISO-8601; a suspension past its end is no longer one, and nothing has to clear it. A separate code from `auth/forbidden` so a client can render the screen that says what happened rather than a generic refusal."),
102
+ status: z.literal(403).describe("Forbidden — the credential is genuine and the account behind it may not act. Not 401: signing in again cannot help, and a client that read it as an expired token would loop."),
103
+ ...publicFields
104
+ }).describe("The account is suspended (403).");
105
+ const AuthAccountDeletedPublic = z.object({
106
+ code: z.literal("auth/account_deleted").describe("The account this credential belongs to is deleted and inside its purge window: it cannot sign in or act, and it can still be restored until the window closes. After the purge there is no account, and the credential is simply invalid."),
107
+ status: z.literal(403).describe("Forbidden — the account exists and may not act. Not 404, because until the purge runs it can come back, and not 401, because signing in again cannot help."),
108
+ ...publicFields
109
+ }).describe("The account is deleted and awaiting its purge (403).");
100
110
  const NotFoundPublic = z.object({
101
111
  code: z.literal("core/not_found").describe("The requested resource does not exist."),
102
112
  status: z.literal(404).describe("Not Found."),
@@ -797,6 +807,8 @@ const KitPublicErrorPayload = z.discriminatedUnion("code", [
797
807
  ForbiddenPublic,
798
808
  AuthProviderUnavailablePublic,
799
809
  AuthSessionNotFreshPublic,
810
+ AuthAccountSuspendedPublic,
811
+ AuthAccountDeletedPublic,
800
812
  NotFoundPublic,
801
813
  ConflictPublic,
802
814
  RateLimitPublic,
@@ -943,6 +955,8 @@ const InvalidToken = InvalidTokenPublic.extend(internalFields).describe(InvalidT
943
955
  const Forbidden = ForbiddenPublic.extend(internalFields).describe(ForbiddenPublic.description ?? "");
944
956
  const AuthProviderUnavailable = AuthProviderUnavailablePublic.extend(internalFields).describe(AuthProviderUnavailablePublic.description ?? "");
945
957
  const AuthSessionNotFresh = AuthSessionNotFreshPublic.extend(internalFields).describe(AuthSessionNotFreshPublic.description ?? "");
958
+ const AuthAccountSuspended = AuthAccountSuspendedPublic.extend(internalFields).describe(AuthAccountSuspendedPublic.description ?? "");
959
+ const AuthAccountDeleted = AuthAccountDeletedPublic.extend(internalFields).describe(AuthAccountDeletedPublic.description ?? "");
946
960
  const NotFound = NotFoundPublic.extend(internalFields).describe(NotFoundPublic.description ?? "");
947
961
  const Conflict = ConflictPublic.extend(internalFields).describe(ConflictPublic.description ?? "");
948
962
  const RateLimit = RateLimitPublic.extend(internalFields).describe(RateLimitPublic.description ?? "");
@@ -1094,6 +1108,8 @@ const KitErrorPayload = z.discriminatedUnion("code", [
1094
1108
  Forbidden,
1095
1109
  AuthProviderUnavailable,
1096
1110
  AuthSessionNotFresh,
1111
+ AuthAccountSuspended,
1112
+ AuthAccountDeleted,
1097
1113
  NotFound,
1098
1114
  Conflict,
1099
1115
  RateLimit,
@@ -2,6 +2,7 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  import type { z } from "zod";
4
4
  import type { MessageParams } from "../i18n/catalog";
5
+ import type { UnmarkedString } from "../privacy/types";
5
6
  import type { ValidationIssue } from "./payload";
6
7
  import { ErrorPayload } from "./payload";
7
8
  /**
@@ -15,18 +16,28 @@ import { ErrorPayload } from "./payload";
15
16
  */
16
17
  export declare class PithyError extends Error {
17
18
  readonly payload: ErrorPayload;
18
- constructor(payload: ErrorPayload, options?: {
19
+ /**
20
+ * `message`, `action` and `detail` are each an {@link UnmarkedString} here and on every subclass's arguments
21
+ * (#132): a value marked with a privacy class is refused at compile time, because all three ride into every log
22
+ * line and audit row that carries this error. A template literal is a plain `string`, so interpolation is not caught — see
23
+ * `privacy/types.ts` for exactly what is.
24
+ */
25
+ constructor(payload: ErrorPayload & {
26
+ message: UnmarkedString;
27
+ action?: UnmarkedString | undefined;
28
+ detail?: UnmarkedString | undefined;
29
+ }, options?: {
19
30
  cause?: unknown;
20
31
  });
21
32
  }
22
33
  /** Variable parts every subclass accepts; the `code`/`status` are fixed by the subclass. */
23
34
  interface ErrorArgs {
24
- /** Override the public, safe-to-expose message. Defaults to a per-code summary. */
25
- message?: string;
26
- /** A remediation hint (CLI action line). */
27
- action?: string;
28
- /** Internal context for logs + audit. Never serialized to clients. */
29
- detail?: string;
35
+ /** Override the public, safe-to-expose message. Defaults to a per-code summary. Never a privacy-marked value. */
36
+ message?: UnmarkedString;
37
+ /** A remediation hint (CLI action line). Never a privacy-marked value. */
38
+ action?: UnmarkedString;
39
+ /** Internal context for logs + audit. Never serialized to clients, and never a privacy-marked value (#132). */
40
+ detail?: UnmarkedString;
30
41
  /**
31
42
  * Values a translating client interpolates into its own wording for this code. Client-facing, so —
32
43
  * unlike `action` and `detail` — these cross the boundary with `message`. The `code` is the catalog
@@ -1 +1 @@
1
- {"version":3,"file":"pithyError.d.ts","sourceRoot":"","sources":["../../src/error/pithyError.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,CAAC,E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,CAAA;KAAE,EAY9D;CACF;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,CAAC,CAAC,QAAQ,EAAE,IAAI,GAAE,SAAc,GAAG,eAAe,CAarF;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEhD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAGjD"}
@@ -13,6 +13,12 @@ import { ErrorPayload } from "./payload.js";
13
13
  */
14
14
  var PithyError = class extends Error {
15
15
  payload;
16
+ /**
17
+ * `message`, `action` and `detail` are each an {@link UnmarkedString} here and on every subclass's arguments
18
+ * (#132): a value marked with a privacy class is refused at compile time, because all three ride into every log
19
+ * line and audit row that carries this error. A template literal is a plain `string`, so interpolation is not caught — see
20
+ * `privacy/types.ts` for exactly what is.
21
+ */
16
22
  constructor(payload, options) {
17
23
  const parsed = ErrorPayload.parse(payload);
18
24
  super(parsed.message, options);
package/dist/index.d.ts CHANGED
@@ -28,7 +28,7 @@ export { type AdminRouteDrift, missingAdminRoutes } from "./controlPlane/discove
28
28
  export { type CapabilityHealth, type CapabilityHealthInput, type CapabilityHealthSource, capabilityHealthSources, defineCapabilityHealth, readCapabilityHealth, } from "./controlPlane/discovery/health";
29
29
  export { CapabilityHealthReport, type CapabilityHealthWire, HealthCountNominal, HealthNominal, type HealthStanding, HealthSummary, HealthSummaryKey, HealthSummaryValue, HealthValueCost, HealthValueKind, healthAttention, healthReport, healthWire, type NamedHealthValue, namedHealthValues, standingOf, } from "./controlPlane/discovery/healthSummary";
30
30
  export { requireControlPlane } from "./controlPlane/http/guard";
31
- export { ANY_VERIFIED_CALLER, type ControlPlaneRequirement, ControlPlaneScope, KEYS_ROTATE_SCOPE, MANIFEST_READ_SCOPE, MIGRATIONS_READ_SCOPE, SEAM_SCOPES, } from "./controlPlane/scope/scope";
31
+ export { ANY_VERIFIED_CALLER, type ControlPlaneRequirement, ControlPlaneScope, KEYS_ROTATE_SCOPE, MANIFEST_READ_SCOPE, MIGRATIONS_READ_SCOPE, PRIVACY_READ_SCOPE, SEAM_SCOPES, } from "./controlPlane/scope/scope";
32
32
  export { exportPublicJwk, type MintControlPlaneToken, mintControlPlaneToken } from "./controlPlane/token/mint";
33
33
  export { CONTROL_PLANE_HEADER, CONTROL_PLANE_VERSION_CREATED_HEADER, CONTROL_PLANE_VERSION_HEADER, type WorkerBuild, workerBuildChanged, } from "./controlPlane/wire";
34
34
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,KAAK,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACtG,OAAO,EACL,wBAAwB,EACxB,4BAA4B,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,YAAY,EACZ,wBAAwB,GACzB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,kBAAkB,EAAE,KAAK,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAChG,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACzG,OAAO,EACL,+BAA+B,EAC/B,KAAK,oBAAoB,EACzB,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AAIpC,OAAO,EACL,UAAU,EACV,KAAK,gBAAgB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,KAAK,wBAAwB,GAC9B,MAAM,qCAAqC,CAAC;AAK7C,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,6BAA6B,EAClC,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,KAAK,gBAAg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AkB,EAClB,WAAW,GACZ,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,KAAK,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAI/G,OAAO,EACL,oBAAoB,EACpB,oCAAoC,EACpC,4BAA4B,EAC5B,KAAK,WAAW,EAChB,kBAAkB,GACnB,MAAM,qBAAqB,CAAC"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // SPDX-FileCopyrightText: 2026 Pithy
2
2
  // SPDX-License-Identifier: MIT
3
- import { ANY_VERIFIED_CALLER, ControlPlaneScope, KEYS_ROTATE_SCOPE, MANIFEST_READ_SCOPE, MIGRATIONS_READ_SCOPE, SEAM_SCOPES } from "./controlPlane/scope/scope.js";
3
+ import { ANY_VERIFIED_CALLER, ControlPlaneScope, KEYS_ROTATE_SCOPE, MANIFEST_READ_SCOPE, MIGRATIONS_READ_SCOPE, PRIVACY_READ_SCOPE, SEAM_SCOPES } from "./controlPlane/scope/scope.js";
4
4
  import { ControlPlaneConfig } from "./controlPlane/config/config.js";
5
5
  import { ControlPlaneConnection, Ed25519PublicJwk, RegisteredKey } from "./controlPlane/data/connection.js";
6
6
  import { CONTROL_PLANE_CONNECTIONS_TABLE, controlPlaneDatabase } from "./controlPlane/data/tables.js";
@@ -16,4 +16,4 @@ import { CONTROL_PLANE_KV_BINDING } from "./controlPlane/replay/kvGuard.js";
16
16
  import { CONTROLPLANE_MIGRATION_ORDER, controlplane, isControlPlaneCapability } from "./controlPlane/capability.js";
17
17
  import { missingAdminRoutes } from "./controlPlane/discovery/drift.js";
18
18
  import { exportPublicJwk, mintControlPlaneToken } from "./controlPlane/token/mint.js";
19
- export { ANY_VERIFIED_CALLER, AdminRoute, CONTROLPLANE_MIGRATION_ORDER, CONTROL_PLANE_CONNECTIONS_TABLE, CONTROL_PLANE_HEADER, CONTROL_PLANE_KV_BINDING, CONTROL_PLANE_VERSION_CREATED_HEADER, CONTROL_PLANE_VERSION_HEADER, CapabilityDeclaration, CapabilityDescriptor, CapabilityHealthReport, ControlPlaneAuditActions, ControlPlaneConfig, ControlPlaneConnection, ControlPlaneContext, ControlPlaneManifest, ControlPlaneScope, Ed25519PublicJwk, HealthCountNominal, HealthNominal, HealthSummary, HealthSummaryKey, HealthSummaryValue, HealthValueCost, HealthValueKind, KEYS_ROTATE_SCOPE, MANIFEST_READ_SCOPE, MIGRATIONS_READ_SCOPE, ManifestConfigKey, ManifestConfigValue, ManifestConfigValues, RegisteredKey, SEAM_SCOPES, capabilityHealthSources, controlPlaneDatabase, controlplane, defineCapabilityHealth, defineManifestConfig, exportPublicJwk, healthAttention, healthReport, healthWire, isControlPlaneCapability, mintControlPlaneToken, missingAdminRoutes, namedConfigValues, namedHealthValues, readCapabilityHealth, requireControlPlane, standingOf, workerBuildChanged };
19
+ export { ANY_VERIFIED_CALLER, AdminRoute, CONTROLPLANE_MIGRATION_ORDER, CONTROL_PLANE_CONNECTIONS_TABLE, CONTROL_PLANE_HEADER, CONTROL_PLANE_KV_BINDING, CONTROL_PLANE_VERSION_CREATED_HEADER, CONTROL_PLANE_VERSION_HEADER, CapabilityDeclaration, CapabilityDescriptor, CapabilityHealthReport, ControlPlaneAuditActions, ControlPlaneConfig, ControlPlaneConnection, ControlPlaneContext, ControlPlaneManifest, ControlPlaneScope, Ed25519PublicJwk, HealthCountNominal, HealthNominal, HealthSummary, HealthSummaryKey, HealthSummaryValue, HealthValueCost, HealthValueKind, KEYS_ROTATE_SCOPE, MANIFEST_READ_SCOPE, MIGRATIONS_READ_SCOPE, ManifestConfigKey, ManifestConfigValue, ManifestConfigValues, PRIVACY_READ_SCOPE, RegisteredKey, SEAM_SCOPES, capabilityHealthSources, controlPlaneDatabase, controlplane, defineCapabilityHealth, defineManifestConfig, exportPublicJwk, healthAttention, healthReport, healthWire, isControlPlaneCapability, mintControlPlaneToken, missingAdminRoutes, namedConfigValues, namedHealthValues, readCapabilityHealth, requireControlPlane, standingOf, workerBuildChanged };
@@ -1,5 +1,6 @@
1
1
  // SPDX-FileCopyrightText: 2026 Pithy
2
2
  // SPDX-License-Identifier: MIT
3
+ import type { Loggable, UnmarkedString } from "../privacy/types";
3
4
  import { type LogFields, type LogLevel, type LogRecord } from "./record";
4
5
  /**
5
6
  * The `Logger` seam. Four levels, each taking a message plus **structured fields** (not a formatted
@@ -11,22 +12,28 @@ import { type LogFields, type LogLevel, type LogRecord } from "./record";
11
12
  * The reserved `error` field on any call may carry a `PithyError` or `ErrorPayload` — the engine lifts
12
13
  * it into the record's `error`, `detail` and all. A log is internal; this is the inverse of the HTTP
13
14
  * codec, which strips `detail`. The logger must never be wired to a client-facing surface.
15
+ *
16
+ * **A value marked with a privacy class does not compile here** (#132). Every method takes `F & Loggable<F>`,
17
+ * so a field holding a `pii()`/`phi()`/`secret()`/`pci()` value — the value itself, or one inside an object or
18
+ * an array, to the depth `privacy/types.ts` states — is refused at that key, and `redact(Schema, value)` is the
19
+ * way through. The message and a child's name take `UnmarkedString`, so `log.info(user.email)` is refused too. `LogFields` the schema stays permissive: a record that reaches a sink at runtime still parses,
20
+ * because a brand is a type and a parsed log line has none.
14
21
  */
15
22
  export interface Logger {
16
23
  /** Dev-time diagnostics. Dropped unless the logger's level is `debug`. */
17
- debug(msg: string, fields?: LogFields): void;
24
+ debug<F extends LogFields = LogFields>(msg: UnmarkedString, fields?: F & Loggable<F>): void;
18
25
  /** Normal operational events. */
19
- info(msg: string, fields?: LogFields): void;
26
+ info<F extends LogFields = LogFields>(msg: UnmarkedString, fields?: F & Loggable<F>): void;
20
27
  /** A recoverable problem worth attention. */
21
- warn(msg: string, fields?: LogFields): void;
28
+ warn<F extends LogFields = LogFields>(msg: UnmarkedString, fields?: F & Loggable<F>): void;
22
29
  /** A failure that was observed. Pass `{ error }` (a PithyError) to carry its full payload. */
23
- error(msg: string, fields?: LogFields): void;
30
+ error<F extends LogFields = LogFields>(msg: UnmarkedString, fields?: F & Loggable<F>): void;
24
31
  /**
25
32
  * A namespaced sub-logger. `name` composes as `parent:child`; bound `fields` merge into every record
26
33
  * the child emits. Omit `name` (pass `undefined`) to bind fields only — how request-correlation
27
34
  * attaches `request`/`method`/`path` without renaming the logger.
28
35
  */
29
- child(name?: string, fields?: LogFields): Logger;
36
+ child<F extends LogFields = LogFields>(name?: UnmarkedString, fields?: F & Loggable<F>): Logger;
30
37
  }
31
38
  /** A sink receives a finished {@link LogRecord}. Adapters supply one; the engine builds records and calls it. */
32
39
  export type LogSink = (record: LogRecord) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger/logger.ts"],"names":[],"mappings":"AAKA,OAAO,EAAmB,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1F;;;;;;;;;;GAUG;AACH,MAAM,WAAW,MAAM;IACrB,0EAA0E;IAC1E,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IAC7C,iCAAiC;IACjC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IAC5C,6CAA6C;IAC7C,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IAC5C,8FAA8F;IAC9F,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IAC7C;;;;OAIG;IACH,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;CAClD;AAED,iHAAiH;AACjH,MAAM,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,SAAS,KAAK,IAAI,CAAC;AAElD,2GAA2G;AAC3G,MAAM,WAAW,mBAAmB;IAClC,mDAAmD;IACnD,KAAK,EAAE,QAAQ,CAAC;IAChB,iCA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AAC,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAC5F;;;;OAIG;IACH,KAAK,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS,EAAE,IAAI,CAAC,EAAE,cAAc,EAAE,MAAM,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;CACjG;AAED,iHAAiH;AACjH,MAAM,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,SAAS,KAAK,IAAI,CAAC;AAElD,2GAA2G;AAC3G,MAAM,WAAW,mBAAmB;IAClC,mDAAmD;IACnD,KAAK,EAAE,QAAQ,CAAC;IAChB,iCAAiC;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,oDAAoD;IACpD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wDAAwD;IACxD,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,+DAA+D;IAC/D,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAoED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,CAQjE;AAED;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,MAMxB,CAAC"}
@@ -107,6 +107,20 @@ export declare const LogRecord: z.ZodObject<{
107
107
  detail: z.ZodOptional<z.ZodString>;
108
108
  code: z.ZodLiteral<"auth/session_not_fresh">;
109
109
  status: z.ZodLiteral<403>;
110
+ }, z.core.$strip>, z.ZodObject<{
111
+ message: z.ZodString;
112
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
113
+ action: z.ZodOptional<z.ZodString>;
114
+ detail: z.ZodOptional<z.ZodString>;
115
+ code: z.ZodLiteral<"auth/account_suspended">;
116
+ status: z.ZodLiteral<403>;
117
+ }, z.core.$strip>, z.ZodObject<{
118
+ message: z.ZodString;
119
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
120
+ action: z.ZodOptional<z.ZodString>;
121
+ detail: z.ZodOptional<z.ZodString>;
122
+ code: z.ZodLiteral<"auth/account_deleted">;
123
+ status: z.ZodLiteral<403>;
110
124
  }, z.core.$strip>, z.ZodObject<{
111
125
  message: z.ZodString;
112
126
  params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
@@ -1 +1 @@
1
- {"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../src/logger/record.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;GAKG;AAEH,4GAA4G;AAC5G,eAAO,MAAM,QAAQ;;;;;EAE4F,CAAC;AAClH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEjD;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAgD,CAAC;AAEtG;;;;GAIG;AACH,eAAO,MAAM,SAAS,wCAEsF,CAAC;AAC7G,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,SAAS,CAAC,CAAC;AAEnD;;;;;GAKG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAW+E,CAAC;AACtG,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,SAAS,CAAC,CAAC;AAmBnD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAMzD"}
@@ -0,0 +1,27 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
3
+ import { type EncryptionConfig } from "../crypto/envelope";
4
+ import { type BlindIndexNormalizer } from "./encrypted";
5
+ /**
6
+ * **A blind index: a keyed hash an encrypted column can be found by** (#390).
7
+ *
8
+ * An encrypted column cannot answer `WHERE email = ?`. A sibling column holding `HMAC(key, normalize(value))` can,
9
+ * for equality and nothing else. One rule here is shared by the app Worker that seals, `sealed().match` that looks
10
+ * up, and the rotator that re-indexes inside the manager, so the three cannot hash one value two ways.
11
+ *
12
+ * - **The key is derived, on the field key's own version axis.** Each version's index key is HKDF-SHA256 over that
13
+ * version's field key, with the label `pithy/blind-index/<normalizer>`. One secret, one rotation.
14
+ * - **The value carries its version**: `<version>:<hmac>`, so the stale count reaches an index exactly as it reaches
15
+ * an envelope, by reading the prefix.
16
+ * - **The normalizer is in the label**, so changing a field's normalizer cannot silently miss against old hashes: they
17
+ * are hashes under a different key, and the change reads as a re-index.
18
+ */
19
+ /** The HKDF label one normalizer's index keys are derived under. */
20
+ export declare function blindIndexLabel(normalizer: BlindIndexNormalizer): string;
21
+ /** The HMAC key for one version and normalizer: HKDF-SHA256 over that version's field key. */
22
+ export declare function blindIndexKey(config: EncryptionConfig, version: number, normalizer: BlindIndexNormalizer): Promise<CryptoKey>;
23
+ /** The blind index of `value` under `version`: `<version>:<hmac>`. The value is normalized first. */
24
+ export declare function blindIndexValue(config: EncryptionConfig, version: number, normalizer: BlindIndexNormalizer, value: string): Promise<string>;
25
+ /** The version a blind-index value was written under, or `null` for a value that is not one. */
26
+ export declare function blindIndexVersion(value: string): number | null;
27
+ //# sourceMappingURL=blindIndex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blindIndex.d.ts","sourceRoot":"","sources":["../../src/privacy/blindIndex.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,gBAAgB,EAAY,MAAM,oBAAoB,CAAC;AAErE,OAAO,EAAE,KAAK,oBAAoB,EAAqB,MAAM,aAAa,CAAC;AAE3E;;;;;;;;;;;;;GAaG;AAEH,oEAAoE;AACpE,wBAAgB,eAAe,CAAC,UAAU,EAAE,oBAAoB,GAAG,MAAM,CAExE;AASD,8FAA8F;AAC9F,wBAAsB,aAAa,CACjC,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,oBAAoB,GAC/B,OAAO,CAAC,SAAS,CAAC,CAmBpB;AAED,qGAAqG;AACrG,wBAAsB,eAAe,CACnC,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,oBAAoB,EAChC,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,MAAM,CAAC,CAQjB;AAED,gGAAgG;AAChG,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAG9D"}
@@ -0,0 +1,57 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
3
+ import { keyBytes } from "../crypto/envelope.js";
4
+ import { FIELD_KEYS_BINDING } from "../crypto/fieldKeys.js";
5
+ import { normalizeForIndex } from "./encrypted.js";
6
+ //#region src/privacy/blindIndex.ts
7
+ /**
8
+ * **A blind index: a keyed hash an encrypted column can be found by** (#390).
9
+ *
10
+ * An encrypted column cannot answer `WHERE email = ?`. A sibling column holding `HMAC(key, normalize(value))` can,
11
+ * for equality and nothing else. One rule here is shared by the app Worker that seals, `sealed().match` that looks
12
+ * up, and the rotator that re-indexes inside the manager, so the three cannot hash one value two ways.
13
+ *
14
+ * - **The key is derived, on the field key's own version axis.** Each version's index key is HKDF-SHA256 over that
15
+ * version's field key, with the label `pithy/blind-index/<normalizer>`. One secret, one rotation.
16
+ * - **The value carries its version**: `<version>:<hmac>`, so the stale count reaches an index exactly as it reaches
17
+ * an envelope, by reading the prefix.
18
+ * - **The normalizer is in the label**, so changing a field's normalizer cannot silently miss against old hashes: they
19
+ * are hashes under a different key, and the change reads as a re-index.
20
+ */
21
+ /** The HKDF label one normalizer's index keys are derived under. */
22
+ function blindIndexLabel(normalizer) {
23
+ return `pithy/blind-index/${normalizer}`;
24
+ }
25
+ /** Unpadded base64url, the alphabet a blind index is written in. */
26
+ function base64Url(bytes) {
27
+ let binary = "";
28
+ for (const byte of bytes) binary += String.fromCharCode(byte);
29
+ return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
30
+ }
31
+ /** The HMAC key for one version and normalizer: HKDF-SHA256 over that version's field key. */
32
+ async function blindIndexKey(config, version, normalizer) {
33
+ const material = await crypto.subtle.importKey("raw", keyBytes(config, version, { keys: FIELD_KEYS_BINDING }), "HKDF", false, ["deriveBits"]);
34
+ const bits = await crypto.subtle.deriveBits({
35
+ name: "HKDF",
36
+ hash: "SHA-256",
37
+ salt: /* @__PURE__ */ new Uint8Array(0),
38
+ info: Uint8Array.from(new TextEncoder().encode(blindIndexLabel(normalizer)))
39
+ }, material, 256);
40
+ return crypto.subtle.importKey("raw", bits, {
41
+ name: "HMAC",
42
+ hash: "SHA-256"
43
+ }, false, ["sign"]);
44
+ }
45
+ /** The blind index of `value` under `version`: `<version>:<hmac>`. The value is normalized first. */
46
+ async function blindIndexValue(config, version, normalizer, value) {
47
+ const key = await blindIndexKey(config, version, normalizer);
48
+ const mac = await crypto.subtle.sign("HMAC", key, Uint8Array.from(new TextEncoder().encode(normalizeForIndex(normalizer, value))));
49
+ return `${version}:${base64Url(new Uint8Array(mac))}`;
50
+ }
51
+ /** The version a blind-index value was written under, or `null` for a value that is not one. */
52
+ function blindIndexVersion(value) {
53
+ const match = /^(\d+):/.exec(value);
54
+ return match ? Number(match[1]) : null;
55
+ }
56
+ //#endregion
57
+ export { blindIndexKey, blindIndexLabel, blindIndexValue, blindIndexVersion };
@@ -0,0 +1,142 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
3
+ import { z } from "zod";
4
+ /**
5
+ * **A field declares its own privacy class, and the declaration drives everything downstream** (#132).
6
+ *
7
+ * One marker, several consumers — the shape `@pithy-sh/vector` already uses, where `.meta({ filterable: true
8
+ * })` drives provisioning, the filter type, the drift check and the boot check. Here the marker drives the
9
+ * type gate on the three internal surfaces (the logger, `AuditEvent.metadata`, `PithyError.detail`), the
10
+ * masked view `redact` returns, the classification `classifyPrivacy` derives, and the inventory the control
11
+ * plane reports.
12
+ *
13
+ * ## What a marker does, in one call
14
+ *
15
+ * `pii(schema)` does two things. It attaches `.meta({ privacy: "pii" })`, which is **introspectable** — that is
16
+ * what `redact`, `classifyPrivacy` and the inventory read. And it applies Zod's `.brand()`, which changes the
17
+ * **inferred type** — that is what makes a log call carrying the value fail to compile. The brand lands on the
18
+ * field, not on the object, so extracting the field does not launder it: `user.email` is as branded as `user`.
19
+ *
20
+ * **A marker over another marker adds its class.** `pii(secret(x))` and `secret(pii(x))` are the same field: it
21
+ * carries both classes, in its `meta` (as a list, strongest first) and in its type (both brands). It is masked with the
22
+ * strongest one's placeholder and listed once per class. The same marker twice is one class.
23
+ *
24
+ * **The brand key is `privacy:<class>`, not the bare class name.** An adopter's own `.brand<"pii">()` for some
25
+ * unrelated purpose must not trip a gate it never opted into, and an adopter's `UserId` brand must not either:
26
+ * the gate reads a brand under the `privacy:` namespace and nothing else, which is the federated-key rule
27
+ * (`auth/invalid_token`, `pithy_auth_users`) applied one more time.
28
+ *
29
+ * **Nothing at runtime changes.** Zod's `.brand()` returns the same schema object — the brand exists only in
30
+ * the type — and `.meta()` returns a clone that parses exactly as its source. `Schema.parse(row)` returns the
31
+ * same data it did before the marker, and no column is added anywhere.
32
+ *
33
+ * ## The set is open
34
+ *
35
+ * Four classes ship named — `secret`, `pii`, `phi`, `pci` — and {@link definePrivacyClass} registers more
36
+ * (`genetic`, `biometric`, whatever a regulator names) without a change to core. A closed union is what #117
37
+ * records the cost of, and a healthcare adopter should not have to wait on us.
38
+ *
39
+ * ## Where `secret` stops and `@pithy-sh/secrets` starts
40
+ *
41
+ * Two different facts, kept apart on purpose. `@pithy-sh/secrets` decides **where a credential the Worker reads
42
+ * is stored** — its registry names a backend, and its reader redacts the value it hands back. `secret()` says
43
+ * **what a field in a data shape is** — a receipt, a magic-link token, a session id, a key hash — values that
44
+ * live in rows and payloads and that no secrets registry ever holds. Merging them would make core depend on a
45
+ * capability (principle 4) and would make a storage decision answer a classification question.
46
+ */
47
+ /** The `meta` key a marker writes and every reader reads. */
48
+ export declare const PRIVACY_META_KEY = "privacy";
49
+ /** The prefix of every privacy brand, so the gate never reads a brand that means something else. */
50
+ export declare const PRIVACY_BRAND_PREFIX = "privacy:";
51
+ /** A class name: a lowercase identifier. It becomes a brand key, a config value and a report column. */
52
+ export declare const PrivacyClassName: z.ZodString;
53
+ export type PrivacyClassName = z.output<typeof PrivacyClassName>;
54
+ /** The four classes the kit names, in the order every report lists them. */
55
+ export declare const BUILT_IN_PRIVACY_CLASSES: readonly ["secret", "pii", "phi", "pci"];
56
+ /** One of the four built-in class names. */
57
+ export type BuiltInPrivacyClass = (typeof BUILT_IN_PRIVACY_CLASSES)[number];
58
+ /** How a class masks a value: the string that stands in its place on every internal surface. */
59
+ export type PrivacyMask = (value: unknown) => string;
60
+ /** One registered class: its name, what it means, and how it masks. */
61
+ export interface PrivacyClass {
62
+ /** The class name — the `meta` value and the brand's suffix. */
63
+ readonly name: string;
64
+ /** What the class means, in one sentence an auditor reads. */
65
+ readonly description: string;
66
+ /** The masked form of a value of this class. */
67
+ readonly mask: PrivacyMask;
68
+ }
69
+ /**
70
+ * The brand a marker puts on a schema's output type. Zod's own brand machinery, under the `privacy:` key.
71
+ *
72
+ * `"out"` on purpose: the **input** side stays unbranded, so `z.input` — the SQLite row shape, the Kysely
73
+ * table type, a KV write's pre-parse value — is exactly what it was. A row read from D1 parses into the
74
+ * branded app shape, and `Schema.encode()` hands Kysely the plain row back.
75
+ */
76
+ export type Marked<S extends z.ZodType, C extends string> = z.core.$ZodBranded<S, `${typeof PRIVACY_BRAND_PREFIX}${C}`, "out">;
77
+ /** A marker for one class: wraps a schema and returns it marked. Carries its class name for a reader. */
78
+ export interface PrivacyMarker<C extends string> {
79
+ <S extends z.ZodType>(schema: S): Marked<S, C>;
80
+ /** The class this marker applies. */
81
+ readonly className: C;
82
+ }
83
+ /**
84
+ * Mask a primary account number to its first six and last four digits — `424242******4242`.
85
+ *
86
+ * **The one class whose mask is not a placeholder, because the masked form is the useful one.** First-six and
87
+ * last-four is the display PCI-DSS permits, and it is what an operator reading a log needs to match a
88
+ * complaint to a card without holding the card. Spaces and dashes are separators and are dropped; anything
89
+ * that is not 13 to 19 digits once they are is not a card number, and masks to `[pci]` rather than to a
90
+ * partial reveal of something else.
91
+ *
92
+ * Every payment rail Pithy ships is hosted, so no PAN ever reaches an adopter's Worker through the kit. The
93
+ * class is here for the adopter's own schemas.
94
+ */
95
+ export declare function maskPan(value: unknown): string;
96
+ /** The class a name refers to, or `undefined` for a name nothing registered. */
97
+ export declare function privacyClass(name: string): PrivacyClass | undefined;
98
+ /** Every registered class, built-ins first in their fixed order, then each adopter class in registration order. */
99
+ export declare function privacyClasses(): PrivacyClass[];
100
+ /**
101
+ * `names` from the strongest to the weakest, each once: `secret`, then `phi`, then `pci`, then each adopter class, then
102
+ * `pii`. An adopter registers a class because its data is more specific than `pii`, so it ranks above it; adopter
103
+ * classes rank among themselves by name. The order a marker records several classes in, whatever order they came.
104
+ */
105
+ export declare function rankPrivacyClasses(names: Iterable<string>): string[];
106
+ /**
107
+ * The strongest of `names`, the class a value is masked with when it carries several and is masked whole. See
108
+ * {@link rankPrivacyClasses}. `undefined` for none.
109
+ */
110
+ export declare function strongestPrivacyClass(names: Iterable<string>): string | undefined;
111
+ /**
112
+ * The classes a schema's own `privacy` meta records: one class as its name, several as a list, strongest first. Read
113
+ * from this exact schema, never through a wrapper. Empty where it records none.
114
+ */
115
+ export declare function ownPrivacyClasses(schema: z.ZodType): string[];
116
+ /** What {@link definePrivacyClass} takes. */
117
+ export interface PrivacyClassSpec<C extends string> {
118
+ /** The class name: a lowercase identifier, unique across the isolate. */
119
+ name: C;
120
+ /** What the class means. Defaults to a sentence naming it as adopter-registered. */
121
+ description?: string;
122
+ /** How a value masks. Defaults to the `[name]` placeholder. */
123
+ mask?: PrivacyMask;
124
+ }
125
+ /**
126
+ * Register a class of the adopter's own — `genetic`, `biometric`, whatever their regulator names — and get its
127
+ * marker back. Usable exactly like the built-ins: the same `meta`, the same brand, the same gate, the same
128
+ * inventory row.
129
+ *
130
+ * **A duplicate is refused at registration**, a built-in name included. Two modules each believing they own
131
+ * `genetic` would disagree about its mask, and the one that loaded second would win silently.
132
+ */
133
+ export declare function definePrivacyClass<const C extends string>(spec: PrivacyClassSpec<C>): PrivacyMarker<C>;
134
+ /** Mark a field as a credential or bearer artifact. See {@link BUILT_INS}. */
135
+ export declare const secret: PrivacyMarker<"secret">;
136
+ /** Mark a field as personal data under GDPR or CCPA. */
137
+ export declare const pii: PrivacyMarker<"pii">;
138
+ /** Mark a field as Protected Health Information under HIPAA. */
139
+ export declare const phi: PrivacyMarker<"phi">;
140
+ /** Mark a field as cardholder data under PCI-DSS. Masks to first six and last four. */
141
+ export declare const pci: PrivacyMarker<"pci">;
142
+ //# sourceMappingURL=classes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"classes.d.ts","sourceRoot":"","sources":["../../src/privacy/classes.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,6DAA6D;AAC7D,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAE1C,oGAAoG;AACpG,eAAO,MAAM,oBAAoB,aAAa,CAAC;AAE/C,wGAAwG;AACxG,eAAO,MAAM,gBAAgB,aAK1B,CAAC;AACJ,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEjE,4EAA4E;AAC5E,eAAO,MAAM,wBAAwB,YAAI,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAU,CAAC;AAEjF,4CAA4C;AAC5C,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5E,gGAAgG;AAChG,MAAM,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,CAAC;AAErD,uEAAuE;AACvE,MAAM,WAAW,YAAY;IAC3B,gEAAgE;IAChE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,8DAA8D;IAC9D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,gDAAgD;IAChD,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC,SAAS,MAAM,IAAI,CAAC,CAAC,IAAI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