@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.
- package/CHANGELOG.md +19 -0
- package/README.md +1 -1
- package/dist/beacon-types/index.d.mts +13 -2
- package/dist/beacon-types/index.d.ts +13 -2
- package/dist/beacon-types/index.js +35 -3
- package/dist/beacon-types/index.mjs +35 -4
- package/dist/browser-posture-report.d.mts +85 -0
- package/dist/browser-posture-report.d.ts +85 -0
- package/dist/browser-posture-report.js +1 -0
- package/dist/browser-posture-report.mjs +1 -0
- package/dist/browser-posture.d.mts +114 -0
- package/dist/browser-posture.d.ts +114 -0
- package/dist/browser-posture.js +4204 -0
- package/dist/browser-posture.mjs +4187 -0
- package/dist/browser.d.mts +35 -1
- package/dist/browser.d.ts +35 -1
- package/dist/browser.js +1 -1
- package/dist/browser.mjs +1 -1
- package/dist/canonical-signer/index.js +31 -2
- package/dist/canonical-signer/index.mjs +31 -2
- package/dist/deploy/index.d.mts +449 -2
- package/dist/deploy/index.d.ts +449 -2
- package/dist/deploy/index.js +238 -1
- package/dist/deploy/index.mjs +228 -2
- package/dist/errors/index.d.mts +104 -0
- package/dist/errors/index.d.ts +104 -0
- package/dist/errors/index.js +338 -0
- package/dist/errors/index.mjs +333 -0
- package/dist/gateway/index.d.mts +6 -1
- package/dist/gateway/index.d.ts +6 -1
- package/dist/gateway/index.js +4 -0
- package/dist/gateway/index.mjs +4 -1
- package/dist/index.d.mts +2388 -851
- package/dist/index.d.ts +2388 -851
- package/dist/index.js +2684 -686
- package/dist/index.mjs +2575 -669
- package/dist/mcpi/multibase-ed25519.d.mts +8 -0
- package/dist/mcpi/multibase-ed25519.d.ts +8 -0
- package/dist/mcpi/multibase-ed25519.js +125 -0
- package/dist/mcpi/multibase-ed25519.mjs +119 -0
- package/dist/signals/index.d.mts +158 -0
- package/dist/signals/index.d.ts +158 -0
- package/dist/signals/index.js +1667 -0
- package/dist/signals/index.mjs +1637 -0
- package/dist/test-fixtures/index.d.mts +37 -1
- package/dist/test-fixtures/index.d.ts +37 -1
- package/dist/test-fixtures/index.js +92 -1
- package/dist/test-fixtures/index.mjs +87 -2
- package/fixtures/client-ip-resolution.json +103 -0
- package/fixtures/detection/reason-codes.json +35 -0
- package/fixtures/detection/signal-exposure-example.json +62 -0
- package/fixtures/kya-http/README.md +112 -0
- package/fixtures/kya-http/challenge-proof.canonical.json +25 -0
- package/fixtures/kya-http/challenge.approval-quorum.json +37 -0
- package/fixtures/kya-http/challenge.delegation.fetcher-200.json +55 -0
- package/fixtures/kya-http/challenge.delegation.full.json +81 -0
- package/fixtures/kya-http/challenge.delegation.minimal.json +57 -0
- package/fixtures/kya-http/error-codes.json +35 -0
- package/fixtures/kya-http/fetcher-200-predicate.vectors.json +72 -0
- package/fixtures/kya-http/negative.challenges.json +54 -0
- package/fixtures/kya-http/pickup.transcript.json +96 -0
- package/fixtures/kya-http/pickup.transcript.quorum.json +156 -0
- package/fixtures/kya-http/protected-resource-metadata.full.json +30 -0
- package/fixtures/kya-http/protected-resource-metadata.global.json +28 -0
- package/fixtures/kya-http/registration.request.json +33 -0
- package/fixtures/kya-http/registration.response.json +32 -0
- package/package.json +42 -9
- package/src/data/compiled/merged-rules.json +8 -2
package/dist/deploy/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var zod = require('zod');
|
|
4
4
|
|
|
5
5
|
// src/deploy/index.ts
|
|
6
|
+
var KYA_OS_EVENTS_PATH = "/api/v1/kya-os/events";
|
|
6
7
|
var DidStringSchema = zod.z.string().min(8, "DID must be at least 8 characters").regex(/^did:[a-z0-9]+:\S+$/, "DID must match format did:<method>:<method-specific-id>");
|
|
7
8
|
var FlyRegionSchema = zod.z.enum([
|
|
8
9
|
"ams",
|
|
@@ -74,7 +75,232 @@ var FlyRegionSchema = zod.z.enum([
|
|
|
74
75
|
"yyz"
|
|
75
76
|
// Toronto, Canada
|
|
76
77
|
]);
|
|
77
|
-
var HostingModeSchema = zod.z.enum(["byok", "managed"]);
|
|
78
|
+
var HostingModeSchema = zod.z.enum(["byok", "managed", "managed-byoa"]);
|
|
79
|
+
var AuditAssuranceProfileSchema = zod.z.enum(["AAP-0", "AAP-1", "AAP-2", "AAP-3", "AAP-4"]);
|
|
80
|
+
var AuditDeliveryModeSchema = zod.z.enum(["best-effort", "buffered", "required"]);
|
|
81
|
+
var AuditDeploymentConfigSchema = zod.z.object({
|
|
82
|
+
enabled: zod.z.boolean(),
|
|
83
|
+
requestedProfile: AuditAssuranceProfileSchema,
|
|
84
|
+
delivery: AuditDeliveryModeSchema,
|
|
85
|
+
evidenceMode: zod.z.enum(["none", "encrypted-separate", "encrypted-inline"]),
|
|
86
|
+
retentionClass: zod.z.string().min(1).max(128),
|
|
87
|
+
retentionDays: zod.z.number().int().min(0).max(3650),
|
|
88
|
+
residency: zod.z.enum(["inherit-project", "us", "eu", "global"]),
|
|
89
|
+
keyCustody: zod.z.enum(["none", "checkpoint-managed", "customer-managed-kms"]),
|
|
90
|
+
recorderTopology: zod.z.enum(["none", "self-hosted", "managed", "verified-mirror"])
|
|
91
|
+
}).strict().superRefine((value, context) => {
|
|
92
|
+
if (!value.enabled && value.requestedProfile !== "AAP-0") {
|
|
93
|
+
context.addIssue({
|
|
94
|
+
code: zod.z.ZodIssueCode.custom,
|
|
95
|
+
path: ["requestedProfile"],
|
|
96
|
+
message: "Disabled audit configuration must request AAP-0"
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
if (value.enabled && value.requestedProfile === "AAP-0") {
|
|
100
|
+
context.addIssue({
|
|
101
|
+
code: zod.z.ZodIssueCode.custom,
|
|
102
|
+
path: ["requestedProfile"],
|
|
103
|
+
message: "Enabled audit configuration must request AAP-1 or higher"
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
if (Number(value.requestedProfile.slice(-1)) >= 2 && value.delivery === "best-effort") {
|
|
107
|
+
context.addIssue({
|
|
108
|
+
code: zod.z.ZodIssueCode.custom,
|
|
109
|
+
path: ["delivery"],
|
|
110
|
+
message: "AAP-2 or higher cannot use best-effort delivery"
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
if (!value.enabled && (value.keyCustody !== "none" || value.recorderTopology !== "none")) {
|
|
114
|
+
context.addIssue({
|
|
115
|
+
code: zod.z.ZodIssueCode.custom,
|
|
116
|
+
message: "Disabled audit configuration cannot claim key custody or recorder topology"
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
var NEW_MANAGED_AUDIT_DEPLOYMENT_DEFAULT = Object.freeze({
|
|
121
|
+
enabled: true,
|
|
122
|
+
requestedProfile: "AAP-2",
|
|
123
|
+
delivery: "buffered",
|
|
124
|
+
evidenceMode: "encrypted-separate",
|
|
125
|
+
retentionClass: "integrity-ledger",
|
|
126
|
+
retentionDays: 365,
|
|
127
|
+
residency: "inherit-project",
|
|
128
|
+
keyCustody: "checkpoint-managed",
|
|
129
|
+
recorderTopology: "managed"
|
|
130
|
+
});
|
|
131
|
+
var ABSENT_AUDIT_DEPLOYMENT_CONFIG = Object.freeze({
|
|
132
|
+
enabled: false,
|
|
133
|
+
requestedProfile: "AAP-0",
|
|
134
|
+
delivery: "best-effort",
|
|
135
|
+
evidenceMode: "none",
|
|
136
|
+
retentionClass: "none",
|
|
137
|
+
retentionDays: 0,
|
|
138
|
+
residency: "inherit-project",
|
|
139
|
+
keyCustody: "none",
|
|
140
|
+
recorderTopology: "none"
|
|
141
|
+
});
|
|
142
|
+
var AuditRuntimeCapabilitiesSchema = zod.z.object({
|
|
143
|
+
recorderTopology: zod.z.enum(["none", "self-hosted", "managed", "verified-mirror"]),
|
|
144
|
+
delivery: AuditDeliveryModeSchema,
|
|
145
|
+
journalDurability: zod.z.enum(["none", "ephemeral", "durable"]),
|
|
146
|
+
atomicAppend: zod.z.boolean(),
|
|
147
|
+
sourceHighWater: zod.z.boolean(),
|
|
148
|
+
merkleCheckpoints: zod.z.boolean(),
|
|
149
|
+
independentObservation: zod.z.boolean(),
|
|
150
|
+
supportingAnchors: zod.z.array(zod.z.enum(["worm", "rfc3161", "scitt"])),
|
|
151
|
+
evidenceRetention: zod.z.enum(["none", "inline", "separate"])
|
|
152
|
+
}).strict();
|
|
153
|
+
var AuditRuntimeCanaryResultSchema = zod.z.object({
|
|
154
|
+
passed: zod.z.boolean(),
|
|
155
|
+
observedAt: zod.z.number().int().nonnegative(),
|
|
156
|
+
capabilities: AuditRuntimeCapabilitiesSchema,
|
|
157
|
+
checks: zod.z.array(
|
|
158
|
+
zod.z.object({
|
|
159
|
+
id: zod.z.string().min(1).max(128),
|
|
160
|
+
passed: zod.z.boolean()
|
|
161
|
+
}).strict()
|
|
162
|
+
).min(1),
|
|
163
|
+
bundleHash: zod.z.string().min(1).max(256).optional()
|
|
164
|
+
}).strict().superRefine((value, context) => {
|
|
165
|
+
if (value.passed !== value.checks.every((check) => check.passed)) {
|
|
166
|
+
context.addIssue({
|
|
167
|
+
code: zod.z.ZodIssueCode.custom,
|
|
168
|
+
path: ["passed"],
|
|
169
|
+
message: "Canary result must equal the aggregate of its mechanical checks"
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
function requiredAuditRuntimeCanaryChecks(capabilities) {
|
|
174
|
+
const checks = [
|
|
175
|
+
"recorder_round_trip",
|
|
176
|
+
"verified_receipt",
|
|
177
|
+
"idempotent_retry",
|
|
178
|
+
"event_identity_conflict",
|
|
179
|
+
"source_state"
|
|
180
|
+
];
|
|
181
|
+
if (capabilities.delivery === "buffered") checks.push("buffered_outbox");
|
|
182
|
+
if (capabilities.evidenceRetention !== "none") checks.push("evidence_write_verified");
|
|
183
|
+
return checks;
|
|
184
|
+
}
|
|
185
|
+
var AuditDeploymentReadinessSchema = zod.z.object({
|
|
186
|
+
requestedProfile: AuditAssuranceProfileSchema,
|
|
187
|
+
effectiveProfile: AuditAssuranceProfileSchema,
|
|
188
|
+
status: zod.z.enum(["disabled", "ready", "degraded"]),
|
|
189
|
+
capabilities: AuditRuntimeCapabilitiesSchema.nullable(),
|
|
190
|
+
canary: AuditRuntimeCanaryResultSchema.nullable(),
|
|
191
|
+
reasonCodes: zod.z.array(zod.z.string().min(1).max(128))
|
|
192
|
+
}).strict();
|
|
193
|
+
var PROFILE_BY_LEVEL = ["AAP-0", "AAP-1", "AAP-2", "AAP-3", "AAP-4"];
|
|
194
|
+
function resolveAuditDeploymentReadiness(config, capabilities, canary) {
|
|
195
|
+
const requested = AuditDeploymentConfigSchema.parse(config ?? ABSENT_AUDIT_DEPLOYMENT_CONFIG);
|
|
196
|
+
const observedCanary = canary ? AuditRuntimeCanaryResultSchema.parse(canary) : null;
|
|
197
|
+
if (!requested.enabled) {
|
|
198
|
+
return {
|
|
199
|
+
requestedProfile: "AAP-0",
|
|
200
|
+
effectiveProfile: "AAP-0",
|
|
201
|
+
status: "disabled",
|
|
202
|
+
capabilities: capabilities ?? null,
|
|
203
|
+
canary: observedCanary,
|
|
204
|
+
reasonCodes: ["audit_not_configured"]
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
const observedCapabilities = capabilities ?? observedCanary?.capabilities;
|
|
208
|
+
if (!observedCapabilities) {
|
|
209
|
+
return {
|
|
210
|
+
requestedProfile: requested.requestedProfile,
|
|
211
|
+
effectiveProfile: "AAP-0",
|
|
212
|
+
status: "degraded",
|
|
213
|
+
capabilities: null,
|
|
214
|
+
canary: observedCanary,
|
|
215
|
+
reasonCodes: ["runtime_capabilities_unavailable"]
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
const observed = AuditRuntimeCapabilitiesSchema.parse(observedCapabilities);
|
|
219
|
+
if (!observedCanary) {
|
|
220
|
+
return {
|
|
221
|
+
requestedProfile: requested.requestedProfile,
|
|
222
|
+
effectiveProfile: "AAP-0",
|
|
223
|
+
status: "degraded",
|
|
224
|
+
capabilities: observed,
|
|
225
|
+
canary: null,
|
|
226
|
+
reasonCodes: ["runtime_canary_required"]
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
if (!observedCanary.passed || JSON.stringify(observedCanary.capabilities) !== JSON.stringify(observed)) {
|
|
230
|
+
return {
|
|
231
|
+
requestedProfile: requested.requestedProfile,
|
|
232
|
+
effectiveProfile: "AAP-0",
|
|
233
|
+
status: "degraded",
|
|
234
|
+
capabilities: observed,
|
|
235
|
+
canary: observedCanary,
|
|
236
|
+
reasonCodes: [
|
|
237
|
+
observedCanary.passed ? "runtime_canary_capability_mismatch" : "runtime_canary_failed"
|
|
238
|
+
]
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
const passedChecks = new Set(
|
|
242
|
+
observedCanary.checks.filter((check) => check.passed).map((check) => check.id)
|
|
243
|
+
);
|
|
244
|
+
if (requiredAuditRuntimeCanaryChecks(observed).some((check) => !passedChecks.has(check))) {
|
|
245
|
+
return {
|
|
246
|
+
requestedProfile: requested.requestedProfile,
|
|
247
|
+
effectiveProfile: "AAP-0",
|
|
248
|
+
status: "degraded",
|
|
249
|
+
capabilities: observed,
|
|
250
|
+
canary: observedCanary,
|
|
251
|
+
reasonCodes: ["runtime_canary_incomplete"]
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
let maximum = 0;
|
|
255
|
+
const reasons = [];
|
|
256
|
+
if (observed.recorderTopology !== requested.recorderTopology) {
|
|
257
|
+
reasons.push("recorder_topology_mismatch");
|
|
258
|
+
}
|
|
259
|
+
const deliveryRank = { "best-effort": 0, buffered: 1, required: 2 };
|
|
260
|
+
if (deliveryRank[observed.delivery] < deliveryRank[requested.delivery]) {
|
|
261
|
+
reasons.push("delivery_mode_mismatch");
|
|
262
|
+
}
|
|
263
|
+
const expectedEvidence = requested.evidenceMode === "none" ? "none" : requested.evidenceMode === "encrypted-inline" ? "inline" : "separate";
|
|
264
|
+
if (expectedEvidence !== observed.evidenceRetention) {
|
|
265
|
+
reasons.push("evidence_retention_mismatch");
|
|
266
|
+
}
|
|
267
|
+
if (reasons.length > 0) {
|
|
268
|
+
return {
|
|
269
|
+
requestedProfile: requested.requestedProfile,
|
|
270
|
+
effectiveProfile: "AAP-0",
|
|
271
|
+
status: "degraded",
|
|
272
|
+
capabilities: observed,
|
|
273
|
+
canary: observedCanary,
|
|
274
|
+
reasonCodes: reasons
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
if (observed.recorderTopology !== "none" && observed.journalDurability !== "none") maximum = 1;
|
|
278
|
+
else reasons.push("recorder_or_journal_unavailable");
|
|
279
|
+
if (maximum >= 1 && observed.journalDurability === "durable" && observed.atomicAppend && observed.delivery !== "best-effort") {
|
|
280
|
+
maximum = 2;
|
|
281
|
+
} else if (Number(requested.requestedProfile.slice(-1)) >= 2) {
|
|
282
|
+
reasons.push("durable_atomic_buffered_append_unavailable");
|
|
283
|
+
}
|
|
284
|
+
if (maximum >= 2 && observed.merkleCheckpoints && observed.sourceHighWater) maximum = 3;
|
|
285
|
+
else if (Number(requested.requestedProfile.slice(-1)) >= 3) {
|
|
286
|
+
reasons.push("checkpoint_or_source_high_water_unavailable");
|
|
287
|
+
}
|
|
288
|
+
if (maximum >= 3 && observed.independentObservation && observed.supportingAnchors.length > 0) {
|
|
289
|
+
maximum = 4;
|
|
290
|
+
} else if (Number(requested.requestedProfile.slice(-1)) >= 4) {
|
|
291
|
+
reasons.push("independent_observation_or_anchor_unavailable");
|
|
292
|
+
}
|
|
293
|
+
const requestedLevel = Number(requested.requestedProfile.slice(-1));
|
|
294
|
+
const effectiveLevel = Math.min(requestedLevel, maximum);
|
|
295
|
+
return {
|
|
296
|
+
requestedProfile: requested.requestedProfile,
|
|
297
|
+
effectiveProfile: PROFILE_BY_LEVEL[effectiveLevel],
|
|
298
|
+
status: effectiveLevel === requestedLevel && reasons.length === 0 ? "ready" : "degraded",
|
|
299
|
+
capabilities: observed,
|
|
300
|
+
canary: observedCanary,
|
|
301
|
+
reasonCodes: reasons
|
|
302
|
+
};
|
|
303
|
+
}
|
|
78
304
|
var ManagedDeployStepStatusSchema = zod.z.enum([
|
|
79
305
|
"pending",
|
|
80
306
|
"in_progress",
|
|
@@ -206,6 +432,13 @@ var ControlStatusSchema = zod.z.object({
|
|
|
206
432
|
cpuPercent: zod.z.number().nonnegative().max(100)
|
|
207
433
|
});
|
|
208
434
|
|
|
435
|
+
exports.ABSENT_AUDIT_DEPLOYMENT_CONFIG = ABSENT_AUDIT_DEPLOYMENT_CONFIG;
|
|
436
|
+
exports.AuditAssuranceProfileSchema = AuditAssuranceProfileSchema;
|
|
437
|
+
exports.AuditDeliveryModeSchema = AuditDeliveryModeSchema;
|
|
438
|
+
exports.AuditDeploymentConfigSchema = AuditDeploymentConfigSchema;
|
|
439
|
+
exports.AuditDeploymentReadinessSchema = AuditDeploymentReadinessSchema;
|
|
440
|
+
exports.AuditRuntimeCanaryResultSchema = AuditRuntimeCanaryResultSchema;
|
|
441
|
+
exports.AuditRuntimeCapabilitiesSchema = AuditRuntimeCapabilitiesSchema;
|
|
209
442
|
exports.ComputeCommandSchema = ComputeCommandSchema;
|
|
210
443
|
exports.ConfigBundleSchema = ConfigBundleSchema;
|
|
211
444
|
exports.ControlStatusSchema = ControlStatusSchema;
|
|
@@ -214,8 +447,12 @@ exports.FlyRegionSchema = FlyRegionSchema;
|
|
|
214
447
|
exports.HeartbeatRequestSchema = HeartbeatRequestSchema;
|
|
215
448
|
exports.HeartbeatResponseSchema = HeartbeatResponseSchema;
|
|
216
449
|
exports.HostingModeSchema = HostingModeSchema;
|
|
450
|
+
exports.KYA_OS_EVENTS_PATH = KYA_OS_EVENTS_PATH;
|
|
217
451
|
exports.ManagedDeployStepStatusSchema = ManagedDeployStepStatusSchema;
|
|
452
|
+
exports.NEW_MANAGED_AUDIT_DEPLOYMENT_DEFAULT = NEW_MANAGED_AUDIT_DEPLOYMENT_DEFAULT;
|
|
218
453
|
exports.RestartCommandSchema = RestartCommandSchema;
|
|
219
454
|
exports.StopCommandSchema = StopCommandSchema;
|
|
220
455
|
exports.UpdateConfigCommandSchema = UpdateConfigCommandSchema;
|
|
221
456
|
exports.UpdateVersionCommandSchema = UpdateVersionCommandSchema;
|
|
457
|
+
exports.requiredAuditRuntimeCanaryChecks = requiredAuditRuntimeCanaryChecks;
|
|
458
|
+
exports.resolveAuditDeploymentReadiness = resolveAuditDeploymentReadiness;
|
package/dist/deploy/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
3
|
// src/deploy/index.ts
|
|
4
|
+
var KYA_OS_EVENTS_PATH = "/api/v1/kya-os/events";
|
|
4
5
|
var DidStringSchema = z.string().min(8, "DID must be at least 8 characters").regex(/^did:[a-z0-9]+:\S+$/, "DID must match format did:<method>:<method-specific-id>");
|
|
5
6
|
var FlyRegionSchema = z.enum([
|
|
6
7
|
"ams",
|
|
@@ -72,7 +73,232 @@ var FlyRegionSchema = z.enum([
|
|
|
72
73
|
"yyz"
|
|
73
74
|
// Toronto, Canada
|
|
74
75
|
]);
|
|
75
|
-
var HostingModeSchema = z.enum(["byok", "managed"]);
|
|
76
|
+
var HostingModeSchema = z.enum(["byok", "managed", "managed-byoa"]);
|
|
77
|
+
var AuditAssuranceProfileSchema = z.enum(["AAP-0", "AAP-1", "AAP-2", "AAP-3", "AAP-4"]);
|
|
78
|
+
var AuditDeliveryModeSchema = z.enum(["best-effort", "buffered", "required"]);
|
|
79
|
+
var AuditDeploymentConfigSchema = z.object({
|
|
80
|
+
enabled: z.boolean(),
|
|
81
|
+
requestedProfile: AuditAssuranceProfileSchema,
|
|
82
|
+
delivery: AuditDeliveryModeSchema,
|
|
83
|
+
evidenceMode: z.enum(["none", "encrypted-separate", "encrypted-inline"]),
|
|
84
|
+
retentionClass: z.string().min(1).max(128),
|
|
85
|
+
retentionDays: z.number().int().min(0).max(3650),
|
|
86
|
+
residency: z.enum(["inherit-project", "us", "eu", "global"]),
|
|
87
|
+
keyCustody: z.enum(["none", "checkpoint-managed", "customer-managed-kms"]),
|
|
88
|
+
recorderTopology: z.enum(["none", "self-hosted", "managed", "verified-mirror"])
|
|
89
|
+
}).strict().superRefine((value, context) => {
|
|
90
|
+
if (!value.enabled && value.requestedProfile !== "AAP-0") {
|
|
91
|
+
context.addIssue({
|
|
92
|
+
code: z.ZodIssueCode.custom,
|
|
93
|
+
path: ["requestedProfile"],
|
|
94
|
+
message: "Disabled audit configuration must request AAP-0"
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
if (value.enabled && value.requestedProfile === "AAP-0") {
|
|
98
|
+
context.addIssue({
|
|
99
|
+
code: z.ZodIssueCode.custom,
|
|
100
|
+
path: ["requestedProfile"],
|
|
101
|
+
message: "Enabled audit configuration must request AAP-1 or higher"
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
if (Number(value.requestedProfile.slice(-1)) >= 2 && value.delivery === "best-effort") {
|
|
105
|
+
context.addIssue({
|
|
106
|
+
code: z.ZodIssueCode.custom,
|
|
107
|
+
path: ["delivery"],
|
|
108
|
+
message: "AAP-2 or higher cannot use best-effort delivery"
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
if (!value.enabled && (value.keyCustody !== "none" || value.recorderTopology !== "none")) {
|
|
112
|
+
context.addIssue({
|
|
113
|
+
code: z.ZodIssueCode.custom,
|
|
114
|
+
message: "Disabled audit configuration cannot claim key custody or recorder topology"
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
var NEW_MANAGED_AUDIT_DEPLOYMENT_DEFAULT = Object.freeze({
|
|
119
|
+
enabled: true,
|
|
120
|
+
requestedProfile: "AAP-2",
|
|
121
|
+
delivery: "buffered",
|
|
122
|
+
evidenceMode: "encrypted-separate",
|
|
123
|
+
retentionClass: "integrity-ledger",
|
|
124
|
+
retentionDays: 365,
|
|
125
|
+
residency: "inherit-project",
|
|
126
|
+
keyCustody: "checkpoint-managed",
|
|
127
|
+
recorderTopology: "managed"
|
|
128
|
+
});
|
|
129
|
+
var ABSENT_AUDIT_DEPLOYMENT_CONFIG = Object.freeze({
|
|
130
|
+
enabled: false,
|
|
131
|
+
requestedProfile: "AAP-0",
|
|
132
|
+
delivery: "best-effort",
|
|
133
|
+
evidenceMode: "none",
|
|
134
|
+
retentionClass: "none",
|
|
135
|
+
retentionDays: 0,
|
|
136
|
+
residency: "inherit-project",
|
|
137
|
+
keyCustody: "none",
|
|
138
|
+
recorderTopology: "none"
|
|
139
|
+
});
|
|
140
|
+
var AuditRuntimeCapabilitiesSchema = z.object({
|
|
141
|
+
recorderTopology: z.enum(["none", "self-hosted", "managed", "verified-mirror"]),
|
|
142
|
+
delivery: AuditDeliveryModeSchema,
|
|
143
|
+
journalDurability: z.enum(["none", "ephemeral", "durable"]),
|
|
144
|
+
atomicAppend: z.boolean(),
|
|
145
|
+
sourceHighWater: z.boolean(),
|
|
146
|
+
merkleCheckpoints: z.boolean(),
|
|
147
|
+
independentObservation: z.boolean(),
|
|
148
|
+
supportingAnchors: z.array(z.enum(["worm", "rfc3161", "scitt"])),
|
|
149
|
+
evidenceRetention: z.enum(["none", "inline", "separate"])
|
|
150
|
+
}).strict();
|
|
151
|
+
var AuditRuntimeCanaryResultSchema = z.object({
|
|
152
|
+
passed: z.boolean(),
|
|
153
|
+
observedAt: z.number().int().nonnegative(),
|
|
154
|
+
capabilities: AuditRuntimeCapabilitiesSchema,
|
|
155
|
+
checks: z.array(
|
|
156
|
+
z.object({
|
|
157
|
+
id: z.string().min(1).max(128),
|
|
158
|
+
passed: z.boolean()
|
|
159
|
+
}).strict()
|
|
160
|
+
).min(1),
|
|
161
|
+
bundleHash: z.string().min(1).max(256).optional()
|
|
162
|
+
}).strict().superRefine((value, context) => {
|
|
163
|
+
if (value.passed !== value.checks.every((check) => check.passed)) {
|
|
164
|
+
context.addIssue({
|
|
165
|
+
code: z.ZodIssueCode.custom,
|
|
166
|
+
path: ["passed"],
|
|
167
|
+
message: "Canary result must equal the aggregate of its mechanical checks"
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
function requiredAuditRuntimeCanaryChecks(capabilities) {
|
|
172
|
+
const checks = [
|
|
173
|
+
"recorder_round_trip",
|
|
174
|
+
"verified_receipt",
|
|
175
|
+
"idempotent_retry",
|
|
176
|
+
"event_identity_conflict",
|
|
177
|
+
"source_state"
|
|
178
|
+
];
|
|
179
|
+
if (capabilities.delivery === "buffered") checks.push("buffered_outbox");
|
|
180
|
+
if (capabilities.evidenceRetention !== "none") checks.push("evidence_write_verified");
|
|
181
|
+
return checks;
|
|
182
|
+
}
|
|
183
|
+
var AuditDeploymentReadinessSchema = z.object({
|
|
184
|
+
requestedProfile: AuditAssuranceProfileSchema,
|
|
185
|
+
effectiveProfile: AuditAssuranceProfileSchema,
|
|
186
|
+
status: z.enum(["disabled", "ready", "degraded"]),
|
|
187
|
+
capabilities: AuditRuntimeCapabilitiesSchema.nullable(),
|
|
188
|
+
canary: AuditRuntimeCanaryResultSchema.nullable(),
|
|
189
|
+
reasonCodes: z.array(z.string().min(1).max(128))
|
|
190
|
+
}).strict();
|
|
191
|
+
var PROFILE_BY_LEVEL = ["AAP-0", "AAP-1", "AAP-2", "AAP-3", "AAP-4"];
|
|
192
|
+
function resolveAuditDeploymentReadiness(config, capabilities, canary) {
|
|
193
|
+
const requested = AuditDeploymentConfigSchema.parse(config ?? ABSENT_AUDIT_DEPLOYMENT_CONFIG);
|
|
194
|
+
const observedCanary = canary ? AuditRuntimeCanaryResultSchema.parse(canary) : null;
|
|
195
|
+
if (!requested.enabled) {
|
|
196
|
+
return {
|
|
197
|
+
requestedProfile: "AAP-0",
|
|
198
|
+
effectiveProfile: "AAP-0",
|
|
199
|
+
status: "disabled",
|
|
200
|
+
capabilities: capabilities ?? null,
|
|
201
|
+
canary: observedCanary,
|
|
202
|
+
reasonCodes: ["audit_not_configured"]
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
const observedCapabilities = capabilities ?? observedCanary?.capabilities;
|
|
206
|
+
if (!observedCapabilities) {
|
|
207
|
+
return {
|
|
208
|
+
requestedProfile: requested.requestedProfile,
|
|
209
|
+
effectiveProfile: "AAP-0",
|
|
210
|
+
status: "degraded",
|
|
211
|
+
capabilities: null,
|
|
212
|
+
canary: observedCanary,
|
|
213
|
+
reasonCodes: ["runtime_capabilities_unavailable"]
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
const observed = AuditRuntimeCapabilitiesSchema.parse(observedCapabilities);
|
|
217
|
+
if (!observedCanary) {
|
|
218
|
+
return {
|
|
219
|
+
requestedProfile: requested.requestedProfile,
|
|
220
|
+
effectiveProfile: "AAP-0",
|
|
221
|
+
status: "degraded",
|
|
222
|
+
capabilities: observed,
|
|
223
|
+
canary: null,
|
|
224
|
+
reasonCodes: ["runtime_canary_required"]
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
if (!observedCanary.passed || JSON.stringify(observedCanary.capabilities) !== JSON.stringify(observed)) {
|
|
228
|
+
return {
|
|
229
|
+
requestedProfile: requested.requestedProfile,
|
|
230
|
+
effectiveProfile: "AAP-0",
|
|
231
|
+
status: "degraded",
|
|
232
|
+
capabilities: observed,
|
|
233
|
+
canary: observedCanary,
|
|
234
|
+
reasonCodes: [
|
|
235
|
+
observedCanary.passed ? "runtime_canary_capability_mismatch" : "runtime_canary_failed"
|
|
236
|
+
]
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
const passedChecks = new Set(
|
|
240
|
+
observedCanary.checks.filter((check) => check.passed).map((check) => check.id)
|
|
241
|
+
);
|
|
242
|
+
if (requiredAuditRuntimeCanaryChecks(observed).some((check) => !passedChecks.has(check))) {
|
|
243
|
+
return {
|
|
244
|
+
requestedProfile: requested.requestedProfile,
|
|
245
|
+
effectiveProfile: "AAP-0",
|
|
246
|
+
status: "degraded",
|
|
247
|
+
capabilities: observed,
|
|
248
|
+
canary: observedCanary,
|
|
249
|
+
reasonCodes: ["runtime_canary_incomplete"]
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
let maximum = 0;
|
|
253
|
+
const reasons = [];
|
|
254
|
+
if (observed.recorderTopology !== requested.recorderTopology) {
|
|
255
|
+
reasons.push("recorder_topology_mismatch");
|
|
256
|
+
}
|
|
257
|
+
const deliveryRank = { "best-effort": 0, buffered: 1, required: 2 };
|
|
258
|
+
if (deliveryRank[observed.delivery] < deliveryRank[requested.delivery]) {
|
|
259
|
+
reasons.push("delivery_mode_mismatch");
|
|
260
|
+
}
|
|
261
|
+
const expectedEvidence = requested.evidenceMode === "none" ? "none" : requested.evidenceMode === "encrypted-inline" ? "inline" : "separate";
|
|
262
|
+
if (expectedEvidence !== observed.evidenceRetention) {
|
|
263
|
+
reasons.push("evidence_retention_mismatch");
|
|
264
|
+
}
|
|
265
|
+
if (reasons.length > 0) {
|
|
266
|
+
return {
|
|
267
|
+
requestedProfile: requested.requestedProfile,
|
|
268
|
+
effectiveProfile: "AAP-0",
|
|
269
|
+
status: "degraded",
|
|
270
|
+
capabilities: observed,
|
|
271
|
+
canary: observedCanary,
|
|
272
|
+
reasonCodes: reasons
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
if (observed.recorderTopology !== "none" && observed.journalDurability !== "none") maximum = 1;
|
|
276
|
+
else reasons.push("recorder_or_journal_unavailable");
|
|
277
|
+
if (maximum >= 1 && observed.journalDurability === "durable" && observed.atomicAppend && observed.delivery !== "best-effort") {
|
|
278
|
+
maximum = 2;
|
|
279
|
+
} else if (Number(requested.requestedProfile.slice(-1)) >= 2) {
|
|
280
|
+
reasons.push("durable_atomic_buffered_append_unavailable");
|
|
281
|
+
}
|
|
282
|
+
if (maximum >= 2 && observed.merkleCheckpoints && observed.sourceHighWater) maximum = 3;
|
|
283
|
+
else if (Number(requested.requestedProfile.slice(-1)) >= 3) {
|
|
284
|
+
reasons.push("checkpoint_or_source_high_water_unavailable");
|
|
285
|
+
}
|
|
286
|
+
if (maximum >= 3 && observed.independentObservation && observed.supportingAnchors.length > 0) {
|
|
287
|
+
maximum = 4;
|
|
288
|
+
} else if (Number(requested.requestedProfile.slice(-1)) >= 4) {
|
|
289
|
+
reasons.push("independent_observation_or_anchor_unavailable");
|
|
290
|
+
}
|
|
291
|
+
const requestedLevel = Number(requested.requestedProfile.slice(-1));
|
|
292
|
+
const effectiveLevel = Math.min(requestedLevel, maximum);
|
|
293
|
+
return {
|
|
294
|
+
requestedProfile: requested.requestedProfile,
|
|
295
|
+
effectiveProfile: PROFILE_BY_LEVEL[effectiveLevel],
|
|
296
|
+
status: effectiveLevel === requestedLevel && reasons.length === 0 ? "ready" : "degraded",
|
|
297
|
+
capabilities: observed,
|
|
298
|
+
canary: observedCanary,
|
|
299
|
+
reasonCodes: reasons
|
|
300
|
+
};
|
|
301
|
+
}
|
|
76
302
|
var ManagedDeployStepStatusSchema = z.enum([
|
|
77
303
|
"pending",
|
|
78
304
|
"in_progress",
|
|
@@ -204,4 +430,4 @@ var ControlStatusSchema = z.object({
|
|
|
204
430
|
cpuPercent: z.number().nonnegative().max(100)
|
|
205
431
|
});
|
|
206
432
|
|
|
207
|
-
export { ComputeCommandSchema, ConfigBundleSchema, ControlStatusSchema, DidStringSchema, FlyRegionSchema, HeartbeatRequestSchema, HeartbeatResponseSchema, HostingModeSchema, ManagedDeployStepStatusSchema, RestartCommandSchema, StopCommandSchema, UpdateConfigCommandSchema, UpdateVersionCommandSchema };
|
|
433
|
+
export { ABSENT_AUDIT_DEPLOYMENT_CONFIG, AuditAssuranceProfileSchema, AuditDeliveryModeSchema, AuditDeploymentConfigSchema, AuditDeploymentReadinessSchema, AuditRuntimeCanaryResultSchema, AuditRuntimeCapabilitiesSchema, ComputeCommandSchema, ConfigBundleSchema, ControlStatusSchema, DidStringSchema, FlyRegionSchema, HeartbeatRequestSchema, HeartbeatResponseSchema, HostingModeSchema, KYA_OS_EVENTS_PATH, ManagedDeployStepStatusSchema, NEW_MANAGED_AUDIT_DEPLOYMENT_DEFAULT, RestartCommandSchema, StopCommandSchema, UpdateConfigCommandSchema, UpdateVersionCommandSchema, requiredAuditRuntimeCanaryChecks, resolveAuditDeploymentReadiness };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
declare const ERROR_CODES: {
|
|
2
|
+
readonly LOWERCASE_INVALID_JSON: "invalid_json";
|
|
3
|
+
readonly LOWERCASE_VALIDATION_ERROR: "validation_error";
|
|
4
|
+
readonly BARE_VALIDATION_ERROR: "VALIDATION_ERROR";
|
|
5
|
+
readonly BARE_INTERNAL_ERROR: "INTERNAL_ERROR";
|
|
6
|
+
readonly POLICY_FETCH_FAILED: "POLICY_FETCH_FAILED";
|
|
7
|
+
readonly CONFLICT: "CONFLICT";
|
|
8
|
+
readonly PROJECT_NOT_FOUND: "PROJECT_NOT_FOUND";
|
|
9
|
+
readonly REVIEW_REQUIRED: "REVIEW_REQUIRED";
|
|
10
|
+
readonly LIMIT_EXCEEDED: "LIMIT_EXCEEDED";
|
|
11
|
+
readonly BILLING_SUSPENDED: "BILLING_SUSPENDED";
|
|
12
|
+
readonly BILLING_GRACE_PERIOD: "BILLING_GRACE_PERIOD";
|
|
13
|
+
readonly ENDPOINT_NOT_FOUND: "API_ENDPOINT_NOT_FOUND";
|
|
14
|
+
readonly METHOD_NOT_ALLOWED: "API_METHOD_NOT_ALLOWED";
|
|
15
|
+
readonly VERSION_NOT_SUPPORTED: "API_VERSION_NOT_SUPPORTED";
|
|
16
|
+
readonly CONTENT_TYPE_NOT_SUPPORTED: "API_CONTENT_TYPE_NOT_SUPPORTED";
|
|
17
|
+
readonly RESPONSE_TOO_LARGE: "API_RESPONSE_TOO_LARGE";
|
|
18
|
+
readonly REQUEST_TOO_LARGE: "API_REQUEST_TOO_LARGE";
|
|
19
|
+
readonly PIXEL_NOT_FOUND: "PIXEL_NOT_FOUND";
|
|
20
|
+
readonly PIXEL_DISABLED: "PIXEL_DISABLED";
|
|
21
|
+
readonly PIXEL_CONFIGURATION_ERROR: "PIXEL_CONFIGURATION_ERROR";
|
|
22
|
+
readonly PIXEL_DOMAIN_NOT_ALLOWED: "PIXEL_DOMAIN_NOT_ALLOWED";
|
|
23
|
+
readonly PIXEL_PATH_SKIPPED: "PIXEL_PATH_SKIPPED";
|
|
24
|
+
readonly PIXEL_EVENT_INVALID: "PIXEL_EVENT_INVALID";
|
|
25
|
+
readonly PIXEL_BATCH_TOO_LARGE: "PIXEL_BATCH_TOO_LARGE";
|
|
26
|
+
readonly MISSING_PIXEL_ID: "MISSING_PIXEL_ID";
|
|
27
|
+
readonly INVALID_EDGE_SIGNATURE: "INVALID_EDGE_SIGNATURE";
|
|
28
|
+
readonly DETECTION_STORAGE_FAILED: "DETECTION_STORAGE_FAILED";
|
|
29
|
+
readonly SESSION_NOT_FOUND: "SESSION_NOT_FOUND";
|
|
30
|
+
readonly SESSION_EXPIRED: "SESSION_EXPIRED";
|
|
31
|
+
readonly SESSION_INVALID: "SESSION_INVALID";
|
|
32
|
+
readonly SESSION_CREATION_FAILED: "SESSION_CREATION_FAILED";
|
|
33
|
+
readonly SESSION_UPDATE_FAILED: "SESSION_UPDATE_FAILED";
|
|
34
|
+
readonly SESSION_STORAGE_ERROR: "SESSION_STORAGE_ERROR";
|
|
35
|
+
readonly MAX_SESSIONS_EXCEEDED: "SESSION_MAX_EXCEEDED";
|
|
36
|
+
readonly INTERNAL_SERVER_ERROR: "INTERNAL_SERVER_ERROR";
|
|
37
|
+
readonly DATABASE_ERROR: "INTERNAL_DATABASE_ERROR";
|
|
38
|
+
readonly CACHE_ERROR: "INTERNAL_CACHE_ERROR";
|
|
39
|
+
readonly CONFIGURATION_ERROR: "INTERNAL_CONFIGURATION_ERROR";
|
|
40
|
+
readonly INITIALIZATION_ERROR: "INTERNAL_INITIALIZATION_ERROR";
|
|
41
|
+
readonly PROCESSING_ERROR: "INTERNAL_PROCESSING_ERROR";
|
|
42
|
+
readonly UNKNOWN_ERROR: "INTERNAL_UNKNOWN_ERROR";
|
|
43
|
+
readonly SERVICE_UNAVAILABLE_TRANSIENT: "SERVICE_UNAVAILABLE_TRANSIENT";
|
|
44
|
+
readonly CONNECTION_FAILED: "NETWORK_CONNECTION_FAILED";
|
|
45
|
+
readonly TIMEOUT: "NETWORK_TIMEOUT";
|
|
46
|
+
readonly DNS_RESOLUTION_FAILED: "NETWORK_DNS_FAILED";
|
|
47
|
+
readonly SSL_ERROR: "NETWORK_SSL_ERROR";
|
|
48
|
+
readonly PROXY_ERROR: "NETWORK_PROXY_ERROR";
|
|
49
|
+
readonly UPSTREAM_ERROR: "NETWORK_UPSTREAM_ERROR";
|
|
50
|
+
readonly INSUFFICIENT_PERMISSIONS: "PERMISSION_INSUFFICIENT";
|
|
51
|
+
readonly RESOURCE_NOT_FOUND: "PERMISSION_RESOURCE_NOT_FOUND";
|
|
52
|
+
readonly RESOURCE_ACCESS_DENIED: "PERMISSION_ACCESS_DENIED";
|
|
53
|
+
readonly OPERATION_NOT_ALLOWED: "PERMISSION_OPERATION_NOT_ALLOWED";
|
|
54
|
+
readonly PROJECT_ACCESS_DENIED: "PERMISSION_PROJECT_ACCESS_DENIED";
|
|
55
|
+
readonly PIXEL_ACCESS_DENIED: "PERMISSION_PIXEL_ACCESS_DENIED";
|
|
56
|
+
readonly FORBIDDEN: "PERMISSION_FORBIDDEN";
|
|
57
|
+
readonly RATE_LIMIT_EXCEEDED: "RATE_LIMIT_EXCEEDED";
|
|
58
|
+
readonly BURST_LIMIT_EXCEEDED: "RATE_LIMIT_BURST_EXCEEDED";
|
|
59
|
+
readonly DAILY_LIMIT_EXCEEDED: "RATE_LIMIT_DAILY_EXCEEDED";
|
|
60
|
+
readonly MONTHLY_LIMIT_EXCEEDED: "RATE_LIMIT_MONTHLY_EXCEEDED";
|
|
61
|
+
readonly CONCURRENT_LIMIT_EXCEEDED: "RATE_LIMIT_CONCURRENT_EXCEEDED";
|
|
62
|
+
readonly QUOTA_EXCEEDED: "RATE_LIMIT_QUOTA_EXCEEDED";
|
|
63
|
+
readonly DETECTION_FAILED: "DETECTION_FAILED";
|
|
64
|
+
readonly INSUFFICIENT_DATA: "DETECTION_INSUFFICIENT_DATA";
|
|
65
|
+
readonly PATTERN_MATCH_FAILED: "DETECTION_PATTERN_MATCH_FAILED";
|
|
66
|
+
readonly WASM_NOT_LOADED: "DETECTION_WASM_NOT_LOADED";
|
|
67
|
+
readonly WASM_EXECUTION_FAILED: "DETECTION_WASM_EXECUTION_FAILED";
|
|
68
|
+
readonly CONFIDENCE_BELOW_THRESHOLD: "DETECTION_CONFIDENCE_BELOW_THRESHOLD";
|
|
69
|
+
readonly SIGNATURE_VERIFICATION_FAILED: "DETECTION_SIGNATURE_VERIFICATION_FAILED";
|
|
70
|
+
readonly INVALID_REQUEST: "VALIDATION_INVALID_REQUEST";
|
|
71
|
+
readonly MISSING_REQUIRED_FIELD: "VALIDATION_MISSING_REQUIRED_FIELD";
|
|
72
|
+
readonly INVALID_FIELD_TYPE: "VALIDATION_INVALID_FIELD_TYPE";
|
|
73
|
+
readonly INVALID_FIELD_VALUE: "VALIDATION_INVALID_FIELD_VALUE";
|
|
74
|
+
readonly FIELD_TOO_LONG: "VALIDATION_FIELD_TOO_LONG";
|
|
75
|
+
readonly FIELD_TOO_SHORT: "VALIDATION_FIELD_TOO_SHORT";
|
|
76
|
+
readonly INVALID_EMAIL: "VALIDATION_INVALID_EMAIL";
|
|
77
|
+
readonly INVALID_URL: "VALIDATION_INVALID_URL";
|
|
78
|
+
readonly INVALID_UUID: "VALIDATION_INVALID_UUID";
|
|
79
|
+
readonly INVALID_IP_ADDRESS: "VALIDATION_INVALID_IP_ADDRESS";
|
|
80
|
+
readonly INVALID_USER_AGENT: "VALIDATION_INVALID_USER_AGENT";
|
|
81
|
+
readonly BAD_REQUEST: "VALIDATION_BAD_REQUEST";
|
|
82
|
+
readonly INVALID_START_DATE: "VALIDATION_INVALID_START_DATE";
|
|
83
|
+
readonly INVALID_END_DATE: "VALIDATION_INVALID_END_DATE";
|
|
84
|
+
readonly INVALID_DATE_RANGE: "VALIDATION_INVALID_DATE_RANGE";
|
|
85
|
+
readonly INVALID_API_KEY: "AUTH_INVALID_API_KEY";
|
|
86
|
+
readonly EXPIRED_API_KEY: "AUTH_EXPIRED_API_KEY";
|
|
87
|
+
readonly INVALID_TOKEN: "AUTH_INVALID_TOKEN";
|
|
88
|
+
readonly EXPIRED_TOKEN: "AUTH_EXPIRED_TOKEN";
|
|
89
|
+
readonly MISSING_CREDENTIALS: "AUTH_MISSING_CREDENTIALS";
|
|
90
|
+
readonly UNAUTHORIZED: "AUTH_UNAUTHORIZED";
|
|
91
|
+
readonly INVALID_PIXEL_ID: "AUTH_INVALID_PIXEL_ID";
|
|
92
|
+
readonly INVALID_SECRET_KEY: "AUTH_INVALID_SECRET_KEY";
|
|
93
|
+
};
|
|
94
|
+
type ErrorCode = (typeof ERROR_CODES)[keyof typeof ERROR_CODES];
|
|
95
|
+
declare const ERROR_MESSAGES: Record<ErrorCode, string>;
|
|
96
|
+
declare const ERROR_STATUS_CODES: Partial<Record<ErrorCode, number>>;
|
|
97
|
+
|
|
98
|
+
type ErrorCodeKey = keyof typeof ERROR_CODES;
|
|
99
|
+
type PickedErrorCodes<K extends readonly ErrorCodeKey[]> = {
|
|
100
|
+
readonly [P in K[number]]: (typeof ERROR_CODES)[P];
|
|
101
|
+
};
|
|
102
|
+
declare function pickErrorCodes<const K extends readonly ErrorCodeKey[]>(keys: K): PickedErrorCodes<K>;
|
|
103
|
+
|
|
104
|
+
export { ERROR_CODES, ERROR_MESSAGES, ERROR_STATUS_CODES, type ErrorCode, type ErrorCodeKey, type PickedErrorCodes, pickErrorCodes };
|