@tearleads/client-sdk 0.1.246 → 0.1.248
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/Tearleads.js +4 -2
- package/Tearleads.js.map +1 -1
- package/data/persistence/principalPolicy/heldOrganizationDirectories.js +53 -0
- package/data/persistence/principalPolicy/heldOrganizationDirectories.js.map +1 -0
- package/data/persistence/verifiedManifestBundlePersistence.d.ts +8 -3
- package/data/persistence/verifiedManifestBundlePersistence.js +34 -15
- package/data/persistence/verifiedManifestBundlePersistence.js.map +1 -1
- package/internal/api-client/ApiClient.d.ts +2 -0
- package/internal/api-client/client/session.d.ts +2 -0
- package/internal/api-client/heldDirectoryCitations.d.ts +19 -0
- package/internal/api-client/heldDirectoryCitations.js +37 -0
- package/internal/api-client/heldDirectoryCitations.js.map +1 -0
- package/internal/api-client/index.d.ts +1 -1
- package/internal/api-client/index.js.map +1 -1
- package/internal/api-client/verifiedManifestCitations.d.ts +16 -6
- package/internal/api-client/verifiedManifestCitations.js +32 -13
- package/internal/api-client/verifiedManifestCitations.js.map +1 -1
- package/internal/api-client/writerProjectionRequests.js +5 -3
- package/internal/api-client/writerProjectionRequests.js.map +1 -1
- package/internal/validators/knownManifestsRefinements.js +1 -1
- package/internal/validators/knownManifestsRefinements.js.map +1 -1
- package/internal/validators/operation/auth.d.ts +14 -0
- package/internal/validators/operation/auth.js +2 -1
- package/internal/validators/operation/auth.js.map +1 -1
- package/internal/validators/operation/writerProjections.d.ts +11 -11
- package/internal/validators/operation/writerProjections.js +1 -1
- package/internal/validators/operation/writerProjections.js.map +1 -1
- package/internal/validators/response/areas/auth.d.ts +1 -1
- package/internal/validators/response/areas/auth.js +1 -1
- package/internal/validators/response/areas/auth.js.map +1 -1
- package/internal/validators/response/areas/principals.d.ts +2 -1
- package/internal/validators/response/areas/principals.js +1 -1
- package/internal/validators/response/areas/principals.js.map +1 -1
- package/internal/validators/response/container.d.ts +4 -4
- package/internal/validators/response/container.js +2 -2
- package/internal/validators/response/container.js.map +1 -1
- package/internal/validators/response/documentMutation.d.ts +4 -4
- package/internal/validators/response/documentMutation.js +2 -2
- package/internal/validators/response/documentMutation.js.map +1 -1
- package/internal/validators/response/documentSyncSchema.d.ts +5 -0
- package/internal/validators/response/documentSyncSchema.js +1 -1
- package/internal/validators/response/documentSyncSchema.js.map +1 -1
- package/internal/validators/response/policyEvidenceWire.d.ts +17 -0
- package/internal/validators/response/policyEvidenceWire.js +36 -0
- package/internal/validators/response/policyEvidenceWire.js.map +1 -0
- package/internal/validators/response/projectionPolicyEvidence.d.ts +175 -0
- package/internal/validators/response/projectionPolicyEvidence.js +13 -0
- package/internal/validators/response/projectionPolicyEvidence.js.map +1 -1
- package/internal/validators/response/registration.d.ts +17 -1
- package/internal/validators/response/registration.js +31 -2
- package/internal/validators/response/registration.js.map +1 -1
- package/internal/validators/response/writerProjectionWire.d.ts +11 -7
- package/internal/validators/response/writerProjectionWire.js +19 -10
- package/internal/validators/response/writerProjectionWire.js.map +1 -1
- package/internal/validators/util/index.d.ts +1 -1
- package/internal/validators/util/index.js +1 -1
- package/internal/validators/util/index.js.map +1 -1
- package/internal/validators/util/knownManifestWire.d.ts +9 -3
- package/internal/validators/util/knownManifestWire.js +24 -8
- package/internal/validators/util/knownManifestWire.js.map +1 -1
- package/package.json +1 -1
- package/workflows/registration/organizationCreation/createOrganization.js +3 -0
- package/workflows/registration/organizationCreation/createOrganization.js.map +1 -1
- package/workflows/registration/organizationProvisioningPersistence.d.ts +7 -0
- package/workflows/registration/organizationProvisioningPersistence.js +1 -0
- package/workflows/registration/organizationProvisioningPersistence.js.map +1 -1
- package/workflows/registration/persistRegistrationBootstrap.d.ts +7 -0
- package/workflows/registration/persistRegistrationBootstrap.js +6 -2
- package/workflows/registration/persistRegistrationBootstrap.js.map +1 -1
- package/workflows/registration/registerIdentity.js +1 -0
- package/workflows/registration/registerIdentity.js.map +1 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { type ContainerKekWireLevel } from "../validators/response/index.js";
|
|
1
|
+
import { type ContainerKekWireLevel, type PrincipalStatePayloadResponse } from "../validators/response/index.js";
|
|
2
2
|
import { type ServedAccessManifestBundleWireResponse } from "../validators/util/index.js";
|
|
3
|
+
import { type HeldDirectoryCitation } from "./heldDirectoryCitations.js";
|
|
4
|
+
export type { HeldDirectoryCitation } from "./heldDirectoryCitations.js";
|
|
3
5
|
/** Citation only saves bytes: a source slower than this sends the read uncited. */
|
|
4
6
|
export declare const MANIFEST_CITATION_DEADLINE_MS = 250;
|
|
5
7
|
/**
|
|
@@ -15,11 +17,15 @@ export interface WriterProjectionTarget {
|
|
|
15
17
|
readonly id: string;
|
|
16
18
|
readonly listing?: WriterProjectionListing | undefined;
|
|
17
19
|
}
|
|
18
|
-
/** A held access-manifest bundle or a held container KEK level. */
|
|
19
|
-
export type HeldProjectionCitation = ServedAccessManifestBundleWireResponse | ContainerKekWireLevel;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
21
|
+
* A held access-manifest bundle, a held container KEK level, or a held
|
|
22
|
+
* organization directory payload with its signed state.
|
|
23
|
+
*/
|
|
24
|
+
export type HeldProjectionCitation = ServedAccessManifestBundleWireResponse | ContainerKekWireLevel | HeldDirectoryCitation;
|
|
25
|
+
/**
|
|
26
|
+
* Verified access-manifest bundles, container KEK levels and organization
|
|
27
|
+
* directory payloads a device durably holds that a writer projection of
|
|
28
|
+
* `target` may cite, most useful first.
|
|
23
29
|
* This is never trust input: the exact cited bytes only fill the response's
|
|
24
30
|
* omitted positions, and the caller verifies the rebuilt projection exactly
|
|
25
31
|
* as a full one.
|
|
@@ -27,10 +33,14 @@ export type HeldProjectionCitation = ServedAccessManifestBundleWireResponse | Co
|
|
|
27
33
|
export interface VerifiedManifestCitations {
|
|
28
34
|
cite(target: WriterProjectionTarget): Promise<readonly HeldProjectionCitation[]>;
|
|
29
35
|
}
|
|
30
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* The exact bytes one request cites: bundles by hash, levels by digest,
|
|
38
|
+
* directory payloads by their organization state's hash.
|
|
39
|
+
*/
|
|
31
40
|
export interface HeldProjectionCitations {
|
|
32
41
|
readonly bundles: Map<string, ServedAccessManifestBundleWireResponse>;
|
|
33
42
|
readonly kekLevels: Map<string, ContainerKekWireLevel>;
|
|
43
|
+
readonly directories: Map<string, PrincipalStatePayloadResponse>;
|
|
34
44
|
}
|
|
35
45
|
/**
|
|
36
46
|
* The bytes one request cites, copied so a later eviction or mutation of the
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { computeContainerKekLevelDigest } from "../crypto/index.js";
|
|
2
2
|
import { isContainerKekWireLevel, } from "../validators/response/index.js";
|
|
3
|
-
import { isServedAccessManifestBundleWireResponse, isSha256HexString, KNOWN_MANIFEST_HINT_LIMIT, } from "../validators/util/index.js";
|
|
3
|
+
import { isServedAccessManifestBundleWireResponse, isSha256HexString, KNOWN_DIRECTORY_HINT_LIMIT, KNOWN_MANIFEST_HINT_LIMIT, } from "../validators/util/index.js";
|
|
4
|
+
import { isHeldDirectoryCitation, signedDirectoryPayload, } from "./heldDirectoryCitations.js";
|
|
4
5
|
/** Citation only saves bytes: a source slower than this sends the read uncited. */
|
|
5
6
|
export const MANIFEST_CITATION_DEADLINE_MS = 250;
|
|
6
7
|
function noCitations() {
|
|
7
|
-
return { bundles: new Map(), kekLevels: new Map() };
|
|
8
|
+
return { bundles: new Map(), kekLevels: new Map(), directories: new Map() };
|
|
8
9
|
}
|
|
9
10
|
/**
|
|
10
11
|
* The prepared citations, or none once the deadline passes, the caller
|
|
@@ -35,34 +36,52 @@ function boundedCitation(prepare, signal) {
|
|
|
35
36
|
}
|
|
36
37
|
});
|
|
37
38
|
}
|
|
38
|
-
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
*/
|
|
42
|
-
async function prepareHeldCitations(entries) {
|
|
43
|
-
const held = noCitations();
|
|
39
|
+
/** Copies of the source's entries, each kind within its own hint quota. */
|
|
40
|
+
function copyHeldEntries(entries) {
|
|
41
|
+
const bundles = new Map();
|
|
44
42
|
const levels = [];
|
|
43
|
+
const directories = [];
|
|
44
|
+
const manifestQuotaLeft = () => bundles.size + levels.length < KNOWN_MANIFEST_HINT_LIMIT;
|
|
45
45
|
for (const entry of entries) {
|
|
46
|
-
if (held.bundles.size + levels.length >= KNOWN_MANIFEST_HINT_LIMIT)
|
|
47
|
-
break;
|
|
48
46
|
try {
|
|
49
|
-
if (
|
|
47
|
+
if (isHeldDirectoryCitation(entry)) {
|
|
48
|
+
if (directories.length < KNOWN_DIRECTORY_HINT_LIMIT)
|
|
49
|
+
directories.push(structuredClone(entry));
|
|
50
|
+
}
|
|
51
|
+
else if (!manifestQuotaLeft())
|
|
52
|
+
continue;
|
|
53
|
+
else if (isContainerKekWireLevel(entry))
|
|
50
54
|
levels.push(structuredClone(entry));
|
|
51
55
|
else if (isServedAccessManifestBundleWireResponse(entry) &&
|
|
52
56
|
isSha256HexString(entry.manifestHash) &&
|
|
53
|
-
!
|
|
54
|
-
|
|
57
|
+
!bundles.has(entry.manifestHash))
|
|
58
|
+
bundles.set(entry.manifestHash, structuredClone(entry));
|
|
55
59
|
}
|
|
56
60
|
catch {
|
|
57
61
|
// An uncloneable entry is skipped; its bytes simply travel.
|
|
58
62
|
}
|
|
59
63
|
}
|
|
64
|
+
return { bundles, levels, directories };
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Copies the source's answer and keys each KEK level by the digest
|
|
68
|
+
* recomputed from its own bytes, never by a digest the source names. A
|
|
69
|
+
* directory payload is cited only when it hashes to the payload hash its own
|
|
70
|
+
* signed organization state commits.
|
|
71
|
+
*/
|
|
72
|
+
async function prepareHeldCitations(entries) {
|
|
73
|
+
const { bundles, levels, directories } = copyHeldEntries(entries);
|
|
74
|
+
const held = { ...noCitations(), bundles };
|
|
60
75
|
const digests = await Promise.all(levels.map(computeContainerKekLevelDigest));
|
|
61
76
|
levels.forEach((level, index) => {
|
|
62
77
|
const digest = digests[index];
|
|
63
78
|
if (digest && !held.kekLevels.has(digest))
|
|
64
79
|
held.kekLevels.set(digest, level);
|
|
65
80
|
});
|
|
81
|
+
const payloads = await Promise.all(directories.map(signedDirectoryPayload));
|
|
82
|
+
for (const payload of payloads)
|
|
83
|
+
if (payload && !held.directories.has(payload.stateHash))
|
|
84
|
+
held.directories.set(payload.stateHash, payload);
|
|
66
85
|
return held;
|
|
67
86
|
}
|
|
68
87
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifiedManifestCitations.js","sourceRoot":"","sources":["verifiedManifestCitations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAEL,uBAAuB,
|
|
1
|
+
{"version":3,"file":"verifiedManifestCitations.js","sourceRoot":"","sources":["verifiedManifestCitations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAEL,uBAAuB,GAExB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,wCAAwC,EACxC,iBAAiB,EACjB,0BAA0B,EAC1B,yBAAyB,GAE1B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,0BAA0B,CAAC;AAIlC,mFAAmF;AACnF,MAAM,CAAC,MAAM,6BAA6B,GAAG,GAAG,CAAC;AAkDjD,SAAS,WAAW;IAClB,OAAO,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,GAAG,EAAE,EAAE,WAAW,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC;AAC9E,CAAC;AAED;;;;GAIG;AACH,SAAS,eAAe,CACtB,OAA+C,EAC/C,MAA+B;IAE/B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,MAAM,M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AAG,CAAC,WAAW,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC,CAAC;IAC5E,KAAK,MAAM,OAAO,IAAI,QAAQ;QAC5B,IAAI,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,CAAC;YACrD,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACrD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,MAAwC,EACxC,MAA8B,EAC9B,MAAgC;IAEhC,IAAI,CAAC,MAAM;QAAE,OAAO,WAAW,EAAE,CAAC;IAClC,OAAO,eAAe,CACpB,KAAK,IAAI,EAAE,CAAC,oBAAoB,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAC3D,MAAM,CACP,CAAC;AACJ,CAAC","sourcesContent":["import { computeContainerKekLevelDigest } from \"@tearleads/crypto\";\nimport {\n type ContainerKekWireLevel,\n isContainerKekWireLevel,\n type PrincipalStatePayloadResponse,\n} from \"@tearleads/validators/response\";\nimport {\n isServedAccessManifestBundleWireResponse,\n isSha256HexString,\n KNOWN_DIRECTORY_HINT_LIMIT,\n KNOWN_MANIFEST_HINT_LIMIT,\n type ServedAccessManifestBundleWireResponse,\n} from \"@tearleads/validators/util\";\nimport {\n type HeldDirectoryCitation,\n isHeldDirectoryCitation,\n signedDirectoryPayload,\n} from \"./heldDirectoryCitations\";\n\nexport type { HeldDirectoryCitation } from \"./heldDirectoryCitations\";\n\n/** Citation only saves bytes: a source slower than this sends the read uncited. */\nexport const MANIFEST_CITATION_DEADLINE_MS = 250;\n\n/**\n * Where a listing placed a container the device has not stored yet. Only\n * which held bytes a read cites depends on it, never what the read accepts.\n */\nexport interface WriterProjectionListing {\n readonly organizationId: string;\n readonly parentId: string | null;\n}\n\nexport interface WriterProjectionTarget {\n readonly kind: \"container\" | \"document\";\n readonly id: string;\n readonly listing?: WriterProjectionListing | undefined;\n}\n\n/**\n * A held access-manifest bundle, a held container KEK level, or a held\n * organization directory payload with its signed state.\n */\nexport type HeldProjectionCitation =\n | ServedAccessManifestBundleWireResponse\n | ContainerKekWireLevel\n | HeldDirectoryCitation;\n\n/**\n * Verified access-manifest bundles, container KEK levels and organization\n * directory payloads a device durably holds that a writer projection of\n * `target` may cite, most useful first.\n * This is never trust input: the exact cited bytes only fill the response's\n * omitted positions, and the caller verifies the rebuilt projection exactly\n * as a full one.\n */\nexport interface VerifiedManifestCitations {\n cite(\n target: WriterProjectionTarget,\n ): Promise<readonly HeldProjectionCitation[]>;\n}\n\n/**\n * The exact bytes one request cites: bundles by hash, levels by digest,\n * directory payloads by their organization state's hash.\n */\nexport interface HeldProjectionCitations {\n readonly bundles: Map<string, ServedAccessManifestBundleWireResponse>;\n readonly kekLevels: Map<string, ContainerKekWireLevel>;\n readonly directories: Map<string, PrincipalStatePayloadResponse>;\n}\n\nfunction noCitations(): HeldProjectionCitations {\n return { bundles: new Map(), kekLevels: new Map(), directories: new Map() };\n}\n\n/**\n * The prepared citations, or none once the deadline passes, the caller\n * aborts, or the source or preparation throws or rejects. A late answer is\n * discarded: it can never reach a request that was already sent.\n */\nfunction boundedCitation(\n prepare: () => Promise<HeldProjectionCitations>,\n signal: AbortSignal | undefined,\n): Promise<HeldProjectionCitations> {\n return new Promise((resolve) => {\n let settled = false;\n const finish = (held: HeldProjectionCitations) => {\n if (settled) return;\n settled = true;\n clearTimeout(timer);\n signal?.removeEventListener(\"abort\", abandon);\n resolve(held);\n };\n const abandon = () => finish(noCitations());\n const timer = setTimeout(abandon, MANIFEST_CITATION_DEADLINE_MS);\n if (signal?.aborted) return abandon();\n signal?.addEventListener(\"abort\", abandon, { once: true });\n try {\n prepare().then(finish, abandon);\n } catch {\n abandon();\n }\n });\n}\n\n/** Copies of the source's entries, each kind within its own hint quota. */\nfunction copyHeldEntries(entries: readonly unknown[]) {\n const bundles = new Map<string, ServedAccessManifestBundleWireResponse>();\n const levels: ContainerKekWireLevel[] = [];\n const directories: HeldDirectoryCitation[] = [];\n const manifestQuotaLeft = () =>\n bundles.size + levels.length < KNOWN_MANIFEST_HINT_LIMIT;\n for (const entry of entries) {\n try {\n if (isHeldDirectoryCitation(entry)) {\n if (directories.length < KNOWN_DIRECTORY_HINT_LIMIT)\n directories.push(structuredClone(entry));\n } else if (!manifestQuotaLeft()) continue;\n else if (isContainerKekWireLevel(entry))\n levels.push(structuredClone(entry));\n else if (\n isServedAccessManifestBundleWireResponse(entry) &&\n isSha256HexString(entry.manifestHash) &&\n !bundles.has(entry.manifestHash)\n )\n bundles.set(entry.manifestHash, structuredClone(entry));\n } catch {\n // An uncloneable entry is skipped; its bytes simply travel.\n }\n }\n return { bundles, levels, directories };\n}\n\n/**\n * Copies the source's answer and keys each KEK level by the digest\n * recomputed from its own bytes, never by a digest the source names. A\n * directory payload is cited only when it hashes to the payload hash its own\n * signed organization state commits.\n */\nasync function prepareHeldCitations(\n entries: readonly unknown[],\n): Promise<HeldProjectionCitations> {\n const { bundles, levels, directories } = copyHeldEntries(entries);\n const held: HeldProjectionCitations = { ...noCitations(), bundles };\n const digests = await Promise.all(levels.map(computeContainerKekLevelDigest));\n levels.forEach((level, index) => {\n const digest = digests[index];\n if (digest && !held.kekLevels.has(digest))\n held.kekLevels.set(digest, level);\n });\n const payloads = await Promise.all(directories.map(signedDirectoryPayload));\n for (const payload of payloads)\n if (payload && !held.directories.has(payload.stateHash))\n held.directories.set(payload.stateHash, payload);\n return held;\n}\n\n/**\n * The bytes one request cites, copied so a later eviction or mutation of the\n * source cannot change what fills its omissions. Citing only saves bytes, so\n * it never blocks or fails a read: a slow, failing, or abandoned source or\n * preparation yields no hints, within one deadline.\n */\nexport async function heldManifestCitations(\n source: VerifiedManifestCitations | null,\n target: WriterProjectionTarget,\n signal?: AbortSignal | undefined,\n): Promise<HeldProjectionCitations> {\n if (!source) return noCitations();\n return boundedCitation(\n async () => prepareHeldCitations(await source.cite(target)),\n signal,\n );\n}\n"]}
|
|
@@ -7,6 +7,7 @@ import { heldManifestCitations, } from "./verifiedManifestCitations.js";
|
|
|
7
7
|
const NO_CITATIONS = {
|
|
8
8
|
bundles: new Map(),
|
|
9
9
|
kekLevels: new Map(),
|
|
10
|
+
directories: new Map(),
|
|
10
11
|
};
|
|
11
12
|
const PROJECTION_PATH = /^\/(?:containers|documents)\/([^/?#]+)\/writer-projection$/u;
|
|
12
13
|
function projectionId(path) {
|
|
@@ -33,8 +34,8 @@ function readProjection(runtime, input, held, context) {
|
|
|
33
34
|
path: input.path,
|
|
34
35
|
validator: input.validator,
|
|
35
36
|
decode: (value) => container
|
|
36
|
-
? decodeContainerWriterProjection(value, held.bundles, held.kekLevels)
|
|
37
|
-
: decodeDocumentWriterProjection(value, held.bundles, held.kekLevels),
|
|
37
|
+
? decodeContainerWriterProjection(value, held.bundles, held.kekLevels, held.directories)
|
|
38
|
+
: decodeDocumentWriterProjection(value, held.bundles, held.kekLevels, held.directories),
|
|
38
39
|
method: "GET",
|
|
39
40
|
context,
|
|
40
41
|
operation: container
|
|
@@ -61,7 +62,7 @@ async function citedProjectionRead(runtime, citations, input, options) {
|
|
|
61
62
|
const held = id === null || options.headers !== undefined
|
|
62
63
|
? NO_CITATIONS
|
|
63
64
|
: await heldManifestCitations(citations, { kind: input.kind, id, listing: options.projectionListing }, options.signal);
|
|
64
|
-
if (held.bundles.size + held.kekLevels.size === 0)
|
|
65
|
+
if (held.bundles.size + held.kekLevels.size + held.directories.size === 0)
|
|
65
66
|
return readProjection(runtime, input, held, context);
|
|
66
67
|
const hinted = await readProjection(runtime, input, held, context.derive({
|
|
67
68
|
...options,
|
|
@@ -69,6 +70,7 @@ async function citedProjectionRead(runtime, citations, input, options) {
|
|
|
69
70
|
"x-known-manifests": formatKnownManifestHints({
|
|
70
71
|
manifests: [...held.bundles.keys()],
|
|
71
72
|
kekLevels: [...held.kekLevels.keys()],
|
|
73
|
+
directories: [...held.directories.keys()],
|
|
72
74
|
}),
|
|
73
75
|
},
|
|
74
76
|
reportErrors: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writerProjectionRequests.js","sourceRoot":"","sources":["writerProjectionRequests.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qCAAqC,EACrC,oCAAoC,GACrC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,+BAA+B,EAC/B,8BAA8B,GAC/B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAOlF,OAAO,EAEL,qBAAqB,GAGtB,MAAM,6BAA6B,CAAC;AAErC,MAAM,YAAY,GAA4B;IAC5C,OAAO,EAAE,IAAI,GAAG,EAAE;IAClB,SAAS,EAAE,IAAI,GAAG,EAAE;
|
|
1
|
+
{"version":3,"file":"writerProjectionRequests.js","sourceRoot":"","sources":["writerProjectionRequests.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qCAAqC,EACrC,oCAAoC,GACrC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,+BAA+B,EAC/B,8BAA8B,GAC/B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAOlF,OAAO,EAEL,qBAAqB,GAGtB,MAAM,6BAA6B,CAAC;AAErC,MAAM,YAAY,GAA4B;IAC5C,OAAO,EAAE,IAAI,GAAG,EAAE;IAClB,SAAS,EAAE,IAAI,GAAG,EAAE;IACpB,WAAW,EAAE,IAAI,GAAG,EAAE;CACvB,CAAC;AAEF,MAAM,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terProjectionOperation,\n getDocumentWriterProjectionOperation,\n} from \"@tearleads/validators/operation\";\nimport {\n decodeContainerWriterProjection,\n decodeDocumentWriterProjection,\n} from \"@tearleads/validators/response\";\nimport { formatKnownManifestHints } from \"@tearleads/validators/util\";\nimport type { ApiRequestRuntime } from \"./apiRequestRuntime\";\nimport { principalHistoryRequest } from \"./principalHistoryRequest\";\nimport { PrincipalHistoryRequestContext } from \"./principalHistoryRequestContext\";\nimport type {\n OperationRequestFn,\n OperationRequestResultFn,\n RequestResult,\n RequestResultOptions,\n} from \"./types\";\nimport {\n type HeldProjectionCitations,\n heldManifestCitations,\n type VerifiedManifestCitations,\n type WriterProjectionTarget,\n} from \"./verifiedManifestCitations\";\n\nconst NO_CITATIONS: HeldProjectionCitations = {\n bundles: new Map(),\n kekLevels: new Map(),\n directories: new Map(),\n};\n\nconst PROJECTION_PATH =\n /^\\/(?:containers|documents)\\/([^/?#]+)\\/writer-projection$/u;\n\nfunction projectionId(path: string): string | null {\n const encoded = PROJECTION_PATH.exec(path)?.[1];\n if (encoded === undefined) return null;\n try {\n return decodeURIComponent(encoded);\n } catch {\n return null;\n }\n}\n\nfunction writerProjectionKind(\n operationId: string,\n): WriterProjectionTarget[\"kind\"] | null {\n if (operationId === \"containers.writerProjection.get\") return \"container\";\n if (operationId === \"documents.writerProjection.get\") return \"document\";\n return null;\n}\n\nfunction readProjection<T>(\n runtime: ApiRequestRuntime,\n input: {\n readonly kind: WriterProjectionTarget[\"kind\"];\n readonly path: string;\n readonly validator: (value: unknown) => value is T;\n },\n held: HeldProjectionCitations,\n context: PrincipalHistoryRequestContext,\n): Promise<RequestResult<T>> {\n const container = input.kind === \"container\";\n return principalHistoryRequest(runtime, {\n path: input.path,\n validator: input.validator,\n decode: (value) =>\n container\n ? decodeContainerWriterProjection(\n value,\n held.bundles,\n held.kekLevels,\n held.directories,\n )\n : decodeDocumentWriterProjection(\n value,\n held.bundles,\n held.kekLevels,\n held.directories,\n ),\n method: \"GET\",\n context,\n operation: container\n ? getContainerWriterProjectionOperation\n : getDocumentWriterProjectionOperation,\n });\n}\n\n/**\n * Preparation and body deadlines sit inside the projection read. The wire\n * cites each manifest bundle by hash and may cite a held KEK level by digest;\n * decoding resolves every citation, from the response or from the exact bytes\n * this request declared held, before any validator, cache, or verifier sees\n * the projection. A response this device\n * cannot rebuild fails closed into one complete, hint-free refetch.\n */\nasync function citedProjectionRead<T>(\n runtime: ApiRequestRuntime,\n citations: VerifiedManifestCitations | null,\n input: {\n readonly kind: WriterProjectionTarget[\"kind\"];\n readonly path: string;\n readonly validator: (value: unknown) => value is T;\n },\n options: RequestResultOptions,\n): Promise<RequestResult<T>> {\n // Bind the identity before citations load: an account switch while they\n // load, or before the refetch, must not carry one identity's hints or\n // answer into another's session. Each request rechecks this context.\n const context = new PrincipalHistoryRequestContext(\n runtime,\n \"GET\",\n input.path,\n options,\n );\n const id = projectionId(input.path);\n // Caller-specific headers make a request its own; it cites nothing. The\n // caller's abort also ends a citation wait.\n const held =\n id === null || options.headers !== undefined\n ? NO_CITATIONS\n : await heldManifestCitations(\n citations,\n { kind: input.kind, id, listing: options.projectionListing },\n options.signal,\n );\n if (held.bundles.size + held.kekLevels.size + held.directories.size === 0)\n return readProjection(runtime, input, held, context);\n const hinted = await readProjection(\n runtime,\n input,\n held,\n context.derive({\n ...options,\n headers: {\n \"x-known-manifests\": formatKnownManifestHints({\n manifests: [...held.bundles.keys()],\n kekLevels: [...held.kekLevels.keys()],\n directories: [...held.directories.keys()],\n }),\n },\n reportErrors: false,\n }),\n );\n if (hinted.ok) return hinted;\n if (hinted.kind !== \"shape\") {\n if (options.reportErrors !== false) hinted.report();\n return hinted;\n }\n return readProjection(runtime, input, NO_CITATIONS, context.derive(options));\n}\n\nexport function writerProjectionRequests(\n runtime: ApiRequestRuntime,\n citations: () => VerifiedManifestCitations | null,\n): {\n request: OperationRequestFn;\n requestResult: OperationRequestResultFn;\n} {\n const requestResult: OperationRequestResultFn = (\n path,\n validator,\n method,\n body,\n options,\n operation,\n ) => {\n const kind = method === \"GET\" ? writerProjectionKind(operation.id) : null;\n if (kind)\n return citedProjectionRead(\n runtime,\n citations(),\n { kind, path, validator },\n options ?? {},\n );\n return runtime.requestResult(\n path,\n validator,\n method,\n body,\n options,\n operation,\n );\n };\n const request: OperationRequestFn = async (...args) => {\n const result = await requestResult(...args);\n return result.ok ? result.data : null;\n };\n return { request, requestResult };\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const knownManifestsHeaderRefinement = {
|
|
2
2
|
id: "request.known-manifest-hints",
|
|
3
|
-
description: "x-known-manifests must list
|
|
3
|
+
description: "x-known-manifests must list unique typed digests, at most 48 m: or k: and at most 8 d:, each followed by a lowercase SHA-256 hex digest",
|
|
4
4
|
};
|
|
5
5
|
//# sourceMappingURL=knownManifestsRefinements.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"knownManifestsRefinements.js","sourceRoot":"","sources":["knownManifestsRefinements.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,8BAA8B,GAAG;IAC5C,EAAE,EAAE,8BAA8B;IAClC,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"knownManifestsRefinements.js","sourceRoot":"","sources":["knownManifestsRefinements.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,8BAA8B,GAAG;IAC5C,EAAE,EAAE,8BAA8B;IAClC,WAAW,EACT,yIAAyI;CACnI,CAAC","sourcesContent":["export const knownManifestsHeaderRefinement = {\n id: \"request.known-manifest-hints\",\n description:\n \"x-known-manifests must list unique typed digests, at most 48 m: or k: and at most 8 d:, each followed by a lowercase SHA-256 hex digest\",\n} as const;\n"]}
|
|
@@ -5914,6 +5914,8 @@ export declare const registerOperation: Omit<{
|
|
|
5914
5914
|
readonly responses: {
|
|
5915
5915
|
readonly 200: z.ZodType<{
|
|
5916
5916
|
challenge: string;
|
|
5917
|
+
commitLsn: string | null;
|
|
5918
|
+
commitLsnMode: "tracked" | "untracked";
|
|
5917
5919
|
committedCoreMetadataUpdateIds: string[];
|
|
5918
5920
|
committedProfileUpdateIds: string[];
|
|
5919
5921
|
organizationId: string;
|
|
@@ -6085,6 +6087,8 @@ export declare const registerOperation: Omit<{
|
|
|
6085
6087
|
rosterProfileDocumentId?: string | undefined;
|
|
6086
6088
|
}, {
|
|
6087
6089
|
challenge: string;
|
|
6090
|
+
commitLsn: string | null;
|
|
6091
|
+
commitLsnMode: "tracked" | "untracked";
|
|
6088
6092
|
committedCoreMetadataUpdateIds: string[];
|
|
6089
6093
|
committedProfileUpdateIds: string[];
|
|
6090
6094
|
organizationId: string;
|
|
@@ -6256,6 +6260,8 @@ export declare const registerOperation: Omit<{
|
|
|
6256
6260
|
rosterProfileDocumentId?: string | undefined;
|
|
6257
6261
|
}, z.core.$ZodTypeInternals<{
|
|
6258
6262
|
challenge: string;
|
|
6263
|
+
commitLsn: string | null;
|
|
6264
|
+
commitLsnMode: "tracked" | "untracked";
|
|
6259
6265
|
committedCoreMetadataUpdateIds: string[];
|
|
6260
6266
|
committedProfileUpdateIds: string[];
|
|
6261
6267
|
organizationId: string;
|
|
@@ -6427,6 +6433,8 @@ export declare const registerOperation: Omit<{
|
|
|
6427
6433
|
rosterProfileDocumentId?: string | undefined;
|
|
6428
6434
|
}, {
|
|
6429
6435
|
challenge: string;
|
|
6436
|
+
commitLsn: string | null;
|
|
6437
|
+
commitLsnMode: "tracked" | "untracked";
|
|
6430
6438
|
committedCoreMetadataUpdateIds: string[];
|
|
6431
6439
|
committedProfileUpdateIds: string[];
|
|
6432
6440
|
organizationId: string;
|
|
@@ -6634,6 +6642,12 @@ export declare const registerOperation: Omit<{
|
|
|
6634
6642
|
}, {
|
|
6635
6643
|
readonly description: "a container response keyring is null exactly for container key epoch 1";
|
|
6636
6644
|
readonly id: "response.organization-provisioning-container-keyring";
|
|
6645
|
+
}, {
|
|
6646
|
+
readonly description: "commitLsnMode \"untracked\" requires the commitLsn \"0/0\" sentinel";
|
|
6647
|
+
readonly id: "response.untracked-commit-lsn-sentinel";
|
|
6648
|
+
}, {
|
|
6649
|
+
readonly description: "commitLsn \"0/0\" requires commitLsnMode \"untracked\" in the same response";
|
|
6650
|
+
readonly id: "response.untracked-commit-lsn-mode";
|
|
6637
6651
|
}];
|
|
6638
6652
|
}, "failureResponses" | "failureStatuses"> & {
|
|
6639
6653
|
readonly failureResponses: {
|
|
@@ -2,7 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import { documentSyncRequestRuntimeRefinements } from "../documentSyncRefinements.js";
|
|
3
3
|
import { organizationProvisioningRequestRuntimeRefinements, organizationProvisioningResponseRuntimeRefinements, } from "../organizationProvisioningRefinements.js";
|
|
4
4
|
import { ChallengeRequestSchema, isChallengeRequest, isRegistrationRequest, isVerifyRequest, RegistrationRequestSchema, VerifyRequestSchema, } from "../request/index.js";
|
|
5
|
-
import { ChallengeErrorResponseSchema, ChallengeResponseSchema, DestroySessionResponseSchema, ErrorResponseSchema, isChallengeResponse, isDestroySessionResponse, isListSessionsResponse, isRegistrationResponse, isUserIdentityResponse, isVerifyResponse, isWebSocketTicketResponse, ListSessionsResponseSchema, RegistrationResponseSchema, SessionFailureResponseSchema, UserIdentityResponseSchema, VerifyFailureResponseSchema, VerifySuccessResponseSchema, WebSocketTicketResponseSchema, } from "../response/index.js";
|
|
5
|
+
import { ChallengeErrorResponseSchema, ChallengeResponseSchema, DestroySessionResponseSchema, ErrorResponseSchema, isChallengeResponse, isDestroySessionResponse, isListSessionsResponse, isRegistrationResponse, isUserIdentityResponse, isVerifyResponse, isWebSocketTicketResponse, ListSessionsResponseSchema, RegistrationResponseSchema, registrationCommitCheckpointRefinements, SessionFailureResponseSchema, UserIdentityResponseSchema, VerifyFailureResponseSchema, VerifySuccessResponseSchema, WebSocketTicketResponseSchema, } from "../response/index.js";
|
|
6
6
|
import { sha256HexStringSchema } from "../schema.js";
|
|
7
7
|
import { defineJsonOperation } from "./definition.js";
|
|
8
8
|
const AuthPathParamsSchema = z.strictObject({});
|
|
@@ -77,6 +77,7 @@ export const registerOperation = defineJsonOperation({
|
|
|
77
77
|
...documentSyncRequestRuntimeRefinements,
|
|
78
78
|
...organizationProvisioningRequestRuntimeRefinements,
|
|
79
79
|
...organizationProvisioningResponseRuntimeRefinements,
|
|
80
|
+
...registrationCommitCheckpointRefinements,
|
|
80
81
|
],
|
|
81
82
|
});
|
|
82
83
|
export const logoutOperation = defineJsonOperation({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,qCAAqC,EAAE,MAAM,4BAA4B,CAAC;AACnF,OAAO,EACL,iDAAiD,EACjD,kDAAkD,GACnD,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,EACf,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,4BAA4B,EAC5B,uBAAuB,EACvB,4BAA4B,EAC5B,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,gBAAgB,EAChB,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAC1B,4BAA4B,EAC5B,0BAA0B,EAC1B,2BAA2B,EAC3B,2BAA2B,EAC3B,6BAA6B,GAC9B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,oBAAoB,GAAG,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;AAChD,MAAM,uBAAuB,GAAG,CAAC,CAAC,YAAY,CAAC;IAC7C,SAAS,EAAE,qBAAqB;CACjC,CAAC,CAAC;AACH,MAAM,4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SAAS;IACf,gBAAgB,EAAE;QAChB,GAAG,EAAE,4BAA4B;QACjC,GAAG,EAAE,mBAAmB;QACxB,GAAG,EAAE,mBAAmB;KACzB;IACD,eAAe,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IAChC,EAAE,EAAE,mBAAmB;IACvB,OAAO,EAAE,8BAA8B;IACvC,WAAW,EACT,iRAAiR;IACnR,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,4BAA4B;IACpC,IAAI,EAAE,8BAA8B;IACpC,SAAS,EAAE;QACT,GAAG,EAAE,0BAA0B;KAChC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,2BAA2B,GAAG,kBAAkB,CAAC;AAC9D,MAAM,CAAC,MAAM,4BAA4B,GAAG,mBAAmB,CAAC;AAChE,MAAM,CAAC,MAAM,8BAA8B,GAAG,qBAAqB,CAAC;AACpE,MAAM,CAAC,MAAM,+BAA+B,GAAG,sBAAsB,CAAC;AACtE,MAAM,CAAC,MAAM,wBAAwB,GAAG,eAAe,CAAC;AACxD,MAAM,CAAC,MAAM,yBAAyB,GAAG,gBAAgB,CAAC;AAC1D,MAAM,CAAC,MAAM,yBAAyB,GAAG,wBAAwB,CAAC;AAClE,MAAM,CAAC,MAAM,kCAAkC,GAAG,yBAAyB,CAAC;AAC5E,MAAM,CAAC,MAAM,+BAA+B,GAAG,sBAAsB,CAAC;AACtE,MAAM,CAAC,MAAM,iCAAiC,GAAG,wBAAwB,CAAC;AAC1E,MAAM,CAAC,MAAM,+BAA+B,GAAG,sBAAsB,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { documentSyncRequestRuntimeRefinements } from \"../documentSyncRefinements\";\nimport {\n organizationProvisioningRequestRuntimeRefinements,\n organizationProvisioningResponseRuntimeRefinements,\n} from \"../organizationProvisioningRefinements\";\nimport {\n ChallengeRequestSchema,\n isChallengeRequest,\n isRegistrationRequest,\n isVerifyRequest,\n RegistrationRequestSchema,\n VerifyRequestSchema,\n} from \"../request\";\nimport {\n ChallengeErrorResponseSchema,\n ChallengeResponseSchema,\n DestroySessionResponseSchema,\n ErrorResponseSchema,\n isChallengeResponse,\n isDestroySessionResponse,\n isListSessionsResponse,\n isRegistrationResponse,\n isUserIdentityResponse,\n isVerifyResponse,\n isWebSocketTicketResponse,\n ListSessionsResponseSchema,\n RegistrationResponseSchema,\n SessionFailureResponseSchema,\n UserIdentityResponseSchema,\n VerifyFailureResponseSchema,\n VerifySuccessResponseSchema,\n WebSocketTicketResponseSchema,\n} from \"../response\";\nimport { sha256HexStringSchema } from \"../schema\";\nimport { defineJsonOperation } from \"./definition\";\n\nconst AuthPathParamsSchema = z.strictObject({});\nconst SessionPathParamsSchema = z.strictObject({\n sessionId: sha256HexStringSchema,\n});\nconst UserIdentityPathParamsSchema = z.strictObject({\n userId: z.string(),\n});\n\nexport const challengeOperation = defineJsonOperation({\n auth: \"none\",\n body: ChallengeRequestSchema,\n failureResponses: {\n 400: ChallengeErrorResponseSchema,\n 404: ChallengeErrorResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [400, 404, 500],\n id: \"auth.challenge\",\n summary: \"Request an auth challenge\",\n description:\n \"Starts sign-in for a registered identity: the server stores a short-lived random challenge for the signing key fingerprint, and the client signs it and sends the signature to `POST /auth/verify`. No session is needed; an unknown fingerprint returns 404.\",\n method: \"POST\",\n params: AuthPathParamsSchema,\n path: \"/auth/challenge\",\n responses: {\n 200: ChallengeResponseSchema,\n },\n});\n\nexport const verifyOperation = defineJsonOperation({\n auth: \"none\",\n body: VerifyRequestSchema,\n failureResponses: {\n 400: ChallengeErrorResponseSchema,\n 401: VerifyFailureResponseSchema,\n 403: VerifyFailureResponseSchema,\n 404: VerifyFailureResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [400, 401, 403, 404, 500],\n id: \"auth.verify\",\n summary: \"Verify an auth challenge\",\n description:\n \"Completes sign-in by checking the challenge signature, bound to the API origin, against the identity's registered signing key, then opens a session and returns its bearer token plus the first WebSocket ticket. Each challenge can be used once. A suspended identity's valid signature is refused with 403 and code `account_suspended`, which clients treat as terminal.\",\n method: \"POST\",\n params: AuthPathParamsSchema,\n path: \"/auth/verify\",\n responses: {\n 200: VerifySuccessResponseSchema,\n },\n});\n\nexport const registerOperation = defineJsonOperation({\n auth: \"none\",\n body: RegistrationRequestSchema,\n failureResponses: {\n 400: ErrorResponseSchema,\n 403: ErrorResponseSchema,\n 404: ErrorResponseSchema,\n 409: ErrorResponseSchema,\n 500: ErrorResponseSchema,\n 503: ErrorResponseSchema,\n },\n failureStatuses: [400, 403, 404, 409, 500, 503],\n id: \"auth.register\",\n summary: \"Register an identity and bootstrap its root state\",\n description:\n \"Creates a new identity from its signing and encapsulation public keys and, in one transaction, provisions its personal organization: the reserved `Admins` and `Members` groups, the root container, and their signed policies and metadata documents. The response carries a fresh login challenge, so the client signs in next with `POST /auth/verify`. A signing key that is already registered returns 409.\",\n method: \"POST\",\n params: AuthPathParamsSchema,\n path: \"/auth/register\",\n responses: {\n 200: RegistrationResponseSchema,\n },\n runtimeRefinements: [\n ...documentSyncRequestRuntimeRefinements,\n ...organizationProvisioningRequestRuntimeRefinements,\n ...organizationProvisioningResponseRuntimeRefinements,\n ],\n});\n\nexport const logoutOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: {\n 401: SessionFailureResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [401, 500],\n id: \"auth.logout\",\n summary: \"Destroy the current session\",\n description:\n \"Ends the session that made the request, so its bearer token stops working. Any signed-in user may call it.\",\n method: \"POST\",\n params: AuthPathParamsSchema,\n path: \"/auth/logout\",\n responses: {\n 200: DestroySessionResponseSchema,\n },\n});\n\nexport const webSocketTicketOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: {\n 401: SessionFailureResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [401, 500],\n id: \"auth.webSocketTicket\",\n summary: \"Mint a one-time WebSocket ticket\",\n description:\n \"Issues a single-use, short-lived ticket that authenticates one WebSocket upgrade to the realtime hint gateway, because browsers cannot attach an `Authorization` header to a WebSocket handshake. Clients call it before each reconnect; sign-in already returns the first ticket.\",\n method: \"POST\",\n params: AuthPathParamsSchema,\n path: \"/auth/ws-ticket\",\n responses: {\n 200: WebSocketTicketResponseSchema,\n },\n});\n\nexport const listSessionsOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: {\n 401: SessionFailureResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [401, 500],\n id: \"auth.sessions.list\",\n summary: \"List auth sessions\",\n description:\n \"Lists the signed-in user's live sessions with their creation time, last activity, IP addresses, and signing key fingerprint, flagging the one that made the request. It only ever returns the caller's own sessions.\",\n method: \"GET\",\n params: AuthPathParamsSchema,\n path: \"/auth/sessions\",\n responses: {\n 200: ListSessionsResponseSchema,\n },\n});\n\nexport const destroySessionOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: {\n 400: ErrorResponseSchema,\n 401: SessionFailureResponseSchema,\n 404: ErrorResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [400, 401, 404, 500],\n id: \"auth.sessions.destroy\",\n summary: \"Destroy a user session\",\n description:\n \"Signs out one of the caller's own sessions, for example a lost device. A session id that is unknown or belongs to another user returns 404.\",\n method: \"DELETE\",\n params: SessionPathParamsSchema,\n path: \"/auth/sessions/{sessionId}\",\n responses: {\n 200: DestroySessionResponseSchema,\n },\n});\n\nexport const userIdentityOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: {\n 401: SessionFailureResponseSchema,\n 404: ErrorResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [401, 404, 500],\n id: \"auth.userIdentity\",\n summary: \"Get a complete user identity\",\n description:\n \"Returns a user's registered signing and encapsulation public keys and fingerprints. Clients never trust the answer alone: they compare it with an identity link or an existing identity pin before using the keys. Any signed-in user may call it; an unknown user returns 404.\",\n method: \"GET\",\n params: UserIdentityPathParamsSchema,\n path: \"/auth/user-identity/{userId}\",\n responses: {\n 200: UserIdentityResponseSchema,\n },\n});\n\nexport const isChallengeOperationRequest = isChallengeRequest;\nexport const isChallengeOperationResponse = isChallengeResponse;\nexport const isRegistrationOperationRequest = isRegistrationRequest;\nexport const isRegistrationOperationResponse = isRegistrationResponse;\nexport const isVerifyOperationRequest = isVerifyRequest;\nexport const isVerifyOperationResponse = isVerifyResponse;\nexport const isLogoutOperationResponse = isDestroySessionResponse;\nexport const isWebSocketTicketOperationResponse = isWebSocketTicketResponse;\nexport const isListSessionsOperationResponse = isListSessionsResponse;\nexport const isDestroySessionOperationResponse = isDestroySessionResponse;\nexport const isUserIdentityOperationResponse = isUserIdentityResponse;\n"]}
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,qCAAqC,EAAE,MAAM,4BAA4B,CAAC;AACnF,OAAO,EACL,iDAAiD,EACjD,kDAAkD,GACnD,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,EACf,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,4BAA4B,EAC5B,uBAAuB,EACvB,4BAA4B,EAC5B,mBAAmB,EACnB,mBAAmB,EACnB,wBAAwB,EACxB,sBAAsB,EACtB,sBAAsB,EACtB,sBAAsB,EACtB,gBAAgB,EAChB,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAC1B,uCAAuC,EACvC,4BAA4B,EAC5B,0BAA0B,EAC1B,2BAA2B,EAC3B,2BAA2B,EAC3B,6BAA6B,GAC9B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,oBAAoB,GAAG,CAAC,CAA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C/B,IAAI,EAAE,4BAA4B;IAClC,SAAS,EAAE;QACT,GAAG,EAAE,4BAA4B;KAClC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,mBAAmB,CAAC;IACvD,IAAI,EAAE,SAAS;IACf,gBAAgB,EAAE;QAChB,GAAG,EAAE,4BAA4B;QACjC,GAAG,EAAE,mBAAmB;QACxB,GAAG,EAAE,mBAAmB;KACzB;IACD,eAAe,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IAChC,EAAE,EAAE,mBAAmB;IACvB,OAAO,EAAE,8BAA8B;IACvC,WAAW,EACT,iRAAiR;IACnR,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,4BAA4B;IACpC,IAAI,EAAE,8BAA8B;IACpC,SAAS,EAAE;QACT,GAAG,EAAE,0BAA0B;KAChC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,2BAA2B,GAAG,kBAAkB,CAAC;AAC9D,MAAM,CAAC,MAAM,4BAA4B,GAAG,mBAAmB,CAAC;AAChE,MAAM,CAAC,MAAM,8BAA8B,GAAG,qBAAqB,CAAC;AACpE,MAAM,CAAC,MAAM,+BAA+B,GAAG,sBAAsB,CAAC;AACtE,MAAM,CAAC,MAAM,wBAAwB,GAAG,eAAe,CAAC;AACxD,MAAM,CAAC,MAAM,yBAAyB,GAAG,gBAAgB,CAAC;AAC1D,MAAM,CAAC,MAAM,yBAAyB,GAAG,wBAAwB,CAAC;AAClE,MAAM,CAAC,MAAM,kCAAkC,GAAG,yBAAyB,CAAC;AAC5E,MAAM,CAAC,MAAM,+BAA+B,GAAG,sBAAsB,CAAC;AACtE,MAAM,CAAC,MAAM,iCAAiC,GAAG,wBAAwB,CAAC;AAC1E,MAAM,CAAC,MAAM,+BAA+B,GAAG,sBAAsB,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { documentSyncRequestRuntimeRefinements } from \"../documentSyncRefinements\";\nimport {\n organizationProvisioningRequestRuntimeRefinements,\n organizationProvisioningResponseRuntimeRefinements,\n} from \"../organizationProvisioningRefinements\";\nimport {\n ChallengeRequestSchema,\n isChallengeRequest,\n isRegistrationRequest,\n isVerifyRequest,\n RegistrationRequestSchema,\n VerifyRequestSchema,\n} from \"../request\";\nimport {\n ChallengeErrorResponseSchema,\n ChallengeResponseSchema,\n DestroySessionResponseSchema,\n ErrorResponseSchema,\n isChallengeResponse,\n isDestroySessionResponse,\n isListSessionsResponse,\n isRegistrationResponse,\n isUserIdentityResponse,\n isVerifyResponse,\n isWebSocketTicketResponse,\n ListSessionsResponseSchema,\n RegistrationResponseSchema,\n registrationCommitCheckpointRefinements,\n SessionFailureResponseSchema,\n UserIdentityResponseSchema,\n VerifyFailureResponseSchema,\n VerifySuccessResponseSchema,\n WebSocketTicketResponseSchema,\n} from \"../response\";\nimport { sha256HexStringSchema } from \"../schema\";\nimport { defineJsonOperation } from \"./definition\";\n\nconst AuthPathParamsSchema = z.strictObject({});\nconst SessionPathParamsSchema = z.strictObject({\n sessionId: sha256HexStringSchema,\n});\nconst UserIdentityPathParamsSchema = z.strictObject({\n userId: z.string(),\n});\n\nexport const challengeOperation = defineJsonOperation({\n auth: \"none\",\n body: ChallengeRequestSchema,\n failureResponses: {\n 400: ChallengeErrorResponseSchema,\n 404: ChallengeErrorResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [400, 404, 500],\n id: \"auth.challenge\",\n summary: \"Request an auth challenge\",\n description:\n \"Starts sign-in for a registered identity: the server stores a short-lived random challenge for the signing key fingerprint, and the client signs it and sends the signature to `POST /auth/verify`. No session is needed; an unknown fingerprint returns 404.\",\n method: \"POST\",\n params: AuthPathParamsSchema,\n path: \"/auth/challenge\",\n responses: {\n 200: ChallengeResponseSchema,\n },\n});\n\nexport const verifyOperation = defineJsonOperation({\n auth: \"none\",\n body: VerifyRequestSchema,\n failureResponses: {\n 400: ChallengeErrorResponseSchema,\n 401: VerifyFailureResponseSchema,\n 403: VerifyFailureResponseSchema,\n 404: VerifyFailureResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [400, 401, 403, 404, 500],\n id: \"auth.verify\",\n summary: \"Verify an auth challenge\",\n description:\n \"Completes sign-in by checking the challenge signature, bound to the API origin, against the identity's registered signing key, then opens a session and returns its bearer token plus the first WebSocket ticket. Each challenge can be used once. A suspended identity's valid signature is refused with 403 and code `account_suspended`, which clients treat as terminal.\",\n method: \"POST\",\n params: AuthPathParamsSchema,\n path: \"/auth/verify\",\n responses: {\n 200: VerifySuccessResponseSchema,\n },\n});\n\nexport const registerOperation = defineJsonOperation({\n auth: \"none\",\n body: RegistrationRequestSchema,\n failureResponses: {\n 400: ErrorResponseSchema,\n 403: ErrorResponseSchema,\n 404: ErrorResponseSchema,\n 409: ErrorResponseSchema,\n 500: ErrorResponseSchema,\n 503: ErrorResponseSchema,\n },\n failureStatuses: [400, 403, 404, 409, 500, 503],\n id: \"auth.register\",\n summary: \"Register an identity and bootstrap its root state\",\n description:\n \"Creates a new identity from its signing and encapsulation public keys and, in one transaction, provisions its personal organization: the reserved `Admins` and `Members` groups, the root container, and their signed policies and metadata documents. The response carries a fresh login challenge, so the client signs in next with `POST /auth/verify`. A signing key that is already registered returns 409.\",\n method: \"POST\",\n params: AuthPathParamsSchema,\n path: \"/auth/register\",\n responses: {\n 200: RegistrationResponseSchema,\n },\n runtimeRefinements: [\n ...documentSyncRequestRuntimeRefinements,\n ...organizationProvisioningRequestRuntimeRefinements,\n ...organizationProvisioningResponseRuntimeRefinements,\n ...registrationCommitCheckpointRefinements,\n ],\n});\n\nexport const logoutOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: {\n 401: SessionFailureResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [401, 500],\n id: \"auth.logout\",\n summary: \"Destroy the current session\",\n description:\n \"Ends the session that made the request, so its bearer token stops working. Any signed-in user may call it.\",\n method: \"POST\",\n params: AuthPathParamsSchema,\n path: \"/auth/logout\",\n responses: {\n 200: DestroySessionResponseSchema,\n },\n});\n\nexport const webSocketTicketOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: {\n 401: SessionFailureResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [401, 500],\n id: \"auth.webSocketTicket\",\n summary: \"Mint a one-time WebSocket ticket\",\n description:\n \"Issues a single-use, short-lived ticket that authenticates one WebSocket upgrade to the realtime hint gateway, because browsers cannot attach an `Authorization` header to a WebSocket handshake. Clients call it before each reconnect; sign-in already returns the first ticket.\",\n method: \"POST\",\n params: AuthPathParamsSchema,\n path: \"/auth/ws-ticket\",\n responses: {\n 200: WebSocketTicketResponseSchema,\n },\n});\n\nexport const listSessionsOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: {\n 401: SessionFailureResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [401, 500],\n id: \"auth.sessions.list\",\n summary: \"List auth sessions\",\n description:\n \"Lists the signed-in user's live sessions with their creation time, last activity, IP addresses, and signing key fingerprint, flagging the one that made the request. It only ever returns the caller's own sessions.\",\n method: \"GET\",\n params: AuthPathParamsSchema,\n path: \"/auth/sessions\",\n responses: {\n 200: ListSessionsResponseSchema,\n },\n});\n\nexport const destroySessionOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: {\n 400: ErrorResponseSchema,\n 401: SessionFailureResponseSchema,\n 404: ErrorResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [400, 401, 404, 500],\n id: \"auth.sessions.destroy\",\n summary: \"Destroy a user session\",\n description:\n \"Signs out one of the caller's own sessions, for example a lost device. A session id that is unknown or belongs to another user returns 404.\",\n method: \"DELETE\",\n params: SessionPathParamsSchema,\n path: \"/auth/sessions/{sessionId}\",\n responses: {\n 200: DestroySessionResponseSchema,\n },\n});\n\nexport const userIdentityOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: {\n 401: SessionFailureResponseSchema,\n 404: ErrorResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [401, 404, 500],\n id: \"auth.userIdentity\",\n summary: \"Get a complete user identity\",\n description:\n \"Returns a user's registered signing and encapsulation public keys and fingerprints. Clients never trust the answer alone: they compare it with an identity link or an existing identity pin before using the keys. Any signed-in user may call it; an unknown user returns 404.\",\n method: \"GET\",\n params: UserIdentityPathParamsSchema,\n path: \"/auth/user-identity/{userId}\",\n responses: {\n 200: UserIdentityResponseSchema,\n },\n});\n\nexport const isChallengeOperationRequest = isChallengeRequest;\nexport const isChallengeOperationResponse = isChallengeResponse;\nexport const isRegistrationOperationRequest = isRegistrationRequest;\nexport const isRegistrationOperationResponse = isRegistrationResponse;\nexport const isVerifyOperationRequest = isVerifyRequest;\nexport const isVerifyOperationResponse = isVerifyResponse;\nexport const isLogoutOperationResponse = isDestroySessionResponse;\nexport const isWebSocketTicketOperationResponse = isWebSocketTicketResponse;\nexport const isListSessionsOperationResponse = isListSessionsResponse;\nexport const isDestroySessionOperationResponse = isDestroySessionResponse;\nexport const isUserIdentityOperationResponse = isUserIdentityResponse;\n"]}
|
|
@@ -72,7 +72,7 @@ export declare const getContainerWriterProjectionOperation: Omit<{
|
|
|
72
72
|
readonly failureStatuses: readonly [400, 401, 403, 404, 409, 500];
|
|
73
73
|
readonly id: "containers.writerProjection.get";
|
|
74
74
|
readonly summary: "Get a container writer projection";
|
|
75
|
-
readonly description: "Returns everything a client needs to read and write under a container: the signed manifests on its authorizing container path, each path level's container KEK wraps and keyring, and the key targets. Requires current read access; write authority is checked again when a write commits. A 202 asks the client to retry the identical request after the server prepares policy history, and the `x-known-manifests` header lets a client skip manifests it already holds.";
|
|
75
|
+
readonly description: "Returns everything a client needs to read and write under a container: the signed manifests on its authorizing container path, each path level's container KEK wraps and keyring, and the key targets. Requires current read access; write authority is checked again when a write commits. A 202 asks the client to retry the identical request after the server prepares policy history, and the `x-known-manifests` header lets a client skip manifests, KEK levels and directory payloads it already holds.";
|
|
76
76
|
readonly method: "GET";
|
|
77
77
|
readonly headers: z.ZodObject<{
|
|
78
78
|
"x-known-manifests": z.ZodOptional<z.ZodString>;
|
|
@@ -112,7 +112,7 @@ export declare const getContainerWriterProjectionOperation: Omit<{
|
|
|
112
112
|
principalId: string;
|
|
113
113
|
principalType: "group" | "organization";
|
|
114
114
|
stateHash: string;
|
|
115
|
-
};
|
|
115
|
+
} | null;
|
|
116
116
|
}[];
|
|
117
117
|
groups: {
|
|
118
118
|
head: {
|
|
@@ -194,7 +194,7 @@ export declare const getContainerWriterProjectionOperation: Omit<{
|
|
|
194
194
|
principalId: string;
|
|
195
195
|
principalType: "group" | "organization";
|
|
196
196
|
stateHash: string;
|
|
197
|
-
};
|
|
197
|
+
} | null;
|
|
198
198
|
}[];
|
|
199
199
|
groups: {
|
|
200
200
|
head: {
|
|
@@ -276,7 +276,7 @@ export declare const getContainerWriterProjectionOperation: Omit<{
|
|
|
276
276
|
principalId: string;
|
|
277
277
|
principalType: "group" | "organization";
|
|
278
278
|
stateHash: string;
|
|
279
|
-
};
|
|
279
|
+
} | null;
|
|
280
280
|
}[];
|
|
281
281
|
groups: {
|
|
282
282
|
head: {
|
|
@@ -358,7 +358,7 @@ export declare const getContainerWriterProjectionOperation: Omit<{
|
|
|
358
358
|
principalId: string;
|
|
359
359
|
principalType: "group" | "organization";
|
|
360
360
|
stateHash: string;
|
|
361
|
-
};
|
|
361
|
+
} | null;
|
|
362
362
|
}[];
|
|
363
363
|
groups: {
|
|
364
364
|
head: {
|
|
@@ -428,7 +428,7 @@ export declare const getContainerWriterProjectionOperation: Omit<{
|
|
|
428
428
|
readonly id: "response.writer-projection-manifest-bundles";
|
|
429
429
|
}, {
|
|
430
430
|
readonly id: "request.known-manifest-hints";
|
|
431
|
-
readonly description: "x-known-manifests must list
|
|
431
|
+
readonly description: "x-known-manifests must list unique typed digests, at most 48 m: or k: and at most 8 d:, each followed by a lowercase SHA-256 hex digest";
|
|
432
432
|
}];
|
|
433
433
|
}, "failureResponses" | "failureStatuses"> & {
|
|
434
434
|
readonly failureResponses: {
|
|
@@ -600,7 +600,7 @@ export declare const getDocumentWriterProjectionOperation: Omit<{
|
|
|
600
600
|
principalId: string;
|
|
601
601
|
principalType: "group" | "organization";
|
|
602
602
|
stateHash: string;
|
|
603
|
-
};
|
|
603
|
+
} | null;
|
|
604
604
|
}[];
|
|
605
605
|
groups: {
|
|
606
606
|
head: {
|
|
@@ -712,7 +712,7 @@ export declare const getDocumentWriterProjectionOperation: Omit<{
|
|
|
712
712
|
principalId: string;
|
|
713
713
|
principalType: "group" | "organization";
|
|
714
714
|
stateHash: string;
|
|
715
|
-
};
|
|
715
|
+
} | null;
|
|
716
716
|
}[];
|
|
717
717
|
groups: {
|
|
718
718
|
head: {
|
|
@@ -824,7 +824,7 @@ export declare const getDocumentWriterProjectionOperation: Omit<{
|
|
|
824
824
|
principalId: string;
|
|
825
825
|
principalType: "group" | "organization";
|
|
826
826
|
stateHash: string;
|
|
827
|
-
};
|
|
827
|
+
} | null;
|
|
828
828
|
}[];
|
|
829
829
|
groups: {
|
|
830
830
|
head: {
|
|
@@ -936,7 +936,7 @@ export declare const getDocumentWriterProjectionOperation: Omit<{
|
|
|
936
936
|
principalId: string;
|
|
937
937
|
principalType: "group" | "organization";
|
|
938
938
|
stateHash: string;
|
|
939
|
-
};
|
|
939
|
+
} | null;
|
|
940
940
|
}[];
|
|
941
941
|
groups: {
|
|
942
942
|
head: {
|
|
@@ -1025,7 +1025,7 @@ export declare const getDocumentWriterProjectionOperation: Omit<{
|
|
|
1025
1025
|
readonly id: "response.writer-projection-manifest-bundles";
|
|
1026
1026
|
}, {
|
|
1027
1027
|
readonly id: "request.known-manifest-hints";
|
|
1028
|
-
readonly description: "x-known-manifests must list
|
|
1028
|
+
readonly description: "x-known-manifests must list unique typed digests, at most 48 m: or k: and at most 8 d:, each followed by a lowercase SHA-256 hex digest";
|
|
1029
1029
|
}];
|
|
1030
1030
|
}, "failureResponses" | "failureStatuses"> & {
|
|
1031
1031
|
readonly failureResponses: {
|
|
@@ -24,7 +24,7 @@ export const getContainerWriterProjectionOperation = defineJsonOperation({
|
|
|
24
24
|
failureStatuses: [400, 401, 403, 404, 409, 500],
|
|
25
25
|
id: "containers.writerProjection.get",
|
|
26
26
|
summary: "Get a container writer projection",
|
|
27
|
-
description: "Returns everything a client needs to read and write under a container: the signed manifests on its authorizing container path, each path level's container KEK wraps and keyring, and the key targets. Requires current read access; write authority is checked again when a write commits. A 202 asks the client to retry the identical request after the server prepares policy history, and the `x-known-manifests` header lets a client skip manifests it already holds.",
|
|
27
|
+
description: "Returns everything a client needs to read and write under a container: the signed manifests on its authorizing container path, each path level's container KEK wraps and keyring, and the key targets. Requires current read access; write authority is checked again when a write commits. A 202 asks the client to retry the identical request after the server prepares policy history, and the `x-known-manifests` header lets a client skip manifests, KEK levels and directory payloads it already holds.",
|
|
28
28
|
method: "GET",
|
|
29
29
|
headers: KnownManifestsHeadersSchema,
|
|
30
30
|
params: ContainerWriterProjectionPathParamsSchema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writerProjections.js","sourceRoot":"","sources":["writerProjections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,8BAA8B,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EACL,oCAAoC,EACpC,4CAA4C,EAC5C,2CAA2C,EAC3C,mCAAmC,EACnC,2CAA2C,EAC3C,0CAA0C,EAC1C,mBAAmB,EACnB,uCAAuC,EACvC,sCAAsC,EACtC,4BAA4B,GAC7B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,yCAAyC,EAAE,MAAM,yCAAyC,CAAC;AACpG,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,0CAA0C,EAAE,MAAM,gCAAgC,CAAC;AAC5F,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,CAAC,MAAM,yCAAyC,GAAG,CAAC,CAAC,YAAY,CAAC;IACt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GAAG,CAAC;IAC/C,EAAE,EAAE,gCAAgC;IACpC,OAAO,EAAE,kCAAkC;IAC3C,WAAW,EACT,kYAAkY;IACpY,MAAM,EAAE,KAAK;IACb,OAAO,EAAE,2BAA2B;IACpC,MAAM,EAAE,wCAAwC;IAChD,IAAI,EAAE,2CAA2C;IACjD,SAAS,EAAE;QACT,GAAG,EAAE,0CAA0C;QAC/C,GAAG,EAAE,yCAAyC;KAC/C;IACD,kBAAkB,EAAE;QAClB,GAAG,0CAA0C;QAC7C,8BAA8B;KAC/B;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,+CAA+C,GAC1D,uCAAuC,CAAC;AAC1C,MAAM,CAAC,MAAM,8CAA8C,GACzD,sCAAsC,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { knownManifestsHeaderRefinement } from \"../knownManifestsRefinements\";\nimport {\n ContainerNotFoundErrorResponseSchema,\n ContainerWriterProjectionErrorResponseSchema,\n ContainerWriterProjectionWireResponseSchema,\n DocumentNotFoundErrorResponseSchema,\n DocumentWriterProjectionErrorResponseSchema,\n DocumentWriterProjectionWireResponseSchema,\n ErrorResponseSchema,\n isContainerWriterProjectionWireResponse,\n isDocumentWriterProjectionWireResponse,\n SessionFailureResponseSchema,\n} from \"../response\";\nimport { PrincipalHistoryPreparationResponseSchema } from \"../response/principalHistoryPreparation\";\nimport { KnownManifestsHeadersSchema } from \"../util/knownManifestWire\";\nimport { writerProjectionResponseRuntimeRefinements } from \"../writerProjectionRefinements\";\nimport { defineJsonOperation } from \"./definition\";\n\nexport const ContainerWriterProjectionPathParamsSchema = z.strictObject({\n containerId: z.string(),\n});\n\nexport const DocumentWriterProjectionPathParamsSchema = z.strictObject({\n documentId: z.string(),\n});\n\nexport type ContainerWriterProjectionPathParams = z.infer<\n typeof ContainerWriterProjectionPathParamsSchema\n>;\nexport type DocumentWriterProjectionPathParams = z.infer<\n typeof DocumentWriterProjectionPathParamsSchema\n>;\n\nexport const getContainerWriterProjectionOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: {\n 400: ErrorResponseSchema,\n 401: SessionFailureResponseSchema,\n 403: ErrorResponseSchema,\n 404: ContainerNotFoundErrorResponseSchema,\n 409: ContainerWriterProjectionErrorResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [400, 401, 403, 404, 409, 500],\n id: \"containers.writerProjection.get\",\n summary: \"Get a container writer projection\",\n description:\n \"Returns everything a client needs to read and write under a container: the signed manifests on its authorizing container path, each path level's container KEK wraps and keyring, and the key targets. Requires current read access; write authority is checked again when a write commits. A 202 asks the client to retry the identical request after the server prepares policy history, and the `x-known-manifests` header lets a client skip manifests, KEK levels and directory payloads it already holds.\",\n method: \"GET\",\n headers: KnownManifestsHeadersSchema,\n params: ContainerWriterProjectionPathParamsSchema,\n path: \"/containers/{containerId}/writer-projection\",\n responses: {\n 200: ContainerWriterProjectionWireResponseSchema,\n 202: PrincipalHistoryPreparationResponseSchema,\n },\n runtimeRefinements: [\n ...writerProjectionResponseRuntimeRefinements,\n knownManifestsHeaderRefinement,\n ],\n});\n\nexport const getDocumentWriterProjectionOperation = defineJsonOperation({\n auth: \"session\",\n failureResponses: {\n 400: ErrorResponseSchema,\n 401: SessionFailureResponseSchema,\n 403: ErrorResponseSchema,\n 404: DocumentNotFoundErrorResponseSchema,\n 409: DocumentWriterProjectionErrorResponseSchema,\n 500: ErrorResponseSchema,\n },\n failureStatuses: [400, 401, 403, 404, 409, 500],\n id: \"documents.writerProjection.get\",\n summary: \"Get a document writer projection\",\n description:\n \"Returns everything a client needs to read and write a document: its document link-set manifest history, the authorizing container paths with their KEK wraps and keyrings, and the key targets. Requires current read access; write authority is checked again when a write commits. A vanished container is reported as 409, never 404, because 404 here means the document itself was deleted.\",\n method: \"GET\",\n headers: KnownManifestsHeadersSchema,\n params: DocumentWriterProjectionPathParamsSchema,\n path: \"/documents/{documentId}/writer-projection\",\n responses: {\n 200: DocumentWriterProjectionWireResponseSchema,\n 202: PrincipalHistoryPreparationResponseSchema,\n },\n runtimeRefinements: [\n ...writerProjectionResponseRuntimeRefinements,\n knownManifestsHeaderRefinement,\n ],\n});\n\nexport const isGetContainerWriterProjectionOperationResponse =\n isContainerWriterProjectionWireResponse;\nexport const isGetDocumentWriterProjectionOperationResponse =\n isDocumentWriterProjectionWireResponse;\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { type ChallengeErrorResponse, ChallengeErrorResponseSchema, type ChallengeResponse, ChallengeResponseSchema, type DestroySessionResponse, DestroySessionResponseSchema, isChallengeErrorResponse, isChallengeResponse, isDestroySessionResponse, isListSessionsResponse, isSessionRefreshRequiredFailure, isUserIdentityResponse, isUserSessionResponse, isVerifyResponse, isWebSocketTicketResponse, type ListSessionsResponse, ListSessionsResponseSchema, SESSION_ERROR_CODES, type SessionErrorCode, SessionErrorCodeSchema, type SessionFailureResponse, SessionFailureResponseSchema, type UserIdentityResponse, UserIdentityResponseSchema, type UserSessionResponse, UserSessionResponseSchema, VERIFY_ERROR_CODES, type VerifyFailureResponse, VerifyFailureResponseSchema, type VerifyResponse, type VerifySuccessResponse, VerifySuccessResponseSchema, type WebSocketTicketResponse, WebSocketTicketResponseSchema, } from "../auth/index.js";
|
|
2
|
-
export { isRegistrationResponse, type RegistrationResponse, RegistrationResponseSchema, } from "../registration.js";
|
|
2
|
+
export { isRegistrationResponse, type RegistrationResponse, RegistrationResponseSchema, registrationCommitCheckpointRefinements, } from "../registration.js";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { ChallengeErrorResponseSchema, ChallengeResponseSchema, DestroySessionResponseSchema, isChallengeErrorResponse, isChallengeResponse, isDestroySessionResponse, isListSessionsResponse, isSessionRefreshRequiredFailure, isUserIdentityResponse, isUserSessionResponse, isVerifyResponse, isWebSocketTicketResponse, ListSessionsResponseSchema, SESSION_ERROR_CODES, SessionErrorCodeSchema, SessionFailureResponseSchema, UserIdentityResponseSchema, UserSessionResponseSchema, VERIFY_ERROR_CODES, VerifyFailureResponseSchema, VerifySuccessResponseSchema, WebSocketTicketResponseSchema, } from "../auth/index.js";
|
|
2
|
-
export { isRegistrationResponse, RegistrationResponseSchema, } from "../registration.js";
|
|
2
|
+
export { isRegistrationResponse, RegistrationResponseSchema, registrationCommitCheckpointRefinements, } from "../registration.js";
|
|
3
3
|
//# sourceMappingURL=auth.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,4BAA4B,EAE5B,uBAAuB,EAEvB,4BAA4B,EAC5B,wBAAwB,EACxB,mBAAmB,EACnB,wBAAwB,EACxB,sBAAsB,EACtB,+BAA+B,EAC/B,sBAAsB,EACtB,qBAAqB,EACrB,gBAAgB,EAChB,yBAAyB,EAEzB,0BAA0B,EAC1B,mBAAmB,EAEnB,sBAAsB,EAEtB,4BAA4B,EAE5B,0BAA0B,EAE1B,yBAAyB,EACzB,kBAAkB,EAElB,2BAA2B,EAG3B,2BAA2B,EAE3B,6BAA6B,GAC9B,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,sBAAsB,EAEtB,0BAA0B,
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,4BAA4B,EAE5B,uBAAuB,EAEvB,4BAA4B,EAC5B,wBAAwB,EACxB,mBAAmB,EACnB,wBAAwB,EACxB,sBAAsB,EACtB,+BAA+B,EAC/B,sBAAsB,EACtB,qBAAqB,EACrB,gBAAgB,EAChB,yBAAyB,EAEzB,0BAA0B,EAC1B,mBAAmB,EAEnB,sBAAsB,EAEtB,4BAA4B,EAE5B,0BAA0B,EAE1B,yBAAyB,EACzB,kBAAkB,EAElB,2BAA2B,EAG3B,2BAA2B,EAE3B,6BAA6B,GAC9B,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,sBAAsB,EAEtB,0BAA0B,EAC1B,uCAAuC,GACxC,MAAM,iBAAiB,CAAC","sourcesContent":["export {\n type ChallengeErrorResponse,\n ChallengeErrorResponseSchema,\n type ChallengeResponse,\n ChallengeResponseSchema,\n type DestroySessionResponse,\n DestroySessionResponseSchema,\n isChallengeErrorResponse,\n isChallengeResponse,\n isDestroySessionResponse,\n isListSessionsResponse,\n isSessionRefreshRequiredFailure,\n isUserIdentityResponse,\n isUserSessionResponse,\n isVerifyResponse,\n isWebSocketTicketResponse,\n type ListSessionsResponse,\n ListSessionsResponseSchema,\n SESSION_ERROR_CODES,\n type SessionErrorCode,\n SessionErrorCodeSchema,\n type SessionFailureResponse,\n SessionFailureResponseSchema,\n type UserIdentityResponse,\n UserIdentityResponseSchema,\n type UserSessionResponse,\n UserSessionResponseSchema,\n VERIFY_ERROR_CODES,\n type VerifyFailureResponse,\n VerifyFailureResponseSchema,\n type VerifyResponse,\n type VerifySuccessResponse,\n VerifySuccessResponseSchema,\n type WebSocketTicketResponse,\n WebSocketTicketResponseSchema,\n} from \"../auth\";\nexport {\n isRegistrationResponse,\n type RegistrationResponse,\n RegistrationResponseSchema,\n registrationCommitCheckpointRefinements,\n} from \"../registration\";\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
export type { HeldDirectoryPayloads } from "../policyEvidenceWire.js";
|
|
1
2
|
export { CommitOrganizationGroupPolicyConflictResponseSchema, type CommitOrganizationGroupPolicyResponse, CommitOrganizationGroupPolicyResponseSchema, type CurrentPrincipalMemberEnvelopesResponse, CurrentPrincipalMemberEnvelopesResponseSchema, isCommitOrganizationGroupPolicyResponse, isCurrentPrincipalMemberEnvelopesResponse, isPrincipalPolicyBundleResponse, isPrincipalPolicyMutationResponse, isPrincipalPolicyStaleErrorResponse, isPrincipalPolicyStateChainEntryResponse, isPrincipalStatePayloadResponse, isPrincipalStateResponse, type PrincipalContainerGrantResponse, PrincipalContainerGrantResponseSchema, type PrincipalMemberEnvelopeResponse, PrincipalMemberEnvelopeResponseSchema, type PrincipalPolicyBundleResponse, PrincipalPolicyBundleResponseSchema, type PrincipalPolicyErrorResponse, PrincipalPolicyErrorResponseSchema, type PrincipalPolicyMutationResponse, PrincipalPolicyMutationResponseSchema, type PrincipalPolicySnapshotResponse, PrincipalPolicySnapshotResponseSchema, type PrincipalPolicyStaleErrorResponse, PrincipalPolicyStaleErrorResponseSchema, type PrincipalPolicyStateChainEntryResponse, PrincipalPolicyStateChainEntryResponseSchema, type PrincipalProjectionMemberResponse, PrincipalProjectionMemberResponseSchema, type PrincipalStateExternalAuthorityResponse, PrincipalStateExternalAuthorityResponseSchema, type PrincipalStatePayloadResponse, PrincipalStatePayloadResponseSchema, type PrincipalStateResponse, PrincipalStateResponseSchema, } from "../principal.js";
|
|
2
3
|
export { isPrincipalPolicyPageResponse, isPrincipalPolicyUnchangedResponse, type PrincipalPolicyPageResponse, PrincipalPolicyPageResponseSchema, type PrincipalPolicyReadResponse, PrincipalPolicyReadResponseSchema, type PrincipalPolicyUnchangedResponse, PrincipalPolicyUnchangedResponseSchema, } from "../principalPolicyPage.js";
|
|
3
4
|
export { isPrincipalPolicySnapshotPage, isPrincipalPolicySnapshotPageResponse, type PrincipalPolicyHistorySourceResponse, PrincipalPolicyHistorySourceResponseSchema, type PrincipalPolicySnapshotPage, type PrincipalPolicySnapshotPageResponse, PrincipalPolicySnapshotPageResponseSchema, } from "../principalPolicySnapshotPage.js";
|
|
4
5
|
export { isReferencedPrincipalStateResponse, type ReferencedPrincipalStateResponse, ReferencedPrincipalStateResponseSchema, } from "../principalReference.js";
|
|
5
|
-
export { type ProjectionPolicyEvidenceResponse, ProjectionPolicyEvidenceResponseSchema, } from "../projectionPolicyEvidence.js";
|
|
6
|
+
export { type ProjectionPolicyEvidenceResponse, ProjectionPolicyEvidenceResponseSchema, type ProjectionPolicyEvidenceWireResponse, ProjectionPolicyEvidenceWireResponseSchema, } from "../projectionPolicyEvidence.js";
|
|
@@ -2,5 +2,5 @@ export { CommitOrganizationGroupPolicyConflictResponseSchema, CommitOrganization
|
|
|
2
2
|
export { isPrincipalPolicyPageResponse, isPrincipalPolicyUnchangedResponse, PrincipalPolicyPageResponseSchema, PrincipalPolicyReadResponseSchema, PrincipalPolicyUnchangedResponseSchema, } from "../principalPolicyPage.js";
|
|
3
3
|
export { isPrincipalPolicySnapshotPage, isPrincipalPolicySnapshotPageResponse, PrincipalPolicyHistorySourceResponseSchema, PrincipalPolicySnapshotPageResponseSchema, } from "../principalPolicySnapshotPage.js";
|
|
4
4
|
export { isReferencedPrincipalStateResponse, ReferencedPrincipalStateResponseSchema, } from "../principalReference.js";
|
|
5
|
-
export { ProjectionPolicyEvidenceResponseSchema, } from "../projectionPolicyEvidence.js";
|
|
5
|
+
export { ProjectionPolicyEvidenceResponseSchema, ProjectionPolicyEvidenceWireResponseSchema, } from "../projectionPolicyEvidence.js";
|
|
6
6
|
//# sourceMappingURL=principals.js.map
|