@oxy.so/contracts 1.0.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 (147) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +16 -0
  3. package/dist/cjs/.tsbuildinfo +1 -0
  4. package/dist/cjs/accountGraph.js +489 -0
  5. package/dist/cjs/agency.js +439 -0
  6. package/dist/cjs/browserHub.js +215 -0
  7. package/dist/cjs/civic.js +163 -0
  8. package/dist/cjs/commonsSignIn.js +59 -0
  9. package/dist/cjs/deviceBoot.js +50 -0
  10. package/dist/cjs/deviceDirectory.js +189 -0
  11. package/dist/cjs/devicePairing.js +138 -0
  12. package/dist/cjs/deviceSession.js +164 -0
  13. package/dist/cjs/emailAgentContext.js +32 -0
  14. package/dist/cjs/followGraph.js +28 -0
  15. package/dist/cjs/identity.js +258 -0
  16. package/dist/cjs/inboxPush.js +24 -0
  17. package/dist/cjs/index.js +618 -0
  18. package/dist/cjs/inference/accountBilling.js +334 -0
  19. package/dist/cjs/inference/aliaModelRelease.js +262 -0
  20. package/dist/cjs/inference/attribution.js +106 -0
  21. package/dist/cjs/inference/catalogue.js +487 -0
  22. package/dist/cjs/inference/entitlement.js +217 -0
  23. package/dist/cjs/inference/errors.js +309 -0
  24. package/dist/cjs/inference/identifiers.js +224 -0
  25. package/dist/cjs/inference/inbox.js +105 -0
  26. package/dist/cjs/inference/modelDocumentation.js +433 -0
  27. package/dist/cjs/inference/money.js +188 -0
  28. package/dist/cjs/inference/priceVersion.js +110 -0
  29. package/dist/cjs/inference/providerConnection.js +455 -0
  30. package/dist/cjs/inference/request.js +477 -0
  31. package/dist/cjs/inference/routingPolicy.js +318 -0
  32. package/dist/cjs/inference/streamEvents.js +258 -0
  33. package/dist/cjs/inference/usage.js +329 -0
  34. package/dist/cjs/inference/version.js +105 -0
  35. package/dist/cjs/keyRecovery.js +91 -0
  36. package/dist/cjs/keyRotation.js +75 -0
  37. package/dist/cjs/links.js +68 -0
  38. package/dist/cjs/moderationReputation.js +298 -0
  39. package/dist/cjs/oauth.js +66 -0
  40. package/dist/cjs/oxyRecordTypes.js +71 -0
  41. package/dist/cjs/protocol.js +53 -0
  42. package/dist/cjs/recommendations.js +168 -0
  43. package/dist/cjs/reputation.js +297 -0
  44. package/dist/cjs/sessionStatus.js +121 -0
  45. package/dist/cjs/transparency.js +89 -0
  46. package/dist/cjs/updates.js +252 -0
  47. package/dist/cjs/userInvalidation.js +89 -0
  48. package/dist/cjs/userResponse.js +245 -0
  49. package/dist/cjs/username.js +290 -0
  50. package/dist/cjs/webauthn.js +71 -0
  51. package/dist/esm/.tsbuildinfo +1 -0
  52. package/dist/esm/accountGraph.js +480 -0
  53. package/dist/esm/agency.js +436 -0
  54. package/dist/esm/browserHub.js +212 -0
  55. package/dist/esm/civic.js +160 -0
  56. package/dist/esm/commonsSignIn.js +56 -0
  57. package/dist/esm/deviceBoot.js +47 -0
  58. package/dist/esm/deviceDirectory.js +186 -0
  59. package/dist/esm/devicePairing.js +135 -0
  60. package/dist/esm/deviceSession.js +161 -0
  61. package/dist/esm/emailAgentContext.js +29 -0
  62. package/dist/esm/followGraph.js +27 -0
  63. package/dist/esm/identity.js +255 -0
  64. package/dist/esm/inboxPush.js +21 -0
  65. package/dist/esm/index.js +172 -0
  66. package/dist/esm/inference/accountBilling.js +331 -0
  67. package/dist/esm/inference/aliaModelRelease.js +259 -0
  68. package/dist/esm/inference/attribution.js +103 -0
  69. package/dist/esm/inference/catalogue.js +484 -0
  70. package/dist/esm/inference/entitlement.js +214 -0
  71. package/dist/esm/inference/errors.js +306 -0
  72. package/dist/esm/inference/identifiers.js +221 -0
  73. package/dist/esm/inference/inbox.js +102 -0
  74. package/dist/esm/inference/modelDocumentation.js +430 -0
  75. package/dist/esm/inference/money.js +185 -0
  76. package/dist/esm/inference/priceVersion.js +107 -0
  77. package/dist/esm/inference/providerConnection.js +452 -0
  78. package/dist/esm/inference/request.js +474 -0
  79. package/dist/esm/inference/routingPolicy.js +315 -0
  80. package/dist/esm/inference/streamEvents.js +255 -0
  81. package/dist/esm/inference/usage.js +326 -0
  82. package/dist/esm/inference/version.js +102 -0
  83. package/dist/esm/keyRecovery.js +88 -0
  84. package/dist/esm/keyRotation.js +72 -0
  85. package/dist/esm/links.js +65 -0
  86. package/dist/esm/moderationReputation.js +295 -0
  87. package/dist/esm/oauth.js +63 -0
  88. package/dist/esm/oxyRecordTypes.js +68 -0
  89. package/dist/esm/protocol.js +50 -0
  90. package/dist/esm/recommendations.js +165 -0
  91. package/dist/esm/reputation.js +293 -0
  92. package/dist/esm/sessionStatus.js +118 -0
  93. package/dist/esm/transparency.js +86 -0
  94. package/dist/esm/updates.js +249 -0
  95. package/dist/esm/userInvalidation.js +85 -0
  96. package/dist/esm/userResponse.js +240 -0
  97. package/dist/esm/username.js +283 -0
  98. package/dist/esm/webauthn.js +68 -0
  99. package/dist/types/.tsbuildinfo +1 -0
  100. package/dist/types/accountGraph.d.ts +378 -0
  101. package/dist/types/agency.d.ts +2162 -0
  102. package/dist/types/browserHub.d.ts +856 -0
  103. package/dist/types/civic.d.ts +338 -0
  104. package/dist/types/commonsSignIn.d.ts +58 -0
  105. package/dist/types/deviceBoot.d.ts +74 -0
  106. package/dist/types/deviceDirectory.d.ts +1317 -0
  107. package/dist/types/devicePairing.d.ts +130 -0
  108. package/dist/types/deviceSession.d.ts +411 -0
  109. package/dist/types/emailAgentContext.d.ts +248 -0
  110. package/dist/types/followGraph.d.ts +150 -0
  111. package/dist/types/identity.d.ts +402 -0
  112. package/dist/types/inboxPush.d.ts +30 -0
  113. package/dist/types/index.d.ts +100 -0
  114. package/dist/types/inference/accountBilling.d.ts +738 -0
  115. package/dist/types/inference/aliaModelRelease.d.ts +609 -0
  116. package/dist/types/inference/attribution.d.ts +176 -0
  117. package/dist/types/inference/catalogue.d.ts +1618 -0
  118. package/dist/types/inference/entitlement.d.ts +519 -0
  119. package/dist/types/inference/errors.d.ts +242 -0
  120. package/dist/types/inference/identifiers.d.ts +182 -0
  121. package/dist/types/inference/inbox.d.ts +374 -0
  122. package/dist/types/inference/modelDocumentation.d.ts +1603 -0
  123. package/dist/types/inference/money.d.ts +185 -0
  124. package/dist/types/inference/priceVersion.d.ts +182 -0
  125. package/dist/types/inference/providerConnection.d.ts +968 -0
  126. package/dist/types/inference/request.d.ts +2800 -0
  127. package/dist/types/inference/routingPolicy.d.ts +616 -0
  128. package/dist/types/inference/streamEvents.d.ts +950 -0
  129. package/dist/types/inference/usage.d.ts +1164 -0
  130. package/dist/types/inference/version.d.ts +102 -0
  131. package/dist/types/keyRecovery.d.ts +138 -0
  132. package/dist/types/keyRotation.d.ts +103 -0
  133. package/dist/types/links.d.ts +96 -0
  134. package/dist/types/moderationReputation.d.ts +487 -0
  135. package/dist/types/oauth.d.ts +86 -0
  136. package/dist/types/oxyRecordTypes.d.ts +62 -0
  137. package/dist/types/protocol.d.ts +86 -0
  138. package/dist/types/recommendations.d.ts +542 -0
  139. package/dist/types/reputation.d.ts +457 -0
  140. package/dist/types/sessionStatus.d.ts +231 -0
  141. package/dist/types/transparency.d.ts +392 -0
  142. package/dist/types/updates.d.ts +545 -0
  143. package/dist/types/userInvalidation.d.ts +94 -0
  144. package/dist/types/userResponse.d.ts +1706 -0
  145. package/dist/types/username.d.ts +265 -0
  146. package/dist/types/webauthn.d.ts +77 -0
  147. package/package.json +87 -0
