was-teaching-server 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1432 -0
- package/LICENSE +661 -0
- package/README.md +305 -0
- package/common/css/materialize.1.0.0.min.css +13 -0
- package/dist/auth-header-hooks.d.ts +84 -0
- package/dist/auth-header-hooks.d.ts.map +1 -0
- package/dist/auth-header-hooks.js +136 -0
- package/dist/auth-header-hooks.js.map +1 -0
- package/dist/authorize.d.ts +45 -0
- package/dist/authorize.d.ts.map +1 -0
- package/dist/authorize.js +76 -0
- package/dist/authorize.js.map +1 -0
- package/dist/backends/filesystem.d.ts +1179 -0
- package/dist/backends/filesystem.d.ts.map +1 -0
- package/dist/backends/filesystem.js +2727 -0
- package/dist/backends/filesystem.js.map +1 -0
- package/dist/backends/postgres.d.ts +833 -0
- package/dist/backends/postgres.d.ts.map +1 -0
- package/dist/backends/postgres.js +2164 -0
- package/dist/backends/postgres.js.map +1 -0
- package/dist/backends/postgresSchema.d.ts +36 -0
- package/dist/backends/postgresSchema.d.ts.map +1 -0
- package/dist/backends/postgresSchema.js +203 -0
- package/dist/backends/postgresSchema.js.map +1 -0
- package/dist/config.default.d.ts +360 -0
- package/dist/config.default.d.ts.map +1 -0
- package/dist/config.default.js +493 -0
- package/dist/config.default.js.map +1 -0
- package/dist/corsProxy.d.ts +45 -0
- package/dist/corsProxy.d.ts.map +1 -0
- package/dist/corsProxy.js +278 -0
- package/dist/corsProxy.js.map +1 -0
- package/dist/digest.d.ts +45 -0
- package/dist/digest.d.ts.map +1 -0
- package/dist/digest.js +174 -0
- package/dist/digest.js.map +1 -0
- package/dist/errors.d.ts +654 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +960 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/atomicFile.d.ts +61 -0
- package/dist/lib/atomicFile.d.ts.map +1 -0
- package/dist/lib/atomicFile.js +150 -0
- package/dist/lib/atomicFile.js.map +1 -0
- package/dist/lib/backendRegistry.d.ts +59 -0
- package/dist/lib/backendRegistry.d.ts.map +1 -0
- package/dist/lib/backendRegistry.js +92 -0
- package/dist/lib/backendRegistry.js.map +1 -0
- package/dist/lib/backendUsage.d.ts +28 -0
- package/dist/lib/backendUsage.d.ts.map +1 -0
- package/dist/lib/backendUsage.js +55 -0
- package/dist/lib/backendUsage.js.map +1 -0
- package/dist/lib/backends.d.ts +142 -0
- package/dist/lib/backends.d.ts.map +1 -0
- package/dist/lib/backends.js +272 -0
- package/dist/lib/backends.js.map +1 -0
- package/dist/lib/blindedIndex.d.ts +156 -0
- package/dist/lib/blindedIndex.d.ts.map +1 -0
- package/dist/lib/blindedIndex.js +338 -0
- package/dist/lib/blindedIndex.js.map +1 -0
- package/dist/lib/collectionDescription.d.ts +33 -0
- package/dist/lib/collectionDescription.d.ts.map +1 -0
- package/dist/lib/collectionDescription.js +21 -0
- package/dist/lib/collectionDescription.js.map +1 -0
- package/dist/lib/cursor.d.ts +18 -0
- package/dist/lib/cursor.d.ts.map +1 -0
- package/dist/lib/cursor.js +50 -0
- package/dist/lib/cursor.js.map +1 -0
- package/dist/lib/edvEnvelope.d.ts +50 -0
- package/dist/lib/edvEnvelope.d.ts.map +1 -0
- package/dist/lib/edvEnvelope.js +106 -0
- package/dist/lib/edvEnvelope.js.map +1 -0
- package/dist/lib/encryption.d.ts +192 -0
- package/dist/lib/encryption.d.ts.map +1 -0
- package/dist/lib/encryption.js +383 -0
- package/dist/lib/encryption.js.map +1 -0
- package/dist/lib/etag.d.ts +33 -0
- package/dist/lib/etag.d.ts.map +1 -0
- package/dist/lib/etag.js +36 -0
- package/dist/lib/etag.js.map +1 -0
- package/dist/lib/exportManifest.d.ts +29 -0
- package/dist/lib/exportManifest.d.ts.map +1 -0
- package/dist/lib/exportManifest.js +77 -0
- package/dist/lib/exportManifest.js.map +1 -0
- package/dist/lib/importTar.d.ts +81 -0
- package/dist/lib/importTar.d.ts.map +1 -0
- package/dist/lib/importTar.js +301 -0
- package/dist/lib/importTar.js.map +1 -0
- package/dist/lib/isJson.d.ts +16 -0
- package/dist/lib/isJson.d.ts.map +1 -0
- package/dist/lib/isJson.js +17 -0
- package/dist/lib/isJson.js.map +1 -0
- package/dist/lib/keyEpoch.d.ts +38 -0
- package/dist/lib/keyEpoch.d.ts.map +1 -0
- package/dist/lib/keyEpoch.js +75 -0
- package/dist/lib/keyEpoch.js.map +1 -0
- package/dist/lib/keyedMutex.d.ts +28 -0
- package/dist/lib/keyedMutex.d.ts.map +1 -0
- package/dist/lib/keyedMutex.js +45 -0
- package/dist/lib/keyedMutex.js.map +1 -0
- package/dist/lib/kmsModule.d.ts +62 -0
- package/dist/lib/kmsModule.d.ts.map +1 -0
- package/dist/lib/kmsModule.js +327 -0
- package/dist/lib/kmsModule.js.map +1 -0
- package/dist/lib/kmsRecordCipher.d.ts +82 -0
- package/dist/lib/kmsRecordCipher.d.ts.map +1 -0
- package/dist/lib/kmsRecordCipher.js +226 -0
- package/dist/lib/kmsRecordCipher.js.map +1 -0
- package/dist/lib/pagination.d.ts +19 -0
- package/dist/lib/pagination.d.ts.map +1 -0
- package/dist/lib/pagination.js +21 -0
- package/dist/lib/pagination.js.map +1 -0
- package/dist/lib/paths.d.ts +273 -0
- package/dist/lib/paths.d.ts.map +1 -0
- package/dist/lib/paths.js +270 -0
- package/dist/lib/paths.js.map +1 -0
- package/dist/lib/preconditions.d.ts +65 -0
- package/dist/lib/preconditions.d.ts.map +1 -0
- package/dist/lib/preconditions.js +112 -0
- package/dist/lib/preconditions.js.map +1 -0
- package/dist/lib/resourceFileName.d.ts +41 -0
- package/dist/lib/resourceFileName.d.ts.map +1 -0
- package/dist/lib/resourceFileName.js +58 -0
- package/dist/lib/resourceFileName.js.map +1 -0
- package/dist/lib/revocations.d.ts +49 -0
- package/dist/lib/revocations.d.ts.map +1 -0
- package/dist/lib/revocations.js +86 -0
- package/dist/lib/revocations.js.map +1 -0
- package/dist/lib/validateDid.d.ts +19 -0
- package/dist/lib/validateDid.d.ts.map +1 -0
- package/dist/lib/validateDid.js +35 -0
- package/dist/lib/validateDid.js.map +1 -0
- package/dist/lib/validateId.d.ts +66 -0
- package/dist/lib/validateId.d.ts.map +1 -0
- package/dist/lib/validateId.js +126 -0
- package/dist/lib/validateId.js.map +1 -0
- package/dist/plugin.d.ts +115 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +134 -0
- package/dist/plugin.js.map +1 -0
- package/dist/policy.d.ts +78 -0
- package/dist/policy.d.ts.map +1 -0
- package/dist/policy.js +115 -0
- package/dist/policy.js.map +1 -0
- package/dist/provisioning.d.ts +38 -0
- package/dist/provisioning.d.ts.map +1 -0
- package/dist/provisioning.js +72 -0
- package/dist/provisioning.js.map +1 -0
- package/dist/requests/BackendRequest.d.ts +61 -0
- package/dist/requests/BackendRequest.d.ts.map +1 -0
- package/dist/requests/BackendRequest.js +152 -0
- package/dist/requests/BackendRequest.js.map +1 -0
- package/dist/requests/CollectionRequest.d.ts +234 -0
- package/dist/requests/CollectionRequest.d.ts.map +1 -0
- package/dist/requests/CollectionRequest.js +705 -0
- package/dist/requests/CollectionRequest.js.map +1 -0
- package/dist/requests/KeyRequest.d.ts +115 -0
- package/dist/requests/KeyRequest.d.ts.map +1 -0
- package/dist/requests/KeyRequest.js +468 -0
- package/dist/requests/KeyRequest.js.map +1 -0
- package/dist/requests/KeystoreRequest.d.ts +99 -0
- package/dist/requests/KeystoreRequest.d.ts.map +1 -0
- package/dist/requests/KeystoreRequest.js +247 -0
- package/dist/requests/KeystoreRequest.js.map +1 -0
- package/dist/requests/PolicyRequest.d.ts +53 -0
- package/dist/requests/PolicyRequest.d.ts.map +1 -0
- package/dist/requests/PolicyRequest.js +124 -0
- package/dist/requests/PolicyRequest.js.map +1 -0
- package/dist/requests/ResourceRequest.d.ts +134 -0
- package/dist/requests/ResourceRequest.d.ts.map +1 -0
- package/dist/requests/ResourceRequest.js +548 -0
- package/dist/requests/ResourceRequest.js.map +1 -0
- package/dist/requests/RevocationRequest.d.ts +67 -0
- package/dist/requests/RevocationRequest.d.ts.map +1 -0
- package/dist/requests/RevocationRequest.js +187 -0
- package/dist/requests/RevocationRequest.js.map +1 -0
- package/dist/requests/SpaceRequest.d.ts +204 -0
- package/dist/requests/SpaceRequest.d.ts.map +1 -0
- package/dist/requests/SpaceRequest.js +520 -0
- package/dist/requests/SpaceRequest.js.map +1 -0
- package/dist/requests/SpacesRepositoryRequest.d.ts +50 -0
- package/dist/requests/SpacesRepositoryRequest.d.ts.map +1 -0
- package/dist/requests/SpacesRepositoryRequest.js +159 -0
- package/dist/requests/SpacesRepositoryRequest.js.map +1 -0
- package/dist/requests/collectionContext.d.ts +21 -0
- package/dist/requests/collectionContext.d.ts.map +1 -0
- package/dist/requests/collectionContext.js +30 -0
- package/dist/requests/collectionContext.js.map +1 -0
- package/dist/requests/controllerConsent.d.ts +58 -0
- package/dist/requests/controllerConsent.d.ts.map +1 -0
- package/dist/requests/controllerConsent.js +73 -0
- package/dist/requests/controllerConsent.js.map +1 -0
- package/dist/requests/keystoreContext.d.ts +68 -0
- package/dist/requests/keystoreContext.d.ts.map +1 -0
- package/dist/requests/keystoreContext.js +87 -0
- package/dist/requests/keystoreContext.js.map +1 -0
- package/dist/requests/resourceInput.d.ts +19 -0
- package/dist/requests/resourceInput.d.ts.map +1 -0
- package/dist/requests/resourceInput.js +102 -0
- package/dist/requests/resourceInput.js.map +1 -0
- package/dist/requests/spaceContext.d.ts +127 -0
- package/dist/requests/spaceContext.d.ts.map +1 -0
- package/dist/requests/spaceContext.js +201 -0
- package/dist/requests/spaceContext.js.map +1 -0
- package/dist/routes.d.ts +55 -0
- package/dist/routes.d.ts.map +1 -0
- package/dist/routes.js +306 -0
- package/dist/routes.js.map +1 -0
- package/dist/server.d.ts +20 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +60 -0
- package/dist/server.js.map +1 -0
- package/dist/start.d.ts +7 -0
- package/dist/start.d.ts.map +1 -0
- package/dist/start.js +61 -0
- package/dist/start.js.map +1 -0
- package/dist/storage.d.ts +29 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +47 -0
- package/dist/storage.js.map +1 -0
- package/dist/types.d.ts +915 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/views/home.hbs +9 -0
- package/dist/views/templates/main.hbs +12 -0
- package/dist/zcap.d.ts +267 -0
- package/dist/zcap.d.ts.map +1 -0
- package/dist/zcap.js +478 -0
- package/dist/zcap.js.map +1 -0
- package/package.json +109 -0
- package/src/auth-header-hooks.ts +163 -0
- package/src/authorize.ts +117 -0
- package/src/backends/filesystem.ts +3626 -0
- package/src/backends/postgres.ts +3073 -0
- package/src/backends/postgresSchema.ts +231 -0
- package/src/config.default.ts +657 -0
- package/src/corsProxy.ts +326 -0
- package/src/declarations.d.ts +28 -0
- package/src/digest.ts +223 -0
- package/src/errors.ts +1122 -0
- package/src/index.ts +21 -0
- package/src/lib/atomicFile.ts +176 -0
- package/src/lib/backendRegistry.ts +139 -0
- package/src/lib/backendUsage.ts +79 -0
- package/src/lib/backends.ts +351 -0
- package/src/lib/blindedIndex.ts +466 -0
- package/src/lib/collectionDescription.ts +43 -0
- package/src/lib/cursor.ts +52 -0
- package/src/lib/edvEnvelope.ts +120 -0
- package/src/lib/encryption.ts +472 -0
- package/src/lib/etag.ts +40 -0
- package/src/lib/exportManifest.ts +115 -0
- package/src/lib/importTar.ts +381 -0
- package/src/lib/isJson.ts +18 -0
- package/src/lib/keyEpoch.ts +89 -0
- package/src/lib/keyedMutex.ts +45 -0
- package/src/lib/kmsModule.ts +451 -0
- package/src/lib/kmsRecordCipher.ts +292 -0
- package/src/lib/pagination.ts +22 -0
- package/src/lib/paths.ts +382 -0
- package/src/lib/preconditions.ts +145 -0
- package/src/lib/resourceFileName.ts +69 -0
- package/src/lib/revocations.ts +116 -0
- package/src/lib/validateDid.ts +41 -0
- package/src/lib/validateId.ts +148 -0
- package/src/plugin.ts +288 -0
- package/src/policy.ts +176 -0
- package/src/provisioning.ts +98 -0
- package/src/requests/BackendRequest.ts +219 -0
- package/src/requests/CollectionRequest.ts +899 -0
- package/src/requests/KeyRequest.ts +617 -0
- package/src/requests/KeystoreRequest.ts +325 -0
- package/src/requests/PolicyRequest.ts +169 -0
- package/src/requests/ResourceRequest.ts +649 -0
- package/src/requests/RevocationRequest.ts +267 -0
- package/src/requests/SpaceRequest.ts +686 -0
- package/src/requests/SpacesRepositoryRequest.ts +194 -0
- package/src/requests/collectionContext.ts +41 -0
- package/src/requests/controllerConsent.ts +108 -0
- package/src/requests/keystoreContext.ts +124 -0
- package/src/requests/resourceInput.ts +118 -0
- package/src/requests/spaceContext.ts +311 -0
- package/src/routes.ts +420 -0
- package/src/server.ts +69 -0
- package/src/start.ts +71 -0
- package/src/storage.ts +60 -0
- package/src/types.ts +1016 -0
- package/src/views/home.hbs +9 -0
- package/src/views/templates/main.hbs +12 -0
- package/src/zcap.ts +657 -0
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,654 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom error classes (each carries type / title / detail / statusCode) plus
|
|
3
|
+
* handleError, the Fastify error handler installed by each route group.
|
|
4
|
+
*/
|
|
5
|
+
import type { FastifyReply, FastifyRequest } from 'fastify';
|
|
6
|
+
import { type ProblemType, type Problem } from '@interop/storage-core';
|
|
7
|
+
export type { Problem };
|
|
8
|
+
/**
|
|
9
|
+
* Base class for the server's error hierarchy. Carries the four
|
|
10
|
+
* `application/problem+json` fields (`type` / `title` / `detail` /
|
|
11
|
+
* `statusCode`) plus an optional `problems` array of `{ detail, pointer }`
|
|
12
|
+
* entries; `handleError` serializes these to the wire. Subclasses set their
|
|
13
|
+
* distinguishing values via `super({ ... })`.
|
|
14
|
+
* @param options {object}
|
|
15
|
+
* @param options.type {ProblemType} problem-kind URI (see @interop/storage-core)
|
|
16
|
+
* @param options.title {string} short human-readable summary
|
|
17
|
+
* @param options.detail {string} specific explanation of the occurrence
|
|
18
|
+
* @param options.statusCode {number} HTTP status code
|
|
19
|
+
* @param [options.problems] {Problem[]} per-field error entries
|
|
20
|
+
* @param [options.cause] {Error} the underlying error, when wrapping one
|
|
21
|
+
*/
|
|
22
|
+
export declare class ProblemError extends Error {
|
|
23
|
+
type: ProblemType;
|
|
24
|
+
title: string;
|
|
25
|
+
detail: string;
|
|
26
|
+
statusCode: number;
|
|
27
|
+
problems?: Problem[];
|
|
28
|
+
constructor({ type, title, detail, statusCode, problems, cause }: {
|
|
29
|
+
type: ProblemType;
|
|
30
|
+
title: string;
|
|
31
|
+
detail: string;
|
|
32
|
+
statusCode: number;
|
|
33
|
+
problems?: Problem[];
|
|
34
|
+
cause?: Error;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* 404 — the requested Space does not exist, or the caller is not authorized.
|
|
39
|
+
* @param options {object}
|
|
40
|
+
* @param [options.requestName] {string} request name used in the error title
|
|
41
|
+
*/
|
|
42
|
+
export declare class SpaceNotFoundError extends ProblemError {
|
|
43
|
+
constructor({ requestName }?: {
|
|
44
|
+
requestName?: string;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* 400 — the provided space id is not URL-safe / otherwise invalid.
|
|
49
|
+
* @param options {object}
|
|
50
|
+
* @param [options.requestName] {string} request name used in the error title
|
|
51
|
+
*/
|
|
52
|
+
export declare class InvalidSpaceIdError extends ProblemError {
|
|
53
|
+
constructor({ requestName }?: {
|
|
54
|
+
requestName?: string;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* 400 — the provided collection id is not URL-safe / otherwise invalid.
|
|
59
|
+
* @param options {object}
|
|
60
|
+
* @param [options.requestName] {string} request name used in the error title
|
|
61
|
+
*/
|
|
62
|
+
export declare class InvalidCollectionIdError extends ProblemError {
|
|
63
|
+
constructor({ requestName }?: {
|
|
64
|
+
requestName?: string;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* 400 — the provided resource id is not URL-safe / otherwise invalid.
|
|
69
|
+
* @param options {object}
|
|
70
|
+
* @param [options.requestName] {string} request name used in the error title
|
|
71
|
+
*/
|
|
72
|
+
export declare class InvalidResourceIdError extends ProblemError {
|
|
73
|
+
constructor({ requestName }?: {
|
|
74
|
+
requestName?: string;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* 409 — a `POST` create operation supplied an `id` that already exists.
|
|
79
|
+
* Create-or-replace at a client-chosen id is the idempotent `PUT` path, which
|
|
80
|
+
* does not conflict.
|
|
81
|
+
* @param options {object}
|
|
82
|
+
* @param options.kind {string} what was being created ('Space', 'Collection',
|
|
83
|
+
* 'Resource'), used in the error title and detail
|
|
84
|
+
*/
|
|
85
|
+
export declare class IdConflictError extends ProblemError {
|
|
86
|
+
constructor({ kind }: {
|
|
87
|
+
kind: string;
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* 409 — a Resource write carries an `indexed` blinded attribute marked
|
|
92
|
+
* `unique: true` whose (HMAC key id, name, value) triple is already claimed by
|
|
93
|
+
* another live Resource in the same Collection (the EDV unique-attribute
|
|
94
|
+
* invariant, enforced by backends carrying the `blinded-index-query` feature).
|
|
95
|
+
* Reuses the `id-conflict` problem type (like the WebKMS conflicts): a unique
|
|
96
|
+
* blinded attribute is a client-chosen identifier-like claim, and the registry
|
|
97
|
+
* defines no more specific kind. Only ever observable by a caller already
|
|
98
|
+
* authorized to write the target.
|
|
99
|
+
*/
|
|
100
|
+
export declare class UniqueAttributeConflictError extends ProblemError {
|
|
101
|
+
constructor();
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* 409 — a client-supplied id collides with a segment from the spec's Reserved
|
|
105
|
+
* Path Segment Registry: the id would shadow the reserved route at that
|
|
106
|
+
* position (e.g. a Collection named `export` would shadow
|
|
107
|
+
* `/space/{id}/export`).
|
|
108
|
+
* @param options {object}
|
|
109
|
+
* @param options.kind {string} which id position collided ('collection',
|
|
110
|
+
* 'resource'), used in the error title and detail
|
|
111
|
+
* @param options.id {string} the offending reserved id
|
|
112
|
+
*/
|
|
113
|
+
export declare class ReservedIdError extends ProblemError {
|
|
114
|
+
constructor({ kind, id }: {
|
|
115
|
+
kind: string;
|
|
116
|
+
id: string;
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* 409 — a backend reference cannot be honored. Three occurrences, distinguished
|
|
121
|
+
* by `detail` / `pointer`: a Collection create/update names a `backend` id not in
|
|
122
|
+
* the Space's backends-available list (the default `#/backend` detail); a
|
|
123
|
+
* registration names a `provider` the server does not permit (the allowlist gate,
|
|
124
|
+
* `#/provider`); or a selected backend is registered but has no live adapter yet
|
|
125
|
+
* (the resolver's data-plane backstop). Spec `unsupported-backend`.
|
|
126
|
+
* @param options {object}
|
|
127
|
+
* @param options.backendId {string} the unrecognized backend (or provider) id
|
|
128
|
+
* @param [options.detail] {string} a specific explanation; defaults to the
|
|
129
|
+
* backends-available message
|
|
130
|
+
* @param [options.pointer] {string} RFC 6901 JSON Pointer to the offending
|
|
131
|
+
* field; defaults to `#/backend`
|
|
132
|
+
*/
|
|
133
|
+
export declare class UnsupportedBackendError extends ProblemError {
|
|
134
|
+
constructor({ backendId, detail, pointer }: {
|
|
135
|
+
backendId: string;
|
|
136
|
+
detail?: string;
|
|
137
|
+
pointer?: string;
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* 409 — a Collection update tried to change or clear an existing client-side
|
|
142
|
+
* `encryption` marker. The marker is set-once (spec): declaring it on a
|
|
143
|
+
* Collection that lacks one is allowed, but changing its scheme (or clearing
|
|
144
|
+
* it) on a populated Collection would corrupt the stored, client-encrypted
|
|
145
|
+
* Resources. Like the other state-conflict 409s (`id-conflict`,
|
|
146
|
+
* `unsupported-backend`), it is only observable by a caller already authorized
|
|
147
|
+
* to update the Collection -- it is checked after capability verification.
|
|
148
|
+
*/
|
|
149
|
+
export declare class EncryptionImmutableError extends ProblemError {
|
|
150
|
+
constructor();
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* 400 — a Collection create/update supplied an `encryption` marker naming a
|
|
154
|
+
* `scheme` this server does not recognize and therefore cannot enforce on write.
|
|
155
|
+
* Taking the spec's fail-closed SHOULD path ("Encryption Scheme Registry"), the
|
|
156
|
+
* reference server rejects such a marker rather than storing it opaquely, so
|
|
157
|
+
* every accepted marker is one whose non-conforming (e.g. plaintext) writes it
|
|
158
|
+
* will reject. A pure body-shape rejection, checked before capability
|
|
159
|
+
* verification like the other `invalid`-shaped 400s.
|
|
160
|
+
* @param options {object}
|
|
161
|
+
* @param options.scheme {string} the unrecognized scheme token
|
|
162
|
+
*/
|
|
163
|
+
export declare class UnsupportedEncryptionSchemeError extends ProblemError {
|
|
164
|
+
constructor({ scheme }: {
|
|
165
|
+
scheme: string;
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* 422 — a content write into a Collection whose `encryption` marker declares a
|
|
170
|
+
* recognized scheme did not conform to that scheme's envelope profile: the
|
|
171
|
+
* request `Content-Type` was not the scheme's registered media type, or the body
|
|
172
|
+
* was not a structurally valid envelope (spec "Encryption Scheme Registry"). The
|
|
173
|
+
* server validates structure only and never decrypts. Like the write-time 409s
|
|
174
|
+
* (`id-conflict`, `encryption-immutable`), it is only ever observable by a caller
|
|
175
|
+
* already authorized to write the target -- it is checked after capability
|
|
176
|
+
* verification, so an under-authorized caller receives the privacy-merged
|
|
177
|
+
* `not-found` (404) instead.
|
|
178
|
+
* @param options {object}
|
|
179
|
+
* @param [options.detail] {string} which gate failed (media type vs envelope shape)
|
|
180
|
+
*/
|
|
181
|
+
export declare class EncryptionSchemeMismatchError extends ProblemError {
|
|
182
|
+
constructor({ detail }?: {
|
|
183
|
+
detail?: string;
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* 412 — a conditional write's `If-Match` / `If-None-Match` precondition
|
|
188
|
+
* evaluated false: the Resource's current `ETag` did not match, or a
|
|
189
|
+
* create-if-absent (`If-None-Match: *`) target already exists. Header-driven
|
|
190
|
+
* and deliberately distinct from the 409 conflict kinds (`id-conflict`,
|
|
191
|
+
* `reserved-id`, `unsupported-backend`). A `412` is only ever observable by a
|
|
192
|
+
* caller already authorized to write the target -- the request layer checks
|
|
193
|
+
* authorization before the backend evaluates the precondition.
|
|
194
|
+
* @param options {object}
|
|
195
|
+
* @param [options.detail] {string} a specific explanation of the mismatch
|
|
196
|
+
* @param [options.requestName] {string} request name used in the error title
|
|
197
|
+
*/
|
|
198
|
+
export declare class PreconditionFailedError extends ProblemError {
|
|
199
|
+
constructor({ detail, requestName }?: {
|
|
200
|
+
detail?: string;
|
|
201
|
+
requestName?: string;
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* 400 — a pagination `cursor` query parameter is malformed or can no longer be
|
|
206
|
+
* honored (not valid base64url, not JSON, or missing its keyset position; spec
|
|
207
|
+
* `invalid-cursor`). Like `precondition-failed`, it is only ever observable by a
|
|
208
|
+
* caller already authorized to list the target -- the request layer checks
|
|
209
|
+
* authorization before the backend validates the cursor, so an under-authorized
|
|
210
|
+
* caller receives the privacy-merged `not-found` (404) instead.
|
|
211
|
+
* @param options {object}
|
|
212
|
+
* @param [options.detail] {string} a specific explanation of the failure
|
|
213
|
+
* @param [options.cause] {Error} the underlying parse error, when wrapping one
|
|
214
|
+
*/
|
|
215
|
+
export declare class InvalidCursorError extends ProblemError {
|
|
216
|
+
constructor({ detail, cause }?: {
|
|
217
|
+
detail?: string;
|
|
218
|
+
cause?: Error;
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* 400 — the Collection Description request body is missing or invalid.
|
|
223
|
+
*/
|
|
224
|
+
export declare class InvalidCollectionError extends ProblemError {
|
|
225
|
+
constructor();
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* 404 — the requested Collection does not exist, or the caller is not
|
|
229
|
+
* authorized.
|
|
230
|
+
* @param options {object}
|
|
231
|
+
* @param [options.requestName] {string} request name used in the error title
|
|
232
|
+
*/
|
|
233
|
+
export declare class CollectionNotFoundError extends ProblemError {
|
|
234
|
+
constructor({ requestName }?: {
|
|
235
|
+
requestName?: string;
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* 404 — the requested Resource does not exist, or the caller is not authorized.
|
|
240
|
+
* @param options {object}
|
|
241
|
+
* @param [options.requestName] {string} request name used in the error title
|
|
242
|
+
*/
|
|
243
|
+
export declare class ResourceNotFoundError extends ProblemError {
|
|
244
|
+
constructor({ requestName }?: {
|
|
245
|
+
requestName?: string;
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* 404 — no access-control policy document is set at the requested level
|
|
250
|
+
* (reported as not-found, consistent with the privacy-merged kind).
|
|
251
|
+
* @param options {object}
|
|
252
|
+
* @param [options.requestName] {string} request name used in the error title
|
|
253
|
+
*/
|
|
254
|
+
export declare class PolicyNotFoundError extends ProblemError {
|
|
255
|
+
constructor({ requestName }?: {
|
|
256
|
+
requestName?: string;
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* 400 — the access-control policy document is missing or malformed (it must be
|
|
261
|
+
* a JSON object carrying a non-empty string `type`).
|
|
262
|
+
* @param options {object}
|
|
263
|
+
* @param [options.requestName] {string} request name used in the error title
|
|
264
|
+
*/
|
|
265
|
+
export declare class InvalidPolicyError extends ProblemError {
|
|
266
|
+
constructor({ requestName }?: {
|
|
267
|
+
requestName?: string;
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* 404 — capability invocation did not verify (reported as not-found so as not
|
|
272
|
+
* to leak resource existence).
|
|
273
|
+
* @param options {object}
|
|
274
|
+
* @param options.requestName {string} request name used in the error title
|
|
275
|
+
*/
|
|
276
|
+
export declare class UnauthorizedError extends ProblemError {
|
|
277
|
+
constructor({ requestName }: {
|
|
278
|
+
requestName?: string;
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* 401 — required `Authorization` / `Capability-Invocation` headers are missing.
|
|
283
|
+
*/
|
|
284
|
+
export declare class MissingAuthError extends ProblemError {
|
|
285
|
+
constructor();
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* 403 — provisioning (creating Spaces or keystores) is refused by the server's
|
|
289
|
+
* configured provisioning policy (`authorizeProvisioning` returned `deny`).
|
|
290
|
+
* There is no dedicated `forbidden` problem type in `@interop/storage-core`, so
|
|
291
|
+
* this deliberately reuses `MISSING_AUTHORIZATION`.
|
|
292
|
+
*/
|
|
293
|
+
export declare class ProvisioningNotAuthorizedError extends ProblemError {
|
|
294
|
+
constructor();
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* 401 — the server requires an onboarding token to provision, but the request
|
|
298
|
+
* carried no `Authorization: Bearer <token>` header.
|
|
299
|
+
*/
|
|
300
|
+
export declare class MissingOnboardingTokenError extends ProblemError {
|
|
301
|
+
constructor();
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* 403 — the onboarding token presented in the `Authorization: Bearer` header
|
|
305
|
+
* did not match the configured token.
|
|
306
|
+
*/
|
|
307
|
+
export declare class InvalidOnboardingTokenError extends ProblemError {
|
|
308
|
+
constructor();
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* 400 — the `Authorization` header did not include a `keyId` parameter.
|
|
312
|
+
*/
|
|
313
|
+
export declare class MissingKeyIdError extends ProblemError {
|
|
314
|
+
constructor();
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* 400 — failed to parse the `Authorization`, `Capability-Invocation`, or
|
|
318
|
+
* `Digest` headers.
|
|
319
|
+
* @param options {object}
|
|
320
|
+
* @param options.cause {Error} the underlying parse error
|
|
321
|
+
*/
|
|
322
|
+
export declare class AuthHeaderParseError extends ProblemError {
|
|
323
|
+
constructor({ cause }: {
|
|
324
|
+
cause: Error;
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* 400 — the `Digest` header is missing, malformed, not covered by the request
|
|
329
|
+
* signature, or does not match the received body (spec "Request Body
|
|
330
|
+
* Integrity"). All of these are reported as `invalid-authorization-header`.
|
|
331
|
+
* @param options {object}
|
|
332
|
+
* @param options.detail {string} which of the digest conditions failed
|
|
333
|
+
* @param [options.cause] {Error} the underlying error, when wrapping one
|
|
334
|
+
*/
|
|
335
|
+
export declare class InvalidDigestError extends ProblemError {
|
|
336
|
+
constructor({ detail, cause }: {
|
|
337
|
+
detail: string;
|
|
338
|
+
cause?: Error;
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* 400 — an error was thrown while verifying the authorization headers.
|
|
343
|
+
* @param options {object}
|
|
344
|
+
* @param options.requestName {string} request name used in the error title
|
|
345
|
+
* @param options.cause {Error} the underlying verification error
|
|
346
|
+
*/
|
|
347
|
+
export declare class AuthVerificationError extends ProblemError {
|
|
348
|
+
constructor({ requestName, cause }: {
|
|
349
|
+
requestName: string;
|
|
350
|
+
cause: Error;
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* 400 — the `controller` field is present but is not a syntactically valid
|
|
355
|
+
* `did:key` DID (the only DID method this server accepts). Caught at the request
|
|
356
|
+
* layer so a malformed controller is rejected on the way in rather than failing
|
|
357
|
+
* later, at capability-verification time.
|
|
358
|
+
* @param options {object}
|
|
359
|
+
* @param [options.requestName] {string} request name used in the error title
|
|
360
|
+
*/
|
|
361
|
+
export declare class InvalidControllerError extends ProblemError {
|
|
362
|
+
constructor({ requestName }?: {
|
|
363
|
+
requestName?: string;
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* 400 — the capability invocation on a Create Space request (via POST or
|
|
368
|
+
* create-via-PUT) is not *authorized by* the `controller` in the request body:
|
|
369
|
+
* it is neither signed directly by that DID nor accompanied by a delegation
|
|
370
|
+
* chain rooted in it.
|
|
371
|
+
* @param options {object}
|
|
372
|
+
* @param options.zcapSigningDid {string} DID that signed the invocation
|
|
373
|
+
* @param options.controller {string} controller DID supplied in the body
|
|
374
|
+
* @param [options.cause] {Error} the underlying chain-verification failure,
|
|
375
|
+
* for a delegated invocation rejected at verification time
|
|
376
|
+
*/
|
|
377
|
+
export declare class SpaceControllerMismatchError extends ProblemError {
|
|
378
|
+
constructor({ zcapSigningDid, controller, cause }: {
|
|
379
|
+
zcapSigningDid: string;
|
|
380
|
+
controller: string;
|
|
381
|
+
cause?: Error;
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* 500 — an underlying storage operation failed. The client-visible `title` /
|
|
386
|
+
* `detail` are deliberately generic: the underlying `cause` can carry
|
|
387
|
+
* server-internal specifics (filesystem paths, errnos, SQL) and is logged
|
|
388
|
+
* server-side by `handleError`, never serialized to the wire.
|
|
389
|
+
* @param options {object}
|
|
390
|
+
* @param options.cause {Error} the underlying storage error
|
|
391
|
+
* @param [options.requestName] {string} request name used in the error title
|
|
392
|
+
*/
|
|
393
|
+
export declare class StorageError extends ProblemError {
|
|
394
|
+
constructor({ cause, requestName }: {
|
|
395
|
+
cause: Error;
|
|
396
|
+
requestName?: string;
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* 500 — an at-rest WebKMS key record could not be decrypted (its KEK is not
|
|
401
|
+
* registered, or the ciphertext failed to authenticate). A server-side
|
|
402
|
+
* misconfiguration of `KMS_RECORD_KEK`, never a client error; `handleError`
|
|
403
|
+
* logs the underlying `cause`.
|
|
404
|
+
* @param options {object}
|
|
405
|
+
* @param options.cause {Error} the underlying cipher error
|
|
406
|
+
* @param [options.requestName] {string} request name used in the error title
|
|
407
|
+
*/
|
|
408
|
+
export declare class KmsRecordCipherError extends ProblemError {
|
|
409
|
+
constructor({ cause, requestName }: {
|
|
410
|
+
cause: Error;
|
|
411
|
+
requestName?: string;
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Rethrows a structured failure from a storage call unchanged (any
|
|
416
|
+
* `ProblemError`, e.g. a 507 quota-exceeded raised by the backend), preserving
|
|
417
|
+
* its status code; wraps anything else -- a genuinely unexpected fault -- as a
|
|
418
|
+
* 500 `StorageError`. For use in request handlers' catch blocks around storage
|
|
419
|
+
* operations.
|
|
420
|
+
* @param options {object}
|
|
421
|
+
* @param options.err {unknown} the caught error
|
|
422
|
+
* @param [options.requestName] {string} request name used in the error title
|
|
423
|
+
* @returns {never}
|
|
424
|
+
*/
|
|
425
|
+
export declare function rethrowOrWrapStorageError({ err, requestName }: {
|
|
426
|
+
err: unknown;
|
|
427
|
+
requestName?: string;
|
|
428
|
+
}): never;
|
|
429
|
+
/**
|
|
430
|
+
* 507 — a write was rejected because the target backend's per-Space storage
|
|
431
|
+
* quota is exhausted (spec "Quotas"). Distinct from `payload-too-large` (413),
|
|
432
|
+
* which is a per-request upload-size limit rather than a cumulative one.
|
|
433
|
+
* @param options {object}
|
|
434
|
+
* @param options.spaceId {string} the Space whose quota is exhausted
|
|
435
|
+
* @param options.capacityBytes {number} the configured per-Space limit
|
|
436
|
+
* @param [options.requestName] {string} request name used in the error title
|
|
437
|
+
*/
|
|
438
|
+
export declare class QuotaExceededError extends ProblemError {
|
|
439
|
+
constructor({ spaceId, capacityBytes, requestName }: {
|
|
440
|
+
spaceId: string;
|
|
441
|
+
capacityBytes: number;
|
|
442
|
+
requestName?: string;
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* 507 — a create was rejected because a default-on count quota is exhausted:
|
|
447
|
+
* too many Spaces for one controller, too many Collections in a Space, or too
|
|
448
|
+
* many live Resources in a Space. Distinct from `QuotaExceededError` (also 507),
|
|
449
|
+
* which caps cumulative bytes rather than item counts; both reuse the spec's
|
|
450
|
+
* `quota-exceeded` problem type (there is no count-specific slug). Only the
|
|
451
|
+
* create path trips this -- overwriting an existing item never does.
|
|
452
|
+
* @param options {object}
|
|
453
|
+
* @param options.scope {string} short phrase naming the exhausted count (e.g.
|
|
454
|
+
* `'Spaces per controller'`, `'Collections per Space'`,
|
|
455
|
+
* `'Resources per Space'`), used in the detail message
|
|
456
|
+
* @param options.limit {number} the configured maximum count
|
|
457
|
+
*/
|
|
458
|
+
export declare class CountQuotaExceededError extends ProblemError {
|
|
459
|
+
constructor({ scope, limit }: {
|
|
460
|
+
scope: string;
|
|
461
|
+
limit: number;
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* 413 — an upload exceeds the target backend's per-request `maxUploadBytes`
|
|
466
|
+
* constraint. Distinct from `quota-exceeded` (507): this limit is per-request,
|
|
467
|
+
* not cumulative, so smaller uploads may still succeed.
|
|
468
|
+
* @param options {object}
|
|
469
|
+
* @param options.maxUploadBytes {number} the backend's per-upload limit
|
|
470
|
+
* @param options.backendId {string} the backend enforcing the limit
|
|
471
|
+
* @param [options.uploadBytes] {number} the upload's size, when known up
|
|
472
|
+
* front (a streamed upload without a Content-Length only reveals the
|
|
473
|
+
* overflow, not the total)
|
|
474
|
+
*/
|
|
475
|
+
export declare class PayloadTooLargeError extends ProblemError {
|
|
476
|
+
constructor({ maxUploadBytes, backendId, uploadBytes }: {
|
|
477
|
+
maxUploadBytes: number;
|
|
478
|
+
backendId: string;
|
|
479
|
+
uploadBytes?: number;
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* 400 — a required field of the request body is missing or invalid.
|
|
484
|
+
* @param options {object}
|
|
485
|
+
* @param [options.requestName] {string} request name used in the error title
|
|
486
|
+
* @param [options.detail] {string} specific detail describing the problem
|
|
487
|
+
* @param [options.pointer] {string} RFC 6901 JSON Pointer (`#/field` form)
|
|
488
|
+
* to the offending body field
|
|
489
|
+
*/
|
|
490
|
+
export declare class InvalidRequestBodyError extends ProblemError {
|
|
491
|
+
constructor({ requestName, detail, pointer }?: {
|
|
492
|
+
requestName?: string;
|
|
493
|
+
detail?: string;
|
|
494
|
+
pointer?: string;
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* 400 — the request is missing a required `Content-Type` header.
|
|
499
|
+
* @param options {object}
|
|
500
|
+
* @param [options.requestName] {string} request name used in the error title
|
|
501
|
+
*/
|
|
502
|
+
export declare class MissingContentTypeError extends ProblemError {
|
|
503
|
+
constructor({ requestName }?: {
|
|
504
|
+
requestName?: string;
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* 501 — the server does not implement this OPTIONAL operation (e.g. updating
|
|
509
|
+
* Resource Metadata, which is not yet supported).
|
|
510
|
+
* @param options {object}
|
|
511
|
+
* @param [options.requestName] {string} request name used in the error title
|
|
512
|
+
*/
|
|
513
|
+
export declare class UnsupportedOperationError extends ProblemError {
|
|
514
|
+
constructor({ requestName }?: {
|
|
515
|
+
requestName?: string;
|
|
516
|
+
});
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* 400 — the uploaded archive is not a valid WAS space export.
|
|
520
|
+
* @param options {object}
|
|
521
|
+
* @param [options.message] {string} detail message describing the problem
|
|
522
|
+
* @param [options.cause] {Error} the underlying error, when wrapping one
|
|
523
|
+
*/
|
|
524
|
+
export declare class InvalidImportError extends ProblemError {
|
|
525
|
+
constructor({ message, cause }?: {
|
|
526
|
+
message?: string;
|
|
527
|
+
cause?: Error;
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* 404 — the requested keystore does not exist, or the caller is not
|
|
532
|
+
* authorized (the WAS existence-masking convention, kept for consistency
|
|
533
|
+
* within this server).
|
|
534
|
+
* @param options {object}
|
|
535
|
+
* @param [options.requestName] {string} request name used in the error title
|
|
536
|
+
*/
|
|
537
|
+
export declare class KeystoreNotFoundError extends ProblemError {
|
|
538
|
+
constructor({ requestName }?: {
|
|
539
|
+
requestName?: string;
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* 400 — the capability invocation on a Create Keystore request is not
|
|
544
|
+
* *authorized by* the `controller` in the request body: it is neither signed
|
|
545
|
+
* directly by that DID nor accompanied by a delegation chain rooted in it.
|
|
546
|
+
* The keystore-creation bootstrap rule, mirroring Create Space.
|
|
547
|
+
* @param options {object}
|
|
548
|
+
* @param options.zcapSigningDid {string} DID that signed the invocation
|
|
549
|
+
* @param options.controller {string} controller DID supplied in the body
|
|
550
|
+
* @param [options.cause] {Error} the underlying chain-verification failure,
|
|
551
|
+
* for a delegated invocation rejected at verification time
|
|
552
|
+
*/
|
|
553
|
+
export declare class KeystoreControllerMismatchError extends ProblemError {
|
|
554
|
+
constructor({ zcapSigningDid, controller, cause }: {
|
|
555
|
+
zcapSigningDid: string;
|
|
556
|
+
controller: string;
|
|
557
|
+
cause?: Error;
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* 409 — a keystore config update could not be applied: the supplied `sequence`
|
|
562
|
+
* is not exactly the stored sequence + 1, or the immutable `kmsModule` does
|
|
563
|
+
* not match. One merged conflict kind; the client distinguishes only the 409
|
|
564
|
+
* status.
|
|
565
|
+
* `ID_CONFLICT` is the nearest WAS problem kind (a 409 state conflict on an
|
|
566
|
+
* identified record) -- the webkms protocol has no type registry of its own.
|
|
567
|
+
*/
|
|
568
|
+
export declare class KeystoreStateConflictError extends ProblemError {
|
|
569
|
+
constructor();
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* 404 — the requested KMS-held key does not exist, or the caller is not
|
|
573
|
+
* authorized (the same existence-masking as `KeystoreNotFoundError`).
|
|
574
|
+
* @param options {object}
|
|
575
|
+
* @param [options.requestName] {string} request name used in the error title
|
|
576
|
+
*/
|
|
577
|
+
export declare class KeyNotFoundError extends ProblemError {
|
|
578
|
+
constructor({ requestName }?: {
|
|
579
|
+
requestName?: string;
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* 409 — a key record already exists at `(keystoreId, localId)`. Key local ids
|
|
584
|
+
* are server-generated 128-bit random values, so this is effectively
|
|
585
|
+
* unreachable through the API; the storage layer still enforces insert-once
|
|
586
|
+
* semantics (a unique-index insert), and
|
|
587
|
+
* `@interop/webkms-client` maps a 409 on generate to its `DuplicateError`.
|
|
588
|
+
*/
|
|
589
|
+
export declare class KeyIdConflictError extends ProblemError {
|
|
590
|
+
constructor();
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* 400 — a well-formed key operation names an operation this KMS does not serve
|
|
594
|
+
* for the key's type (e.g. `VerifyOperation` on an asymmetric key -- custody
|
|
595
|
+
* is the criterion: asymmetric verify needs only the public key and is
|
|
596
|
+
* client-local), or an operation type it does not recognize at all. A clean
|
|
597
|
+
* 400.
|
|
598
|
+
* @param options {object}
|
|
599
|
+
* @param options.operationType {string} the operation envelope's `type`
|
|
600
|
+
* @param [options.keyType] {string} the target key's type, when known
|
|
601
|
+
*/
|
|
602
|
+
export declare class UnsupportedKeyOperationError extends ProblemError {
|
|
603
|
+
constructor({ operationType, keyType }: {
|
|
604
|
+
operationType: string;
|
|
605
|
+
keyType?: string;
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* 400 — a submitted zcap revocation cannot be accepted: the body is not a
|
|
610
|
+
* revocable delegated capability (root zcaps cannot be revoked), its id does
|
|
611
|
+
* not match the revocation URL, its chain does not root in the keystore being
|
|
612
|
+
* posted to, or its delegation chain fails verification (a chain containing
|
|
613
|
+
* an already-revoked capability included -- resubmitting a stored revocation
|
|
614
|
+
* therefore lands here, per ezcap-express's `authorizeZcapRevocation`; the
|
|
615
|
+
* 409 duplicate is reserved for a write race at the store).
|
|
616
|
+
* @param options {object}
|
|
617
|
+
* @param options.detail {string} which of the revocation conditions failed
|
|
618
|
+
* @param [options.cause] {Error} the underlying chain-verification failure
|
|
619
|
+
*/
|
|
620
|
+
export declare class InvalidRevocationError extends ProblemError {
|
|
621
|
+
constructor({ detail, cause }: {
|
|
622
|
+
detail: string;
|
|
623
|
+
cause?: Error;
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* 409 — a revocation record already exists at `(delegator, capabilityId)`
|
|
628
|
+
* (`@interop/webkms-client` maps a 409 to its `DuplicateError`). Reached only
|
|
629
|
+
* on a concurrent-submission race:
|
|
630
|
+
* a sequential resubmission fails the chain verification first (the chain now
|
|
631
|
+
* contains a revoked capability) and is the 400 `InvalidRevocationError`.
|
|
632
|
+
*/
|
|
633
|
+
export declare class DuplicateRevocationError extends ProblemError {
|
|
634
|
+
constructor();
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* Fastify error handler installed by each route group. Serializes the error to
|
|
638
|
+
* an `application/problem+json` response using its `type` / `title` / `detail`
|
|
639
|
+
* (or `problems`), defaulting to a 500 internal error when no statusCode is
|
|
640
|
+
* present. The spec requires `type` and `title`, so both always fall back to a
|
|
641
|
+
* sensible value.
|
|
642
|
+
* @param error {Error & { statusCode?: number, type?: string, title?: string, detail?: string, problems?: Problem[] }}
|
|
643
|
+
* @param request {import('fastify').FastifyRequest}
|
|
644
|
+
* @param reply {import('fastify').FastifyReply}
|
|
645
|
+
* @returns {Promise<FastifyReply>}
|
|
646
|
+
*/
|
|
647
|
+
export declare function handleError(error: Error & {
|
|
648
|
+
statusCode?: number;
|
|
649
|
+
type?: string;
|
|
650
|
+
title?: string;
|
|
651
|
+
detail?: string;
|
|
652
|
+
problems?: Problem[];
|
|
653
|
+
}, request: FastifyRequest, reply: FastifyReply): Promise<FastifyReply>;
|
|
654
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
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