@cobaltcore-dev/aurora 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/App.d.ts +2 -1
- package/dist/client/AuroraApp.d.ts +25 -0
- package/dist/client/{AuthProvider-5TyZKZkx.mjs → AuthProvider-BS5OVv8n.mjs} +2 -2
- package/dist/client/AuthProvider-BS5OVv8n.mjs.map +1 -0
- package/dist/client/{ContentHeader-D64NtKvo.mjs → ContentHeader-BHMUzd9H.mjs} +16 -16
- package/dist/client/{ContentHeader-D64NtKvo.mjs.map → ContentHeader-BHMUzd9H.mjs.map} +1 -1
- package/dist/client/{DeleteFlavorModal-C2K43ABZ.mjs → DeleteFlavorModal-BP83t9zX.mjs} +283 -294
- package/dist/client/DeleteFlavorModal-BP83t9zX.mjs.map +1 -0
- package/dist/client/{FiltersInput-Bw8TFfwb.mjs → FiltersInput-B8CNBg1L.mjs} +23 -23
- package/dist/client/{FiltersInput-Bw8TFfwb.mjs.map → FiltersInput-B8CNBg1L.mjs.map} +1 -1
- package/dist/client/{FloatingIpActionModals-BfEDfYg9.mjs → FloatingIpActionModals-BraiJWBi.mjs} +48 -48
- package/dist/client/{FloatingIpActionModals-BfEDfYg9.mjs.map → FloatingIpActionModals-BraiJWBi.mjs.map} +1 -1
- package/dist/client/ImageToastNotifications-BXMHJaIH.mjs +1131 -0
- package/dist/client/ImageToastNotifications-BXMHJaIH.mjs.map +1 -0
- package/dist/client/{RouteError-B-NPGIv7.mjs → RouteError-hAF8_jbe.mjs} +2 -2
- package/dist/client/{RouteError-B-NPGIv7.mjs.map → RouteError-hAF8_jbe.mjs.map} +1 -1
- package/dist/client/{SortInput-DysAXpB3.mjs → SortInput-Cqs2poV3.mjs} +7 -7
- package/dist/client/{SortInput-DysAXpB3.mjs.map → SortInput-Cqs2poV3.mjs.map} +1 -1
- package/dist/client/{StatusError-DX-GvLjq.mjs → StatusError-C5KodQOq.mjs} +4 -4
- package/dist/client/{StatusError-DX-GvLjq.mjs.map → StatusError-C5KodQOq.mjs.map} +1 -1
- package/dist/client/{TwoColumnDescriptionList-B3xunXmz.mjs → TwoColumnDescriptionList-DiDx3PnH.mjs} +6 -6
- package/dist/client/{TwoColumnDescriptionList-B3xunXmz.mjs.map → TwoColumnDescriptionList-DiDx3PnH.mjs.map} +1 -1
- package/dist/client/{_auth-R5H2yKFf.mjs → _auth-DJ9wHZaj.mjs} +2 -2
- package/dist/client/{_auth-R5H2yKFf.mjs.map → _auth-DJ9wHZaj.mjs.map} +1 -1
- package/dist/client/{_flavorId-Zj7LNL-R.mjs → _flavorId-BN_qessZ.mjs} +2 -2
- package/dist/client/{_flavorId-Zj7LNL-R.mjs.map → _flavorId-BN_qessZ.mjs.map} +1 -1
- package/dist/client/{_flavorId-Dit5mM8I.mjs → _flavorId-CJjEB_Ao.mjs} +34 -34
- package/dist/client/{_flavorId-Dit5mM8I.mjs.map → _flavorId-CJjEB_Ao.mjs.map} +1 -1
- package/dist/client/{_floatingIpId-DCQQpNO-.mjs → _floatingIpId-CwDGHkWm.mjs} +2 -2
- package/dist/client/{_floatingIpId-DCQQpNO-.mjs.map → _floatingIpId-CwDGHkWm.mjs.map} +1 -1
- package/dist/client/{_floatingIpId-B0MCoqE3.mjs → _floatingIpId-foMIwbE4.mjs} +23 -23
- package/dist/client/{_floatingIpId-B0MCoqE3.mjs.map → _floatingIpId-foMIwbE4.mjs.map} +1 -1
- package/dist/client/_imageId-BtJ7GmYB.mjs +558 -0
- package/dist/client/{_imageId-CZYzBAVx.mjs.map → _imageId-BtJ7GmYB.mjs.map} +1 -1
- package/dist/client/{_projectId-DhSWowQo.mjs → _projectId-BmtCuzJu.mjs} +4 -4
- package/dist/client/{_projectId-DhSWowQo.mjs.map → _projectId-BmtCuzJu.mjs.map} +1 -1
- package/dist/client/_projectId-Byt3GQDW.mjs +99 -0
- package/dist/client/_projectId-Byt3GQDW.mjs.map +1 -0
- package/dist/client/_projectId-NYk1IN_a.mjs +291 -0
- package/dist/client/_projectId-NYk1IN_a.mjs.map +1 -0
- package/dist/client/{_projectId-D2pFfYIs.mjs → _projectId-QueiFczy.mjs} +3 -3
- package/dist/client/{_projectId-D2pFfYIs.mjs.map → _projectId-QueiFczy.mjs.map} +1 -1
- package/dist/client/{_securityGroupId-Mj8NJT2-.mjs → _securityGroupId-BcbkRhsN.mjs} +2 -2
- package/dist/client/{_securityGroupId-Mj8NJT2-.mjs.map → _securityGroupId-BcbkRhsN.mjs.map} +1 -1
- package/dist/client/{_securityGroupId-DZ4D4WwB.mjs → _securityGroupId-pPtJsCoe.mjs} +438 -442
- package/dist/client/{_securityGroupId-DZ4D4WwB.mjs.map → _securityGroupId-pPtJsCoe.mjs.map} +1 -1
- package/dist/client/_storageType-BmqrU06i.mjs +2202 -0
- package/dist/client/_storageType-BmqrU06i.mjs.map +1 -0
- package/dist/client/{about-WLyShNgE.mjs → about-_73VmpTB.mjs} +2 -2
- package/dist/client/{about-WLyShNgE.mjs.map → about-_73VmpTB.mjs.map} +1 -1
- package/dist/client/assets/{objectDownload.worker-BXFQIIU_.js.map → objectDownload.worker-CWWLPDyb.js.map} +1 -1
- package/dist/client/assets/{objectDownload.worker-ECvFtmOF.js.map → objectDownload.worker-kZlQuo3F.js.map} +1 -1
- package/dist/client/{aurora-IMO9HhqJ.mjs → aurora-EbwGRLLf.mjs} +2 -2
- package/dist/client/{aurora-IMO9HhqJ.mjs.map → aurora-EbwGRLLf.mjs.map} +1 -1
- package/dist/client/{build-DnD-T35u.mjs → build-C_4vRMCq.mjs} +2233 -2662
- package/dist/client/{build-DnD-T35u.mjs.map → build-C_4vRMCq.mjs.map} +1 -1
- package/dist/client/{flavors-Cp0LEGOH.mjs → flavors-CiHCYrtZ.mjs} +2 -2
- package/dist/client/{flavors-Cp0LEGOH.mjs.map → flavors-CiHCYrtZ.mjs.map} +1 -1
- package/dist/client/{flavors-CwMbDRHm2.mjs → flavors-DY-bDc8l.mjs} +164 -164
- package/dist/client/flavors-DY-bDc8l.mjs.map +1 -0
- package/dist/client/{floatingips-ICwo-rV_.mjs → floatingips-Ci4jHkaG.mjs} +177 -177
- package/dist/client/{floatingips-ICwo-rV_.mjs.map → floatingips-Ci4jHkaG.mjs.map} +1 -1
- package/dist/client/{hooks-CrriowRk.mjs → hooks-LutR2Yg3.mjs} +2 -2
- package/dist/client/{hooks-CrriowRk.mjs.map → hooks-LutR2Yg3.mjs.map} +1 -1
- package/dist/client/images-91U7tr9Y2.mjs +1976 -0
- package/dist/client/images-91U7tr9Y2.mjs.map +1 -0
- package/dist/client/{images-DWiM_72I.mjs → images-CS4kZQyu.mjs} +2 -2
- package/dist/client/{images-DWiM_72I.mjs.map → images-CS4kZQyu.mjs.map} +1 -1
- package/dist/client/index.d.ts +4 -1
- package/dist/client/index.js +444 -586
- package/dist/client/index.js.map +1 -1
- package/dist/client/{md-DNzcRhmz.mjs → md-kvaGCNAK.mjs} +4 -22
- package/dist/client/{md-DNzcRhmz.mjs.map → md-kvaGCNAK.mjs.map} +1 -1
- package/dist/client/{objects-DeK2WD5K.mjs → objects-C3azvW8m.mjs} +2019 -2023
- package/dist/client/{objects-DeK2WD5K.mjs.map → objects-C3azvW8m.mjs.map} +1 -1
- package/dist/client/{objects-DI1-tnKr.mjs → objects-CM265S6b.mjs} +2 -2
- package/dist/client/{objects-DI1-tnKr.mjs.map → objects-CM265S6b.mjs.map} +1 -1
- package/dist/client/{objects-D2MKUCxc.mjs → objects-EE9Cd1wI.mjs} +2 -2
- package/dist/client/{objects-D2MKUCxc.mjs.map → objects-EE9Cd1wI.mjs.map} +1 -1
- package/dist/client/{routeInfo-CdTRlSxv.mjs → routeInfo-DXqB2HCf.mjs} +3 -3
- package/dist/client/routeInfo-DXqB2HCf.mjs.map +1 -0
- package/dist/client/router.d.ts +2 -1
- package/dist/client/{routes-DOJr5onJ.mjs → routes-CBd8CCuM.mjs} +13 -13
- package/dist/client/{routes-DOJr5onJ.mjs.map → routes-CBd8CCuM.mjs.map} +1 -1
- package/dist/client/{routes-B05u5bk4.mjs → routes-CdDm-hhO.mjs} +2 -2
- package/dist/client/{routes-B05u5bk4.mjs.map → routes-CdDm-hhO.mjs.map} +1 -1
- package/dist/client/{securitygroups-Be2Qgmew.mjs → securitygroups-Bd_uV4S9.mjs} +198 -198
- package/dist/client/{securitygroups-Be2Qgmew.mjs.map → securitygroups-Bd_uV4S9.mjs.map} +1 -1
- package/dist/client/{securitygroups-_7SYN2jN.mjs → securitygroups-Byte-iSp.mjs} +2 -2
- package/dist/client/{securitygroups-_7SYN2jN.mjs.map → securitygroups-Byte-iSp.mjs.map} +1 -1
- package/dist/client/services-D1PbooD1.mjs +6 -0
- package/dist/client/services-D1PbooD1.mjs.map +1 -0
- package/dist/client/services-DEMVtFyn.mjs +9 -0
- package/dist/client/services-DEMVtFyn.mjs.map +1 -0
- package/dist/client/trpcClient.d.ts +18 -367
- package/dist/client/{useSecurityGroupPermissions-qPwm4mFt.mjs → useSecurityGroupPermissions-C29mzb3b.mjs} +15 -15
- package/dist/client/{useSecurityGroupPermissions-qPwm4mFt.mjs.map → useSecurityGroupPermissions-C29mzb3b.mjs.map} +1 -1
- package/dist/server/index.d.ts +43 -369
- package/dist/server/index.js +71 -276
- package/package.json +1 -3
- package/dist/client/AuthProvider-5TyZKZkx.mjs.map +0 -1
- package/dist/client/DeleteFlavorModal-C2K43ABZ.mjs.map +0 -1
- package/dist/client/DeletePcaModal-D9v8E0Ki.mjs +0 -92
- package/dist/client/DeletePcaModal-D9v8E0Ki.mjs.map +0 -1
- package/dist/client/DetailsInfo-h7rPJ4Jf.mjs +0 -61
- package/dist/client/DetailsInfo-h7rPJ4Jf.mjs.map +0 -1
- package/dist/client/ImageToastNotifications-C0Tluzq-.mjs +0 -1125
- package/dist/client/ImageToastNotifications-C0Tluzq-.mjs.map +0 -1
- package/dist/client/_imageId-CZYzBAVx.mjs +0 -558
- package/dist/client/_pcaId-CHRRsWmO.mjs +0 -605
- package/dist/client/_pcaId-CHRRsWmO.mjs.map +0 -1
- package/dist/client/_projectId-B8wWSxPu.mjs +0 -98
- package/dist/client/_projectId-B8wWSxPu.mjs.map +0 -1
- package/dist/client/_projectId-C5DUYIjt.mjs +0 -291
- package/dist/client/_projectId-C5DUYIjt.mjs.map +0 -1
- package/dist/client/_storageType-C-9bNkmZ.mjs +0 -2211
- package/dist/client/_storageType-C-9bNkmZ.mjs.map +0 -1
- package/dist/client/flavors-CwMbDRHm2.mjs.map +0 -1
- package/dist/client/images-DOGZmr3D.mjs +0 -1937
- package/dist/client/images-DOGZmr3D.mjs.map +0 -1
- package/dist/client/pca-BokFv4Gz.mjs +0 -239
- package/dist/client/pca-BokFv4Gz.mjs.map +0 -1
- package/dist/client/pca-D5jHAl0b.mjs +0 -26
- package/dist/client/pca-D5jHAl0b.mjs.map +0 -1
- package/dist/client/pcaAccess-Br4kVjLQ.mjs +0 -9
- package/dist/client/pcaAccess-Br4kVjLQ.mjs.map +0 -1
- package/dist/client/routeInfo-CdTRlSxv.mjs.map +0 -1
package/dist/server/index.js
CHANGED
|
@@ -27310,7 +27310,7 @@ var require_pathHelpers = __commonJS({
|
|
|
27310
27310
|
});
|
|
27311
27311
|
exports2.encodeOpenstackPathSegment = encodeOpenstackPathSegment2;
|
|
27312
27312
|
exports2.encodeOpenstackPath = encodeOpenstackPath;
|
|
27313
|
-
exports2.validateAndEncodeResourceId =
|
|
27313
|
+
exports2.validateAndEncodeResourceId = validateAndEncodeResourceId6;
|
|
27314
27314
|
var error_1 = require_error();
|
|
27315
27315
|
function encodeOpenstackPathSegment2(segment, label = "Path segment") {
|
|
27316
27316
|
if (!segment || typeof segment !== "string") {
|
|
@@ -27332,10 +27332,10 @@ var require_pathHelpers = __commonJS({
|
|
|
27332
27332
|
return segments.map((seg, idx) => encodeOpenstackPathSegment2(seg, `Path segment ${idx}`)).join("/");
|
|
27333
27333
|
}
|
|
27334
27334
|
__name(encodeOpenstackPath, "encodeOpenstackPath");
|
|
27335
|
-
function
|
|
27335
|
+
function validateAndEncodeResourceId6(id, resourceType = "Resource") {
|
|
27336
27336
|
return encodeOpenstackPathSegment2(id, `${resourceType} ID`);
|
|
27337
27337
|
}
|
|
27338
|
-
__name(
|
|
27338
|
+
__name(validateAndEncodeResourceId6, "validateAndEncodeResourceId");
|
|
27339
27339
|
}
|
|
27340
27340
|
});
|
|
27341
27341
|
|
|
@@ -28569,10 +28569,12 @@ __export(server_exports, {
|
|
|
28569
28569
|
createServer: () => createServer,
|
|
28570
28570
|
domainScopedInputSchema: () => domainScopedInputSchema,
|
|
28571
28571
|
domainScopedProcedure: () => domainScopedProcedure,
|
|
28572
|
+
parseOrThrow: () => parseOrThrow,
|
|
28572
28573
|
projectScopedInputSchema: () => projectScopedInputSchema,
|
|
28573
28574
|
projectScopedProcedure: () => projectScopedProcedure,
|
|
28574
28575
|
protectedProcedure: () => protectedProcedure,
|
|
28575
|
-
publicProcedure: () => publicProcedure
|
|
28576
|
+
publicProcedure: () => publicProcedure,
|
|
28577
|
+
validateOpenstackService: () => validateOpenstackService
|
|
28576
28578
|
});
|
|
28577
28579
|
module.exports = __toCommonJS(server_exports);
|
|
28578
28580
|
|
|
@@ -28688,11 +28690,20 @@ var discriminatedSchema = import_zod2.z.discriminatedUnion("type", [
|
|
|
28688
28690
|
var sessionRouter = {
|
|
28689
28691
|
getCurrentUserSession: publicProcedure.query(async ({ ctx }) => {
|
|
28690
28692
|
const token = ctx.openstack?.getToken();
|
|
28691
|
-
|
|
28692
|
-
|
|
28693
|
-
|
|
28694
|
-
|
|
28695
|
-
|
|
28693
|
+
if (!token) return null;
|
|
28694
|
+
return {
|
|
28695
|
+
user: token.tokenData.user,
|
|
28696
|
+
...token.tokenData.expires_at && {
|
|
28697
|
+
expires_at: token.tokenData.expires_at
|
|
28698
|
+
},
|
|
28699
|
+
...token.tokenData.issued_at && {
|
|
28700
|
+
issued_at: token.tokenData.issued_at
|
|
28701
|
+
},
|
|
28702
|
+
roles: token.tokenData.roles,
|
|
28703
|
+
project: token.tokenData.project,
|
|
28704
|
+
domain: token.tokenData.domain,
|
|
28705
|
+
catalog: token.tokenData.catalog
|
|
28706
|
+
};
|
|
28696
28707
|
}),
|
|
28697
28708
|
getCurrentScope: publicProcedure.query(async ({ ctx }) => {
|
|
28698
28709
|
const token = ctx.openstack?.getToken();
|
|
@@ -36297,20 +36308,60 @@ var ec2CredentialRouter = {
|
|
|
36297
36308
|
}),
|
|
36298
36309
|
/**
|
|
36299
36310
|
* Deletes an EC2 credential by ID.
|
|
36311
|
+
* Verifies ownership before deletion to prevent IDOR attacks.
|
|
36300
36312
|
*/
|
|
36301
36313
|
delete: projectScopedProcedure.input(projectScopedInputSchema.extend({
|
|
36302
36314
|
credentialId: import_zod15.z.string().min(1)
|
|
36303
36315
|
})).mutation(async ({ ctx, input }) => {
|
|
36304
36316
|
const userId = ctx.openstack.getToken()?.tokenData.user?.id;
|
|
36317
|
+
const projectId = ctx.openstack.getToken()?.tokenData.project?.id;
|
|
36305
36318
|
if (!userId) {
|
|
36306
36319
|
throw new import_server15.TRPCError({
|
|
36307
36320
|
code: "UNAUTHORIZED",
|
|
36308
36321
|
message: "User ID not found in token"
|
|
36309
36322
|
});
|
|
36310
36323
|
}
|
|
36324
|
+
if (!projectId) {
|
|
36325
|
+
throw new import_server15.TRPCError({
|
|
36326
|
+
code: "UNAUTHORIZED",
|
|
36327
|
+
message: "Project ID not found in token"
|
|
36328
|
+
});
|
|
36329
|
+
}
|
|
36311
36330
|
const identityService = ctx.openstack.service("identity");
|
|
36312
|
-
const
|
|
36313
|
-
if (!
|
|
36331
|
+
const getResponse = await identityService.get(`credentials/${input.credentialId}`);
|
|
36332
|
+
if (!getResponse.ok) {
|
|
36333
|
+
if (getResponse.status === 404) {
|
|
36334
|
+
return {
|
|
36335
|
+
success: true
|
|
36336
|
+
};
|
|
36337
|
+
}
|
|
36338
|
+
if (getResponse.status === 401) {
|
|
36339
|
+
throw new import_server15.TRPCError({
|
|
36340
|
+
code: "UNAUTHORIZED",
|
|
36341
|
+
message: "Authentication failed"
|
|
36342
|
+
});
|
|
36343
|
+
}
|
|
36344
|
+
if (getResponse.status === 403) {
|
|
36345
|
+
throw new import_server15.TRPCError({
|
|
36346
|
+
code: "FORBIDDEN",
|
|
36347
|
+
message: "Access denied"
|
|
36348
|
+
});
|
|
36349
|
+
}
|
|
36350
|
+
throw new import_server15.TRPCError({
|
|
36351
|
+
code: "INTERNAL_SERVER_ERROR",
|
|
36352
|
+
message: "Failed to fetch credential for verification"
|
|
36353
|
+
});
|
|
36354
|
+
}
|
|
36355
|
+
const credentialData = await getResponse.json();
|
|
36356
|
+
const credential = credentialData.credential;
|
|
36357
|
+
if (credential.user_id !== userId || credential.project_id !== projectId) {
|
|
36358
|
+
throw new import_server15.TRPCError({
|
|
36359
|
+
code: "NOT_FOUND",
|
|
36360
|
+
message: "Credential not found"
|
|
36361
|
+
});
|
|
36362
|
+
}
|
|
36363
|
+
const deleteResponse = await identityService.del(`credentials/${input.credentialId}`);
|
|
36364
|
+
if (!deleteResponse.ok && deleteResponse.status !== 404) {
|
|
36314
36365
|
throw new import_server15.TRPCError({
|
|
36315
36366
|
code: "INTERNAL_SERVER_ERROR",
|
|
36316
36367
|
message: "Failed to delete EC2 credential"
|
|
@@ -39120,273 +39171,15 @@ var buildNetworkRouters = /* @__PURE__ */ __name((policyDir) => ({
|
|
|
39120
39171
|
})
|
|
39121
39172
|
}), "buildNetworkRouters");
|
|
39122
39173
|
|
|
39123
|
-
// src/server/Services/routers/pcaRouter.ts
|
|
39124
|
-
var import_signal_openstack8 = __toESM(require_esm());
|
|
39125
|
-
|
|
39126
|
-
// src/server/Services/types/pca.ts
|
|
39127
|
-
var import_zod25 = require("zod");
|
|
39128
|
-
var CertificateValiditySchema = import_zod25.z.object({
|
|
39129
|
-
not_after: import_zod25.z.number().int(),
|
|
39130
|
-
not_before: import_zod25.z.number().int().optional()
|
|
39131
|
-
});
|
|
39132
|
-
var CertificateAuthorityCertificateSchema = import_zod25.z.object({
|
|
39133
|
-
/** PEM encoded certificate data. */
|
|
39134
|
-
pem: import_zod25.z.string(),
|
|
39135
|
-
validity: CertificateValiditySchema
|
|
39136
|
-
});
|
|
39137
|
-
var CertificateAuthorityCertificateChainSchema = import_zod25.z.object({
|
|
39138
|
-
certificates: import_zod25.z.array(import_zod25.z.object({
|
|
39139
|
-
pem: import_zod25.z.string()
|
|
39140
|
-
})),
|
|
39141
|
-
/** Concatenated PEM certificates of the chain. */
|
|
39142
|
-
pem: import_zod25.z.string()
|
|
39143
|
-
});
|
|
39144
|
-
var CertificateAuthorityAdditionalAttributeSchema = import_zod25.z.object({
|
|
39145
|
-
/** ASN.1 Object Identifier of the attribute */
|
|
39146
|
-
key: import_zod25.z.array(import_zod25.z.number().int()),
|
|
39147
|
-
value: import_zod25.z.string()
|
|
39148
|
-
});
|
|
39149
|
-
var stringOrStringArray = import_zod25.z.union([
|
|
39150
|
-
import_zod25.z.array(import_zod25.z.string()),
|
|
39151
|
-
import_zod25.z.string().transform((s) => [
|
|
39152
|
-
s
|
|
39153
|
-
])
|
|
39154
|
-
]);
|
|
39155
|
-
var CertificateAuthoritySubjectSchema = import_zod25.z.object({
|
|
39156
|
-
additional_attribute: import_zod25.z.array(CertificateAuthorityAdditionalAttributeSchema).optional(),
|
|
39157
|
-
named_attributes: import_zod25.z.object({
|
|
39158
|
-
cn: import_zod25.z.string(),
|
|
39159
|
-
/** Country codes (ISO 3166-1 alpha-2). */
|
|
39160
|
-
c: stringOrStringArray.optional(),
|
|
39161
|
-
/** Locality/city names. */
|
|
39162
|
-
l: stringOrStringArray.optional(),
|
|
39163
|
-
/** Organization names. */
|
|
39164
|
-
o: stringOrStringArray.optional(),
|
|
39165
|
-
/** Organizational unit names. */
|
|
39166
|
-
ou: stringOrStringArray.optional(),
|
|
39167
|
-
/** Postal/ZIP codes. */
|
|
39168
|
-
postal_code: stringOrStringArray.optional(),
|
|
39169
|
-
/** State or province names. */
|
|
39170
|
-
st: stringOrStringArray.optional(),
|
|
39171
|
-
serial_number: import_zod25.z.string().optional(),
|
|
39172
|
-
street: stringOrStringArray.optional()
|
|
39173
|
-
})
|
|
39174
|
-
});
|
|
39175
|
-
var CertificateAuthorityStateSchema = import_zod25.z.enum([
|
|
39176
|
-
"CREATING",
|
|
39177
|
-
"AWAITING_CERTIFICATE",
|
|
39178
|
-
"READY",
|
|
39179
|
-
"FAILED"
|
|
39180
|
-
]);
|
|
39181
|
-
var CertificateAuthoritySchema = import_zod25.z.object({
|
|
39182
|
-
certificate: CertificateAuthorityCertificateSchema.optional(),
|
|
39183
|
-
/** Details of Certificate Authority certificate's issuers chain. */
|
|
39184
|
-
certificate_chain: CertificateAuthorityCertificateChainSchema.optional(),
|
|
39185
|
-
configuration: import_zod25.z.object({
|
|
39186
|
-
/** X.509 subject of Certificate Authority. Required on create operation. */
|
|
39187
|
-
subject: CertificateAuthoritySubjectSchema
|
|
39188
|
-
}).optional(),
|
|
39189
|
-
csr: import_zod25.z.string().optional(),
|
|
39190
|
-
/** Human-readable subject string, e.g. "CN=demo-ca.test.sci". */
|
|
39191
|
-
display_subject: import_zod25.z.string().optional(),
|
|
39192
|
-
id: import_zod25.z.string(),
|
|
39193
|
-
/**
|
|
39194
|
-
* Required on import certificate operation.
|
|
39195
|
-
* Certificate Authority certificate chain, in PEM format. Consists of concatenated string
|
|
39196
|
-
* of Certificate Authority certificate, followed by its intermediate issuing CAs certificates
|
|
39197
|
-
* and root issuing CA certificate last.
|
|
39198
|
-
*/
|
|
39199
|
-
imported_certificate_chain: import_zod25.z.string().optional(),
|
|
39200
|
-
/** Identifier of OpenStack project that Certificate Authority belongs. */
|
|
39201
|
-
project_id: import_zod25.z.string(),
|
|
39202
|
-
/** Current operational state of Certificate Authority. */
|
|
39203
|
-
state: CertificateAuthorityStateSchema
|
|
39204
|
-
});
|
|
39205
|
-
var LinkSchema = import_zod25.z.object({
|
|
39206
|
-
href: import_zod25.z.string(),
|
|
39207
|
-
rel: import_zod25.z.string()
|
|
39208
|
-
});
|
|
39209
|
-
var CertificateAuthoritiesListSchema = import_zod25.z.object({
|
|
39210
|
-
certificate_authorities: import_zod25.z.array(CertificateAuthoritySchema),
|
|
39211
|
-
links: import_zod25.z.array(LinkSchema),
|
|
39212
|
-
next_page_marker: import_zod25.z.string().optional()
|
|
39213
|
-
});
|
|
39214
|
-
var CertificateAuthoritiesListInputSchema = projectScopedInputSchema.extend({
|
|
39215
|
-
limit: import_zod25.z.number().int().min(1).max(1e3).optional(),
|
|
39216
|
-
next_page_marker: import_zod25.z.string().trim().min(1).optional()
|
|
39217
|
-
});
|
|
39218
|
-
var CertificateAuthorityCreateSchema = import_zod25.z.object({
|
|
39219
|
-
configuration: import_zod25.z.object({
|
|
39220
|
-
subject: import_zod25.z.object({
|
|
39221
|
-
named_attributes: import_zod25.z.object({
|
|
39222
|
-
cn: import_zod25.z.string().trim().min(1)
|
|
39223
|
-
})
|
|
39224
|
-
})
|
|
39225
|
-
})
|
|
39226
|
-
});
|
|
39227
|
-
var CertificateAuthorityIdInputSchema = projectScopedInputSchema.extend({
|
|
39228
|
-
certificate_authority_id: import_zod25.z.string().min(1)
|
|
39229
|
-
});
|
|
39230
|
-
var CertificateAuthorityCertificatesListInputSchema = CertificateAuthorityIdInputSchema.extend({
|
|
39231
|
-
limit: import_zod25.z.number().int().min(1).max(1e3).optional(),
|
|
39232
|
-
next_page_marker: import_zod25.z.string().trim().min(1).optional()
|
|
39233
|
-
});
|
|
39234
|
-
var CertificateAuthorityImportInputSchema = CertificateAuthorityIdInputSchema.extend({
|
|
39235
|
-
imported_certificate_chain: import_zod25.z.string().min(1)
|
|
39236
|
-
});
|
|
39237
|
-
var CertificateIdInputSchema = CertificateAuthorityIdInputSchema.extend({
|
|
39238
|
-
certificate_id: import_zod25.z.string().min(1)
|
|
39239
|
-
});
|
|
39240
|
-
var CertificateConfigurationSchema = import_zod25.z.object({
|
|
39241
|
-
validity: CertificateValiditySchema
|
|
39242
|
-
});
|
|
39243
|
-
var CreateCertificateInputSchema = projectScopedInputSchema.extend({
|
|
39244
|
-
certificate_authority_id: import_zod25.z.string().min(1),
|
|
39245
|
-
csr: import_zod25.z.string().min(1),
|
|
39246
|
-
configuration: CertificateConfigurationSchema
|
|
39247
|
-
});
|
|
39248
|
-
var CertificateSchema = import_zod25.z.object({
|
|
39249
|
-
certificate: CertificateAuthorityCertificateSchema.optional(),
|
|
39250
|
-
certificate_authority_id: import_zod25.z.string(),
|
|
39251
|
-
certificate_chain: CertificateAuthorityCertificateChainSchema.optional(),
|
|
39252
|
-
configuration: CertificateConfigurationSchema.optional(),
|
|
39253
|
-
csr: import_zod25.z.string().optional(),
|
|
39254
|
-
id: import_zod25.z.string(),
|
|
39255
|
-
project_id: import_zod25.z.string()
|
|
39256
|
-
});
|
|
39257
|
-
var CertificatesListSchema = import_zod25.z.object({
|
|
39258
|
-
certificates: import_zod25.z.array(CertificateSchema),
|
|
39259
|
-
links: import_zod25.z.array(LinkSchema),
|
|
39260
|
-
next_page_marker: import_zod25.z.string().optional()
|
|
39261
|
-
});
|
|
39262
|
-
|
|
39263
|
-
// src/server/Services/routers/pcaRouter.ts
|
|
39264
|
-
var PCA_BASE_URL = "v1/certificate-authorities";
|
|
39265
|
-
var pcaRouter = {
|
|
39266
|
-
list: projectScopedProcedure.input(CertificateAuthoritiesListInputSchema).query(async ({ input, ctx }) => {
|
|
39267
|
-
return withErrorHandling3(async () => {
|
|
39268
|
-
const pca = ctx.openstack?.service("pca");
|
|
39269
|
-
validateOpenstackService(pca, "pca");
|
|
39270
|
-
const queryParams = new URLSearchParams();
|
|
39271
|
-
if (input.limit !== void 0) queryParams.set("limit", String(input.limit));
|
|
39272
|
-
if (input.next_page_marker !== void 0) queryParams.set("next_page_marker", input.next_page_marker);
|
|
39273
|
-
const queryString = queryParams.toString();
|
|
39274
|
-
const url = queryString ? `${PCA_BASE_URL}?${queryString}` : PCA_BASE_URL;
|
|
39275
|
-
const response = await pca.get(url);
|
|
39276
|
-
const data = await response.json();
|
|
39277
|
-
return parseOrThrow(CertificateAuthoritiesListSchema, data, "pcaRouter.list");
|
|
39278
|
-
}, "list certificate authorities");
|
|
39279
|
-
}),
|
|
39280
|
-
/**
|
|
39281
|
-
* Creates a new Certificate Authority (CA).
|
|
39282
|
-
* The CA is created in CREATING state and transitions to AWAITING_CERTIFICATE state once its CSR has been generated.
|
|
39283
|
-
* CA in AWAITING_CERTIFICATE can't issue end-entity certificates, and needs to have its certificate imported - see the respective importCertificate endpoint.
|
|
39284
|
-
*/
|
|
39285
|
-
create: projectScopedProcedure.input(CertificateAuthorityCreateSchema).mutation(async ({ input, ctx }) => {
|
|
39286
|
-
return withErrorHandling3(async () => {
|
|
39287
|
-
const pca = ctx.openstack?.service("pca");
|
|
39288
|
-
validateOpenstackService(pca, "pca");
|
|
39289
|
-
const response = await pca.post(PCA_BASE_URL, omit(input, "project_id"));
|
|
39290
|
-
const data = await response.json();
|
|
39291
|
-
return parseOrThrow(CertificateAuthoritySchema, data, "pcaRouter.create");
|
|
39292
|
-
}, "create certificate authority");
|
|
39293
|
-
}),
|
|
39294
|
-
getById: projectScopedProcedure.input(CertificateAuthorityIdInputSchema).query(async ({ input, ctx }) => {
|
|
39295
|
-
return withErrorHandling3(async () => {
|
|
39296
|
-
const pca = ctx.openstack?.service("pca");
|
|
39297
|
-
validateOpenstackService(pca, "pca");
|
|
39298
|
-
const encodedId = (0, import_signal_openstack8.validateAndEncodeResourceId)(input.certificate_authority_id, "Certificate authority");
|
|
39299
|
-
const url = `${PCA_BASE_URL}/${encodedId}`;
|
|
39300
|
-
const response = await pca.get(url);
|
|
39301
|
-
const data = await response.json();
|
|
39302
|
-
return parseOrThrow(CertificateAuthoritySchema, data, "pcaRouter.getById");
|
|
39303
|
-
}, "get certificate authority details");
|
|
39304
|
-
}),
|
|
39305
|
-
// Permanently deletes a Certificate Authority. This operation is irreversible.
|
|
39306
|
-
delete: projectScopedProcedure.input(CertificateAuthorityIdInputSchema).mutation(async ({ input, ctx }) => {
|
|
39307
|
-
return withErrorHandling3(async () => {
|
|
39308
|
-
const pca = ctx.openstack?.service("pca");
|
|
39309
|
-
validateOpenstackService(pca, "pca");
|
|
39310
|
-
const encodedId = (0, import_signal_openstack8.validateAndEncodeResourceId)(input.certificate_authority_id, "Certificate authority");
|
|
39311
|
-
const url = `${PCA_BASE_URL}/${encodedId}`;
|
|
39312
|
-
await pca.del(url);
|
|
39313
|
-
}, "delete certificate authority");
|
|
39314
|
-
}),
|
|
39315
|
-
/**
|
|
39316
|
-
* Imports Certificate Authority certificate
|
|
39317
|
-
* Transitioning the CA from AWAITING_CERTIFICATE to READY state
|
|
39318
|
-
* after which the CA becomes fully operational and can issue certificates to end entities
|
|
39319
|
-
*/
|
|
39320
|
-
import: projectScopedProcedure.input(CertificateAuthorityImportInputSchema).mutation(async ({ input, ctx }) => {
|
|
39321
|
-
return withErrorHandling3(async () => {
|
|
39322
|
-
const pca = ctx.openstack?.service("pca");
|
|
39323
|
-
validateOpenstackService(pca, "pca");
|
|
39324
|
-
const encodedId = (0, import_signal_openstack8.validateAndEncodeResourceId)(input.certificate_authority_id, "Certificate authority");
|
|
39325
|
-
const url = `${PCA_BASE_URL}/${encodedId}:importCertificate`;
|
|
39326
|
-
const response = await pca.post(url, {
|
|
39327
|
-
imported_certificate_chain: input.imported_certificate_chain
|
|
39328
|
-
});
|
|
39329
|
-
const data = await response.json();
|
|
39330
|
-
return parseOrThrow(CertificateAuthoritySchema, data, "pcaRouter.import");
|
|
39331
|
-
}, "import certificate of certificate authority");
|
|
39332
|
-
}),
|
|
39333
|
-
listCertificates: projectScopedProcedure.input(CertificateAuthorityCertificatesListInputSchema).query(async ({ input, ctx }) => {
|
|
39334
|
-
return withErrorHandling3(async () => {
|
|
39335
|
-
const pca = ctx.openstack?.service("pca");
|
|
39336
|
-
validateOpenstackService(pca, "pca");
|
|
39337
|
-
const queryParams = new URLSearchParams();
|
|
39338
|
-
if (input.limit !== void 0) queryParams.set("limit", String(input.limit));
|
|
39339
|
-
if (input.next_page_marker !== void 0) queryParams.set("next_page_marker", input.next_page_marker);
|
|
39340
|
-
const queryString = queryParams.toString();
|
|
39341
|
-
const encodedId = (0, import_signal_openstack8.validateAndEncodeResourceId)(input.certificate_authority_id, "Certificate authority");
|
|
39342
|
-
const baseUrl = `${PCA_BASE_URL}/${encodedId}/certificates`;
|
|
39343
|
-
const url = queryString ? `${baseUrl}?${queryString}` : baseUrl;
|
|
39344
|
-
const response = await pca.get(url);
|
|
39345
|
-
const data = await response.json();
|
|
39346
|
-
return parseOrThrow(CertificatesListSchema, data, "pcaRouter.listCertificates");
|
|
39347
|
-
}, "list certificates for certificate authority");
|
|
39348
|
-
}),
|
|
39349
|
-
createCertificate: projectScopedProcedure.input(CreateCertificateInputSchema).mutation(async ({ input, ctx }) => {
|
|
39350
|
-
return withErrorHandling3(async () => {
|
|
39351
|
-
const pca = ctx.openstack?.service("pca");
|
|
39352
|
-
validateOpenstackService(pca, "pca");
|
|
39353
|
-
const encodedId = (0, import_signal_openstack8.validateAndEncodeResourceId)(input.certificate_authority_id, "Certificate authority");
|
|
39354
|
-
const url = `${PCA_BASE_URL}/${encodedId}/certificates`;
|
|
39355
|
-
const response = await pca.post(url, omit(input, "project_id", "certificate_authority_id"));
|
|
39356
|
-
const data = await response.json();
|
|
39357
|
-
return parseOrThrow(CertificateSchema, data, "pcaRouter.createCertificate");
|
|
39358
|
-
}, "create certificate for certificate authority");
|
|
39359
|
-
}),
|
|
39360
|
-
getByIdCertificate: projectScopedProcedure.input(CertificateIdInputSchema).query(async ({ input, ctx }) => {
|
|
39361
|
-
return withErrorHandling3(async () => {
|
|
39362
|
-
const pca = ctx.openstack?.service("pca");
|
|
39363
|
-
validateOpenstackService(pca, "pca");
|
|
39364
|
-
const encodedAuthorityId = (0, import_signal_openstack8.validateAndEncodeResourceId)(input.certificate_authority_id, "Certificate authority");
|
|
39365
|
-
const encodedCertId = (0, import_signal_openstack8.validateAndEncodeResourceId)(input.certificate_id, "Certificate");
|
|
39366
|
-
const url = `${PCA_BASE_URL}/${encodedAuthorityId}/certificates/${encodedCertId}`;
|
|
39367
|
-
const response = await pca.get(url);
|
|
39368
|
-
const data = await response.json();
|
|
39369
|
-
return parseOrThrow(CertificateSchema, data, "pcaRouter.getByIdCertificate");
|
|
39370
|
-
}, "get certificate details");
|
|
39371
|
-
})
|
|
39372
|
-
};
|
|
39373
|
-
|
|
39374
|
-
// src/server/Services/routers/index.ts
|
|
39375
|
-
var serviceRouters = {
|
|
39376
|
-
services: auroraRouter({
|
|
39377
|
-
pca: pcaRouter
|
|
39378
|
-
})
|
|
39379
|
-
};
|
|
39380
|
-
|
|
39381
39174
|
// src/server/routers.ts
|
|
39382
|
-
var buildBaseRouter = /* @__PURE__ */ __name((policyDir) => mergeRouters(auroraRouter(authRouters), auroraRouter(buildComputeRouters(policyDir)), auroraRouter(buildObjectStorageRouters(policyDir)), auroraRouter(projectRouters), auroraRouter(buildNetworkRouters(policyDir))
|
|
39175
|
+
var buildBaseRouter = /* @__PURE__ */ __name((policyDir) => mergeRouters(auroraRouter(authRouters), auroraRouter(buildComputeRouters(policyDir)), auroraRouter(buildObjectStorageRouters(policyDir)), auroraRouter(projectRouters), auroraRouter(buildNetworkRouters(policyDir))), "buildBaseRouter");
|
|
39383
39176
|
var buildAppRouter = /* @__PURE__ */ __name((policyDir, extraRouters = []) => {
|
|
39384
39177
|
if (extraRouters.length === 0) return buildBaseRouter(policyDir);
|
|
39385
39178
|
return mergeRouters(buildBaseRouter(policyDir), ...extraRouters);
|
|
39386
39179
|
}, "buildAppRouter");
|
|
39387
39180
|
|
|
39388
39181
|
// src/server/context.ts
|
|
39389
|
-
var
|
|
39182
|
+
var import_signal_openstack8 = __toESM(require_esm());
|
|
39390
39183
|
|
|
39391
39184
|
// src/server/sessionCookie.ts
|
|
39392
39185
|
var import_cookie = require("@fastify/cookie");
|
|
@@ -39474,7 +39267,7 @@ async function createContext(opts, config) {
|
|
|
39474
39267
|
writable: false
|
|
39475
39268
|
});
|
|
39476
39269
|
if (currentAuthToken) {
|
|
39477
|
-
openstackSession = await (0,
|
|
39270
|
+
openstackSession = await (0, import_signal_openstack8.SignalOpenstackSession)(normalizedEndpoint, {
|
|
39478
39271
|
auth: {
|
|
39479
39272
|
identity: {
|
|
39480
39273
|
methods: [
|
|
@@ -39537,7 +39330,7 @@ async function createContext(opts, config) {
|
|
|
39537
39330
|
}
|
|
39538
39331
|
}, "getUserInfo");
|
|
39539
39332
|
const createSession = /* @__PURE__ */ __name(async (params) => {
|
|
39540
|
-
openstackSession = await (0,
|
|
39333
|
+
openstackSession = await (0, import_signal_openstack8.SignalOpenstackSession)(normalizedEndpoint, {
|
|
39541
39334
|
auth: {
|
|
39542
39335
|
identity: {
|
|
39543
39336
|
methods: [
|
|
@@ -39683,7 +39476,7 @@ __name(createContext, "createContext");
|
|
|
39683
39476
|
// src/server/server.ts
|
|
39684
39477
|
var import_path2 = __toESM(require("path"));
|
|
39685
39478
|
var import_node_stream4 = require("stream");
|
|
39686
|
-
var
|
|
39479
|
+
var import_zod25 = require("zod");
|
|
39687
39480
|
|
|
39688
39481
|
// src/server/aurora-fastify-plugins/csrfProtection.ts
|
|
39689
39482
|
var import_csrf_protection = __toESM(require("@fastify/csrf-protection"));
|
|
@@ -39884,7 +39677,7 @@ async function createServer(config) {
|
|
|
39884
39677
|
router: appRouter,
|
|
39885
39678
|
createContext: /* @__PURE__ */ __name((opts) => createContext(opts, contextConfig), "createContext"),
|
|
39886
39679
|
onError: /* @__PURE__ */ __name((err) => {
|
|
39887
|
-
if (err.error.cause instanceof
|
|
39680
|
+
if (err.error.cause instanceof import_zod25.ZodError) err.error.message = err.error.cause.issues.map((e) => e.message).join(",");
|
|
39888
39681
|
}, "onError")
|
|
39889
39682
|
}
|
|
39890
39683
|
});
|
|
@@ -39949,10 +39742,12 @@ __name(createServer, "createServer");
|
|
|
39949
39742
|
createServer,
|
|
39950
39743
|
domainScopedInputSchema,
|
|
39951
39744
|
domainScopedProcedure,
|
|
39745
|
+
parseOrThrow,
|
|
39952
39746
|
projectScopedInputSchema,
|
|
39953
39747
|
projectScopedProcedure,
|
|
39954
39748
|
protectedProcedure,
|
|
39955
|
-
publicProcedure
|
|
39749
|
+
publicProcedure,
|
|
39750
|
+
validateOpenstackService
|
|
39956
39751
|
});
|
|
39957
39752
|
/*! Bundled license information:
|
|
39958
39753
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cobaltcore-dev/aurora",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Aurora OpenStack dashboard — server and client library",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -58,14 +58,12 @@
|
|
|
58
58
|
"@fastify/helmet": "^13.0.2",
|
|
59
59
|
"@fastify/multipart": "^10.0.0",
|
|
60
60
|
"@fastify/static": "^10.1.2",
|
|
61
|
-
"@peculiar/x509": "^2.0.0",
|
|
62
61
|
"@trpc/client": "11.16.0",
|
|
63
62
|
"@trpc/server": "11.16.0",
|
|
64
63
|
"class-variance-authority": "^0.7.1",
|
|
65
64
|
"clsx": "^2.1.1",
|
|
66
65
|
"fastify-plugin": "^5.1.0",
|
|
67
66
|
"node-fetch": "^3.3.2",
|
|
68
|
-
"reflect-metadata": "^0.2.2",
|
|
69
67
|
"tailwind-merge": "^3.2.0",
|
|
70
68
|
"zod": "^4.0.0"
|
|
71
69
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AuthProvider-5TyZKZkx.mjs","names":["React","useEffect","useState","trpcClient","AuthContext","createContext","AuthProvider","children","user","setUser","isLoading","setIsLoading","error","setError","expiresAt","setExpiresAt","redirectToLogin","saveReturnUrl","window","location","pathname","returnUrl","encodeURIComponent","search","replace","clearLocalSession","auth","getCurrentUserSession","query","then","session","expires_at","catch","err","Error","message","finally","timeUntilExpiry","Date","getTime","now","handleExpiry","timer","setTimeout","clearTimeout","login","domain","password","createUserSession","mutate","domainName","success","logout","terminateUserSession","Provider","value","isAuthenticated","undefined","useAuth","context","useContext"],"sources":["../../src/client/store/AuthProvider.tsx"],"sourcesContent":["import React, { useEffect, useState } from \"react\"\nimport { TokenData } from \"../../server/Authentication/types/models\"\nimport { trpcClient } from \"../trpcClient\"\n\nexport type User = TokenData[\"user\"] | null\n\nexport interface AuthContext {\n isAuthenticated: boolean\n isLoading: boolean\n error: string | null\n login: (credentials: { domain: string; user: string; password: string }) => Promise<{ success: boolean }>\n logout: () => Promise<void>\n user?: User\n expiresAt?: Date\n}\n\nconst AuthContext = React.createContext<AuthContext | null>(null)\n\nexport function AuthProvider({ children }: { children: React.ReactNode }) {\n const [user, setUser] = useState<User | null>(null)\n const [isLoading, setIsLoading] = useState(true)\n const [error, setError] = useState<string | null>(null)\n const [expiresAt, setExpiresAt] = useState<string | null>(null)\n\n // Redirect to login, optionally with return URL\n const redirectToLogin = (saveReturnUrl: boolean = false) => {\n if (window.location.pathname !== \"/\") {\n const returnUrl = saveReturnUrl\n ? `/?redirect=${encodeURIComponent(window.location.pathname + window.location.search)}`\n : \"/\"\n window.location.replace(returnUrl)\n }\n }\n\n // Clear local session state\n const clearLocalSession = () => {\n setUser(null)\n setExpiresAt(null)\n }\n\n // Get current session on mount\n useEffect(() => {\n trpcClient.auth.getCurrentUserSession\n .query()\n .then((session) => {\n if (session) {\n setUser(session.user)\n setExpiresAt(session.expires_at)\n }\n })\n .catch((err) => {\n setError(err instanceof Error ? err.message : \"Could not load session\")\n })\n .finally(() => setIsLoading(false))\n }, [])\n\n // Auto-logout when session expires\n useEffect(() => {\n if (!user || !expiresAt) return\n\n const timeUntilExpiry = new Date(expiresAt).getTime() - Date.now()\n\n const handleExpiry = () => {\n clearLocalSession()\n redirectToLogin(true)\n }\n\n if (timeUntilExpiry <= 0) {\n handleExpiry()\n return\n }\n\n const timer = setTimeout(handleExpiry, timeUntilExpiry)\n return () => clearTimeout(timer)\n }, [user, expiresAt])\n\n const login = async ({ domain, user, password }: { domain: string; user: string; password: string }) => {\n setError(null)\n setIsLoading(true)\n try {\n const session = await trpcClient.auth.createUserSession.mutate({ domainName: domain, user, password })\n setUser(session.user)\n setExpiresAt(session.expires_at)\n return { success: true }\n } catch (err) {\n setError(err instanceof Error ? err.message : `Could not create session: ${err}`)\n return { success: false }\n } finally {\n setIsLoading(false)\n }\n }\n\n const logout = async () => {\n setIsLoading(true)\n await trpcClient.auth.terminateUserSession.mutate().catch(() => {})\n clearLocalSession()\n redirectToLogin(false) // Don't save return URL on manual logout\n // If already on login page, no redirect happens - reset loading state\n if (window.location.pathname === \"/\") {\n setIsLoading(false)\n }\n }\n\n return (\n <AuthContext.Provider\n value={{\n user,\n isAuthenticated: !!user,\n isLoading,\n error,\n login,\n logout,\n expiresAt: expiresAt ? new Date(expiresAt) : undefined,\n }}\n >\n {children}\n </AuthContext.Provider>\n )\n}\n\nexport function useAuth() {\n const context = React.useContext(AuthContext)\n if (!context) {\n throw new Error(\"useAuth must be used within an AuthProvider\")\n }\n return context\n}\n"],"mappings":";;;;AAgBA,IAAMI,IAAcJ,gBAAMK,cAAkC,IAAA;AAE5D,SAAgBC,EAAa,EAAEC,eAAyC;CACtE,IAAM,CAACC,GAAMC,KAAWP,EAAsB,IAAA,GACxC,CAACQ,GAAWC,KAAgBT,EAAS,EAAA,GACrC,CAACU,GAAOC,KAAYX,EAAwB,IAAA,GAC5C,CAACY,GAAWC,KAAgBb,EAAwB,IAAA,GAGpDc,KAAmBC,IAAyB,OAAK;EACrD,IAAIC,OAAOC,SAASC,aAAa,KAAK;GACpC,IAAMC,IAAYJ,IACd,cAAcK,mBAAmBJ,OAAOC,SAASC,WAAWF,OAAOC,SAASI,MAAM,MAClF;GACJL,OAAOC,SAASK,QAAQH,CAAAA;EAC1B;CACF,GAGMI,UAAoB;EAExBV,AADAN,EAAQ,IAAA,GACRM,EAAa,IAAA;CACf;CAiEA,OA9DAd,QAAU;EACRE,EAAWuB,KAAKC,sBACbC,MAAK,CAAA,CACLC,MAAMC,MAAAA;GACL,AAAIA,MACFrB,EAAQqB,EAAQtB,IAAI,GACpBO,EAAae,EAAQC,UAAU;EAEnC,CAAA,CAAA,CACCC,OAAOC,MAAAA;GACNpB,EAASoB,aAAeC,QAAQD,EAAIE,UAAU,wBAAA;EAChD,CAAA,CAAA,CACCC,cAAczB,EAAa,EAAA,CAAA;CAChC,GAAG,CAAA,CAAE,GAGLV,QAAU;EACR,IAAI,CAACO,KAAQ,CAACM,GAAW;EAEzB,IAAMuB,IAAkB,IAAIC,KAAKxB,CAAAA,CAAAA,CAAWyB,QAAO,IAAKD,KAAKE,IAAG,GAE1DC,UAAe;GAEnBzB,AADAS,EAAAA,GACAT,EAAgB,EAAA;EAClB;EAEA,IAAIqB,KAAmB,GAAG;GACxBI,EAAAA;GACA;EACF;EAEA,IAAMC,IAAQC,WAAWF,GAAcJ,CAAAA;EACvC,aAAaO,aAAaF,CAAAA;CAC5B,GAAG,CAAClC,GAAMM,CAAU,CAAA,GA8BlB,gBAACV,EAAYkD,UAAQ;EACnBC,OAAO;GACL/C;GACAgD,iBAAiB,CAAC,CAAChD;GACnBE;GACAE;GACAiC,cAlCe,EAAEC,WAAQtC,SAAMuC,kBAA8D;IAEjGpC,AADAE,EAAS,IAAA,GACTF,EAAa,EAAA;IACb,IAAI;KACF,IAAMmB,IAAU,MAAM3B,EAAWuB,KAAKsB,kBAAkBC,OAAO;MAAEC,YAAYJ;MAAQtC;MAAMuC;KAAS,CAAA;KAGpG,OAFAtC,EAAQqB,EAAQtB,IAAI,GACpBO,EAAae,EAAQC,UAAU,GACxB,EAAEoB,SAAS,GAAK;IACzB,SAASlB,GAAK;KAEZ,OADApB,EAASoB,aAAeC,QAAQD,EAAIE,UAAU,6BAA6BF,GAAK,GACzE,EAAEkB,SAAS,GAAM;IAC1B,UAAU;KACRxC,EAAa,EAAA;IACf;GACF;GAqBMyC,oBAnBS;IAMb,AALAzC,EAAa,EAAA,GACb,MAAMR,EAAWuB,KAAK2B,qBAAqBJ,OAAM,CAAA,CAAGjB,YAAM,CAAO,CAAA,GACjEP,EAAAA,GACAT,EAAgB,EAAA,GAEZE,OAAOC,SAASC,aAAa,OAC/BT,EAAa,EAAA;GAEjB;GAWMG,WAAWA,IAAY,IAAIwB,KAAKxB,CAAAA,IAAa2C,KAAAA;EAC/C;EAEClD;;AAGP;AAEA,SAAgBmD,IAAAA;CACd,IAAMC,IAAU3D,EAAM4D,WAAWxD,CAAAA;CACjC,IAAI,CAACuD,GACH,MAAUzB,MAAM,6CAAA;CAElB,OAAOyB;AACT"}
|