@@ -0,0 +1,231 @@
1
+ /**
2
+ * Canonical contract for `GET /auth/session/status/:sessionToken`.
3
+ *
4
+ * SINGLE SOURCE OF TRUTH for the wire shape of the cross-app device-flow
5
+ * session-status payload and the sanitized public application identity it
6
+ * embeds. The API validates its OUTPUT against these schemas; the auth app
7
+ * (consent UI) validates its INPUT against the same schemas. Because there is
8
+ * exactly one definition, the producer and the consumer cannot drift.
9
+ *
10
+ * The class of bug that motivated moving this into `@oxy.so/contracts`: the auth
11
+ * app's LOCAL `sessionStatusSchema` typed `sessionId` as a non-nullable
12
+ * `z.string().optional()`. The producer emits `sessionId: authorizedSessionId ||
13
+ * null`, so a PENDING session (not yet authorized) carries `sessionId: null` —
14
+ * `.optional()` permits `undefined`/missing but REJECTS `null`, so `safeParse`
15
+ * failed, the whole response collapsed to `null`, and the consent screen showed
16
+ * "Unable to identify the requesting application". Pinning the nullability in one
17
+ * shared place makes that drift impossible.
18
+ *
19
+ * Faithful to the producers:
20
+ * - `packages/api/src/utils/serializeApplication.ts` `serializePublicApplication`
21
+ * — the ONLY shape returned to an unauthenticated consent UI. Optional fields
22
+ * (`description`, `icon`, `websiteUrl`, `privacyPolicyUrl`, `termsUrl`,
23
+ * `developerName`) are OMITTED when absent (never serialized as `null`), so
24
+ * they are `.optional()` — NOT `.nullable()`. `type` is the `Application.type`
25
+ * enum.
26
+ * - `packages/api/src/routes/auth.ts` `GET /session/status/:sessionToken` — the
27
+ * inner object of the API's `{ data: ... }` success envelope. The handler
28
+ * ALWAYS emits `status`, `authorized` (`status === 'authorized'`),
29
+ * `sessionToken`, `expiresAt` (ISO string), and `application` (resolved object
30
+ * OR `null`). It ALWAYS emits `sessionId` / `publicKey` / `userId`, each as a
31
+ * string value OR `null` (`authorizedSessionId || null`, `authorizedBy ||
32
+ * null`, `authorizedUserId?.toString() || null`).
33
+ *
34
+ * Platform-agnostic — zod only, no react/react-native/expo. ESM-safe (no
35
+ * `require()`).
36
+ */
37
+ import { z } from 'zod';
38
+ /**
39
+ * Application `type` enum. Mirrors `APPLICATION_TYPES` in
40
+ * `packages/api/src/models/Application.ts` (`first_party` | `third_party` |
41
+ * `internal` | `system`).
42
+ */
43
+ export declare const applicationTypeSchema: z.ZodEnum<["first_party", "third_party", "internal", "system"]>;
44
+ export type ApplicationTypeContract = z.infer<typeof applicationTypeSchema>;
45
+ /**
46
+ * The display-safe public identity of a requesting application, exactly as
47
+ * `serializePublicApplication` emits it. Returned by the API inside
48
+ * `GET /auth/session/status/:sessionToken` (device flow) and
49
+ * `GET /auth/oauth/client/:clientId` (OAuth code flow).
50
+ *
51
+ * Optional fields are `.optional()` (NOT `.nullable()`): the serializer OMITS
52
+ * `description` / `icon` / `websiteUrl` / `privacyPolicyUrl` / `termsUrl` /
53
+ * `developerName` when the underlying value is absent — it never writes `null`
54
+ * for them. `developerName` is only attached for non-official apps when a name
55
+ * could be resolved.
56
+ */
57
+ export declare const publicApplicationSchema: z.ZodObject<{
58
+ id: z.ZodString;
59
+ name: z.ZodString;
60
+ description: z.ZodOptional<z.ZodString>;
61
+ icon: z.ZodOptional<z.ZodString>;
62
+ websiteUrl: z.ZodOptional<z.ZodString>;
63
+ privacyPolicyUrl: z.ZodOptional<z.ZodString>;
64
+ termsUrl: z.ZodOptional<z.ZodString>;
65
+ type: z.ZodEnum<["first_party", "third_party", "internal", "system"]>;
66
+ isOfficial: z.ZodBoolean;
67
+ isInternal: z.ZodBoolean;
68
+ scopes: z.ZodArray<z.ZodString, "many">;
69
+ developerName: z.ZodOptional<z.ZodString>;
70
+ }, "strip", z.ZodTypeAny, {
71
+ type: "internal" | "system" | "first_party" | "third_party";
72
+ name: string;
73
+ id: string;
74
+ isOfficial: boolean;
75
+ isInternal: boolean;
76
+ scopes: string[];
77
+ description?: string | undefined;
78
+ icon?: string | undefined;
79
+ websiteUrl?: string | undefined;
80
+ privacyPolicyUrl?: string | undefined;
81
+ termsUrl?: string | undefined;
82
+ developerName?: string | undefined;
83
+ }, {
84
+ type: "internal" | "system" | "first_party" | "third_party";
85
+ name: string;
86
+ id: string;
87
+ isOfficial: boolean;
88
+ isInternal: boolean;
89
+ scopes: string[];
90
+ description?: string | undefined;
91
+ icon?: string | undefined;
92
+ websiteUrl?: string | undefined;
93
+ privacyPolicyUrl?: string | undefined;
94
+ termsUrl?: string | undefined;
95
+ developerName?: string | undefined;
96
+ }>;
97
+ export type PublicApplicationResponse = z.infer<typeof publicApplicationSchema>;
98
+ /**
99
+ * The inner object of `GET /auth/session/status/:sessionToken` (inside the API's
100
+ * `{ data: ... }` envelope).
101
+ *
102
+ * `application` is the resolved {@link publicApplicationSchema} identity of the
103
+ * requesting application, or `null` when the bound app was hard-deleted / is no
104
+ * longer `active` (defensive — normally always present).
105
+ *
106
+ * `sessionId` / `publicKey` / `userId` are `.nullable().optional()`: the producer
107
+ * ALWAYS emits the key, with a string for an AUTHORIZED session or `null` for a
108
+ * PENDING one. `.nullable()` accepts the PENDING `null`; `.optional()` is belt-
109
+ * and-braces so a consumer is never broken by a future projection that drops the
110
+ * key. (`.optional()` alone would REJECT the PENDING `null` — that was the bug.)
111
+ *
112
+ * `authorized` / `sessionToken` / `expiresAt` are emitted unconditionally by the
113
+ * current producer and are never `null`, but stay `.optional()` so the contract
114
+ * tolerates leaner shapes from other producers of this same payload without a
115
+ * coordinated bump.
116
+ *
117
+ * `pushSentAt` / `openedAt` are DELIVERY PROGRESS, not authorization state: they
118
+ * let a waiting surface render "Check Commons on your phone" → "Opened in
119
+ * Commons" without inventing competing statuses. `status` remains the only
120
+ * authority on whether the request is pending, authorized, cancelled or expired.
121
+ * Both are `.nullable().optional()` for the same reason as `sessionId` — the
122
+ * producer always emits the key with `null` until that step happens, and an
123
+ * older API that omits them entirely must degrade, not fail the parse.
124
+ */
125
+ export declare const sessionStatusSchema: z.ZodObject<{
126
+ status: z.ZodString;
127
+ authorized: z.ZodOptional<z.ZodBoolean>;
128
+ sessionToken: z.ZodOptional<z.ZodString>;
129
+ application: z.ZodOptional<z.ZodNullable<z.ZodObject<{
130
+ id: z.ZodString;
131
+ name: z.ZodString;
132
+ description: z.ZodOptional<z.ZodString>;
133
+ icon: z.ZodOptional<z.ZodString>;
134
+ websiteUrl: z.ZodOptional<z.ZodString>;
135
+ privacyPolicyUrl: z.ZodOptional<z.ZodString>;
136
+ termsUrl: z.ZodOptional<z.ZodString>;
137
+ type: z.ZodEnum<["first_party", "third_party", "internal", "system"]>;
138
+ isOfficial: z.ZodBoolean;
139
+ isInternal: z.ZodBoolean;
140
+ scopes: z.ZodArray<z.ZodString, "many">;
141
+ developerName: z.ZodOptional<z.ZodString>;
142
+ }, "strip", z.ZodTypeAny, {
143
+ type: "internal" | "system" | "first_party" | "third_party";
144
+ name: string;
145
+ id: string;
146
+ isOfficial: boolean;
147
+ isInternal: boolean;
148
+ scopes: string[];
149
+ description?: string | undefined;
150
+ icon?: string | undefined;
151
+ websiteUrl?: string | undefined;
152
+ privacyPolicyUrl?: string | undefined;
153
+ termsUrl?: string | undefined;
154
+ developerName?: string | undefined;
155
+ }, {
156
+ type: "internal" | "system" | "first_party" | "third_party";
157
+ name: string;
158
+ id: string;
159
+ isOfficial: boolean;
160
+ isInternal: boolean;
161
+ scopes: string[];
162
+ description?: string | undefined;
163
+ icon?: string | undefined;
164
+ websiteUrl?: string | undefined;
165
+ privacyPolicyUrl?: string | undefined;
166
+ termsUrl?: string | undefined;
167
+ developerName?: string | undefined;
168
+ }>>>;
169
+ expiresAt: z.ZodOptional<z.ZodString>;
170
+ sessionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
171
+ publicKey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
172
+ userId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
173
+ /**
174
+ * What approving this request does. Legacy rows read as `device_sign_in`.
175
+ * OAuth-bound sessions finalize into an authorization code (no `sessionId`).
176
+ */
177
+ purpose: z.ZodOptional<z.ZodEnum<["device_sign_in", "oauth_authorization"]>>;
178
+ pushSentAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
179
+ openedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
180
+ }, "strip", z.ZodTypeAny, {
181
+ status: string;
182
+ expiresAt?: string | undefined;
183
+ sessionId?: string | null | undefined;
184
+ userId?: string | null | undefined;
185
+ publicKey?: string | null | undefined;
186
+ sessionToken?: string | undefined;
187
+ authorized?: boolean | undefined;
188
+ application?: {
189
+ type: "internal" | "system" | "first_party" | "third_party";
190
+ name: string;
191
+ id: string;
192
+ isOfficial: boolean;
193
+ isInternal: boolean;
194
+ scopes: string[];
195
+ description?: string | undefined;
196
+ icon?: string | undefined;
197
+ websiteUrl?: string | undefined;
198
+ privacyPolicyUrl?: string | undefined;
199
+ termsUrl?: string | undefined;
200
+ developerName?: string | undefined;
201
+ } | null | undefined;
202
+ purpose?: "device_sign_in" | "oauth_authorization" | undefined;
203
+ pushSentAt?: string | null | undefined;
204
+ openedAt?: string | null | undefined;
205
+ }, {
206
+ status: string;
207
+ expiresAt?: string | undefined;
208
+ sessionId?: string | null | undefined;
209
+ userId?: string | null | undefined;
210
+ publicKey?: string | null | undefined;
211
+ sessionToken?: string | undefined;
212
+ authorized?: boolean | undefined;
213
+ application?: {
214
+ type: "internal" | "system" | "first_party" | "third_party";
215
+ name: string;
216
+ id: string;
217
+ isOfficial: boolean;
218
+ isInternal: boolean;
219
+ scopes: string[];
220
+ description?: string | undefined;
221
+ icon?: string | undefined;
222
+ websiteUrl?: string | undefined;
223
+ privacyPolicyUrl?: string | undefined;
224
+ termsUrl?: string | undefined;
225
+ developerName?: string | undefined;
226
+ } | null | undefined;
227
+ purpose?: "device_sign_in" | "oauth_authorization" | undefined;
228
+ pushSentAt?: string | null | undefined;
229
+ openedAt?: string | null | undefined;
230
+ }>;
231
+ export type SessionStatusResponse = z.infer<typeof sessionStatusSchema>;
@@ -0,0 +1,392 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * One signer's endorsement of a checkpoint's signed fields.
4
+ *
5
+ * The operator and every independent witness produce this same shape over the
6
+ * SAME bytes, so the array on a checkpoint can grow without coordination.
7
+ */
8
+ export declare const transparencyCheckpointSignatureSchema: z.ZodObject<{
9
+ /** Uncompressed hex public key of the signer. */
10
+ publicKey: z.ZodString;
11
+ alg: z.ZodLiteral<"ES256K-DER-SHA256">;
12
+ /** DER-encoded hex secp256k1 signature over the checkpoint signing input. */
13
+ signature: z.ZodString;
14
+ }, "strip", z.ZodTypeAny, {
15
+ signature: string;
16
+ publicKey: string;
17
+ alg: "ES256K-DER-SHA256";
18
+ }, {
19
+ signature: string;
20
+ publicKey: string;
21
+ alg: "ES256K-DER-SHA256";
22
+ }>;
23
+ /** Where a checkpoint root was published on a public chain. */
24
+ export declare const transparencyAnchorSchema: z.ZodObject<{
25
+ /** Chain/network identifier, e.g. `faircoin-main`. */
26
+ network: z.ZodString;
27
+ txid: z.ZodString;
28
+ confirmations: z.ZodNumber;
29
+ /** When the anchoring transaction was broadcast (ms epoch). */
30
+ anchoredAt: z.ZodNumber;
31
+ }, "strip", z.ZodTypeAny, {
32
+ network: string;
33
+ txid: string;
34
+ confirmations: number;
35
+ anchoredAt: number;
36
+ }, {
37
+ network: string;
38
+ txid: string;
39
+ confirmations: number;
40
+ anchoredAt: number;
41
+ }>;
42
+ /**
43
+ * A published checkpoint.
44
+ *
45
+ * `signatures` is non-empty by contract: an unsigned root commits nobody and
46
+ * must never be served as a checkpoint. `anchors` may be empty — a checkpoint is
47
+ * published immediately and anchored asynchronously, so "not yet anchored" is a
48
+ * normal, temporary state rather than an error.
49
+ */
50
+ export declare const transparencyCheckpointSchema: z.ZodObject<{
51
+ index: z.ZodNumber;
52
+ /** End of the committed period (ms epoch). */
53
+ periodEnd: z.ZodNumber;
54
+ /** Number of subjects (leaves) committed. */
55
+ treeSize: z.ZodNumber;
56
+ root: z.ZodString;
57
+ /** Hash of the previous checkpoint; `null` only at genesis. */
58
+ prevCheckpointHash: z.ZodNullable<z.ZodString>;
59
+ signatures: z.ZodArray<z.ZodObject<{
60
+ /** Uncompressed hex public key of the signer. */
61
+ publicKey: z.ZodString;
62
+ alg: z.ZodLiteral<"ES256K-DER-SHA256">;
63
+ /** DER-encoded hex secp256k1 signature over the checkpoint signing input. */
64
+ signature: z.ZodString;
65
+ }, "strip", z.ZodTypeAny, {
66
+ signature: string;
67
+ publicKey: string;
68
+ alg: "ES256K-DER-SHA256";
69
+ }, {
70
+ signature: string;
71
+ publicKey: string;
72
+ alg: "ES256K-DER-SHA256";
73
+ }>, "many">;
74
+ anchors: z.ZodArray<z.ZodObject<{
75
+ /** Chain/network identifier, e.g. `faircoin-main`. */
76
+ network: z.ZodString;
77
+ txid: z.ZodString;
78
+ confirmations: z.ZodNumber;
79
+ /** When the anchoring transaction was broadcast (ms epoch). */
80
+ anchoredAt: z.ZodNumber;
81
+ }, "strip", z.ZodTypeAny, {
82
+ network: string;
83
+ txid: string;
84
+ confirmations: number;
85
+ anchoredAt: number;
86
+ }, {
87
+ network: string;
88
+ txid: string;
89
+ confirmations: number;
90
+ anchoredAt: number;
91
+ }>, "many">;
92
+ }, "strip", z.ZodTypeAny, {
93
+ index: number;
94
+ periodEnd: number;
95
+ treeSize: number;
96
+ root: string;
97
+ prevCheckpointHash: string | null;
98
+ signatures: {
99
+ signature: string;
100
+ publicKey: string;
101
+ alg: "ES256K-DER-SHA256";
102
+ }[];
103
+ anchors: {
104
+ network: string;
105
+ txid: string;
106
+ confirmations: number;
107
+ anchoredAt: number;
108
+ }[];
109
+ }, {
110
+ index: number;
111
+ periodEnd: number;
112
+ treeSize: number;
113
+ root: string;
114
+ prevCheckpointHash: string | null;
115
+ signatures: {
116
+ signature: string;
117
+ publicKey: string;
118
+ alg: "ES256K-DER-SHA256";
119
+ }[];
120
+ anchors: {
121
+ network: string;
122
+ txid: string;
123
+ confirmations: number;
124
+ anchoredAt: number;
125
+ }[];
126
+ }>;
127
+ /**
128
+ * An inclusion proof for one subject against one checkpoint.
129
+ *
130
+ * Carries the leaf PREIMAGE (`subjectDid`, `seq`, `headRecordId`) as well as the
131
+ * `leaf` digest so the verifier re-derives the leaf itself rather than trusting
132
+ * the server's hash, then walks `proof` up to the checkpoint's `root`.
133
+ */
134
+ export declare const transparencyInclusionProofSchema: z.ZodObject<{
135
+ checkpoint: z.ZodObject<{
136
+ index: z.ZodNumber;
137
+ /** End of the committed period (ms epoch). */
138
+ periodEnd: z.ZodNumber;
139
+ /** Number of subjects (leaves) committed. */
140
+ treeSize: z.ZodNumber;
141
+ root: z.ZodString;
142
+ /** Hash of the previous checkpoint; `null` only at genesis. */
143
+ prevCheckpointHash: z.ZodNullable<z.ZodString>;
144
+ signatures: z.ZodArray<z.ZodObject<{
145
+ /** Uncompressed hex public key of the signer. */
146
+ publicKey: z.ZodString;
147
+ alg: z.ZodLiteral<"ES256K-DER-SHA256">;
148
+ /** DER-encoded hex secp256k1 signature over the checkpoint signing input. */
149
+ signature: z.ZodString;
150
+ }, "strip", z.ZodTypeAny, {
151
+ signature: string;
152
+ publicKey: string;
153
+ alg: "ES256K-DER-SHA256";
154
+ }, {
155
+ signature: string;
156
+ publicKey: string;
157
+ alg: "ES256K-DER-SHA256";
158
+ }>, "many">;
159
+ anchors: z.ZodArray<z.ZodObject<{
160
+ /** Chain/network identifier, e.g. `faircoin-main`. */
161
+ network: z.ZodString;
162
+ txid: z.ZodString;
163
+ confirmations: z.ZodNumber;
164
+ /** When the anchoring transaction was broadcast (ms epoch). */
165
+ anchoredAt: z.ZodNumber;
166
+ }, "strip", z.ZodTypeAny, {
167
+ network: string;
168
+ txid: string;
169
+ confirmations: number;
170
+ anchoredAt: number;
171
+ }, {
172
+ network: string;
173
+ txid: string;
174
+ confirmations: number;
175
+ anchoredAt: number;
176
+ }>, "many">;
177
+ }, "strip", z.ZodTypeAny, {
178
+ index: number;
179
+ periodEnd: number;
180
+ treeSize: number;
181
+ root: string;
182
+ prevCheckpointHash: string | null;
183
+ signatures: {
184
+ signature: string;
185
+ publicKey: string;
186
+ alg: "ES256K-DER-SHA256";
187
+ }[];
188
+ anchors: {
189
+ network: string;
190
+ txid: string;
191
+ confirmations: number;
192
+ anchoredAt: number;
193
+ }[];
194
+ }, {
195
+ index: number;
196
+ periodEnd: number;
197
+ treeSize: number;
198
+ root: string;
199
+ prevCheckpointHash: string | null;
200
+ signatures: {
201
+ signature: string;
202
+ publicKey: string;
203
+ alg: "ES256K-DER-SHA256";
204
+ }[];
205
+ anchors: {
206
+ network: string;
207
+ txid: string;
208
+ confirmations: number;
209
+ anchoredAt: number;
210
+ }[];
211
+ }>;
212
+ subjectDid: z.ZodString;
213
+ seq: z.ZodNumber;
214
+ headRecordId: z.ZodString;
215
+ leaf: z.ZodString;
216
+ leafIndex: z.ZodNumber;
217
+ /** Audit path, leaf-adjacent sibling first; empty for a single-leaf tree. */
218
+ proof: z.ZodArray<z.ZodString, "many">;
219
+ }, "strip", z.ZodTypeAny, {
220
+ seq: number;
221
+ proof: string[];
222
+ headRecordId: string;
223
+ checkpoint: {
224
+ index: number;
225
+ periodEnd: number;
226
+ treeSize: number;
227
+ root: string;
228
+ prevCheckpointHash: string | null;
229
+ signatures: {
230
+ signature: string;
231
+ publicKey: string;
232
+ alg: "ES256K-DER-SHA256";
233
+ }[];
234
+ anchors: {
235
+ network: string;
236
+ txid: string;
237
+ confirmations: number;
238
+ anchoredAt: number;
239
+ }[];
240
+ };
241
+ subjectDid: string;
242
+ leaf: string;
243
+ leafIndex: number;
244
+ }, {
245
+ seq: number;
246
+ proof: string[];
247
+ headRecordId: string;
248
+ checkpoint: {
249
+ index: number;
250
+ periodEnd: number;
251
+ treeSize: number;
252
+ root: string;
253
+ prevCheckpointHash: string | null;
254
+ signatures: {
255
+ signature: string;
256
+ publicKey: string;
257
+ alg: "ES256K-DER-SHA256";
258
+ }[];
259
+ anchors: {
260
+ network: string;
261
+ txid: string;
262
+ confirmations: number;
263
+ anchoredAt: number;
264
+ }[];
265
+ };
266
+ subjectDid: string;
267
+ leaf: string;
268
+ leafIndex: number;
269
+ }>;
270
+ /** A page of the checkpoint chain, oldest first, for walking `prevCheckpointHash`. */
271
+ export declare const transparencyCheckpointListSchema: z.ZodObject<{
272
+ checkpoints: z.ZodArray<z.ZodObject<{
273
+ index: z.ZodNumber;
274
+ /** End of the committed period (ms epoch). */
275
+ periodEnd: z.ZodNumber;
276
+ /** Number of subjects (leaves) committed. */
277
+ treeSize: z.ZodNumber;
278
+ root: z.ZodString;
279
+ /** Hash of the previous checkpoint; `null` only at genesis. */
280
+ prevCheckpointHash: z.ZodNullable<z.ZodString>;
281
+ signatures: z.ZodArray<z.ZodObject<{
282
+ /** Uncompressed hex public key of the signer. */
283
+ publicKey: z.ZodString;
284
+ alg: z.ZodLiteral<"ES256K-DER-SHA256">;
285
+ /** DER-encoded hex secp256k1 signature over the checkpoint signing input. */
286
+ signature: z.ZodString;
287
+ }, "strip", z.ZodTypeAny, {
288
+ signature: string;
289
+ publicKey: string;
290
+ alg: "ES256K-DER-SHA256";
291
+ }, {
292
+ signature: string;
293
+ publicKey: string;
294
+ alg: "ES256K-DER-SHA256";
295
+ }>, "many">;
296
+ anchors: z.ZodArray<z.ZodObject<{
297
+ /** Chain/network identifier, e.g. `faircoin-main`. */
298
+ network: z.ZodString;
299
+ txid: z.ZodString;
300
+ confirmations: z.ZodNumber;
301
+ /** When the anchoring transaction was broadcast (ms epoch). */
302
+ anchoredAt: z.ZodNumber;
303
+ }, "strip", z.ZodTypeAny, {
304
+ network: string;
305
+ txid: string;
306
+ confirmations: number;
307
+ anchoredAt: number;
308
+ }, {
309
+ network: string;
310
+ txid: string;
311
+ confirmations: number;
312
+ anchoredAt: number;
313
+ }>, "many">;
314
+ }, "strip", z.ZodTypeAny, {
315
+ index: number;
316
+ periodEnd: number;
317
+ treeSize: number;
318
+ root: string;
319
+ prevCheckpointHash: string | null;
320
+ signatures: {
321
+ signature: string;
322
+ publicKey: string;
323
+ alg: "ES256K-DER-SHA256";
324
+ }[];
325
+ anchors: {
326
+ network: string;
327
+ txid: string;
328
+ confirmations: number;
329
+ anchoredAt: number;
330
+ }[];
331
+ }, {
332
+ index: number;
333
+ periodEnd: number;
334
+ treeSize: number;
335
+ root: string;
336
+ prevCheckpointHash: string | null;
337
+ signatures: {
338
+ signature: string;
339
+ publicKey: string;
340
+ alg: "ES256K-DER-SHA256";
341
+ }[];
342
+ anchors: {
343
+ network: string;
344
+ txid: string;
345
+ confirmations: number;
346
+ anchoredAt: number;
347
+ }[];
348
+ }>, "many">;
349
+ }, "strip", z.ZodTypeAny, {
350
+ checkpoints: {
351
+ index: number;
352
+ periodEnd: number;
353
+ treeSize: number;
354
+ root: string;
355
+ prevCheckpointHash: string | null;
356
+ signatures: {
357
+ signature: string;
358
+ publicKey: string;
359
+ alg: "ES256K-DER-SHA256";
360
+ }[];
361
+ anchors: {
362
+ network: string;
363
+ txid: string;
364
+ confirmations: number;
365
+ anchoredAt: number;
366
+ }[];
367
+ }[];
368
+ }, {
369
+ checkpoints: {
370
+ index: number;
371
+ periodEnd: number;
372
+ treeSize: number;
373
+ root: string;
374
+ prevCheckpointHash: string | null;
375
+ signatures: {
376
+ signature: string;
377
+ publicKey: string;
378
+ alg: "ES256K-DER-SHA256";
379
+ }[];
380
+ anchors: {
381
+ network: string;
382
+ txid: string;
383
+ confirmations: number;
384
+ anchoredAt: number;
385
+ }[];
386
+ }[];
387
+ }>;
388
+ export type TransparencyCheckpointSignature = z.infer<typeof transparencyCheckpointSignatureSchema>;
389
+ export type TransparencyAnchor = z.infer<typeof transparencyAnchorSchema>;
390
+ export type TransparencyCheckpoint = z.infer<typeof transparencyCheckpointSchema>;
391
+ export type TransparencyInclusionProof = z.infer<typeof transparencyInclusionProofSchema>;
392
+ export type TransparencyCheckpointList = z.infer<typeof transparencyCheckpointListSchema>;