@sebastienrousseau/crypto-server 0.0.39 → 0.0.40
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/dist/config/openapi.d.ts +65 -0
- package/dist/config/openapi.d.ts.map +1 -0
- package/dist/config/openapi.js +84 -0
- package/dist/lib/lifecycle.d.ts.map +1 -1
- package/dist/lib/lifecycle.js +2 -1
- package/dist/lib/problem.d.ts +32 -0
- package/dist/lib/problem.d.ts.map +1 -1
- package/dist/lib/problem.js +45 -7
- package/dist/routes/index.d.ts.map +1 -1
- package/dist/routes/index.js +2 -0
- package/dist/routes/probes.d.ts +26 -0
- package/dist/routes/probes.d.ts.map +1 -1
- package/dist/routes/probes.js +79 -3
- package/dist/routes/v1/decrypt.d.ts.map +1 -1
- package/dist/routes/v1/decrypt.js +3 -2
- package/dist/routes/v1/encrypt.d.ts.map +1 -1
- package/dist/routes/v1/encrypt.js +7 -3
- package/dist/routes/v1/generate.d.ts.map +1 -1
- package/dist/routes/v1/generate.js +3 -2
- package/dist/routes/v1/index.d.ts.map +1 -1
- package/dist/routes/v1/index.js +27 -1
- package/dist/routes/v1/revoke.d.ts.map +1 -1
- package/dist/routes/v1/revoke.js +3 -2
- package/dist/routes/v1/verify.d.ts.map +1 -1
- package/dist/routes/v1/verify.js +3 -2
- package/dist/routes/v2/algorithms.d.ts.map +1 -1
- package/dist/routes/v2/algorithms.js +13 -0
- package/dist/routes/v2/compliance.d.ts.map +1 -1
- package/dist/routes/v2/compliance.js +98 -23
- package/dist/routes/v2/encrypt.d.ts.map +1 -1
- package/dist/routes/v2/encrypt.js +6 -0
- package/dist/routes/v2/hash.d.ts.map +1 -1
- package/dist/routes/v2/hash.js +6 -0
- package/dist/routes/v2/hpke.d.ts.map +1 -1
- package/dist/routes/v2/hpke.js +11 -0
- package/dist/routes/v2/kdf.d.ts.map +1 -1
- package/dist/routes/v2/kdf.js +7 -0
- package/dist/routes/v2/key-wrap.d.ts.map +1 -1
- package/dist/routes/v2/key-wrap.js +9 -2
- package/dist/routes/v2/keys.d.ts.map +1 -1
- package/dist/routes/v2/keys.js +47 -0
- package/dist/routes/v2/kms-responses.d.ts +61 -0
- package/dist/routes/v2/kms-responses.d.ts.map +1 -0
- package/dist/routes/v2/kms-responses.js +79 -0
- package/dist/routes/v2/kms.d.ts.map +1 -1
- package/dist/routes/v2/kms.js +7 -0
- package/dist/routes/v2/mac.d.ts.map +1 -1
- package/dist/routes/v2/mac.js +7 -0
- package/dist/routes/v2/multi-recipient.d.ts.map +1 -1
- package/dist/routes/v2/multi-recipient.js +21 -0
- package/dist/routes/v2/opaque.d.ts.map +1 -1
- package/dist/routes/v2/opaque.js +24 -0
- package/dist/routes/v2/password-encrypt.d.ts.map +1 -1
- package/dist/routes/v2/password-encrypt.js +6 -0
- package/dist/routes/v2/password.d.ts.map +1 -1
- package/dist/routes/v2/password.js +18 -0
- package/dist/routes/v2/pq-hash-sign.d.ts.map +1 -1
- package/dist/routes/v2/pq-hash-sign.js +12 -1
- package/dist/routes/v2/pq-sign.d.ts.map +1 -1
- package/dist/routes/v2/pq-sign.js +12 -1
- package/dist/routes/v2/pq.d.ts.map +1 -1
- package/dist/routes/v2/pq.js +33 -1
- package/dist/routes/v2/sealedbox.d.ts.map +1 -1
- package/dist/routes/v2/sealedbox.js +10 -0
- package/dist/routes/v2/secretbox.d.ts.map +1 -1
- package/dist/routes/v2/secretbox.js +6 -0
- package/dist/routes/v2/signing.d.ts.map +1 -1
- package/dist/routes/v2/signing.js +10 -0
- package/dist/routes/v2/stream-schemas.d.ts +70 -0
- package/dist/routes/v2/stream-schemas.d.ts.map +1 -1
- package/dist/routes/v2/stream-schemas.js +55 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +11 -16
- package/dist/utils/keys.d.ts +1 -0
- package/dist/utils/keys.d.ts.map +1 -1
- package/dist/utils/keys.js +4 -0
- package/dist/utils/response-schemas.d.ts +92 -0
- package/dist/utils/response-schemas.d.ts.map +1 -0
- package/dist/utils/response-schemas.js +111 -0
- package/package.json +23 -21
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { FastifySchema } from "fastify";
|
|
2
|
+
import type { SwaggerTransformObject } from "@fastify/swagger";
|
|
3
|
+
export declare const SECURITY_SCHEMES: {
|
|
4
|
+
readonly apiKey: {
|
|
5
|
+
readonly type: "apiKey";
|
|
6
|
+
readonly name: "x-api-key";
|
|
7
|
+
readonly in: "header";
|
|
8
|
+
readonly description: "The static key in CRYPTO_API_KEY. It holds crypto:admin, which grants every scope except crypto:keys:export.";
|
|
9
|
+
};
|
|
10
|
+
readonly bearerAuth: {
|
|
11
|
+
readonly type: "http";
|
|
12
|
+
readonly scheme: "bearer";
|
|
13
|
+
readonly bearerFormat: "JWT";
|
|
14
|
+
readonly description: "An HS256 JWT signed with JWT_SECRET. Claims: sub (required; not api-key or anonymous), iat and exp (required; lifetime at most JWT_MAX_AGE seconds, default 3600), iss and aud (when JWT_ISSUER and JWT_AUDIENCE are set, as production requires), scopes (array of scope strings). Tried first when the Authorization header carries a Bearer token.";
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export type Requirement = Record<string, string[]>;
|
|
18
|
+
export declare const OPENAPI_DOCUMENT: {
|
|
19
|
+
openapi: string;
|
|
20
|
+
info: {
|
|
21
|
+
title: string;
|
|
22
|
+
description: string;
|
|
23
|
+
license: {
|
|
24
|
+
name: string;
|
|
25
|
+
identifier: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
components: {
|
|
29
|
+
securitySchemes: {
|
|
30
|
+
readonly apiKey: {
|
|
31
|
+
readonly type: "apiKey";
|
|
32
|
+
readonly name: "x-api-key";
|
|
33
|
+
readonly in: "header";
|
|
34
|
+
readonly description: "The static key in CRYPTO_API_KEY. It holds crypto:admin, which grants every scope except crypto:keys:export.";
|
|
35
|
+
};
|
|
36
|
+
readonly bearerAuth: {
|
|
37
|
+
readonly type: "http";
|
|
38
|
+
readonly scheme: "bearer";
|
|
39
|
+
readonly bearerFormat: "JWT";
|
|
40
|
+
readonly description: "An HS256 JWT signed with JWT_SECRET. Claims: sub (required; not api-key or anonymous), iat and exp (required; lifetime at most JWT_MAX_AGE seconds, default 3600), iss and aud (when JWT_ISSUER and JWT_AUDIENCE are set, as production requires), scopes (array of scope strings). Tried first when the Authorization header carries a Bearer token.";
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
security: Requirement[];
|
|
45
|
+
};
|
|
46
|
+
export interface OperationSecurity {
|
|
47
|
+
security: Requirement[];
|
|
48
|
+
"x-required-scopes"?: string[];
|
|
49
|
+
}
|
|
50
|
+
export declare function operationSecurity(method: string, url: string): OperationSecurity;
|
|
51
|
+
export declare function operationId(method: string, url: string): string;
|
|
52
|
+
export declare function withEncodings(value: unknown): unknown;
|
|
53
|
+
export declare const documentObject: SwaggerTransformObject;
|
|
54
|
+
export interface DocumentedRoute {
|
|
55
|
+
schema?: FastifySchema;
|
|
56
|
+
url: string;
|
|
57
|
+
route: {
|
|
58
|
+
method: string | string[];
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export declare function documentRoute({ schema, url, route }: DocumentedRoute): {
|
|
62
|
+
schema: FastifySchema;
|
|
63
|
+
url: string;
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=openapi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../../src/config/openapi.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAK/D,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;CAenB,CAAC;AAGX,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;AAMnD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;CAU5B,CAAC;AAGF,MAAM,WAAW,iBAAiB;IAEhC,QAAQ,EAAE,WAAW,EAAE,CAAC;IAExB,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;CAChC;AAUD,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,GACV,iBAAiB,CAYnB;AAMD,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAI/D;AAgBD,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAQrD;AAGD,eAAO,MAAM,cAAc,EAAE,sBAGY,CAAC;AAG1C,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE,CAAC;CACtC;AAOD,wBAAgB,aAAa,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,eAAe,GAAG;IACtE,MAAM,EAAE,aAAa,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;CACb,CAUA"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.documentObject = exports.OPENAPI_DOCUMENT = exports.SECURITY_SCHEMES = void 0;
|
|
4
|
+
exports.operationSecurity = operationSecurity;
|
|
5
|
+
exports.operationId = operationId;
|
|
6
|
+
exports.withEncodings = withEncodings;
|
|
7
|
+
exports.documentRoute = documentRoute;
|
|
8
|
+
const auth_policy_1 = require("./auth-policy");
|
|
9
|
+
const auth_1 = require("../lib/auth");
|
|
10
|
+
const response_schemas_1 = require("../utils/response-schemas");
|
|
11
|
+
exports.SECURITY_SCHEMES = {
|
|
12
|
+
apiKey: {
|
|
13
|
+
type: "apiKey",
|
|
14
|
+
name: "x-api-key",
|
|
15
|
+
in: "header",
|
|
16
|
+
description: "The static key in CRYPTO_API_KEY. It holds crypto:admin, which grants every scope except crypto:keys:export.",
|
|
17
|
+
},
|
|
18
|
+
bearerAuth: {
|
|
19
|
+
type: "http",
|
|
20
|
+
scheme: "bearer",
|
|
21
|
+
bearerFormat: "JWT",
|
|
22
|
+
description: "An HS256 JWT signed with JWT_SECRET. Claims: sub (required; not api-key or anonymous), iat and exp (required; lifetime at most JWT_MAX_AGE seconds, default 3600), iss and aud (when JWT_ISSUER and JWT_AUDIENCE are set, as production requires), scopes (array of scope strings). Tried first when the Authorization header carries a Bearer token.",
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
const ANY_CREDENTIAL = [{ apiKey: [] }, { bearerAuth: [] }];
|
|
26
|
+
exports.OPENAPI_DOCUMENT = {
|
|
27
|
+
openapi: "3.1.0",
|
|
28
|
+
info: {
|
|
29
|
+
title: "Crypto Service Suite API",
|
|
30
|
+
description: "REST API for low-level cryptographic operations: key generation, encryption, decryption, signing, verification, and revocation. Every error is an RFC 9457 problem (application/problem+json) whose type is urn:crypto-service:problem:<slug>. Each operation lists the scope it requires in x-required-scopes; with ALLOW_ANONYMOUS=1 and no credential configured, the server accepts requests without credentials.",
|
|
31
|
+
license: { name: "Apache-2.0 OR MIT", identifier: "Apache-2.0 OR MIT" },
|
|
32
|
+
},
|
|
33
|
+
components: { securitySchemes: exports.SECURITY_SCHEMES },
|
|
34
|
+
security: ANY_CREDENTIAL,
|
|
35
|
+
};
|
|
36
|
+
function operationSecurity(method, url) {
|
|
37
|
+
if ((0, auth_policy_1.isPublicRoute)(url))
|
|
38
|
+
return { security: [] };
|
|
39
|
+
const required = (0, auth_policy_1.routeRequirement)(method, url);
|
|
40
|
+
if (required === auth_policy_1.AUTHENTICATED) {
|
|
41
|
+
return { security: ANY_CREDENTIAL, "x-required-scopes": [] };
|
|
42
|
+
}
|
|
43
|
+
const bearer = { bearerAuth: [required] };
|
|
44
|
+
const explicit = auth_1.EXPLICIT_SCOPES.includes(required);
|
|
45
|
+
return {
|
|
46
|
+
security: explicit ? [bearer] : [{ apiKey: [] }, bearer],
|
|
47
|
+
"x-required-scopes": [required],
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function operationId(method, url) {
|
|
51
|
+
const words = url.split(/[^A-Za-z0-9]+/).filter(Boolean);
|
|
52
|
+
const pascal = words.map((w) => w[0].toUpperCase() + w.slice(1)).join("");
|
|
53
|
+
return `${method.toLowerCase()}${pascal || "Root"}`;
|
|
54
|
+
}
|
|
55
|
+
function encodingOf(schema) {
|
|
56
|
+
if (schema["pattern"] === response_schemas_1.HEX_PATTERN)
|
|
57
|
+
return "base16";
|
|
58
|
+
if (schema["format"] === "byte")
|
|
59
|
+
return "base64";
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
function withEncodings(value) {
|
|
63
|
+
if (Array.isArray(value))
|
|
64
|
+
return value.map(withEncodings);
|
|
65
|
+
if (value === null || typeof value !== "object")
|
|
66
|
+
return value;
|
|
67
|
+
const copy = Object.fromEntries(Object.entries(value).map(([k, v]) => [k, withEncodings(v)]));
|
|
68
|
+
const encoding = encodingOf(copy);
|
|
69
|
+
return encoding === undefined ? copy : { ...copy, contentEncoding: encoding };
|
|
70
|
+
}
|
|
71
|
+
const documentObject = (document) => withEncodings(document.openapiObject);
|
|
72
|
+
exports.documentObject = documentObject;
|
|
73
|
+
function documentRoute({ schema, url, route }) {
|
|
74
|
+
const method = [].concat(route.method)[0];
|
|
75
|
+
return {
|
|
76
|
+
url,
|
|
77
|
+
schema: {
|
|
78
|
+
...schema,
|
|
79
|
+
operationId: operationId(method, url),
|
|
80
|
+
...operationSecurity(method, url),
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=openapi.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../src/lib/lifecycle.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../src/lib/lifecycle.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAKnC,MAAM,WAAW,eAAe;IAE9B,SAAS,EAAE,MAAM,CAAC;IAElB,GAAG,EAAE,MAAM,CAAC;IAEZ,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAE7B,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAChC;AAMD,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,eAAe,GACvB,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CA2BnC;AAGD,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,eAAe,EAAE,WAAW,CAAC;IAEtE,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;IAEvB,OAAO,EAAE,YAAY,CAAC;CACvB;AAQD,wBAAsB,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,CAiB3E"}
|
package/dist/lib/lifecycle.js
CHANGED
|
@@ -36,7 +36,8 @@ async function start(options) {
|
|
|
36
36
|
const config = (0, env_1.loadConfig)(options.env);
|
|
37
37
|
const server = await (0, server_1.init)();
|
|
38
38
|
await server.listen({ port: config.port, host: config.host });
|
|
39
|
-
const
|
|
39
|
+
const { port } = server.addresses()[0];
|
|
40
|
+
const base = `${config.protocol}://${config.host}:${port}`;
|
|
40
41
|
options.log.info(`Server listening on ${base}/`);
|
|
41
42
|
options.log.info(`Swagger docs at ${base}/docs`);
|
|
42
43
|
const shutdown = gracefulShutdown(server, {
|
package/dist/lib/problem.d.ts
CHANGED
|
@@ -34,27 +34,59 @@ export interface Problem {
|
|
|
34
34
|
}
|
|
35
35
|
export declare const PROBLEM_SCHEMA: {
|
|
36
36
|
readonly type: "object";
|
|
37
|
+
readonly description: "RFC 9457 problem details (application/problem+json).";
|
|
38
|
+
readonly required: readonly ["type", "title", "status", "detail"];
|
|
39
|
+
readonly additionalProperties: true;
|
|
37
40
|
readonly properties: {
|
|
38
41
|
readonly type: {
|
|
39
42
|
readonly type: "string";
|
|
43
|
+
readonly pattern: "^urn:crypto-service:problem:[a-z-]+$";
|
|
44
|
+
readonly description: "Problem type, `urn:crypto-service:problem:<slug>`; stable and machine-readable.";
|
|
40
45
|
};
|
|
41
46
|
readonly title: {
|
|
42
47
|
readonly type: "string";
|
|
48
|
+
readonly description: "Summary of the problem type.";
|
|
43
49
|
};
|
|
44
50
|
readonly status: {
|
|
45
51
|
readonly type: "integer";
|
|
52
|
+
readonly description: "HTTP status code.";
|
|
46
53
|
};
|
|
47
54
|
readonly detail: {
|
|
48
55
|
readonly type: "string";
|
|
56
|
+
readonly description: "Explanation of this occurrence, safe to show the client.";
|
|
49
57
|
};
|
|
50
58
|
readonly instance: {
|
|
51
59
|
readonly type: "string";
|
|
60
|
+
readonly description: "Request path, without the query string.";
|
|
52
61
|
};
|
|
53
62
|
readonly code: {
|
|
54
63
|
readonly type: "string";
|
|
64
|
+
readonly description: "Error code from crypto-lib, the key store or a KMS provider (e.g. INVALID_HEX, KEY_NOT_FOUND).";
|
|
55
65
|
};
|
|
56
66
|
readonly errors: {
|
|
57
67
|
readonly type: "array";
|
|
68
|
+
readonly description: "Each field that failed validation (validation-failed).";
|
|
69
|
+
readonly items: {
|
|
70
|
+
readonly type: "object";
|
|
71
|
+
readonly required: readonly ["field", "message"];
|
|
72
|
+
readonly properties: {
|
|
73
|
+
readonly field: {
|
|
74
|
+
readonly type: "string";
|
|
75
|
+
readonly description: "The field, as a JSON pointer or a body field name.";
|
|
76
|
+
};
|
|
77
|
+
readonly message: {
|
|
78
|
+
readonly type: "string";
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
readonly limit: {
|
|
84
|
+
readonly type: "integer";
|
|
85
|
+
readonly description: "Requests a tenant may make per minute (tenant quota).";
|
|
86
|
+
};
|
|
87
|
+
readonly resetSeconds: {
|
|
88
|
+
readonly type: "integer";
|
|
89
|
+
readonly description: "Seconds until the tenant quota resets.";
|
|
58
90
|
};
|
|
59
91
|
};
|
|
60
92
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"problem.d.ts","sourceRoot":"","sources":["../../src/lib/problem.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAkB,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAqB,MAAM,+BAA+B,CAAC;AAQ/E,eAAO,MAAM,oBAAoB,6BAA6B,CAAC;AAG/D,eAAO,MAAM,mBAAmB,gCAAgC,CAAC;AAGjE,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;EAoBzB,CAAC;AAGH,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,cAAc,CAAC;AAGtD,MAAM,WAAW,OAAO;IAEtB,IAAI,EAAE,MAAM,CAAC;IAEb,KAAK,EAAE,MAAM,CAAC;IAEd,MAAM,EAAE,MAAM,CAAC;IAEf,MAAM,EAAE,MAAM,CAAC;IAEf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;CAC9B;
|
|
1
|
+
{"version":3,"file":"problem.d.ts","sourceRoot":"","sources":["../../src/lib/problem.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAkB,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAqB,MAAM,+BAA+B,CAAC;AAQ/E,eAAO,MAAM,oBAAoB,6BAA6B,CAAC;AAG/D,eAAO,MAAM,mBAAmB,gCAAgC,CAAC;AAGjE,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;EAoBzB,CAAC;AAGH,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,cAAc,CAAC;AAGtD,MAAM,WAAW,OAAO;IAEtB,IAAI,EAAE,MAAM,CAAC;IAEb,KAAK,EAAE,MAAM,CAAC;IAEd,MAAM,EAAE,MAAM,CAAC;IAEf,MAAM,EAAE,MAAM,CAAC;IAEf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;CAC9B;AAMD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmDjB,CAAC;AAGX,wBAAgB,OAAO,CACrB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,MAAM,EACd,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACxC,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAST;AAOD,wBAAgB,WAAW,CACzB,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,YAAY,CAGd;AAGD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGtD;AAGD,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAElE;AAgBD,MAAM,WAAW,WAAW;IAE1B,MAAM,EAAE,MAAM,CAAC;IAEf,IAAI,EAAE,WAAW,CAAC;IAElB,MAAM,EAAE,MAAM,CAAC;IAEf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC;AA0BD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAKxD;AAGD,eAAO,MAAM,IAAI,QAAO,WAKtB,CAAC;AAoEH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,CAW1D;AAOD,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,eAAe,GAAG,IAAI,CAoBlE"}
|
package/dist/lib/problem.js
CHANGED
|
@@ -37,14 +37,52 @@ exports.PROBLEM_TITLES = Object.freeze({
|
|
|
37
37
|
});
|
|
38
38
|
exports.PROBLEM_SCHEMA = {
|
|
39
39
|
type: "object",
|
|
40
|
+
description: "RFC 9457 problem details (application/problem+json).",
|
|
41
|
+
required: ["type", "title", "status", "detail"],
|
|
42
|
+
additionalProperties: true,
|
|
40
43
|
properties: {
|
|
41
|
-
type: {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
type: {
|
|
45
|
+
type: "string",
|
|
46
|
+
pattern: "^urn:crypto-service:problem:[a-z-]+$",
|
|
47
|
+
description: "Problem type, `urn:crypto-service:problem:<slug>`; stable and machine-readable.",
|
|
48
|
+
},
|
|
49
|
+
title: { type: "string", description: "Summary of the problem type." },
|
|
50
|
+
status: { type: "integer", description: "HTTP status code." },
|
|
51
|
+
detail: {
|
|
52
|
+
type: "string",
|
|
53
|
+
description: "Explanation of this occurrence, safe to show the client.",
|
|
54
|
+
},
|
|
55
|
+
instance: {
|
|
56
|
+
type: "string",
|
|
57
|
+
description: "Request path, without the query string.",
|
|
58
|
+
},
|
|
59
|
+
code: {
|
|
60
|
+
type: "string",
|
|
61
|
+
description: "Error code from crypto-lib, the key store or a KMS provider (e.g. INVALID_HEX, KEY_NOT_FOUND).",
|
|
62
|
+
},
|
|
63
|
+
errors: {
|
|
64
|
+
type: "array",
|
|
65
|
+
description: "Each field that failed validation (validation-failed).",
|
|
66
|
+
items: {
|
|
67
|
+
type: "object",
|
|
68
|
+
required: ["field", "message"],
|
|
69
|
+
properties: {
|
|
70
|
+
field: {
|
|
71
|
+
type: "string",
|
|
72
|
+
description: "The field, as a JSON pointer or a body field name.",
|
|
73
|
+
},
|
|
74
|
+
message: { type: "string" },
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
limit: {
|
|
79
|
+
type: "integer",
|
|
80
|
+
description: "Requests a tenant may make per minute (tenant quota).",
|
|
81
|
+
},
|
|
82
|
+
resetSeconds: {
|
|
83
|
+
type: "integer",
|
|
84
|
+
description: "Seconds until the tenant quota resets.",
|
|
85
|
+
},
|
|
48
86
|
},
|
|
49
87
|
};
|
|
50
88
|
function problem(status, slug, detail, extensions = {}, instance) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/routes/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/routes/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAgBnC,eAAO,MAAM,cAAc,gBAAgB,CAAC;AAG5C,eAAO,MAAM,SAAS,kCAAkC,CAAC;AAGzD,eAAO,MAAM,iBAAiB,0HACuF,CAAC;yBAGtG,KAAK,OAAO,CAAC,eAAe,KAAG,IAAI;AAAnD,wBA2BE"}
|
package/dist/routes/index.js
CHANGED
|
@@ -13,10 +13,12 @@ const verify_1 = __importDefault(require("./v1/verify"));
|
|
|
13
13
|
const v2_1 = __importDefault(require("./v2"));
|
|
14
14
|
const probes_1 = __importDefault(require("./probes"));
|
|
15
15
|
const env_1 = require("../config/env");
|
|
16
|
+
const response_schemas_1 = require("../utils/response-schemas");
|
|
16
17
|
exports.V1_DEPRECATION = "@1787270400";
|
|
17
18
|
exports.V1_SUNSET = "Fri, 01 Jan 2027 00:00:00 GMT";
|
|
18
19
|
exports.V1_MIGRATION_LINK = '<https://github.com/sebastienrousseau/crypto-service/blob/main/MIGRATION.md>; rel="deprecation"; type="text/html"';
|
|
19
20
|
exports.default = (app) => {
|
|
21
|
+
(0, response_schemas_1.addSharedSchemas)(app);
|
|
20
22
|
if ((0, env_1.v1Enabled)()) {
|
|
21
23
|
app.addHook("onSend", async (request, reply) => {
|
|
22
24
|
if (request.url.startsWith("/v1/")) {
|
package/dist/routes/probes.d.ts
CHANGED
|
@@ -1,4 +1,30 @@
|
|
|
1
1
|
import type { FastifyInstance } from "fastify";
|
|
2
|
+
export declare const HEALTH_SCHEMA: {
|
|
3
|
+
readonly tags: readonly ["Probes"];
|
|
4
|
+
readonly summary: "Health check";
|
|
5
|
+
readonly description: "Process health from fastify-healthcheck. No credentials.";
|
|
6
|
+
readonly response: {
|
|
7
|
+
readonly 200: {
|
|
8
|
+
readonly type: "object";
|
|
9
|
+
readonly description: "Healthy.";
|
|
10
|
+
readonly required: readonly ["statusCode", "status", "uptime"];
|
|
11
|
+
readonly properties: {
|
|
12
|
+
readonly statusCode: {
|
|
13
|
+
readonly type: "integer";
|
|
14
|
+
readonly enum: readonly [200];
|
|
15
|
+
};
|
|
16
|
+
readonly status: {
|
|
17
|
+
readonly type: "string";
|
|
18
|
+
readonly enum: readonly ["ok"];
|
|
19
|
+
};
|
|
20
|
+
readonly uptime: {
|
|
21
|
+
readonly type: "number";
|
|
22
|
+
readonly description: "Process uptime in seconds.";
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
2
28
|
declare const _default: (app: FastifyInstance) => void;
|
|
3
29
|
export default _default;
|
|
4
30
|
//# sourceMappingURL=probes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"probes.d.ts","sourceRoot":"","sources":["../../src/routes/probes.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"probes.d.ts","sourceRoot":"","sources":["../../src/routes/probes.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AA8B/C,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;CAiBhB,CAAC;yBAgDK,KAAK,eAAe,KAAG,IAAI;AAA3C,wBAyDE"}
|
package/dist/routes/probes.js
CHANGED
|
@@ -1,15 +1,91 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HEALTH_SCHEMA = void 0;
|
|
3
4
|
const readiness_1 = require("../lib/readiness");
|
|
5
|
+
const response_schemas_1 = require("../utils/response-schemas");
|
|
4
6
|
const startTime = Date.now();
|
|
7
|
+
const READINESS = {
|
|
8
|
+
type: "object",
|
|
9
|
+
required: ["status", "checks"],
|
|
10
|
+
properties: {
|
|
11
|
+
status: { type: "string", enum: ["ready", "not_ready"] },
|
|
12
|
+
checks: {
|
|
13
|
+
type: "object",
|
|
14
|
+
description: "Each check, true when it passes.",
|
|
15
|
+
required: ["accepting", "keyStore"],
|
|
16
|
+
properties: {
|
|
17
|
+
accepting: (0, response_schemas_1.flag)("The server is not draining for shutdown."),
|
|
18
|
+
keyStore: (0, response_schemas_1.flag)("The key directory, when configured, is writable."),
|
|
19
|
+
},
|
|
20
|
+
additionalProperties: { type: "boolean" },
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
exports.HEALTH_SCHEMA = {
|
|
25
|
+
tags: ["Probes"],
|
|
26
|
+
summary: "Health check",
|
|
27
|
+
description: "Process health from fastify-healthcheck. No credentials.",
|
|
28
|
+
response: {
|
|
29
|
+
200: {
|
|
30
|
+
type: "object",
|
|
31
|
+
description: "Healthy.",
|
|
32
|
+
required: ["statusCode", "status", "uptime"],
|
|
33
|
+
properties: {
|
|
34
|
+
statusCode: { type: "integer", enum: [200] },
|
|
35
|
+
status: { type: "string", enum: ["ok"] },
|
|
36
|
+
uptime: { type: "number", description: "Process uptime in seconds." },
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
...(0, response_schemas_1.problems)(500),
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
const LIVE_SCHEMA = {
|
|
43
|
+
tags: ["Probes"],
|
|
44
|
+
summary: "Liveness probe",
|
|
45
|
+
description: "Answers while the process is alive. No credentials.",
|
|
46
|
+
response: {
|
|
47
|
+
200: {
|
|
48
|
+
type: "object",
|
|
49
|
+
description: "The process is alive.",
|
|
50
|
+
required: ["status", "uptime"],
|
|
51
|
+
properties: {
|
|
52
|
+
status: { type: "string", enum: ["alive"] },
|
|
53
|
+
uptime: (0, response_schemas_1.integer)("Process uptime in whole seconds."),
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
...(0, response_schemas_1.problems)(500),
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
const READY_SCHEMA = {
|
|
60
|
+
tags: ["Probes"],
|
|
61
|
+
summary: "Readiness probe",
|
|
62
|
+
description: "503 while the server drains for shutdown or cannot write keys. No credentials.",
|
|
63
|
+
response: {
|
|
64
|
+
200: { ...READINESS, description: "Ready to take traffic." },
|
|
65
|
+
503: { ...READINESS, description: "Not ready; same body." },
|
|
66
|
+
...(0, response_schemas_1.problems)(500),
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
const METRICS_SCHEMA = {
|
|
70
|
+
tags: ["Probes"],
|
|
71
|
+
summary: "Prometheus metrics",
|
|
72
|
+
description: "Process gauges and per-route request counters in the Prometheus text format 0.0.4. No credentials.",
|
|
73
|
+
response: {
|
|
74
|
+
200: {
|
|
75
|
+
description: "Prometheus text exposition format.",
|
|
76
|
+
content: { "text/plain": { schema: { type: "string" } } },
|
|
77
|
+
},
|
|
78
|
+
...(0, response_schemas_1.problems)(500),
|
|
79
|
+
},
|
|
80
|
+
};
|
|
5
81
|
exports.default = (app) => {
|
|
6
|
-
app.get("/live", { schema:
|
|
82
|
+
app.get("/live", { schema: LIVE_SCHEMA }, async () => {
|
|
7
83
|
return {
|
|
8
84
|
status: "alive",
|
|
9
85
|
uptime: Math.floor((Date.now() - startTime) / 1000),
|
|
10
86
|
};
|
|
11
87
|
});
|
|
12
|
-
app.get("/ready", { schema:
|
|
88
|
+
app.get("/ready", { schema: READY_SCHEMA }, async (_request, reply) => {
|
|
13
89
|
const checks = await (0, readiness_1.readinessChecks)(app);
|
|
14
90
|
const allReady = Object.values(checks).every(Boolean);
|
|
15
91
|
return reply.status(allReady ? 200 : 503).send({
|
|
@@ -17,7 +93,7 @@ exports.default = (app) => {
|
|
|
17
93
|
checks,
|
|
18
94
|
});
|
|
19
95
|
});
|
|
20
|
-
app.get("/metrics", { schema:
|
|
96
|
+
app.get("/metrics", { schema: METRICS_SCHEMA }, async (_request, reply) => {
|
|
21
97
|
const uptime = Math.floor((Date.now() - startTime) / 1000);
|
|
22
98
|
const memUsage = process.memoryUsage();
|
|
23
99
|
const lines = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decrypt.d.ts","sourceRoot":"","sources":["../../../src/routes/v1/decrypt.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"decrypt.d.ts","sourceRoot":"","sources":["../../../src/routes/v1/decrypt.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;yBA6C/B,KAAK,eAAe,KAAG,IAAI;AAA3C,wBAkCE"}
|
|
@@ -4,6 +4,7 @@ const pgp_1 = require("@sebastienrousseau/crypto-lib/pgp");
|
|
|
4
4
|
const validation_1 = require("../../utils/validation");
|
|
5
5
|
const route_helpers_1 = require("../../utils/route-helpers");
|
|
6
6
|
const problem_1 = require("../../lib/problem");
|
|
7
|
+
const response_schemas_1 = require("../../utils/response-schemas");
|
|
7
8
|
const keys_1 = require("../../utils/keys");
|
|
8
9
|
const decryptSchema = {
|
|
9
10
|
tags: ["Encryption"],
|
|
@@ -12,6 +13,7 @@ const decryptSchema = {
|
|
|
12
13
|
description: "Decrypts a PGP message encrypted to the server's key pair (CRYPTO_KEY_DIR), unlocked with the passphrase. The API never takes a private key.",
|
|
13
14
|
response: {
|
|
14
15
|
200: {
|
|
16
|
+
description: "The decrypted message and whether its signature verified.",
|
|
15
17
|
type: "object",
|
|
16
18
|
properties: {
|
|
17
19
|
data: {
|
|
@@ -23,8 +25,7 @@ const decryptSchema = {
|
|
|
23
25
|
},
|
|
24
26
|
},
|
|
25
27
|
},
|
|
26
|
-
|
|
27
|
-
401: problem_1.PROBLEM_SCHEMA,
|
|
28
|
+
...(0, response_schemas_1.bodyProblems)(),
|
|
28
29
|
},
|
|
29
30
|
body: {
|
|
30
31
|
type: "object",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encrypt.d.ts","sourceRoot":"","sources":["../../../src/routes/v1/encrypt.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"encrypt.d.ts","sourceRoot":"","sources":["../../../src/routes/v1/encrypt.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;yBA0C/B,KAAK,eAAe,KAAG,IAAI;AAA3C,wBA+BE"}
|
|
@@ -4,6 +4,7 @@ const pgp_1 = require("@sebastienrousseau/crypto-lib/pgp");
|
|
|
4
4
|
const validation_1 = require("../../utils/validation");
|
|
5
5
|
const route_helpers_1 = require("../../utils/route-helpers");
|
|
6
6
|
const problem_1 = require("../../lib/problem");
|
|
7
|
+
const response_schemas_1 = require("../../utils/response-schemas");
|
|
7
8
|
const keys_1 = require("../../utils/keys");
|
|
8
9
|
const encryptSchema = {
|
|
9
10
|
tags: ["Encryption"],
|
|
@@ -11,9 +12,12 @@ const encryptSchema = {
|
|
|
11
12
|
summary: "Encrypt a message",
|
|
12
13
|
description: "Encrypts a plaintext message using the supplied PGP public key and passphrase.",
|
|
13
14
|
response: {
|
|
14
|
-
200: {
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
200: {
|
|
16
|
+
description: "The armored OpenPGP message.",
|
|
17
|
+
type: "object",
|
|
18
|
+
properties: { data: { type: "string" } },
|
|
19
|
+
},
|
|
20
|
+
...(0, response_schemas_1.bodyProblems)(),
|
|
17
21
|
},
|
|
18
22
|
body: {
|
|
19
23
|
type: "object",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/routes/v1/generate.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/routes/v1/generate.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,SAAS,CAAC;yBAyF7C,KAAK,eAAe,KAAG,IAAI;AAA3C,wBAoDE"}
|
|
@@ -5,6 +5,7 @@ const types_1 = require("../../@types/types");
|
|
|
5
5
|
const validation_1 = require("../../utils/validation");
|
|
6
6
|
const route_helpers_1 = require("../../utils/route-helpers");
|
|
7
7
|
const problem_1 = require("../../lib/problem");
|
|
8
|
+
const response_schemas_1 = require("../../utils/response-schemas");
|
|
8
9
|
const generateSchema = {
|
|
9
10
|
tags: ["Key Management"],
|
|
10
11
|
deprecated: true,
|
|
@@ -12,6 +13,7 @@ const generateSchema = {
|
|
|
12
13
|
description: "Generates an OpenPGP key pair (RSA or ECC). The private key is NOT returned for security.",
|
|
13
14
|
response: {
|
|
14
15
|
200: {
|
|
16
|
+
description: "The armored public key and revocation certificate; the private key is not returned.",
|
|
15
17
|
type: "object",
|
|
16
18
|
properties: {
|
|
17
19
|
data: {
|
|
@@ -24,8 +26,7 @@ const generateSchema = {
|
|
|
24
26
|
warning: { type: "string" },
|
|
25
27
|
},
|
|
26
28
|
},
|
|
27
|
-
|
|
28
|
-
401: problem_1.PROBLEM_SCHEMA,
|
|
29
|
+
...(0, response_schemas_1.bodyProblems)(),
|
|
29
30
|
},
|
|
30
31
|
body: {
|
|
31
32
|
type: "object",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/routes/v1/index.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/routes/v1/index.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;yBA4CnB,KAAK,OAAO,CAAC,eAAe,KAAG,IAAI;AAAnD,wBAcE"}
|
package/dist/routes/v1/index.js
CHANGED
|
@@ -2,9 +2,35 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const crypto_1 = require("crypto");
|
|
4
4
|
const constants_1 = require("../../config/constants");
|
|
5
|
+
const response_schemas_1 = require("../../utils/response-schemas");
|
|
5
6
|
const id = (0, crypto_1.randomUUID)();
|
|
7
|
+
const STRING = { type: "string" };
|
|
8
|
+
const ROOT_SCHEMA = {
|
|
9
|
+
tags: ["Service"],
|
|
10
|
+
summary: "Service metadata",
|
|
11
|
+
description: "Static, non-secret metadata about this server. Not wrapped in data.",
|
|
12
|
+
response: {
|
|
13
|
+
200: (0, response_schemas_1.fields)({
|
|
14
|
+
id: {
|
|
15
|
+
type: "string",
|
|
16
|
+
format: "uuid",
|
|
17
|
+
description: "Identifier of this server instance, new at each start.",
|
|
18
|
+
},
|
|
19
|
+
title: STRING,
|
|
20
|
+
description: STRING,
|
|
21
|
+
details: STRING,
|
|
22
|
+
license: STRING,
|
|
23
|
+
url: STRING,
|
|
24
|
+
version: {
|
|
25
|
+
type: "string",
|
|
26
|
+
description: 'The library version as a JSON string literal, quotes included: the characters "1.2.3" with their quotes. Parse it as JSON to get the version.',
|
|
27
|
+
},
|
|
28
|
+
}, "Service metadata."),
|
|
29
|
+
...(0, response_schemas_1.problems)(...response_schemas_1.GET_ERRORS),
|
|
30
|
+
},
|
|
31
|
+
};
|
|
6
32
|
exports.default = (app) => {
|
|
7
|
-
app.get("/", async () => {
|
|
33
|
+
app.get("/", { schema: ROOT_SCHEMA }, async () => {
|
|
8
34
|
return {
|
|
9
35
|
id: id,
|
|
10
36
|
title: "Welcome to Crypto Server",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"revoke.d.ts","sourceRoot":"","sources":["../../../src/routes/v1/revoke.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"revoke.d.ts","sourceRoot":"","sources":["../../../src/routes/v1/revoke.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;yBA8C/B,KAAK,eAAe,KAAG,IAAI;AAA3C,wBAqCE"}
|
package/dist/routes/v1/revoke.js
CHANGED
|
@@ -5,6 +5,7 @@ const types_1 = require("../../@types/types");
|
|
|
5
5
|
const validation_1 = require("../../utils/validation");
|
|
6
6
|
const route_helpers_1 = require("../../utils/route-helpers");
|
|
7
7
|
const problem_1 = require("../../lib/problem");
|
|
8
|
+
const response_schemas_1 = require("../../utils/response-schemas");
|
|
8
9
|
const revokeSchema = {
|
|
9
10
|
tags: ["Key Management"],
|
|
10
11
|
deprecated: true,
|
|
@@ -12,6 +13,7 @@ const revokeSchema = {
|
|
|
12
13
|
description: "Revokes the shipped key pair with a reason code (0=unspecified, 1=superseded, 2=compromised, 3=retired). Returns the revoked public key only.",
|
|
13
14
|
response: {
|
|
14
15
|
200: {
|
|
16
|
+
description: "The revoked armored public key.",
|
|
15
17
|
type: "object",
|
|
16
18
|
additionalProperties: false,
|
|
17
19
|
properties: {
|
|
@@ -22,8 +24,7 @@ const revokeSchema = {
|
|
|
22
24
|
},
|
|
23
25
|
},
|
|
24
26
|
},
|
|
25
|
-
|
|
26
|
-
401: problem_1.PROBLEM_SCHEMA,
|
|
27
|
+
...(0, response_schemas_1.bodyProblems)(),
|
|
27
28
|
},
|
|
28
29
|
body: {
|
|
29
30
|
type: "object",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../../src/routes/v1/verify.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../../src/routes/v1/verify.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;yBAoD/B,KAAK,eAAe,KAAG,IAAI;AAA3C,wBA+CE"}
|