@andrewheberle/serverless-ssh-ca 0.21.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -1
- package/dist/api/operations.d.ts +49 -0
- package/dist/api/operations.d.ts.map +1 -0
- package/dist/api/operations.js +175 -0
- package/dist/api/operations.js.map +1 -0
- package/dist/api/schema.d.ts +71 -0
- package/dist/api/schema.d.ts.map +1 -0
- package/dist/api/schema.js +107 -0
- package/dist/api/schema.js.map +1 -0
- package/dist/api/v3/index.d.ts.map +1 -1
- package/dist/api/v3/index.js +25 -212
- package/dist/api/v3/index.js.map +1 -1
- package/dist/api/v3/schema.d.ts +30 -74
- package/dist/api/v3/schema.d.ts.map +1 -1
- package/dist/api/v3/schema.js +18 -73
- package/dist/api/v3/schema.js.map +1 -1
- package/dist/api/v4/index.d.ts +8 -0
- package/dist/api/v4/index.d.ts.map +1 -0
- package/dist/api/v4/index.js +155 -0
- package/dist/api/v4/index.js.map +1 -0
- package/dist/api/v4/schema.d.ts +268 -0
- package/dist/api/v4/schema.d.ts.map +1 -0
- package/dist/api/v4/schema.js +182 -0
- package/dist/api/v4/schema.js.map +1 -0
- package/dist/certificate.d.ts +9 -6
- package/dist/certificate.d.ts.map +1 -1
- package/dist/certificate.js +55 -99
- package/dist/certificate.js.map +1 -1
- package/dist/db/index.d.ts +32 -24
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +101 -28
- package/dist/db/index.js.map +1 -1
- package/dist/db/migrations/0002_krl_version.d.ts +3 -0
- package/dist/db/migrations/0002_krl_version.d.ts.map +1 -0
- package/dist/db/migrations/0002_krl_version.js +15 -0
- package/dist/db/migrations/0002_krl_version.js.map +1 -0
- package/dist/db/migrations/index.d.ts.map +1 -1
- package/dist/db/migrations/index.js +3 -1
- package/dist/db/migrations/index.js.map +1 -1
- package/dist/db/types.d.ts +37 -0
- package/dist/db/types.d.ts.map +1 -0
- package/dist/db/types.js +13 -0
- package/dist/db/types.js.map +1 -0
- package/dist/krl.d.ts +9 -1
- package/dist/krl.d.ts.map +1 -1
- package/dist/krl.js +22 -162
- package/dist/krl.js.map +1 -1
- package/dist/proof.d.ts +36 -7
- package/dist/proof.d.ts.map +1 -1
- package/dist/proof.js +53 -21
- package/dist/proof.js.map +1 -1
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +3 -1
- package/dist/router.js.map +1 -1
- package/dist/ssh/certificate.d.ts +93 -0
- package/dist/ssh/certificate.d.ts.map +1 -0
- package/dist/ssh/certificate.js +178 -0
- package/dist/ssh/certificate.js.map +1 -0
- package/dist/ssh/encoding.d.ts +41 -0
- package/dist/ssh/encoding.d.ts.map +1 -0
- package/dist/ssh/encoding.js +70 -0
- package/dist/ssh/encoding.js.map +1 -0
- package/dist/ssh/keys.d.ts +80 -0
- package/dist/ssh/keys.d.ts.map +1 -0
- package/dist/ssh/keys.js +249 -0
- package/dist/ssh/keys.js.map +1 -0
- package/dist/ssh/signer.d.ts +35 -0
- package/dist/ssh/signer.d.ts.map +1 -0
- package/dist/ssh/signer.js +99 -0
- package/dist/ssh/signer.js.map +1 -0
- package/dist/types.d.ts +12 -17
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +40 -21
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +87 -54
- package/dist/utils.js.map +1 -1
- package/openapi.json +1960 -82
- package/package.json +5 -17
- package/src/api/operations.ts +211 -0
- package/src/api/schema.ts +137 -0
- package/src/api/v3/index.ts +32 -259
- package/src/api/v3/schema.ts +34 -96
- package/src/api/v4/index.ts +265 -0
- package/src/api/v4/schema.ts +235 -0
- package/src/certificate.ts +62 -123
- package/src/db/index.ts +113 -49
- package/src/db/migrations/0002_krl_version.ts +16 -0
- package/src/db/migrations/index.ts +3 -1
- package/src/db/types.ts +40 -0
- package/src/krl.ts +32 -194
- package/src/proof.ts +65 -31
- package/src/router.ts +3 -1
- package/src/ssh/certificate.ts +236 -0
- package/src/ssh/encoding.ts +81 -0
- package/src/ssh/keys.ts +294 -0
- package/src/ssh/signer.ts +129 -0
- package/src/types.ts +12 -18
- package/src/utils.ts +99 -69
package/dist/api/v3/schema.js
CHANGED
|
@@ -1,57 +1,11 @@
|
|
|
1
1
|
import z from "zod";
|
|
2
|
-
import { split, refineCertificateRequest,
|
|
2
|
+
import { split, refineCertificateRequest, transformProofOfPossession, transformRenewalProofOfPossession, refineHostCertificateRequest, transformCertificate, refineHostCertificateRenewal, refineRevokeCertificate, } from "../../utils.js";
|
|
3
3
|
import { ConflictException, contentJson, ForbiddenException, InputValidationException, InternalServerErrorException, UnauthorizedException, UnprocessableEntityException, } from "chanfana";
|
|
4
4
|
import { seconds } from "itty-time";
|
|
5
5
|
import { isRevoked } from "../../db/index.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return Buffer.from(a.buffer, a.byteOffset, a.length);
|
|
10
|
-
})
|
|
11
|
-
.openapi({ format: "byte" });
|
|
12
|
-
const proofOfPossession = z.string()
|
|
13
|
-
.meta({
|
|
14
|
-
description: "Proof of possession comprising of ${timestamp}.${fingerprint}.${signature}",
|
|
15
|
-
example: "1765696780805.SHA256:79mq0wtpQMTvS4+Of8VzLN0qmYWNUyTXYmqKwhEgSLs.LS0tLS1CRUdJTiBTU0ggU0lHTkFUVVJFLS0tLS0KVTFOSVUwbEhBQUFBQVFBQUFHZ0FBQUFUWldOa2MyRXRjMmhoTWkxdWFYTjBjREkxTmdBQUFBaHVhWE4wY0RJMQpOZ0FBQUVFRUR6Ymk4OE10alBYSDFCb1JURU9HaS96aEc4QnhQNVZUUW5OQkFNMGZtMExtekErUUZkUlNVYVRFCkdNN2l0QjhINmZNZFAydlAxcElQcGUyOWVLQkJZd0FBQUFSbWFXeGxBQUFBQUFBQUFBWnphR0UxTVRJQUFBQmsKQUFBQUUyVmpaSE5oTFhOb1lUSXRibWx6ZEhBeU5UWUFBQUJKQUFBQUlHdmZVZGNDQkRXa3ZwL0ZHS3NkakgrRQpKZzZXN0EvWUJVZng2Z0srQ01raEFBQUFJUUQxOFd5cDNZejZ0eXNvdllXbEJHTXprRnlYbFRrSHM5blVVRXJqCkczNWVPQT09Ci0tLS0tRU5EIFNTSCBTSUdOQVRVUkUtLS0tLQo="
|
|
16
|
-
});
|
|
17
|
-
const publicKey = openapiStringByte
|
|
18
|
-
.transform(transformPublicKey)
|
|
19
|
-
.meta({
|
|
20
|
-
description: "SSH public key to sign",
|
|
21
|
-
example: "ZWNkc2Etc2hhMi1uaXN0cDI1NiBBQUFBRTJWalpITmhMWE5vWVRJdGJtbHpkSEF5TlRZQUFBQUlibWx6ZEhBeU5UWUFBQUJCQkdNcFNKdHRmMEl0dE5DVmMyOFR6WEZSMUQweHZPM25wNjdWemVBUXNiZFpza3JEY1lqU2x3SjZIUERtVHBYYVUwbEVhWDlMNFloYy9jQ2YxTWU5RlRrPQo="
|
|
22
|
-
});
|
|
23
|
-
export const createIdentityTokenSchema = (env) => (z.string()
|
|
24
|
-
.meta({
|
|
25
|
-
description: "Identity Token JWT from OIDC IdP",
|
|
26
|
-
example: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwiZW1haWwiOiJ1c2VyQGV4YW1wbGUuY29tIiwiaWF0IjoxNzc1NzAzMDk1fQ.ri_neAWnhMNK3LzlsrBcQYymSM4yRjmNSZZSeZiXhrEqtEz6c3cXk0Esq765umGjpUsWcosL-OFrDJlyAjTDnhrd9oV08uc_CW0rQRsJIGEuRo3ryxkLdVu9mGoZWEUb9KwjGJrwxvr-0cPWx5jaDyKwJcqMvtV_bEITUD51sDB1Vm89QfYRO_pGJo2vrRzSvMjpUenRpwPay4lYIBxl41_4YpR9Rc6VrIZuYsjV2iqEZ4eBrygMA7zPR_hN7l7s95FddLOzj5NsK57VT4uLHwYohx2oqMzw3M-B9HsZIQin_9q61pZFQXepzJth0woXiZheU27llnfHX967PhNQyg"
|
|
27
|
-
})
|
|
28
|
-
.transform((val, ctx) => transformIdentityToken(env, val, ctx)));
|
|
29
|
-
export const createAccessTokenSchema = (env) => (z.string()
|
|
30
|
-
.meta({
|
|
31
|
-
description: "Access Token JWT from OIDC IdP",
|
|
32
|
-
example: "Bearer eyJ..."
|
|
33
|
-
})
|
|
34
|
-
.transform((val, ctx) => transformAuthorizationHeader(env, val, ctx)));
|
|
35
|
-
const krl = openapiStringByte
|
|
36
|
-
.meta({ description: "Key Revocation List" });
|
|
37
|
-
export const createHeaderSchema = (env) => (z.object({
|
|
38
|
-
"Authorization": createAccessTokenSchema(env)
|
|
39
|
-
}));
|
|
40
|
-
const certificate = openapiStringByte
|
|
41
|
-
.meta({ description: "Issued Certificate" });
|
|
42
|
-
export const CaPublicKeyEndpointSchema = {
|
|
43
|
-
responses: {
|
|
44
|
-
"200": {
|
|
45
|
-
content: {
|
|
46
|
-
"text/plain": {
|
|
47
|
-
schema: z.string()
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
description: "Returns SSH Certificate Authority Public Key",
|
|
51
|
-
},
|
|
52
|
-
...InternalServerErrorException.schema(),
|
|
53
|
-
}
|
|
54
|
-
};
|
|
6
|
+
import { CertificateType } from "../../db/types.js";
|
|
7
|
+
import { certificate, certificateTypeName, certificateTypeTag, createHeaderSchema, createIdentityTokenSchema, openapiStringByte, proofOfPossession, publicKey, } from "../schema.js";
|
|
8
|
+
export { CaPublicKeyEndpointSchema, certificateTypeName, createAccessTokenSchema, createHeaderSchema, createIdentityTokenSchema, createRevocationListEndpointSchema, } from "../schema.js";
|
|
55
9
|
export const userCertificateRequestEndpointBodySchema = (env) => (z.object({
|
|
56
10
|
public_key: publicKey,
|
|
57
11
|
proof: proofOfPossession
|
|
@@ -69,6 +23,9 @@ export const userCertificateRequestEndpointBodySchema = (env) => (z.object({
|
|
|
69
23
|
.superRefine((val, ctx) => refineCertificateRequest(env, val, ctx))
|
|
70
24
|
.openapi("User Certificate Request"));
|
|
71
25
|
export const createUserCertificateRequestEndpointSchema = (env) => ({
|
|
26
|
+
tags: [certificateTypeTag(CertificateType.User)],
|
|
27
|
+
summary: "Request a user certificate",
|
|
28
|
+
description: "Issues a signed SSH user certificate for the provided public key. The request must be authenticated with an access token and include an identity token from the OIDC IdP for the same subject, along with a proof of possession of the private key. Principals on the issued certificate are derived from the identity token.",
|
|
72
29
|
security: [{ oidcAuth: [] }],
|
|
73
30
|
request: {
|
|
74
31
|
headers: createHeaderSchema(env),
|
|
@@ -89,24 +46,6 @@ export const createUserCertificateRequestEndpointSchema = (env) => ({
|
|
|
89
46
|
...InternalServerErrorException.schema(),
|
|
90
47
|
}
|
|
91
48
|
});
|
|
92
|
-
export const createRevocationListEndpointSchema = () => ({
|
|
93
|
-
request: {
|
|
94
|
-
params: z.object({
|
|
95
|
-
certificateType: z.enum(["user", "host"])
|
|
96
|
-
}),
|
|
97
|
-
},
|
|
98
|
-
responses: {
|
|
99
|
-
"200": {
|
|
100
|
-
description: "Returns an Open SSH Key Revocation List as BASE64 and an SSHSIG signature for verification",
|
|
101
|
-
...contentJson(z.object({
|
|
102
|
-
krl: krl,
|
|
103
|
-
signature: z.string()
|
|
104
|
-
})
|
|
105
|
-
.openapi("Key Revocation List Response"))
|
|
106
|
-
},
|
|
107
|
-
...InternalServerErrorException.schema(),
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
49
|
export const hostCertificateRequestEndpointBodySchema = (env) => (z.object({
|
|
111
50
|
public_key: publicKey,
|
|
112
51
|
proof: proofOfPossession
|
|
@@ -123,6 +62,9 @@ export const hostCertificateRequestEndpointBodySchema = (env) => (z.object({
|
|
|
123
62
|
.superRefine((val, ctx) => refineHostCertificateRequest(env, val, ctx))
|
|
124
63
|
.openapi("Host Certificate Request"));
|
|
125
64
|
export const createHostCertificateRequestEndpointSchema = (env) => ({
|
|
65
|
+
tags: [certificateTypeTag(CertificateType.Host)],
|
|
66
|
+
summary: "Request a host certificate",
|
|
67
|
+
description: "Issues a signed SSH host certificate for the provided public key and principals. The request must be authenticated with an access token and include an identity token from the OIDC IdP for the same subject, along with a proof of possession of the private key. The user must be permitted to request host certificates by email address or role.",
|
|
126
68
|
security: [{ oidcAuth: [] }],
|
|
127
69
|
request: {
|
|
128
70
|
headers: createHeaderSchema(env),
|
|
@@ -159,6 +101,9 @@ export const hostCertificateRenewEndpointBodySchema = (env) => (z.object({
|
|
|
159
101
|
.superRefine((val, ctx) => refineHostCertificateRenewal(env, isRevoked, val, ctx))
|
|
160
102
|
.openapi("Host Certificate Renew"));
|
|
161
103
|
export const createHostCertificateRenewEndpointSchema = (env) => ({
|
|
104
|
+
tags: [certificateTypeTag(CertificateType.Host)],
|
|
105
|
+
summary: "Renew a host certificate",
|
|
106
|
+
description: "Issues a new SSH host certificate with the same principals as an existing, unexpired and unrevoked host certificate issued by this CA. No OIDC authentication is required; instead the public key must match the existing certificate and the proof of possession must be made with its private key. The lifetime of the renewed certificate is no longer than that of the existing certificate.",
|
|
162
107
|
request: {
|
|
163
108
|
body: contentJson(hostCertificateRenewEndpointBodySchema(env))
|
|
164
109
|
},
|
|
@@ -191,16 +136,16 @@ export const revokeCertificateEndpointBodySchema = (env) => (z.object({
|
|
|
191
136
|
})
|
|
192
137
|
.openapi("Certificate Revocation")
|
|
193
138
|
.superRefine((val, ctx) => refineRevokeCertificate(env, val, ctx)));
|
|
194
|
-
export const createRevokeCertificateEndpointSchema = (env) => ({
|
|
139
|
+
export const createRevokeCertificateEndpointSchema = (env, certificateType) => ({
|
|
140
|
+
tags: [certificateTypeTag(certificateType)],
|
|
141
|
+
summary: `Revoke a ${certificateTypeName(certificateType)} certificate`,
|
|
142
|
+
description: `Revokes a ${certificateTypeName(certificateType)} certificate issued by this CA, identified by its serial number, and adds it to the ${certificateTypeName(certificateType)} Key Revocation List. The request must include a proof of possession of the private key for the public key that the certificate was issued for.`,
|
|
195
143
|
request: {
|
|
196
|
-
params: z.object({
|
|
197
|
-
certificateType: z.enum(["user", "host"])
|
|
198
|
-
}),
|
|
199
144
|
body: contentJson(revokeCertificateEndpointBodySchema(env))
|
|
200
145
|
},
|
|
201
146
|
responses: {
|
|
202
147
|
"200": {
|
|
203
|
-
description:
|
|
148
|
+
description: `SSH ${certificateTypeName(certificateType)} certificate revoked successfully`,
|
|
204
149
|
...contentJson(z.object({
|
|
205
150
|
revoked_at: z.iso.datetime(),
|
|
206
151
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/api/v3/schema.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAA;AAEnB,OAAO,EACN,KAAK,EACL,wBAAwB,EACxB,
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/api/v3/schema.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAA;AAEnB,OAAO,EACN,KAAK,EACL,wBAAwB,EACxB,0BAA0B,EAC1B,iCAAiC,EACjC,4BAA4B,EAC5B,oBAAoB,EACpB,4BAA4B,EAC5B,uBAAuB,GACvB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EACN,iBAAiB,EACjB,WAAW,EACX,kBAAkB,EAClB,wBAAwB,EACxB,4BAA4B,EAC5B,qBAAqB,EACrB,4BAA4B,GAC5B,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EACN,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,iBAAiB,EACjB,SAAS,GACT,MAAM,cAAc,CAAA;AAErB,OAAO,EACN,yBAAyB,EACzB,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,EAClB,yBAAyB,EACzB,kCAAkC,GAClC,MAAM,cAAc,CAAA;AAErB,MAAM,C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AE;YACN,WAAW,EAAE,OAAO,mBAAmB,CAAC,eAAe,CAAC,mCAAmC;YAC3F,GAAG,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC;gBACvB,UAAU,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE;aAC5B,CAAC;iBACA,OAAO,CAAC,qBAAqB,CAAC,CAC/B;SACD;QACD,GAAG,qBAAqB,CAAC,MAAM,EAAE;QACjC,GAAG,kBAAkB,CAAC,MAAM,EAAE;QAC9B,GAAG,wBAAwB,CAAC,MAAM,EAAE;QACpC,GAAG,4BAA4B,CAAC,MAAM,EAAE;QACxC,GAAG,4BAA4B,CAAC,MAAM,EAAE;QACxC,GAAG,iBAAiB,CAAC,MAAM,EAAE;KAC7B;CACD,CAAC,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SshCaBindings } from "../../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* The path the v4 API is served under, which is part of the request a proof
|
|
4
|
+
* of possession is made for
|
|
5
|
+
*/
|
|
6
|
+
export declare const BasePath = "/api/v4";
|
|
7
|
+
export declare const createApi: (env: SshCaBindings) => import("chanfana").HonoOpenAPIRouterType<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/v4/index.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAEnD;;;GAGG;AACH,eAAO,MAAM,QAAQ,YAAY,CAAA;AAqNjC,eAAO,MAAM,SAAS,QAAS,aAAa,mHAa3C,CAAA"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { group } from "@andrewheberle/ts-slog";
|
|
2
|
+
import { ForbiddenException, fromHono, InputValidationException, OpenAPIRoute, UnauthorizedException, } from "chanfana";
|
|
3
|
+
import { Hono } from "hono";
|
|
4
|
+
import { createSignedCertificate, createSignedHostCertificate, } from "../../certificate.js";
|
|
5
|
+
import { split } from "../../utils.js";
|
|
6
|
+
import { CertificateType } from "../../db/types.js";
|
|
7
|
+
import { caPublicKey, issueCertificate, revocationList, revoke } from "../operations.js";
|
|
8
|
+
import { certificateTypeName } from "../schema.js";
|
|
9
|
+
import { createCaPublicKeyEndpointSchema, createGetRevocationListEndpointSchema, createIssueHostCertificateEndpointSchema, createIssueUserCertificateEndpointSchema, createRenewHostCertificateEndpointSchema, createRevokeCertificateEndpointSchema, ProofHeader, } from "./schema.js";
|
|
10
|
+
import { logger } from "../../logger.js";
|
|
11
|
+
/**
|
|
12
|
+
* The path the v4 API is served under, which is part of the request a proof
|
|
13
|
+
* of possession is made for
|
|
14
|
+
*/
|
|
15
|
+
export const BasePath = "/api/v4";
|
|
16
|
+
/**
|
|
17
|
+
* Ensures a proof of possession was made with the private key for a public key
|
|
18
|
+
* and for this request, so it cannot be replayed against another endpoint or
|
|
19
|
+
* for another certificate.
|
|
20
|
+
*
|
|
21
|
+
* @param l The logger for the request
|
|
22
|
+
* @param proof The proof of possession from the request
|
|
23
|
+
* @param key The public key the proof must be made with
|
|
24
|
+
* @param method The HTTP method of the request
|
|
25
|
+
* @param path The path of the request below {@link BasePath}, with any parameters filled in
|
|
26
|
+
* @throws {@link InputValidationException} when the proof is not valid for the key and request
|
|
27
|
+
*/
|
|
28
|
+
const verifyProof = async (l, proof, key, method, path) => {
|
|
29
|
+
if (!proof.matches(key)) {
|
|
30
|
+
l.warn("proof of possession fingerprint did not match public key");
|
|
31
|
+
throw new InputValidationException("proof of possession fingerprint did not match public key", ["headers", ProofHeader]);
|
|
32
|
+
}
|
|
33
|
+
if (!await proof.verifyRequest(method, `${BasePath}${path}`)) {
|
|
34
|
+
l.warn("proof of possession signature validation failed");
|
|
35
|
+
throw new InputValidationException("proof of possession signature validation failed", ["headers", ProofHeader]);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const CaPublicKeyEndpoint = (env) => {
|
|
39
|
+
return class extends OpenAPIRoute {
|
|
40
|
+
schema = createCaPublicKeyEndpointSchema();
|
|
41
|
+
async handle(c) {
|
|
42
|
+
const l = logger(env).with(...group("request", "action", "ca"));
|
|
43
|
+
return await caPublicKey(c, l);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
const IssueUserCertificateEndpoint = (env) => {
|
|
48
|
+
return class extends OpenAPIRoute {
|
|
49
|
+
schema = createIssueUserCertificateEndpointSchema(env);
|
|
50
|
+
async handle(c) {
|
|
51
|
+
const data = await this.getValidatedData();
|
|
52
|
+
const l = logger(env).with(...group("request", "type", "user", "action", "request"), ...group("auth_token", "email", data.headers.Authorization.email, "sub", data.headers.Authorization.sub), ...group("id_token", "sub", data.body.identity.sub));
|
|
53
|
+
await verifyProof(l, data.headers[ProofHeader], data.body.public_key, "POST", "/user/certificates");
|
|
54
|
+
if (data.body.identity.sub !== data.headers.Authorization.sub) {
|
|
55
|
+
l.error("token subjects did not match");
|
|
56
|
+
throw new ForbiddenException("Possible token substitution as subjects for authentication and identity tokens did not match");
|
|
57
|
+
}
|
|
58
|
+
const opts = {
|
|
59
|
+
lifetime: data.body.lifetime,
|
|
60
|
+
principals: data.body.identity.principals,
|
|
61
|
+
extensions: data.body.extensions,
|
|
62
|
+
};
|
|
63
|
+
return await issueCertificate(c, l, () => createSignedCertificate(c.env, data.headers.Authorization.email, data.body.public_key, opts), CertificateType.User);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
const RevocationListEndpoint = (env, certificateType) => {
|
|
68
|
+
return class extends OpenAPIRoute {
|
|
69
|
+
schema = createGetRevocationListEndpointSchema(certificateType);
|
|
70
|
+
async handle(c) {
|
|
71
|
+
const l = logger(env).with(...group("request", "type", certificateTypeName(certificateType), "action", "krl"));
|
|
72
|
+
return await revocationList(c, l, certificateType);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
const IssueHostCertificateEndpoint = (env) => {
|
|
77
|
+
return class extends OpenAPIRoute {
|
|
78
|
+
schema = createIssueHostCertificateEndpointSchema(env);
|
|
79
|
+
async handle(c) {
|
|
80
|
+
const data = await this.getValidatedData();
|
|
81
|
+
const l = logger(env).with(...group("request", "type", "host", "action", "request"), ...group("auth_token", "email", data.headers.Authorization.email, "sub", data.headers.Authorization.sub), ...group("id_token", "sub", data.body.identity.sub));
|
|
82
|
+
await verifyProof(l, data.headers[ProofHeader], data.body.public_key, "POST", "/host/certificates");
|
|
83
|
+
// check id and access token are for the same user
|
|
84
|
+
if (data.body.identity.sub !== data.headers.Authorization.sub) {
|
|
85
|
+
l.error("token subjects did not match");
|
|
86
|
+
throw new ForbiddenException("possible token substitution as subjects for authentication and identity tokens did not match");
|
|
87
|
+
}
|
|
88
|
+
// check user can issue host certificates
|
|
89
|
+
if (!split(c.env.SSH_HOST_CERTIFICATE_ALLOWED_EMAILS).includes(data.headers.Authorization.email) && !data.body.identity.principals.some((p) => split(c.env.SSH_HOST_CERTIFICATE_ALLOWED_ROLES).includes(p))) {
|
|
90
|
+
l.error("unauthorized host certificate request");
|
|
91
|
+
throw new UnauthorizedException("User not allowed to issue host certificates");
|
|
92
|
+
}
|
|
93
|
+
const opts = {
|
|
94
|
+
lifetime: data.body.lifetime,
|
|
95
|
+
principals: data.body.principals,
|
|
96
|
+
};
|
|
97
|
+
return await issueCertificate(c, l, () => createSignedHostCertificate(c.env, data.body.public_key, opts), CertificateType.Host);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
const RenewHostCertificateEndpoint = (env) => {
|
|
102
|
+
return class extends OpenAPIRoute {
|
|
103
|
+
schema = createRenewHostCertificateEndpointSchema(env);
|
|
104
|
+
async handle(c) {
|
|
105
|
+
const data = await this.getValidatedData();
|
|
106
|
+
const serial = data.params.serial;
|
|
107
|
+
const l = logger(env).with(...group("request", "type", "host", "action", "renewal", "serial", serial));
|
|
108
|
+
// the serial in the path is what the proof was made for, so it
|
|
109
|
+
// must be the certificate being renewed
|
|
110
|
+
if (data.body.certificate.serial !== serial) {
|
|
111
|
+
l.warn("certificate serial did not match the serial in the path");
|
|
112
|
+
throw new InputValidationException("certificate serial did not match the serial in the path", ["body", "certificate"]);
|
|
113
|
+
}
|
|
114
|
+
await verifyProof(l, data.headers[ProofHeader], data.body.certificate.publicKey, "POST", `/host/certificates/${serial}/renew`);
|
|
115
|
+
// use smaller of the current certificate lifetime and the requested lifetime
|
|
116
|
+
const originalLifetime = (data.body.certificate.validBefore.getTime() - data.body.certificate.validAfter.getTime()) / 1000;
|
|
117
|
+
const lifetime = originalLifetime > data.body.lifetime
|
|
118
|
+
? data.body.lifetime
|
|
119
|
+
: originalLifetime;
|
|
120
|
+
const opts = {
|
|
121
|
+
lifetime: lifetime,
|
|
122
|
+
principals: data.body.certificate.principals,
|
|
123
|
+
};
|
|
124
|
+
return await issueCertificate(c, l, () => createSignedHostCertificate(c.env, data.body.certificate.publicKey, opts), CertificateType.Host);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
const RevokeCertificateEndpoint = (env, certificateType) => {
|
|
129
|
+
return class extends OpenAPIRoute {
|
|
130
|
+
schema = createRevokeCertificateEndpointSchema(env, certificateType);
|
|
131
|
+
async handle(c) {
|
|
132
|
+
const data = await this.getValidatedData();
|
|
133
|
+
const serial = data.params.serial;
|
|
134
|
+
const proof = data.headers[ProofHeader];
|
|
135
|
+
const l = logger(env).with(...group("request", "type", certificateTypeName(certificateType), "action", "revoke", "serial", serial));
|
|
136
|
+
// the key the proof was made with is the key the certificate must
|
|
137
|
+
// have been issued for
|
|
138
|
+
await verifyProof(l, proof, proof.signaturePubkey, "DELETE", `/${certificateTypeName(certificateType)}/certificates/${serial}`);
|
|
139
|
+
return await revoke(c, l, serial, proof.signaturePubkey, certificateType);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
export const createApi = (env) => {
|
|
144
|
+
const api = fromHono(new Hono());
|
|
145
|
+
api.get("/ca", CaPublicKeyEndpoint(env));
|
|
146
|
+
api.post("/user/certificates", IssueUserCertificateEndpoint(env));
|
|
147
|
+
api.delete("/user/certificates/:serial", RevokeCertificateEndpoint(env, CertificateType.User));
|
|
148
|
+
api.get("/user/krl", RevocationListEndpoint(env, CertificateType.User));
|
|
149
|
+
api.post("/host/certificates", IssueHostCertificateEndpoint(env));
|
|
150
|
+
api.post("/host/certificates/:serial/renew", RenewHostCertificateEndpoint(env));
|
|
151
|
+
api.delete("/host/certificates/:serial", RevokeCertificateEndpoint(env, CertificateType.Host));
|
|
152
|
+
api.get("/host/krl", RevocationListEndpoint(env, CertificateType.Host));
|
|
153
|
+
return api;
|
|
154
|
+
};
|
|
155
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/v4/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAU,MAAM,wBAAwB,CAAA;AACtD,OAAO,EACN,kBAAkB,EAClB,QAAQ,EACR,wBAAwB,EACxB,YAAY,EACZ,qBAAqB,GACrB,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAG3B,OAAO,EAGN,uBAAuB,EACvB,2BAA2B,GAC3B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACxF,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EACN,+BAA+B,EAC/B,qCAAqC,EACrC,wCAAwC,EACxC,wCAAwC,EACxC,wCAAwC,EACxC,qC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
3
|
+
import { CertificateType } from "../../db/types.js";
|
|
4
|
+
/**
|
|
5
|
+
* The name of the header carrying the proof of possession of the private key
|
|
6
|
+
*/
|
|
7
|
+
export declare const ProofHeader = "Proof-Of-Possession";
|
|
8
|
+
export declare const createProofSchema: (env: SshCaBindings) => z.ZodPipe<z.ZodString, z.ZodTransform<import("../../proof.js").ProofOfPossession, string>>;
|
|
9
|
+
/**
|
|
10
|
+
* Headers for a request authorised by a proof of possession alone
|
|
11
|
+
*/
|
|
12
|
+
export declare const createProofHeaderSchema: (env: SshCaBindings) => z.ZodObject<{
|
|
13
|
+
"Proof-Of-Possession": z.ZodPipe<z.ZodString, z.ZodTransform<import("../../proof.js").ProofOfPossession, string>>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
/**
|
|
16
|
+
* Headers for a request authenticated with an access token and authorised by
|
|
17
|
+
* a proof of possession
|
|
18
|
+
*/
|
|
19
|
+
export declare const createAuthenticatedHeaderSchema: (env: SshCaBindings) => z.ZodObject<{
|
|
20
|
+
Authorization: z.ZodPipe<z.ZodString, z.ZodTransform<{
|
|
21
|
+
email: string;
|
|
22
|
+
sub: string;
|
|
23
|
+
}, string>>;
|
|
24
|
+
"Proof-Of-Possession": z.ZodPipe<z.ZodString, z.ZodTransform<import("../../proof.js").ProofOfPossession, string>>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
export declare const serialParamSchema: z.ZodObject<{
|
|
27
|
+
serial: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
export declare const createCaPublicKeyEndpointSchema: () => {
|
|
30
|
+
tags: string[];
|
|
31
|
+
summary: string;
|
|
32
|
+
description: string;
|
|
33
|
+
responses: {
|
|
34
|
+
"200": {
|
|
35
|
+
content: {
|
|
36
|
+
"text/plain": {
|
|
37
|
+
schema: z.ZodString;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
description: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
operationId: string;
|
|
44
|
+
};
|
|
45
|
+
export declare const createGetRevocationListEndpointSchema: (certificateType: CertificateType) => {
|
|
46
|
+
tags: ("Host" | "User")[];
|
|
47
|
+
summary: string;
|
|
48
|
+
description: string;
|
|
49
|
+
responses: {
|
|
50
|
+
"200": {
|
|
51
|
+
content: {
|
|
52
|
+
"application/json": {
|
|
53
|
+
schema: z.ZodType<{
|
|
54
|
+
krl: Buffer<ArrayBuffer>;
|
|
55
|
+
signature: string;
|
|
56
|
+
}, unknown, z.core.$ZodTypeInternals<{
|
|
57
|
+
krl: Buffer<ArrayBuffer>;
|
|
58
|
+
signature: string;
|
|
59
|
+
}, unknown>>;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
description: string;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
operationId: string;
|
|
66
|
+
};
|
|
67
|
+
export declare const issueUserCertificateEndpointBodySchema: (env: SshCaBindings) => z.ZodObject<{
|
|
68
|
+
public_key: z.ZodPipe<z.ZodPipe<z.ZodBase64, z.ZodTransform<Buffer<ArrayBuffer>, string>>, z.ZodTransform<import("../../ssh/keys.js").PublicKey, Buffer<ArrayBuffer>>>;
|
|
69
|
+
identity: z.ZodPipe<z.ZodString, z.ZodTransform<{
|
|
70
|
+
sub: string;
|
|
71
|
+
principals: string[];
|
|
72
|
+
}, string>>;
|
|
73
|
+
extensions: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
74
|
+
lifetime: z.ZodDefault<z.ZodInt>;
|
|
75
|
+
}, z.core.$strip>;
|
|
76
|
+
export declare const createIssueUserCertificateEndpointSchema: (env: SshCaBindings) => {
|
|
77
|
+
tags: ("Host" | "User")[];
|
|
78
|
+
operationId: string;
|
|
79
|
+
summary: string;
|
|
80
|
+
description: string;
|
|
81
|
+
security: {
|
|
82
|
+
oidcAuth: never[];
|
|
83
|
+
}[];
|
|
84
|
+
request: {
|
|
85
|
+
headers: z.ZodObject<{
|
|
86
|
+
Authorization: z.ZodPipe<z.ZodString, z.ZodTransform<{
|
|
87
|
+
email: string;
|
|
88
|
+
sub: string;
|
|
89
|
+
}, string>>;
|
|
90
|
+
"Proof-Of-Possession": z.ZodPipe<z.ZodString, z.ZodTransform<import("../../proof.js").ProofOfPossession, string>>;
|
|
91
|
+
}, z.core.$strip>;
|
|
92
|
+
body: {
|
|
93
|
+
content: {
|
|
94
|
+
"application/json": {
|
|
95
|
+
schema: z.ZodType<{
|
|
96
|
+
public_key: import("../../ssh/keys.js").PublicKey;
|
|
97
|
+
identity: {
|
|
98
|
+
sub: string;
|
|
99
|
+
principals: string[];
|
|
100
|
+
};
|
|
101
|
+
extensions: string[];
|
|
102
|
+
lifetime: number;
|
|
103
|
+
}, unknown, z.core.$ZodTypeInternals<{
|
|
104
|
+
public_key: import("../../ssh/keys.js").PublicKey;
|
|
105
|
+
identity: {
|
|
106
|
+
sub: string;
|
|
107
|
+
principals: string[];
|
|
108
|
+
};
|
|
109
|
+
extensions: string[];
|
|
110
|
+
lifetime: number;
|
|
111
|
+
}, unknown>>;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
responses: {
|
|
117
|
+
"200": {
|
|
118
|
+
content: {
|
|
119
|
+
"application/json": {
|
|
120
|
+
schema: z.ZodType<{
|
|
121
|
+
certificate: Buffer<ArrayBuffer>;
|
|
122
|
+
}, unknown, z.core.$ZodTypeInternals<{
|
|
123
|
+
certificate: Buffer<ArrayBuffer>;
|
|
124
|
+
}, unknown>>;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
description: string;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
export declare const issueHostCertificateEndpointBodySchema: (env: SshCaBindings) => z.ZodObject<{
|
|
132
|
+
public_key: z.ZodPipe<z.ZodPipe<z.ZodBase64, z.ZodTransform<Buffer<ArrayBuffer>, string>>, z.ZodTransform<import("../../ssh/keys.js").PublicKey, Buffer<ArrayBuffer>>>;
|
|
133
|
+
identity: z.ZodPipe<z.ZodString, z.ZodTransform<{
|
|
134
|
+
sub: string;
|
|
135
|
+
principals: string[];
|
|
136
|
+
}, string>>;
|
|
137
|
+
principals: z.ZodArray<z.ZodString>;
|
|
138
|
+
lifetime: z.ZodDefault<z.ZodInt>;
|
|
139
|
+
}, z.core.$strip>;
|
|
140
|
+
export declare const createIssueHostCertificateEndpointSchema: (env: SshCaBindings) => {
|
|
141
|
+
tags: ("Host" | "User")[];
|
|
142
|
+
operationId: string;
|
|
143
|
+
summary: string;
|
|
144
|
+
description: string;
|
|
145
|
+
security: {
|
|
146
|
+
oidcAuth: never[];
|
|
147
|
+
}[];
|
|
148
|
+
request: {
|
|
149
|
+
headers: z.ZodObject<{
|
|
150
|
+
Authorization: z.ZodPipe<z.ZodString, z.ZodTransform<{
|
|
151
|
+
email: string;
|
|
152
|
+
sub: string;
|
|
153
|
+
}, string>>;
|
|
154
|
+
"Proof-Of-Possession": z.ZodPipe<z.ZodString, z.ZodTransform<import("../../proof.js").ProofOfPossession, string>>;
|
|
155
|
+
}, z.core.$strip>;
|
|
156
|
+
body: {
|
|
157
|
+
content: {
|
|
158
|
+
"application/json": {
|
|
159
|
+
schema: z.ZodType<{
|
|
160
|
+
public_key: import("../../ssh/keys.js").PublicKey;
|
|
161
|
+
identity: {
|
|
162
|
+
sub: string;
|
|
163
|
+
principals: string[];
|
|
164
|
+
};
|
|
165
|
+
principals: string[];
|
|
166
|
+
lifetime: number;
|
|
167
|
+
}, unknown, z.core.$ZodTypeInternals<{
|
|
168
|
+
public_key: import("../../ssh/keys.js").PublicKey;
|
|
169
|
+
identity: {
|
|
170
|
+
sub: string;
|
|
171
|
+
principals: string[];
|
|
172
|
+
};
|
|
173
|
+
principals: string[];
|
|
174
|
+
lifetime: number;
|
|
175
|
+
}, unknown>>;
|
|
176
|
+
};
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
responses: {
|
|
181
|
+
"200": {
|
|
182
|
+
content: {
|
|
183
|
+
"application/json": {
|
|
184
|
+
schema: z.ZodType<{
|
|
185
|
+
certificate: Buffer<ArrayBuffer>;
|
|
186
|
+
}, unknown, z.core.$ZodTypeInternals<{
|
|
187
|
+
certificate: Buffer<ArrayBuffer>;
|
|
188
|
+
}, unknown>>;
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
description: string;
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
export declare const renewHostCertificateEndpointBodySchema: (env: SshCaBindings) => z.ZodObject<{
|
|
196
|
+
certificate: z.ZodPipe<z.ZodPipe<z.ZodBase64, z.ZodTransform<Buffer<ArrayBuffer>, string>>, z.ZodTransform<import("../../ssh/certificate.js").SshCertificate, Buffer<ArrayBuffer>>>;
|
|
197
|
+
lifetime: z.ZodDefault<z.ZodInt>;
|
|
198
|
+
}, z.core.$strip>;
|
|
199
|
+
export declare const createRenewHostCertificateEndpointSchema: (env: SshCaBindings) => {
|
|
200
|
+
tags: ("Host" | "User")[];
|
|
201
|
+
operationId: string;
|
|
202
|
+
summary: string;
|
|
203
|
+
description: string;
|
|
204
|
+
request: {
|
|
205
|
+
params: z.ZodObject<{
|
|
206
|
+
serial: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
207
|
+
}, z.core.$strip>;
|
|
208
|
+
headers: z.ZodObject<{
|
|
209
|
+
"Proof-Of-Possession": z.ZodPipe<z.ZodString, z.ZodTransform<import("../../proof.js").ProofOfPossession, string>>;
|
|
210
|
+
}, z.core.$strip>;
|
|
211
|
+
body: {
|
|
212
|
+
content: {
|
|
213
|
+
"application/json": {
|
|
214
|
+
schema: z.ZodType<{
|
|
215
|
+
certificate: import("../../ssh/certificate.js").SshCertificate;
|
|
216
|
+
lifetime: number;
|
|
217
|
+
}, unknown, z.core.$ZodTypeInternals<{
|
|
218
|
+
certificate: import("../../ssh/certificate.js").SshCertificate;
|
|
219
|
+
lifetime: number;
|
|
220
|
+
}, unknown>>;
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
responses: {
|
|
226
|
+
"200": {
|
|
227
|
+
content: {
|
|
228
|
+
"application/json": {
|
|
229
|
+
schema: z.ZodType<{
|
|
230
|
+
certificate: Buffer<ArrayBuffer>;
|
|
231
|
+
}, unknown, z.core.$ZodTypeInternals<{
|
|
232
|
+
certificate: Buffer<ArrayBuffer>;
|
|
233
|
+
}, unknown>>;
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
description: string;
|
|
237
|
+
};
|
|
238
|
+
};
|
|
239
|
+
};
|
|
240
|
+
export declare const createRevokeCertificateEndpointSchema: (env: SshCaBindings, certificateType: CertificateType) => {
|
|
241
|
+
tags: ("Host" | "User")[];
|
|
242
|
+
operationId: string;
|
|
243
|
+
summary: string;
|
|
244
|
+
description: string;
|
|
245
|
+
request: {
|
|
246
|
+
params: z.ZodObject<{
|
|
247
|
+
serial: z.ZodPipe<z.ZodString, z.ZodTransform<bigint, string>>;
|
|
248
|
+
}, z.core.$strip>;
|
|
249
|
+
headers: z.ZodObject<{
|
|
250
|
+
"Proof-Of-Possession": z.ZodPipe<z.ZodString, z.ZodTransform<import("../../proof.js").ProofOfPossession, string>>;
|
|
251
|
+
}, z.core.$strip>;
|
|
252
|
+
};
|
|
253
|
+
responses: {
|
|
254
|
+
"200": {
|
|
255
|
+
content: {
|
|
256
|
+
"application/json": {
|
|
257
|
+
schema: z.ZodType<{
|
|
258
|
+
revoked_at: string;
|
|
259
|
+
}, unknown, z.core.$ZodTypeInternals<{
|
|
260
|
+
revoked_at: string;
|
|
261
|
+
}, unknown>>;
|
|
262
|
+
};
|
|
263
|
+
};
|
|
264
|
+
description: string;
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
};
|
|
268
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","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