@hasna/infinity 0.1.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.
- package/LICENSE +3 -0
- package/README.md +331 -0
- package/dist/cli.js +2965 -0
- package/dist/http-api.js +6448 -0
- package/dist/index.js +28536 -0
- package/dist/migrate.js +346 -0
- package/dist/self-hosted-migrate.js +2064 -0
- package/dist/self-hosted.js +13180 -0
- package/dist/types/authcapsules/codewith-local.d.ts +109 -0
- package/dist/types/authcapsules/infinity-agent-policy.d.ts +57 -0
- package/dist/types/authcapsules/os-isolated-runner.d.ts +87 -0
- package/dist/types/authority/authority.d.ts +342 -0
- package/dist/types/authority/effect-journal.d.ts +205 -0
- package/dist/types/authority/mutation-journal.d.ts +163 -0
- package/dist/types/authority/mutation-tuple.d.ts +26 -0
- package/dist/types/authority/state.d.ts +75 -0
- package/dist/types/authority/store.d.ts +15 -0
- package/dist/types/brokers/checkpoint/archive.d.ts +21 -0
- package/dist/types/brokers/checkpoint/bundle.d.ts +22 -0
- package/dist/types/brokers/checkpoint/bytes.d.ts +4 -0
- package/dist/types/brokers/checkpoint/clean-verifier-finalization.d.ts +62 -0
- package/dist/types/brokers/checkpoint/clean-verifier.d.ts +145 -0
- package/dist/types/brokers/checkpoint/final-trust-authority.d.ts +55 -0
- package/dist/types/brokers/checkpoint/idempotency.d.ts +25 -0
- package/dist/types/brokers/checkpoint/journaled-store.d.ts +9 -0
- package/dist/types/brokers/checkpoint/manifest-signature.d.ts +135 -0
- package/dist/types/brokers/checkpoint/manifest.d.ts +57 -0
- package/dist/types/brokers/checkpoint/s3-store.d.ts +215 -0
- package/dist/types/brokers/checkpoint/seal-authority.d.ts +86 -0
- package/dist/types/brokers/checkpoint/service.d.ts +198 -0
- package/dist/types/brokers/checkpoint/signing-message.d.ts +22 -0
- package/dist/types/brokers/checkpoint/store.d.ts +76 -0
- package/dist/types/brokers/checkpoint/verifier-cleanup-authority.d.ts +108 -0
- package/dist/types/brokers/checkpoint/verifier-cleanup.d.ts +391 -0
- package/dist/types/brokers/checkpoint/verifier.d.ts +225 -0
- package/dist/types/brokers/composition.d.ts +86 -0
- package/dist/types/brokers/git/github-app.d.ts +216 -0
- package/dist/types/brokers/git/promotion.d.ts +418 -0
- package/dist/types/brokers/persistence/contracts.d.ts +77 -0
- package/dist/types/brokers/persistence/memory.d.ts +5 -0
- package/dist/types/brokers/persistence/migration.d.ts +6 -0
- package/dist/types/brokers/persistence/postgres.d.ts +74 -0
- package/dist/types/cli/main.d.ts +2 -0
- package/dist/types/cli/operation-journal.d.ts +47 -0
- package/dist/types/cli/run.d.ts +15 -0
- package/dist/types/client/operator-client.d.ts +100 -0
- package/dist/types/contracts/dtos.d.ts +198 -0
- package/dist/types/contracts/events.d.ts +45 -0
- package/dist/types/contracts/fence.d.ts +39 -0
- package/dist/types/contracts/operations.d.ts +91 -0
- package/dist/types/contracts/runspec.d.ts +75 -0
- package/dist/types/contracts/validators.d.ts +8 -0
- package/dist/types/core/clock.d.ts +12 -0
- package/dist/types/core/errors.d.ts +18 -0
- package/dist/types/core/ids.d.ts +10 -0
- package/dist/types/core/int64.d.ts +7 -0
- package/dist/types/core/strict-json.d.ts +8 -0
- package/dist/types/core/validation.d.ts +25 -0
- package/dist/types/golden/disposable-task.d.ts +108 -0
- package/dist/types/golden/source-pins.d.ts +77 -0
- package/dist/types/http/api.d.ts +52 -0
- package/dist/types/http/bearer-auth.d.ts +8 -0
- package/dist/types/http/main.d.ts +3 -0
- package/dist/types/http/self-hosted-main.d.ts +17 -0
- package/dist/types/index.d.ts +65 -0
- package/dist/types/mcp/schema.d.ts +7 -0
- package/dist/types/node-agent/agent.d.ts +174 -0
- package/dist/types/node-agent/contracts.d.ts +119 -0
- package/dist/types/node-agent/macos-service.d.ts +33 -0
- package/dist/types/node-agent/service-cli.d.ts +26 -0
- package/dist/types/persistence/composition.d.ts +49 -0
- package/dist/types/persistence/migrate-main.d.ts +2 -0
- package/dist/types/persistence/migrations.d.ts +30 -0
- package/dist/types/persistence/postgres-accounts-operation.d.ts +26 -0
- package/dist/types/persistence/postgres-authority.d.ts +69 -0
- package/dist/types/persistence/postgres-external-mutation-journal.d.ts +22 -0
- package/dist/types/persistence/postgres-json.d.ts +1 -0
- package/dist/types/persistence/postgres-mutation-journal.d.ts +31 -0
- package/dist/types/persistence/postgres-reconciler.d.ts +34 -0
- package/dist/types/persistence/postgres-sandbox-dispatch-authority.d.ts +9 -0
- package/dist/types/persistence/self-hosted-migrate-main.d.ts +2 -0
- package/dist/types/ports/accounts-operation.d.ts +336 -0
- package/dist/types/ports/accounts.d.ts +293 -0
- package/dist/types/ports/sandbox-dispatch-authority.d.ts +154 -0
- package/dist/types/ports/sandboxes.d.ts +40 -0
- package/dist/types/providers/sandbox-dispatch.d.ts +143 -0
- package/dist/types/runtime/config.d.ts +61 -0
- package/dist/types/runtime/postgres.d.ts +18 -0
- package/dist/types/runtime/provider-activation.d.ts +45 -0
- package/dist/types/runtime/server.d.ts +68 -0
- package/dist/types/testing/accounts-fake.d.ts +31 -0
- package/dist/types/testing/fakes.d.ts +2 -0
- package/dist/types/testing/node-control-plane-fake.d.ts +20 -0
- package/dist/types/testing/reference.d.ts +27 -0
- package/dist/types/testing/sandboxes-fake.d.ts +22 -0
- package/evidence/provider-live-daytona-v3.json +1 -0
- package/evidence/provider-live-e2b-v3.json +1 -0
- package/evidence/provider-production-route-daytona-v1.json +1 -0
- package/evidence/provider-production-route-e2b-v1.json +1 -0
- package/migrations/0001_authority.sql +689 -0
- package/migrations/0002_effect_step_global_owner.sql +2 -0
- package/migrations/0003_effect_journal_observed_head.sql +34 -0
- package/migrations/0004_authority_mutation_journal_binding.sql +15 -0
- package/migrations/20260710_checkpoint_broker_v1.sql +163 -0
- package/migrations/20260711_accounts_operation_v1.sql +137 -0
- package/migrations/20260711_checkpoint_trust_v2.sql +17 -0
- package/migrations/20260711_verifier_cleanup_v2.sql +169 -0
- package/migrations/20260711_z_accounts_claim_authority_v2.sql +172 -0
- package/migrations/20260711_zz_sandbox_dispatch_authority_v1.sql +143 -0
- package/migrations/20260712_sandbox_dispatch_authority_v2.sql +58 -0
- package/migrations/external-journal/0001_external_authority_mutation_journal.sql +175 -0
- package/package.json +47 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { type BrokerFence } from "../../contracts/fence";
|
|
2
|
+
import type { SqlExecutor } from "../persistence/postgres";
|
|
3
|
+
import { type CheckpointManifestSigningTrustHead } from "./manifest-signature";
|
|
4
|
+
import type { CheckpointSealCore } from "./service";
|
|
5
|
+
export interface AuthorityReceiptCryptographyPort {
|
|
6
|
+
signDigest(input: {
|
|
7
|
+
domain: "infinity.checkpoint-seal-authority/v1";
|
|
8
|
+
digest: string;
|
|
9
|
+
fence: BrokerFence;
|
|
10
|
+
}): Promise<{
|
|
11
|
+
keyId: string;
|
|
12
|
+
algorithm: "ecdsa-p256-sha256";
|
|
13
|
+
signature: Uint8Array;
|
|
14
|
+
}>;
|
|
15
|
+
verifyDigest(input: {
|
|
16
|
+
domain: "infinity.checkpoint-seal-authority/v1";
|
|
17
|
+
digest: string;
|
|
18
|
+
keyId: string;
|
|
19
|
+
algorithm: "ecdsa-p256-sha256";
|
|
20
|
+
signature: Uint8Array;
|
|
21
|
+
}): Promise<boolean>;
|
|
22
|
+
}
|
|
23
|
+
export interface AuthorityCheckpointSealCommitReceipt {
|
|
24
|
+
readonly schemaVersion: "infinity.checkpoint-authority-commit/v1";
|
|
25
|
+
readonly checkpointId: string;
|
|
26
|
+
readonly operationId: string;
|
|
27
|
+
readonly operationDigest: string;
|
|
28
|
+
readonly sealCoreSha256: string;
|
|
29
|
+
readonly manifestSha256: string;
|
|
30
|
+
readonly fence: BrokerFence;
|
|
31
|
+
readonly authorityTransactionId: string;
|
|
32
|
+
readonly authorityEventId: string;
|
|
33
|
+
readonly committedAt: string;
|
|
34
|
+
readonly signingKeyId: string;
|
|
35
|
+
readonly signatureAlgorithm: "ecdsa-p256-sha256";
|
|
36
|
+
readonly signatureBase64: string;
|
|
37
|
+
readonly signatureSha256: string;
|
|
38
|
+
}
|
|
39
|
+
export interface CheckpointSealAuthorityPort {
|
|
40
|
+
commitCheckpointSeal(input: {
|
|
41
|
+
core: CheckpointSealCore;
|
|
42
|
+
coreDigest: string;
|
|
43
|
+
}): Promise<AuthorityCheckpointSealCommitReceipt>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Locks the authority's durable current signing-trust head in the supplied
|
|
47
|
+
* seal transaction. Implementations must read the authority-owned persisted
|
|
48
|
+
* head (never echo caller state), compare it with expectedHead, and retain the
|
|
49
|
+
* row/advisory lock until that transaction commits. observationSequence is a
|
|
50
|
+
* durable high-water mark and must increase for every issued observation.
|
|
51
|
+
*/
|
|
52
|
+
export interface CheckpointManifestSigningTrustFinalizationAuthorityPort {
|
|
53
|
+
lockCurrentHead(input: {
|
|
54
|
+
transaction: SqlExecutor;
|
|
55
|
+
expectedHead: CheckpointManifestSigningTrustHead;
|
|
56
|
+
}): Promise<{
|
|
57
|
+
head: CheckpointManifestSigningTrustHead;
|
|
58
|
+
databaseTime: Date;
|
|
59
|
+
}>;
|
|
60
|
+
}
|
|
61
|
+
export declare class PostgresCheckpointSealAuthority implements CheckpointSealAuthorityPort {
|
|
62
|
+
private readonly dependencies;
|
|
63
|
+
constructor(dependencies: {
|
|
64
|
+
sql: SqlExecutor;
|
|
65
|
+
cryptography: AuthorityReceiptCryptographyPort;
|
|
66
|
+
signingTrustFinalizationAuthority: CheckpointManifestSigningTrustFinalizationAuthorityPort;
|
|
67
|
+
});
|
|
68
|
+
commitCheckpointSeal(input: {
|
|
69
|
+
core: CheckpointSealCore;
|
|
70
|
+
coreDigest: string;
|
|
71
|
+
}): Promise<AuthorityCheckpointSealCommitReceipt>;
|
|
72
|
+
private readExisting;
|
|
73
|
+
}
|
|
74
|
+
export declare class InMemoryCheckpointSealAuthority implements CheckpointSealAuthorityPort {
|
|
75
|
+
private readonly cryptography;
|
|
76
|
+
private sequence;
|
|
77
|
+
private readonly byCheckpoint;
|
|
78
|
+
private readonly checkpointByOperation;
|
|
79
|
+
constructor(cryptography: AuthorityReceiptCryptographyPort);
|
|
80
|
+
commitCheckpointSeal(input: {
|
|
81
|
+
core: CheckpointSealCore;
|
|
82
|
+
coreDigest: string;
|
|
83
|
+
}): Promise<AuthorityCheckpointSealCommitReceipt>;
|
|
84
|
+
}
|
|
85
|
+
export declare function verifyAuthorityCheckpointSeal(core: CheckpointSealCore, receiptInput: AuthorityCheckpointSealCommitReceipt, cryptography: AuthorityReceiptCryptographyPort): Promise<AuthorityCheckpointSealCommitReceipt>;
|
|
86
|
+
export declare function parseAuthorityCheckpointSealCommitReceipt(value: unknown): AuthorityCheckpointSealCommitReceipt;
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { type AuthenticatedFenceContext, type BrokerFence, type BrokerFenceInput } from "../../contracts/fence";
|
|
2
|
+
import { type ArchiveEntry, type ArchivePolicy } from "./archive";
|
|
3
|
+
import { type BinarySource } from "./bytes";
|
|
4
|
+
import { type GitBundleInspectionPolicy } from "./bundle";
|
|
5
|
+
import type { IdempotentExecutor } from "./idempotency";
|
|
6
|
+
import { type CheckpointManifest } from "./manifest";
|
|
7
|
+
import { type CheckpointManifestSignatureVerifierPort, type CheckpointManifestSigningTrustHead, type CheckpointManifestSigningTrustHeadResolverPort, type CheckpointManifestSigningTrustHeadVerifierPort } from "./manifest-signature";
|
|
8
|
+
import { CHECKPOINT_MANIFEST_SIGNATURE_DOMAIN, CHECKPOINT_PROVENANCE_SIGNATURE_DOMAIN } from "./signing-message";
|
|
9
|
+
import { type VersionedObjectStore, type VersionedReadbackReceipt } from "./store";
|
|
10
|
+
import type { AuthorityCheckpointSealCommitReceipt, CheckpointSealAuthorityPort } from "./seal-authority";
|
|
11
|
+
export interface FenceAuthorityPort {
|
|
12
|
+
readCurrentFence(operationId: string): Promise<{
|
|
13
|
+
fence: BrokerFence;
|
|
14
|
+
databaseTime: Date;
|
|
15
|
+
}>;
|
|
16
|
+
}
|
|
17
|
+
export interface ManifestSignerPort {
|
|
18
|
+
signManifestDigest(input: {
|
|
19
|
+
domain: typeof CHECKPOINT_MANIFEST_SIGNATURE_DOMAIN;
|
|
20
|
+
messageType: "digest";
|
|
21
|
+
digestAlgorithm: "sha256";
|
|
22
|
+
manifestDigest: string;
|
|
23
|
+
signingMessageDigest: string;
|
|
24
|
+
signingMessageDigestBytes: Uint8Array;
|
|
25
|
+
checkpointId: string;
|
|
26
|
+
fence: BrokerFence;
|
|
27
|
+
}): Promise<{
|
|
28
|
+
keyId: string;
|
|
29
|
+
algorithm: "ecdsa-p256-sha256";
|
|
30
|
+
signature: Uint8Array;
|
|
31
|
+
}>;
|
|
32
|
+
}
|
|
33
|
+
export interface CheckpointProvenanceVerificationInput {
|
|
34
|
+
fence: BrokerFence;
|
|
35
|
+
checkpointId: string;
|
|
36
|
+
projectId: string;
|
|
37
|
+
repositoryId: string;
|
|
38
|
+
authorityActivationReceiptSha256: string;
|
|
39
|
+
routeActivationReceiptSha256: string;
|
|
40
|
+
attemptLeaseGrantSha256: string;
|
|
41
|
+
captureGrantReceiptSha256: string;
|
|
42
|
+
workspaceExportReceiptSha256: string;
|
|
43
|
+
packerReceiptSha256: string;
|
|
44
|
+
scanReceiptSha256: string;
|
|
45
|
+
runSpecSha256: string;
|
|
46
|
+
policySha256: string;
|
|
47
|
+
objectFormat: "sha1" | "sha256";
|
|
48
|
+
expectedBaseOid: string;
|
|
49
|
+
targetRef: string;
|
|
50
|
+
candidateOid: string;
|
|
51
|
+
candidateParentOid: string;
|
|
52
|
+
candidateTreeOid: string;
|
|
53
|
+
packerImageSha256: string;
|
|
54
|
+
packerIdentity: string;
|
|
55
|
+
executorIdentity: string;
|
|
56
|
+
bundleSha256: string;
|
|
57
|
+
binaryDiffSha256: string;
|
|
58
|
+
testPlanSha256: string;
|
|
59
|
+
packerEvidenceSha256: string;
|
|
60
|
+
archiveIndexSha256: string;
|
|
61
|
+
}
|
|
62
|
+
export interface VerifiedCheckpointProvenanceReceipt {
|
|
63
|
+
schemaVersion: "infinity.checkpoint-provenance-verification/v1";
|
|
64
|
+
fence: BrokerFence;
|
|
65
|
+
provenanceInputSha256: string;
|
|
66
|
+
authorityEventId: string;
|
|
67
|
+
verifiedAt: string;
|
|
68
|
+
signingKeyId: string;
|
|
69
|
+
signatureAlgorithm: "ecdsa-p256-sha256";
|
|
70
|
+
signatureBase64: string;
|
|
71
|
+
signatureSha256: string;
|
|
72
|
+
}
|
|
73
|
+
/** Trusted boundary that verifies signed capture, export, packer, and scan receipts. */
|
|
74
|
+
export interface CheckpointProvenanceVerifierPort {
|
|
75
|
+
verifyCheckpointProvenance(input: CheckpointProvenanceVerificationInput): Promise<VerifiedCheckpointProvenanceReceipt>;
|
|
76
|
+
}
|
|
77
|
+
/** Verifies provenance authority signatures against implementation-pinned trust roots and key history. */
|
|
78
|
+
export interface CheckpointProvenanceReceiptCryptographyPort {
|
|
79
|
+
verifyDigest(input: {
|
|
80
|
+
domain: typeof CHECKPOINT_PROVENANCE_SIGNATURE_DOMAIN;
|
|
81
|
+
messageType: "digest";
|
|
82
|
+
digestAlgorithm: "sha256";
|
|
83
|
+
payloadDigest: string;
|
|
84
|
+
signingMessageDigest: string;
|
|
85
|
+
signingMessageDigestBytes: Uint8Array;
|
|
86
|
+
keyId: string;
|
|
87
|
+
algorithm: "ecdsa-p256-sha256";
|
|
88
|
+
signature: Uint8Array;
|
|
89
|
+
}): Promise<boolean>;
|
|
90
|
+
}
|
|
91
|
+
export interface CheckpointSealRequest {
|
|
92
|
+
fence: BrokerFenceInput;
|
|
93
|
+
checkpointId: string;
|
|
94
|
+
projectId: string;
|
|
95
|
+
repositoryId: string;
|
|
96
|
+
authorityActivationReceiptSha256: string;
|
|
97
|
+
routeActivationReceiptSha256: string;
|
|
98
|
+
attemptLeaseGrantSha256: string;
|
|
99
|
+
captureGrantReceiptSha256: string;
|
|
100
|
+
workspaceExportReceiptSha256: string;
|
|
101
|
+
packerReceiptSha256: string;
|
|
102
|
+
runSpecSha256: string;
|
|
103
|
+
policySha256: string;
|
|
104
|
+
objectFormat: "sha1" | "sha256";
|
|
105
|
+
expectedBaseOid: string;
|
|
106
|
+
targetRef: string;
|
|
107
|
+
candidateOid: string;
|
|
108
|
+
candidateParentOid: string;
|
|
109
|
+
candidateTreeOid: string;
|
|
110
|
+
packerImageSha256: string;
|
|
111
|
+
packerIdentity: string;
|
|
112
|
+
executorIdentity: string;
|
|
113
|
+
dataClass: "public" | "internal_non_sensitive" | "sensitive_restricted";
|
|
114
|
+
retentionClass: "phase1_evidence" | "recovery_only_secret_quarantine";
|
|
115
|
+
scanReceiptSha256: string;
|
|
116
|
+
bundle: BinarySource;
|
|
117
|
+
declaredBundleSha256: string;
|
|
118
|
+
binaryDiff: Uint8Array;
|
|
119
|
+
declaredBinaryDiffSha256: string;
|
|
120
|
+
testPlan: Uint8Array;
|
|
121
|
+
declaredTestPlanSha256: string;
|
|
122
|
+
packerEvidence: Uint8Array;
|
|
123
|
+
declaredPackerEvidenceSha256: string;
|
|
124
|
+
archiveEntries: readonly ArchiveEntry[];
|
|
125
|
+
declaredArchiveIndexSha256: string;
|
|
126
|
+
bundlePolicy: GitBundleInspectionPolicy;
|
|
127
|
+
archivePolicy: ArchivePolicy;
|
|
128
|
+
}
|
|
129
|
+
export interface CheckpointSealCore {
|
|
130
|
+
readonly schemaVersion: "infinity.checkpoint-seal-receipt/v1";
|
|
131
|
+
readonly checkpointId: string;
|
|
132
|
+
readonly fence: BrokerFence;
|
|
133
|
+
readonly manifest: CheckpointManifest;
|
|
134
|
+
readonly manifestDigest: string;
|
|
135
|
+
readonly bundle: Readonly<{
|
|
136
|
+
byteLength: number;
|
|
137
|
+
sha256: string;
|
|
138
|
+
prerequisiteOid: string;
|
|
139
|
+
candidateOid: string;
|
|
140
|
+
candidateRef: "refs/infinity/candidate";
|
|
141
|
+
bundleVersion: 2 | 3;
|
|
142
|
+
packVersion: 2 | 3;
|
|
143
|
+
packObjectCount: number;
|
|
144
|
+
verificationLevel: "bounded_header_only_requires_clean_verifier";
|
|
145
|
+
}>;
|
|
146
|
+
readonly bundleObject: VersionedReadbackReceipt;
|
|
147
|
+
readonly binaryDiffObject: VersionedReadbackReceipt;
|
|
148
|
+
readonly testPlanObject: VersionedReadbackReceipt;
|
|
149
|
+
readonly packerEvidenceObject: VersionedReadbackReceipt;
|
|
150
|
+
readonly provenanceReceiptObject: VersionedReadbackReceipt;
|
|
151
|
+
readonly manifestObject: VersionedReadbackReceipt;
|
|
152
|
+
readonly signatureObject: VersionedReadbackReceipt;
|
|
153
|
+
readonly archiveIndexSha256: string;
|
|
154
|
+
readonly signatureKeyId: string;
|
|
155
|
+
readonly signatureAlgorithm: "ecdsa-p256-sha256";
|
|
156
|
+
readonly signatureSha256: string;
|
|
157
|
+
readonly signatureTrustAnchorSha256: string;
|
|
158
|
+
readonly signatureKeyHistorySha256: string;
|
|
159
|
+
readonly signatureTrustHead: CheckpointManifestSigningTrustHead;
|
|
160
|
+
readonly signatureTrustHeadSha256: string;
|
|
161
|
+
readonly signaturePostSigningTrustHead: CheckpointManifestSigningTrustHead;
|
|
162
|
+
readonly signaturePostSigningTrustHeadSha256: string;
|
|
163
|
+
readonly signatureFinalTrustHead: CheckpointManifestSigningTrustHead;
|
|
164
|
+
readonly signatureFinalTrustHeadSha256: string;
|
|
165
|
+
readonly sealedAt: string;
|
|
166
|
+
}
|
|
167
|
+
export interface CheckpointSealReceipt extends CheckpointSealCore {
|
|
168
|
+
readonly authorityCommit: AuthorityCheckpointSealCommitReceipt;
|
|
169
|
+
}
|
|
170
|
+
export declare class CheckpointBroker {
|
|
171
|
+
private readonly dependencies;
|
|
172
|
+
private currentSigningTrustHead;
|
|
173
|
+
private signingTrustHeadResolution;
|
|
174
|
+
constructor(dependencies: {
|
|
175
|
+
authority: FenceAuthorityPort;
|
|
176
|
+
store: VersionedObjectStore;
|
|
177
|
+
signer: ManifestSignerPort;
|
|
178
|
+
ledger: IdempotentExecutor<CheckpointSealReceipt>;
|
|
179
|
+
sealAuthority: CheckpointSealAuthorityPort;
|
|
180
|
+
provenanceVerifier: CheckpointProvenanceVerifierPort;
|
|
181
|
+
provenanceReceiptCryptography: CheckpointProvenanceReceiptCryptographyPort;
|
|
182
|
+
manifestSignatureVerifier: CheckpointManifestSignatureVerifierPort;
|
|
183
|
+
manifestSigningTrustHeadResolver: CheckpointManifestSigningTrustHeadResolverPort;
|
|
184
|
+
manifestSigningTrustHeadVerifier: CheckpointManifestSigningTrustHeadVerifierPort;
|
|
185
|
+
});
|
|
186
|
+
seal(input: CheckpointSealRequest, authenticated: AuthenticatedFenceContext): Promise<CheckpointSealReceipt>;
|
|
187
|
+
private resolveCurrentSigningTrustHead;
|
|
188
|
+
private revalidate;
|
|
189
|
+
}
|
|
190
|
+
export declare function checkpointSealOperationDigest(request: CheckpointSealRequest): string;
|
|
191
|
+
export declare function checkpointSealReceiptDigest(receipt: CheckpointSealReceipt): string;
|
|
192
|
+
export declare function fenceDigestInput(fence: BrokerFenceInput | BrokerFence): Record<string, unknown>;
|
|
193
|
+
export declare function checkpointProvenanceInputDigest(input: CheckpointProvenanceVerificationInput): string;
|
|
194
|
+
export declare function checkpointProvenanceReceiptSigningPreimage(receipt: Pick<VerifiedCheckpointProvenanceReceipt, "schemaVersion" | "fence" | "provenanceInputSha256" | "authorityEventId" | "verifiedAt">): Readonly<Record<string, unknown>>;
|
|
195
|
+
export declare function checkpointProvenanceReceiptCoreDigest(receipt: Pick<VerifiedCheckpointProvenanceReceipt, "schemaVersion" | "fence" | "provenanceInputSha256" | "authorityEventId" | "verifiedAt">): string;
|
|
196
|
+
export declare function checkpointProvenanceReceiptDigest(receipt: VerifiedCheckpointProvenanceReceipt): string;
|
|
197
|
+
export declare function verifyCheckpointProvenanceReceiptSignature(receipt: VerifiedCheckpointProvenanceReceipt, cryptography: CheckpointProvenanceReceiptCryptographyPort): Promise<void>;
|
|
198
|
+
export declare function parseVerifiedCheckpointProvenanceReceipt(value: unknown): VerifiedCheckpointProvenanceReceipt;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const CHECKPOINT_MANIFEST_SIGNATURE_DOMAIN: "infinity.checkpoint-manifest-signature/v1";
|
|
2
|
+
export declare const CHECKPOINT_PROVENANCE_SIGNATURE_DOMAIN: "infinity.checkpoint-provenance-verification/v1";
|
|
3
|
+
export type CheckpointSignatureDomain = typeof CHECKPOINT_MANIFEST_SIGNATURE_DOMAIN | typeof CHECKPOINT_PROVENANCE_SIGNATURE_DOMAIN;
|
|
4
|
+
export interface CheckpointSigningMessage {
|
|
5
|
+
readonly schema_version: "infinity.checkpoint-signing-message/v1";
|
|
6
|
+
readonly domain: CheckpointSignatureDomain;
|
|
7
|
+
readonly message_type: "digest";
|
|
8
|
+
readonly digest_algorithm: "sha256";
|
|
9
|
+
readonly payload_sha256: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Exact domain-separated message contract for checkpoint signatures.
|
|
13
|
+
*
|
|
14
|
+
* The payload digest is SHA-256 over that domain's canonical payload bytes.
|
|
15
|
+
* Cryptography adapters receive signingMessageDigest with messageType=digest and
|
|
16
|
+
* MUST decode its 32-byte hex value as a prehash (for example KMS MessageType
|
|
17
|
+
* DIGEST). They must not sign the UTF-8 digest label or hash it as a RAW message.
|
|
18
|
+
*/
|
|
19
|
+
export declare function checkpointSigningMessage(domain: CheckpointSignatureDomain, payloadSha256: string): CheckpointSigningMessage;
|
|
20
|
+
export declare function checkpointSigningMessageCanonicalBytes(domain: CheckpointSignatureDomain, payloadSha256: string): Uint8Array;
|
|
21
|
+
export declare function checkpointSigningMessageDigest(domain: CheckpointSignatureDomain, payloadSha256: string): string;
|
|
22
|
+
export declare function checkpointSigningMessageDigestBytes(signingMessageSha256: string): Uint8Array;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { type BrokerFence, type BrokerFenceInput } from "../../contracts/fence";
|
|
2
|
+
export interface PutVersionedObjectInput {
|
|
3
|
+
objectKey: string;
|
|
4
|
+
bytes: Uint8Array;
|
|
5
|
+
contentType: string;
|
|
6
|
+
sha256: string;
|
|
7
|
+
operationId: string;
|
|
8
|
+
fence: BrokerFence;
|
|
9
|
+
}
|
|
10
|
+
export interface VersionedObjectRef {
|
|
11
|
+
readonly fence: BrokerFence;
|
|
12
|
+
readonly bucketAlias: string;
|
|
13
|
+
readonly objectKey: string;
|
|
14
|
+
readonly versionId: string;
|
|
15
|
+
readonly byteLength: number;
|
|
16
|
+
readonly checksumSha256: string;
|
|
17
|
+
readonly kmsKeyAlias: string;
|
|
18
|
+
readonly encryptionContextSha256: string;
|
|
19
|
+
readonly putProviderRequestId: string;
|
|
20
|
+
readonly kmsContextAuditReceiptSha256: string;
|
|
21
|
+
readonly kmsContextAuditProviderRequestId: string;
|
|
22
|
+
readonly objectLockMode: "COMPLIANCE";
|
|
23
|
+
readonly objectLockRetainUntil: string;
|
|
24
|
+
readonly bucketControlsSha256: string;
|
|
25
|
+
}
|
|
26
|
+
export interface VersionedObjectRead {
|
|
27
|
+
readonly bytes: Uint8Array;
|
|
28
|
+
readonly getProviderRequestId: string;
|
|
29
|
+
}
|
|
30
|
+
export declare function parseVersionedObjectRef(value: unknown): VersionedObjectRef;
|
|
31
|
+
export interface VersionedObjectStore {
|
|
32
|
+
putIfAbsent(input: PutVersionedObjectInput): Promise<VersionedObjectRef>;
|
|
33
|
+
getVersion(reference: VersionedObjectRef): Promise<VersionedObjectRead>;
|
|
34
|
+
}
|
|
35
|
+
export interface PutAndReadbackInput {
|
|
36
|
+
objectKey: string;
|
|
37
|
+
bytes: Uint8Array;
|
|
38
|
+
contentType: string;
|
|
39
|
+
operationId: string;
|
|
40
|
+
fence: BrokerFenceInput | BrokerFence;
|
|
41
|
+
}
|
|
42
|
+
export interface VersionedReadbackReceipt {
|
|
43
|
+
readonly bucketAlias: string;
|
|
44
|
+
readonly objectKey: string;
|
|
45
|
+
readonly versionId: string;
|
|
46
|
+
readonly byteLength: number;
|
|
47
|
+
readonly putSha256: string;
|
|
48
|
+
readonly readbackSha256: string;
|
|
49
|
+
readonly fence: BrokerFence;
|
|
50
|
+
readonly kmsKeyAlias: string;
|
|
51
|
+
readonly encryptionContextSha256: string;
|
|
52
|
+
readonly putProviderRequestId: string;
|
|
53
|
+
readonly kmsContextAuditReceiptSha256: string;
|
|
54
|
+
readonly kmsContextAuditProviderRequestId: string;
|
|
55
|
+
readonly getProviderRequestId: string;
|
|
56
|
+
readonly objectLockMode: "COMPLIANCE";
|
|
57
|
+
readonly objectLockRetainUntil: string;
|
|
58
|
+
readonly bucketControlsSha256: string;
|
|
59
|
+
}
|
|
60
|
+
export declare function putAndReadbackVerified(store: VersionedObjectStore, input: PutAndReadbackInput): Promise<VersionedReadbackReceipt>;
|
|
61
|
+
export declare class InMemoryVersionedObjectStore implements VersionedObjectStore {
|
|
62
|
+
private readonly options;
|
|
63
|
+
readonly bucketAlias: string;
|
|
64
|
+
putCalls: number;
|
|
65
|
+
readCalls: number;
|
|
66
|
+
unversionedReadCalls: number;
|
|
67
|
+
readonly observedFences: BrokerFence[];
|
|
68
|
+
private sequence;
|
|
69
|
+
private readonly versions;
|
|
70
|
+
private readonly currentByKey;
|
|
71
|
+
constructor(bucketAlias: string, options?: {
|
|
72
|
+
corruptReadback?: boolean;
|
|
73
|
+
});
|
|
74
|
+
putIfAbsent(input: PutVersionedObjectInput): Promise<VersionedObjectRef>;
|
|
75
|
+
getVersion(reference: VersionedObjectRef): Promise<VersionedObjectRead>;
|
|
76
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { type BrokerFence } from "../../contracts/fence";
|
|
2
|
+
import { type Int64 } from "../../core/int64";
|
|
3
|
+
import type { SqlExecutor } from "../persistence/postgres";
|
|
4
|
+
import { type SandboxesVerifierCleanupReceipt, type SandboxesVerifierAllocationReceiptVerifierPort, type SandboxesVerifierCleanupReceiptVerifierPort, type SandboxesVerifierQuarantineReceipt, type SandboxesVerifierQuarantineReceiptVerifierPort, type VerifierCleanupAuthorityPort, type VerifierCleanupCommitReceipt, type VerifierCleanupGrant, type VerifierCleanupGrantAuthorityPort, type VerifierCleanupFenceAuthorityPort } from "./verifier-cleanup";
|
|
5
|
+
/**
|
|
6
|
+
* Final authority boundary for cleanup. Implementations must lock the
|
|
7
|
+
* authoritative full-fence row and resource-generation head using the supplied
|
|
8
|
+
* transaction, then conditionally advance the head. The lock is held until the
|
|
9
|
+
* caller's cleanup-consumption transaction commits or rolls back.
|
|
10
|
+
*/
|
|
11
|
+
export interface VerifierCleanupFinalizationAuthorityPort {
|
|
12
|
+
recordInitialHead?(input: {
|
|
13
|
+
transaction: SqlExecutor;
|
|
14
|
+
verificationFence: BrokerFence;
|
|
15
|
+
resourceId: string;
|
|
16
|
+
resourceLeaseId: string;
|
|
17
|
+
resourceGeneration: Int64;
|
|
18
|
+
}): Promise<void>;
|
|
19
|
+
lockAndAdvance(input: {
|
|
20
|
+
transaction: SqlExecutor;
|
|
21
|
+
verificationFence: BrokerFence;
|
|
22
|
+
cleanupFence: BrokerFence;
|
|
23
|
+
resourceId: string;
|
|
24
|
+
resourceLeaseId: string;
|
|
25
|
+
resourceGenerationBefore: Int64;
|
|
26
|
+
resourceGenerationAfter: Int64;
|
|
27
|
+
}): Promise<{
|
|
28
|
+
cleanupFence: BrokerFence;
|
|
29
|
+
databaseTime: Date;
|
|
30
|
+
resourceId: string;
|
|
31
|
+
resourceLeaseId: string;
|
|
32
|
+
resourceGenerationBefore: Int64;
|
|
33
|
+
resourceGenerationAfter: Int64;
|
|
34
|
+
}>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* PostgreSQL-owned cleanup fence and generation authority. The current head is
|
|
38
|
+
* seeded while the durable cleanup grant is issued, then locked and advanced
|
|
39
|
+
* in the same transaction that commits the exact signed cleanup receipt.
|
|
40
|
+
*/
|
|
41
|
+
export declare class PostgresVerifierCleanupFinalizationAuthority implements VerifierCleanupFinalizationAuthorityPort {
|
|
42
|
+
recordInitialHead(input: {
|
|
43
|
+
transaction: SqlExecutor;
|
|
44
|
+
verificationFence: BrokerFence;
|
|
45
|
+
resourceId: string;
|
|
46
|
+
resourceLeaseId: string;
|
|
47
|
+
resourceGeneration: Int64;
|
|
48
|
+
}): Promise<void>;
|
|
49
|
+
lockAndAdvance(input: {
|
|
50
|
+
transaction: SqlExecutor;
|
|
51
|
+
verificationFence: BrokerFence;
|
|
52
|
+
cleanupFence: BrokerFence;
|
|
53
|
+
resourceId: string;
|
|
54
|
+
resourceLeaseId: string;
|
|
55
|
+
resourceGenerationBefore: Int64;
|
|
56
|
+
resourceGenerationAfter: Int64;
|
|
57
|
+
}): Promise<{
|
|
58
|
+
cleanupFence: BrokerFence;
|
|
59
|
+
databaseTime: Date;
|
|
60
|
+
resourceId: string;
|
|
61
|
+
resourceLeaseId: string;
|
|
62
|
+
resourceGenerationBefore: Int64;
|
|
63
|
+
resourceGenerationAfter: Int64;
|
|
64
|
+
}>;
|
|
65
|
+
}
|
|
66
|
+
export declare class PostgresVerifierCleanupAuthority implements VerifierCleanupAuthorityPort {
|
|
67
|
+
private readonly dependencies;
|
|
68
|
+
constructor(dependencies: {
|
|
69
|
+
sql: SqlExecutor;
|
|
70
|
+
grantAuthority: VerifierCleanupGrantAuthorityPort;
|
|
71
|
+
receiptVerifier: SandboxesVerifierCleanupReceiptVerifierPort;
|
|
72
|
+
allocationReceiptVerifier: SandboxesVerifierAllocationReceiptVerifierPort;
|
|
73
|
+
quarantineReceiptVerifier: SandboxesVerifierQuarantineReceiptVerifierPort;
|
|
74
|
+
fenceAuthority: VerifierCleanupFenceAuthorityPort;
|
|
75
|
+
finalizationAuthority: VerifierCleanupFinalizationAuthorityPort;
|
|
76
|
+
});
|
|
77
|
+
authorize(input: Parameters<VerifierCleanupGrantAuthorityPort["authorize"]>[0]): Promise<VerifierCleanupGrant>;
|
|
78
|
+
consumeAndCommit(input: {
|
|
79
|
+
verificationFence: BrokerFence;
|
|
80
|
+
grant: VerifierCleanupGrant;
|
|
81
|
+
receipt: SandboxesVerifierCleanupReceipt;
|
|
82
|
+
receiptCanonicalBytes: Uint8Array;
|
|
83
|
+
receiptSha256: string;
|
|
84
|
+
}): Promise<VerifierCleanupCommitReceipt>;
|
|
85
|
+
verifyCommitted(input: {
|
|
86
|
+
consumptionTransactionId: string;
|
|
87
|
+
cleanupNonce: string;
|
|
88
|
+
grant: VerifierCleanupGrant;
|
|
89
|
+
receipt: SandboxesVerifierCleanupReceipt;
|
|
90
|
+
receiptCanonicalBytes: Uint8Array;
|
|
91
|
+
receiptSha256: string;
|
|
92
|
+
commit: VerifierCleanupCommitReceipt;
|
|
93
|
+
}): Promise<VerifierCleanupCommitReceipt>;
|
|
94
|
+
recordQuarantine(input: {
|
|
95
|
+
receipt: SandboxesVerifierQuarantineReceipt;
|
|
96
|
+
receiptCanonicalBytes: Uint8Array;
|
|
97
|
+
receiptSha256: string;
|
|
98
|
+
}): Promise<SandboxesVerifierQuarantineReceipt>;
|
|
99
|
+
verifyQuarantineRecorded(input: {
|
|
100
|
+
receipt: SandboxesVerifierQuarantineReceipt;
|
|
101
|
+
receiptCanonicalBytes: Uint8Array;
|
|
102
|
+
receiptSha256: string;
|
|
103
|
+
}): Promise<SandboxesVerifierQuarantineReceipt>;
|
|
104
|
+
private normalizeConsumption;
|
|
105
|
+
private normalizeQuarantine;
|
|
106
|
+
private readAny;
|
|
107
|
+
private assertCurrentFence;
|
|
108
|
+
}
|