@hintergrund/worker 0.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/README.md +45 -0
- package/dist/api/builder/handlers/generate.handler.d.ts +12 -0
- package/dist/api/builder/handlers/generate.handler.d.ts.map +1 -0
- package/dist/api/builder/handlers/generate.handler.js +203 -0
- package/dist/api/builder/handlers/template.handler.d.ts +12 -0
- package/dist/api/builder/handlers/template.handler.d.ts.map +1 -0
- package/dist/api/builder/handlers/template.handler.js +208 -0
- package/dist/api/builder/routes.d.ts +7 -0
- package/dist/api/builder/routes.d.ts.map +1 -0
- package/dist/api/builder/routes.js +15 -0
- package/dist/api/cms/handlers/assets.handler.d.ts +8 -0
- package/dist/api/cms/handlers/assets.handler.d.ts.map +1 -0
- package/dist/api/cms/handlers/assets.handler.js +299 -0
- package/dist/api/cms/handlers/auth.handler.d.ts +11 -0
- package/dist/api/cms/handlers/auth.handler.d.ts.map +1 -0
- package/dist/api/cms/handlers/auth.handler.js +214 -0
- package/dist/api/cms/handlers/config.handler.d.ts +3 -0
- package/dist/api/cms/handlers/config.handler.d.ts.map +1 -0
- package/dist/api/cms/handlers/config.handler.js +88 -0
- package/dist/api/cms/handlers/content.handler.d.ts +10 -0
- package/dist/api/cms/handlers/content.handler.d.ts.map +1 -0
- package/dist/api/cms/handlers/content.handler.js +293 -0
- package/dist/api/cms/handlers/dashboard.handler.d.ts +6 -0
- package/dist/api/cms/handlers/dashboard.handler.d.ts.map +1 -0
- package/dist/api/cms/handlers/dashboard.handler.js +15 -0
- package/dist/api/cms/routes/assets.routes.d.ts +4 -0
- package/dist/api/cms/routes/assets.routes.d.ts.map +1 -0
- package/dist/api/cms/routes/assets.routes.js +13 -0
- package/dist/api/cms/routes/auth.routes.d.ts +4 -0
- package/dist/api/cms/routes/auth.routes.d.ts.map +1 -0
- package/dist/api/cms/routes/auth.routes.js +7 -0
- package/dist/api/cms/routes/content.routes.d.ts +4 -0
- package/dist/api/cms/routes/content.routes.d.ts.map +1 -0
- package/dist/api/cms/routes/content.routes.js +11 -0
- package/dist/api/cms/routes/index.d.ts +4 -0
- package/dist/api/cms/routes/index.d.ts.map +1 -0
- package/dist/api/cms/routes/index.js +16 -0
- package/dist/api/newsletter/handlers/email.handler.d.ts +7 -0
- package/dist/api/newsletter/handlers/email.handler.d.ts.map +1 -0
- package/dist/api/newsletter/handlers/email.handler.js +102 -0
- package/dist/api/newsletter/handlers/emails.handler.d.ts +21 -0
- package/dist/api/newsletter/handlers/emails.handler.d.ts.map +1 -0
- package/dist/api/newsletter/handlers/emails.handler.js +134 -0
- package/dist/api/newsletter/handlers/public.handler.d.ts +22 -0
- package/dist/api/newsletter/handlers/public.handler.d.ts.map +1 -0
- package/dist/api/newsletter/handlers/public.handler.js +242 -0
- package/dist/api/newsletter/handlers/send.handler.d.ts +12 -0
- package/dist/api/newsletter/handlers/send.handler.d.ts.map +1 -0
- package/dist/api/newsletter/handlers/send.handler.js +153 -0
- package/dist/api/newsletter/handlers/subscribers.handler.d.ts +22 -0
- package/dist/api/newsletter/handlers/subscribers.handler.d.ts.map +1 -0
- package/dist/api/newsletter/handlers/subscribers.handler.js +191 -0
- package/dist/api/newsletter/routes/admin.routes.d.ts +4 -0
- package/dist/api/newsletter/routes/admin.routes.d.ts.map +1 -0
- package/dist/api/newsletter/routes/admin.routes.js +21 -0
- package/dist/api/newsletter/routes/index.d.ts +4 -0
- package/dist/api/newsletter/routes/index.d.ts.map +1 -0
- package/dist/api/newsletter/routes/index.js +9 -0
- package/dist/api/newsletter/routes/public.routes.d.ts +4 -0
- package/dist/api/newsletter/routes/public.routes.d.ts.map +1 -0
- package/dist/api/newsletter/routes/public.routes.js +9 -0
- package/dist/api/shop/handlers/customers.handler.d.ts +17 -0
- package/dist/api/shop/handlers/customers.handler.d.ts.map +1 -0
- package/dist/api/shop/handlers/customers.handler.js +89 -0
- package/dist/api/shop/handlers/orders.handler.d.ts +17 -0
- package/dist/api/shop/handlers/orders.handler.d.ts.map +1 -0
- package/dist/api/shop/handlers/orders.handler.js +84 -0
- package/dist/api/shop/handlers/prices.handler.d.ts +17 -0
- package/dist/api/shop/handlers/prices.handler.d.ts.map +1 -0
- package/dist/api/shop/handlers/prices.handler.js +87 -0
- package/dist/api/shop/handlers/products.handler.d.ts +45 -0
- package/dist/api/shop/handlers/products.handler.d.ts.map +1 -0
- package/dist/api/shop/handlers/products.handler.js +243 -0
- package/dist/api/shop/handlers/stats.handler.d.ts +10 -0
- package/dist/api/shop/handlers/stats.handler.d.ts.map +1 -0
- package/dist/api/shop/handlers/stats.handler.js +71 -0
- package/dist/api/shop/routes.d.ts +7 -0
- package/dist/api/shop/routes.d.ts.map +1 -0
- package/dist/api/shop/routes.js +31 -0
- package/dist/cms-assets.d.ts +4 -0
- package/dist/cms-assets.d.ts.map +1 -0
- package/dist/cms-assets.js +5 -0
- package/dist/cms-bundle.d.ts +3 -0
- package/dist/cms-bundle.d.ts.map +1 -0
- package/dist/cms-bundle.js +4 -0
- package/dist/config-loader.d.ts +26 -0
- package/dist/config-loader.d.ts.map +1 -0
- package/dist/config-loader.js +98 -0
- package/dist/hintergrund-assets.d.ts +4 -0
- package/dist/hintergrund-assets.d.ts.map +1 -0
- package/dist/hintergrund-assets.js +9 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +66 -0
- package/dist/jwt.d.ts +26 -0
- package/dist/jwt.d.ts.map +1 -0
- package/dist/jwt.js +102 -0
- package/dist/lib/auth/crypto.d.ts +23 -0
- package/dist/lib/auth/crypto.d.ts.map +1 -0
- package/dist/lib/auth/crypto.js +110 -0
- package/dist/lib/auth/jwt.d.ts +38 -0
- package/dist/lib/auth/jwt.d.ts.map +1 -0
- package/dist/lib/auth/jwt.js +120 -0
- package/dist/lib/config.d.ts +31 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +174 -0
- package/dist/lib/email.d.ts +16 -0
- package/dist/lib/email.d.ts.map +1 -0
- package/dist/lib/email.js +83 -0
- package/dist/lib/template.d.ts +2 -0
- package/dist/lib/template.d.ts.map +1 -0
- package/dist/lib/template.js +226 -0
- package/dist/middleware/auth.d.ts +9 -0
- package/dist/middleware/auth.d.ts.map +1 -0
- package/dist/middleware/auth.js +93 -0
- package/dist/template.d.ts +2 -0
- package/dist/template.d.ts.map +1 -0
- package/dist/template.js +61 -0
- package/dist/utils.d.ts +23 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +110 -0
- package/package.json +32 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Hono } from 'hono';
|
|
2
|
+
export type Bindings = {
|
|
3
|
+
HG_CONFIG?: string;
|
|
4
|
+
HG_SECRET?: string;
|
|
5
|
+
HG_PASSWORD?: string;
|
|
6
|
+
HG_CMS_GIT_TOKEN?: string;
|
|
7
|
+
HG_CMS_GIT_OWNER?: string;
|
|
8
|
+
HG_CMS_GIT_REPO?: string;
|
|
9
|
+
HG_CMS_GIT_BRANCH?: string;
|
|
10
|
+
HG_CMS_CONTENT_DIR?: string;
|
|
11
|
+
HG_CMS_ASSET_DIR?: string;
|
|
12
|
+
HG_NEWSLETTER_EMAIL_PROVIDER?: string;
|
|
13
|
+
HG_NEWSLETTER_EMAIL_API_KEY?: string;
|
|
14
|
+
HG_NEWSLETTER_FROM_EMAIL?: string;
|
|
15
|
+
HG_NEWSLETTER_FROM_NAME?: string;
|
|
16
|
+
HG_NEWSLETTER_REPLY_TO?: string;
|
|
17
|
+
HG_NEWSLETTER_CONFIRMATION_URL?: string;
|
|
18
|
+
HG_SHOP_STRIPE_SECRET_KEY?: string;
|
|
19
|
+
HG_SHOP_STRIPE_WEBHOOK_SECRET?: string;
|
|
20
|
+
HG_SHOP_STRIPE_PUBLISHABLE_KEY?: string;
|
|
21
|
+
HG_BUILDER_GEMINI_API_KEY?: string;
|
|
22
|
+
HG_BUILDER_GIT_TOKEN?: string;
|
|
23
|
+
HG_BUILDER_TEMPLATE_REPO?: string;
|
|
24
|
+
HG_BUILDER_GIT_BRANCH?: string;
|
|
25
|
+
UI_BASE_URL: string;
|
|
26
|
+
ASSETS: Fetcher;
|
|
27
|
+
DB: D1Database;
|
|
28
|
+
};
|
|
29
|
+
export declare function createApp(): Hono<{
|
|
30
|
+
Bindings: Bindings;
|
|
31
|
+
}, import("hono/types").BlankSchema, "/">;
|
|
32
|
+
export * from './lib/auth/jwt';
|
|
33
|
+
export * from './lib/auth/crypto';
|
|
34
|
+
export * from './lib/template';
|
|
35
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAS5B,MAAM,MAAM,QAAQ,GAAG;IAEtB,SAAS,CAAC,EAAE,MAAM,CAAC;IAGnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IAGrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAG1B,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,8BAA8B,CAAC,EAAE,MAAM,CAAC;IAGxC,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,6BAA6B,CAAC,EAAE,MAAM,CAAC;IACvC,8BAA8B,CAAC,EAAE,MAAM,CAAC;IAGxC,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAG/B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,EAAE,EAAE,UAAU,CAAC;CACf,CAAC;AAEF,wBAAgB,SAAS;cACS,QAAQ;0CAgEzC;AAGD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Hono } from 'hono';
|
|
2
|
+
import { cors } from 'hono/cors';
|
|
3
|
+
import cmsRoutes from './api/cms/routes';
|
|
4
|
+
import newsletterRoutes from './api/newsletter/routes';
|
|
5
|
+
import shopRoutes from './api/shop/routes';
|
|
6
|
+
import builderRoutes from './api/builder/routes';
|
|
7
|
+
import { authMiddleware } from './middleware/auth';
|
|
8
|
+
import { getTemplate } from './lib/template';
|
|
9
|
+
export function createApp() {
|
|
10
|
+
const app = new Hono();
|
|
11
|
+
// Add CORS middleware
|
|
12
|
+
app.use('*', cors());
|
|
13
|
+
// Login page route (public)
|
|
14
|
+
app.get('/login', (c) => c.html(getTemplate('login', c.env.UI_BASE_URL)));
|
|
15
|
+
// Mount CMS routes under /api/admin
|
|
16
|
+
app.route('/api/admin', cmsRoutes);
|
|
17
|
+
// Mount newsletter routes under /api/newsletter
|
|
18
|
+
app.route('/api/newsletter', newsletterRoutes);
|
|
19
|
+
// Mount shop routes under /api/shop
|
|
20
|
+
app.route('/api/shop', shopRoutes);
|
|
21
|
+
// Mount builder routes under /api/builder
|
|
22
|
+
app.route('/api/builder', builderRoutes);
|
|
23
|
+
// Admin main page (protected)
|
|
24
|
+
app.get('/admin', async (c) => {
|
|
25
|
+
// Check authentication
|
|
26
|
+
let authPassed = false;
|
|
27
|
+
const authResult = await authMiddleware(c, async () => {
|
|
28
|
+
authPassed = true;
|
|
29
|
+
});
|
|
30
|
+
if (!authPassed) {
|
|
31
|
+
return authResult;
|
|
32
|
+
}
|
|
33
|
+
// Get admin configuration
|
|
34
|
+
try {
|
|
35
|
+
const { loadConfig, getAdminConfig } = await import('./lib/config');
|
|
36
|
+
const appConfig = loadConfig(c.env);
|
|
37
|
+
const adminConfig = getAdminConfig(appConfig);
|
|
38
|
+
const configParams = `config='${JSON.stringify(adminConfig)}'`;
|
|
39
|
+
return c.html(getTemplate('admin', c.env.UI_BASE_URL, configParams));
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
// Fallback to default config if parsing fails
|
|
43
|
+
const configParams = 'config=\'{"cms":true,"newsletter":false,"shop":false}\'';
|
|
44
|
+
return c.html(getTemplate('admin', c.env.UI_BASE_URL, configParams));
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
// Serve static assets from the app build
|
|
48
|
+
app.get('*', async (c) => {
|
|
49
|
+
const url = new URL(c.req.url);
|
|
50
|
+
const assetResponse = await c.env.ASSETS.fetch(url);
|
|
51
|
+
// If the asset exists, return it
|
|
52
|
+
if (assetResponse.status !== 404) {
|
|
53
|
+
return assetResponse;
|
|
54
|
+
}
|
|
55
|
+
// For SPA routing: if no asset found, serve index.html
|
|
56
|
+
// This allows client-side routing to work
|
|
57
|
+
const indexUrl = new URL(url);
|
|
58
|
+
indexUrl.pathname = '/index.html';
|
|
59
|
+
return c.env.ASSETS.fetch(indexUrl);
|
|
60
|
+
});
|
|
61
|
+
return app;
|
|
62
|
+
}
|
|
63
|
+
// Export individual utilities if needed
|
|
64
|
+
export * from './lib/auth/jwt';
|
|
65
|
+
export * from './lib/auth/crypto';
|
|
66
|
+
export * from './lib/template';
|
package/dist/jwt.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
interface JwtHeader {
|
|
2
|
+
alg: string;
|
|
3
|
+
typ: string;
|
|
4
|
+
}
|
|
5
|
+
interface JwtPayload {
|
|
6
|
+
iat: number;
|
|
7
|
+
exp: number;
|
|
8
|
+
}
|
|
9
|
+
interface JwtData {
|
|
10
|
+
header: JwtHeader;
|
|
11
|
+
payload: JwtPayload;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Signs a payload and returns the token
|
|
15
|
+
*/
|
|
16
|
+
export declare function sign(secret: string): Promise<string>;
|
|
17
|
+
/**
|
|
18
|
+
* Verifies the integrity of the token and returns a boolean value.
|
|
19
|
+
*/
|
|
20
|
+
export declare function verify(token: string, secret: string): Promise<boolean>;
|
|
21
|
+
/**
|
|
22
|
+
* Returns the payload **without** verifying the integrity of the token. Please use `verify()` first to keep your application secure!
|
|
23
|
+
*/
|
|
24
|
+
export declare function decode(token: string): JwtData;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=jwt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwt.d.ts","sourceRoot":"","sources":["../src/jwt.ts"],"names":[],"mappings":"AAgEA,UAAU,SAAS;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACZ;AAED,UAAU,UAAU;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACZ;AAED,UAAU,OAAO;IAChB,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,UAAU,CAAC;CACpB;AAOD;;GAEG;AACH,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAiC1D;AAED;;GAEG;AACH,wBAAsB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAwB5E;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAK7C"}
|
package/dist/jwt.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// Simplified code from https://github.com/tsndr/cloudflare-worker-jwt
|
|
2
|
+
function textToBase64Url(str) {
|
|
3
|
+
return btoa(str).replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_');
|
|
4
|
+
}
|
|
5
|
+
function bytesToByteString(bytes) {
|
|
6
|
+
let byteStr = '';
|
|
7
|
+
for (let i = 0; i < bytes.byteLength; i++) {
|
|
8
|
+
byteStr += String.fromCharCode(bytes[i]);
|
|
9
|
+
}
|
|
10
|
+
return byteStr;
|
|
11
|
+
}
|
|
12
|
+
function byteStringToBytes(byteStr) {
|
|
13
|
+
const bytes = new Uint8Array(byteStr.length);
|
|
14
|
+
for (let i = 0; i < byteStr.length; i++) {
|
|
15
|
+
bytes[i] = byteStr.charCodeAt(i);
|
|
16
|
+
}
|
|
17
|
+
return bytes;
|
|
18
|
+
}
|
|
19
|
+
function arrayBufferToBase64String(arrayBuffer) {
|
|
20
|
+
return btoa(bytesToByteString(new Uint8Array(arrayBuffer)));
|
|
21
|
+
}
|
|
22
|
+
function base64StringToArrayBuffer(b64str) {
|
|
23
|
+
return byteStringToBytes(atob(b64str)).buffer;
|
|
24
|
+
}
|
|
25
|
+
function textToArrayBuffer(str) {
|
|
26
|
+
return byteStringToBytes(decodeURI(encodeURIComponent(str)));
|
|
27
|
+
}
|
|
28
|
+
function arrayBufferToBase64Url(arrayBuffer) {
|
|
29
|
+
return arrayBufferToBase64String(arrayBuffer)
|
|
30
|
+
.replace(/=/g, '')
|
|
31
|
+
.replace(/\+/g, '-')
|
|
32
|
+
.replace(/\//g, '_');
|
|
33
|
+
}
|
|
34
|
+
function base64UrlToArrayBuffer(b64url) {
|
|
35
|
+
return base64StringToArrayBuffer(b64url.replace(/-/g, '+').replace(/_/g, '/').replace(/\s/g, ''));
|
|
36
|
+
}
|
|
37
|
+
async function importTextSecret(key, algorithm) {
|
|
38
|
+
return await crypto.subtle.importKey('raw', textToArrayBuffer(key), algorithm, true, [
|
|
39
|
+
'verify',
|
|
40
|
+
'sign'
|
|
41
|
+
]);
|
|
42
|
+
}
|
|
43
|
+
async function importKey(key, algorithm) {
|
|
44
|
+
return importTextSecret(key, algorithm);
|
|
45
|
+
}
|
|
46
|
+
function decodePayload(raw) {
|
|
47
|
+
try {
|
|
48
|
+
return JSON.parse(atob(raw));
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Signs a payload and returns the token
|
|
56
|
+
*/
|
|
57
|
+
export async function sign(secret) {
|
|
58
|
+
const options = {
|
|
59
|
+
alg: 'HS256',
|
|
60
|
+
typ: 'JWT'
|
|
61
|
+
};
|
|
62
|
+
const now = Math.floor(Date.now() / 1000);
|
|
63
|
+
// Create payload valid for 1 day
|
|
64
|
+
const payload = {
|
|
65
|
+
iat: now,
|
|
66
|
+
exp: now + 24 * 60 * 60
|
|
67
|
+
};
|
|
68
|
+
const partialToken = `${textToBase64Url(JSON.stringify(options))}.${textToBase64Url(JSON.stringify(payload))}`;
|
|
69
|
+
// Derive a 256-bit key from the secret
|
|
70
|
+
const key = await crypto.subtle.importKey('raw', textToArrayBuffer(secret), { name: 'HMAC', hash: { name: 'SHA-256' } }, true, ['verify', 'sign']);
|
|
71
|
+
const signature = await crypto.subtle.sign({ name: 'HMAC', hash: { name: 'SHA-256' } }, key, textToArrayBuffer(partialToken));
|
|
72
|
+
return `${partialToken}.${arrayBufferToBase64Url(signature)}`;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Verifies the integrity of the token and returns a boolean value.
|
|
76
|
+
*/
|
|
77
|
+
export async function verify(token, secret) {
|
|
78
|
+
const tokenParts = token.split('.');
|
|
79
|
+
if (tokenParts.length !== 3)
|
|
80
|
+
throw new Error('token must consist of 3 parts');
|
|
81
|
+
const { payload } = decode(token);
|
|
82
|
+
try {
|
|
83
|
+
if (payload.exp && payload.exp <= Math.floor(Date.now() / 1000))
|
|
84
|
+
throw new Error('EXPIRED');
|
|
85
|
+
const key = await importKey(secret, { name: 'HMAC', hash: { name: 'SHA-256' } });
|
|
86
|
+
const signatureBuffer = base64UrlToArrayBuffer(tokenParts[2]);
|
|
87
|
+
const dataBuffer = textToArrayBuffer(`${tokenParts[0]}.${tokenParts[1]}`);
|
|
88
|
+
return await crypto.subtle.verify({ name: 'HMAC', hash: { name: 'SHA-256' } }, key, signatureBuffer, dataBuffer);
|
|
89
|
+
}
|
|
90
|
+
catch (err) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Returns the payload **without** verifying the integrity of the token. Please use `verify()` first to keep your application secure!
|
|
96
|
+
*/
|
|
97
|
+
export function decode(token) {
|
|
98
|
+
return {
|
|
99
|
+
header: decodePayload(token.split('.')[0].replace(/-/g, '+').replace(/_/g, '/')),
|
|
100
|
+
payload: decodePayload(token.split('.')[1].replace(/-/g, '+').replace(/_/g, '/'))
|
|
101
|
+
};
|
|
102
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a random token used as a Secret Key
|
|
3
|
+
*/
|
|
4
|
+
export declare function generateRandomToken(): string;
|
|
5
|
+
/**
|
|
6
|
+
* Hash a password with salt and pepper
|
|
7
|
+
*/
|
|
8
|
+
export declare function hashPw(password: string, pepper: string): Promise<string>;
|
|
9
|
+
/**
|
|
10
|
+
* Verify a password against an encrypted password
|
|
11
|
+
* Uses AES-GCM decryption to match hintergrund.cloud's encryption method
|
|
12
|
+
*/
|
|
13
|
+
export declare function verifyPw(encryptedPassword: string, password: string, secret: string): Promise<boolean>;
|
|
14
|
+
/**
|
|
15
|
+
* Decrypts an encrypted string using AES-GCM
|
|
16
|
+
* Matches hintergrund.cloud's decrypt function
|
|
17
|
+
*/
|
|
18
|
+
export declare function decrypt(ciphertext: string, secret: string): Promise<string>;
|
|
19
|
+
/**
|
|
20
|
+
* Read and parse request body
|
|
21
|
+
*/
|
|
22
|
+
export declare function readRequestBody(request: Request): Promise<any>;
|
|
23
|
+
//# sourceMappingURL=crypto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/crypto.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAG5C;AAED;;GAEG;AACH,wBAAsB,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA2B9E;AAED;;;GAGG;AACH,wBAAsB,QAAQ,CAAC,iBAAiB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAO5G;AAiBD;;;GAGG;AACH,wBAAsB,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CA0BjF;AAiBD;;GAEG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAepE"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generates a random token used as a Secret Key
|
|
3
|
+
*/
|
|
4
|
+
export function generateRandomToken() {
|
|
5
|
+
const tokenBytes = crypto.getRandomValues(new Uint8Array(32));
|
|
6
|
+
return btoa(String.fromCharCode(...tokenBytes));
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Hash a password with salt and pepper
|
|
10
|
+
*/
|
|
11
|
+
export async function hashPw(password, pepper) {
|
|
12
|
+
// Create salt
|
|
13
|
+
const salt = crypto.getRandomValues(new Uint8Array(16));
|
|
14
|
+
// Convert password and pepper to Uint8Array
|
|
15
|
+
const pass = new TextEncoder().encode(password);
|
|
16
|
+
const pepp = new TextEncoder().encode(pepper);
|
|
17
|
+
// Combine salt, pepper, and password hash
|
|
18
|
+
const combined = new Uint8Array(salt.length + pepper.length + password.length);
|
|
19
|
+
combined.set(salt);
|
|
20
|
+
combined.set(pepp, salt.length);
|
|
21
|
+
combined.set(pass, salt.length + pepper.length);
|
|
22
|
+
// Hash combined
|
|
23
|
+
const hashBuffer = await crypto.subtle.digest('SHA-256', combined);
|
|
24
|
+
// Convert hashBuffer to Uint8Array
|
|
25
|
+
const hash = new Uint8Array(hashBuffer);
|
|
26
|
+
// Combine salt and hash
|
|
27
|
+
const combinedHash = new Uint8Array(salt.length + hash.length);
|
|
28
|
+
combinedHash.set(salt);
|
|
29
|
+
combinedHash.set(hash, salt.length);
|
|
30
|
+
// Return combined hash as base64 string
|
|
31
|
+
return btoa(new Uint8Array(combinedHash).reduce((s, b) => s + String.fromCharCode(b), ''));
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Verify a password against an encrypted password
|
|
35
|
+
* Uses AES-GCM decryption to match hintergrund.cloud's encryption method
|
|
36
|
+
*/
|
|
37
|
+
export async function verifyPw(encryptedPassword, password, secret) {
|
|
38
|
+
try {
|
|
39
|
+
const decryptedPassword = await decrypt(encryptedPassword, secret);
|
|
40
|
+
return decryptedPassword === password;
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Derives a cryptographic key from the secret string
|
|
48
|
+
*/
|
|
49
|
+
async function deriveKey(secret) {
|
|
50
|
+
const secretBytes = new TextEncoder().encode(secret);
|
|
51
|
+
const keyMaterial = await crypto.subtle.digest('SHA-256', secretBytes);
|
|
52
|
+
return await crypto.subtle.importKey('raw', keyMaterial, { name: 'AES-GCM', length: 256 }, false, ['encrypt', 'decrypt']);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Decrypts an encrypted string using AES-GCM
|
|
56
|
+
* Matches hintergrund.cloud's decrypt function
|
|
57
|
+
*/
|
|
58
|
+
export async function decrypt(ciphertext, secret) {
|
|
59
|
+
try {
|
|
60
|
+
// Decode from base64
|
|
61
|
+
const combined = Uint8Array.from(atob(ciphertext), (c) => c.charCodeAt(0));
|
|
62
|
+
// Extract IV (first 12 bytes)
|
|
63
|
+
const iv = combined.slice(0, 12);
|
|
64
|
+
// Extract encrypted data (remaining bytes)
|
|
65
|
+
const encryptedData = combined.slice(12);
|
|
66
|
+
// Derive decryption key
|
|
67
|
+
const key = await deriveKey(secret);
|
|
68
|
+
// Decrypt
|
|
69
|
+
const decryptedBuffer = await crypto.subtle.decrypt({ name: 'AES-GCM', iv }, key, encryptedData);
|
|
70
|
+
// Convert bytes back to string
|
|
71
|
+
return new TextDecoder().decode(decryptedBuffer);
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
throw new Error('Decryption failed');
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Compare two Uint8Arrays for equality
|
|
79
|
+
*/
|
|
80
|
+
function areUint8ArraysEqual(a, b) {
|
|
81
|
+
if (a.length !== b.length) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
for (let i = 0; i < a.length; i++) {
|
|
85
|
+
if (a[i] !== b[i]) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Read and parse request body
|
|
93
|
+
*/
|
|
94
|
+
export async function readRequestBody(request) {
|
|
95
|
+
const contentType = request.headers.get('content-type');
|
|
96
|
+
if (!contentType)
|
|
97
|
+
throw new Error('Content-Type not set');
|
|
98
|
+
if (contentType.includes('application/json')) {
|
|
99
|
+
return await request.json();
|
|
100
|
+
}
|
|
101
|
+
else if (contentType.includes('form')) {
|
|
102
|
+
const formData = await request.formData();
|
|
103
|
+
const body = {};
|
|
104
|
+
for (const entry of formData.entries()) {
|
|
105
|
+
body[entry[0]] = entry[1];
|
|
106
|
+
}
|
|
107
|
+
return body;
|
|
108
|
+
}
|
|
109
|
+
throw new Error('Content-Type not supported');
|
|
110
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
interface JwtHeader {
|
|
2
|
+
alg: string;
|
|
3
|
+
typ: string;
|
|
4
|
+
}
|
|
5
|
+
interface JwtPayload {
|
|
6
|
+
iat: number;
|
|
7
|
+
exp: number;
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}
|
|
10
|
+
interface JwtData {
|
|
11
|
+
header: JwtHeader;
|
|
12
|
+
payload: JwtPayload;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Signs a payload and returns the token
|
|
16
|
+
*/
|
|
17
|
+
export declare function sign(secret: string): Promise<string>;
|
|
18
|
+
/**
|
|
19
|
+
* Signs a payload with custom data and returns the token
|
|
20
|
+
* @param secret The secret key for signing
|
|
21
|
+
* @param customPayload Additional payload data (userGroup, modules, email, etc.)
|
|
22
|
+
* @param expiresIn Time in seconds until token expires (default: 24 hours)
|
|
23
|
+
*/
|
|
24
|
+
export declare function signWithPayload(secret: string, customPayload: Record<string, any>, expiresIn?: number): Promise<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Verifies the integrity of the token and returns the payload if valid, null otherwise.
|
|
27
|
+
*/
|
|
28
|
+
export declare function verify(token: string, secret: string): Promise<JwtPayload | null>;
|
|
29
|
+
/**
|
|
30
|
+
* Verifies the integrity of the token and returns a boolean value (legacy).
|
|
31
|
+
*/
|
|
32
|
+
export declare function verifyBoolean(token: string, secret: string): Promise<boolean>;
|
|
33
|
+
/**
|
|
34
|
+
* Returns the payload **without** verifying the integrity of the token. Please use `verify()` first to keep your application secure!
|
|
35
|
+
*/
|
|
36
|
+
export declare function decode(token: string): JwtData;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=jwt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwt.d.ts","sourceRoot":"","sources":["../../../src/lib/auth/jwt.ts"],"names":[],"mappings":"AAgEA,UAAU,SAAS;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACZ;AAED,UAAU,UAAU;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACnB;AAED,UAAU,OAAO;IAChB,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,UAAU,CAAC;CACpB;AAOD;;GAEG;AACH,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE1D;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACpC,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAClC,SAAS,GAAE,MAAqB,GAC9B,OAAO,CAAC,MAAM,CAAC,CAkCjB;AAED;;GAEG;AACH,wBAAsB,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CA0BtF;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAGnF;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAK7C"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// Simplified code from https://github.com/tsndr/cloudflare-worker-jwt
|
|
2
|
+
function textToBase64Url(str) {
|
|
3
|
+
return btoa(str).replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_');
|
|
4
|
+
}
|
|
5
|
+
function bytesToByteString(bytes) {
|
|
6
|
+
let byteStr = '';
|
|
7
|
+
for (let i = 0; i < bytes.byteLength; i++) {
|
|
8
|
+
byteStr += String.fromCharCode(bytes[i]);
|
|
9
|
+
}
|
|
10
|
+
return byteStr;
|
|
11
|
+
}
|
|
12
|
+
function byteStringToBytes(byteStr) {
|
|
13
|
+
const bytes = new Uint8Array(byteStr.length);
|
|
14
|
+
for (let i = 0; i < byteStr.length; i++) {
|
|
15
|
+
bytes[i] = byteStr.charCodeAt(i);
|
|
16
|
+
}
|
|
17
|
+
return bytes;
|
|
18
|
+
}
|
|
19
|
+
function arrayBufferToBase64String(arrayBuffer) {
|
|
20
|
+
return btoa(bytesToByteString(new Uint8Array(arrayBuffer)));
|
|
21
|
+
}
|
|
22
|
+
function base64StringToArrayBuffer(b64str) {
|
|
23
|
+
return byteStringToBytes(atob(b64str)).buffer;
|
|
24
|
+
}
|
|
25
|
+
function textToArrayBuffer(str) {
|
|
26
|
+
return byteStringToBytes(decodeURI(encodeURIComponent(str)));
|
|
27
|
+
}
|
|
28
|
+
function arrayBufferToBase64Url(arrayBuffer) {
|
|
29
|
+
return arrayBufferToBase64String(arrayBuffer)
|
|
30
|
+
.replace(/=/g, '')
|
|
31
|
+
.replace(/\+/g, '-')
|
|
32
|
+
.replace(/\//g, '_');
|
|
33
|
+
}
|
|
34
|
+
function base64UrlToArrayBuffer(b64url) {
|
|
35
|
+
return base64StringToArrayBuffer(b64url.replace(/-/g, '+').replace(/_/g, '/').replace(/\s/g, ''));
|
|
36
|
+
}
|
|
37
|
+
async function importTextSecret(key, algorithm) {
|
|
38
|
+
return await crypto.subtle.importKey('raw', textToArrayBuffer(key), algorithm, true, [
|
|
39
|
+
'verify',
|
|
40
|
+
'sign'
|
|
41
|
+
]);
|
|
42
|
+
}
|
|
43
|
+
async function importKey(key, algorithm) {
|
|
44
|
+
return importTextSecret(key, algorithm);
|
|
45
|
+
}
|
|
46
|
+
function decodePayload(raw) {
|
|
47
|
+
try {
|
|
48
|
+
return JSON.parse(atob(raw));
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Signs a payload and returns the token
|
|
56
|
+
*/
|
|
57
|
+
export async function sign(secret) {
|
|
58
|
+
return signWithPayload(secret, {});
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Signs a payload with custom data and returns the token
|
|
62
|
+
* @param secret The secret key for signing
|
|
63
|
+
* @param customPayload Additional payload data (userGroup, modules, email, etc.)
|
|
64
|
+
* @param expiresIn Time in seconds until token expires (default: 24 hours)
|
|
65
|
+
*/
|
|
66
|
+
export async function signWithPayload(secret, customPayload, expiresIn = 24 * 60 * 60) {
|
|
67
|
+
const options = {
|
|
68
|
+
alg: 'HS256',
|
|
69
|
+
typ: 'JWT'
|
|
70
|
+
};
|
|
71
|
+
const now = Math.floor(Date.now() / 1000);
|
|
72
|
+
// Create payload with custom data
|
|
73
|
+
const payload = {
|
|
74
|
+
...customPayload,
|
|
75
|
+
iat: now,
|
|
76
|
+
exp: now + expiresIn
|
|
77
|
+
};
|
|
78
|
+
const partialToken = `${textToBase64Url(JSON.stringify(options))}.${textToBase64Url(JSON.stringify(payload))}`;
|
|
79
|
+
// Derive a 256-bit key from the secret
|
|
80
|
+
const key = await crypto.subtle.importKey('raw', textToArrayBuffer(secret), { name: 'HMAC', hash: { name: 'SHA-256' } }, true, ['verify', 'sign']);
|
|
81
|
+
const signature = await crypto.subtle.sign({ name: 'HMAC', hash: { name: 'SHA-256' } }, key, textToArrayBuffer(partialToken));
|
|
82
|
+
return `${partialToken}.${arrayBufferToBase64Url(signature)}`;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Verifies the integrity of the token and returns the payload if valid, null otherwise.
|
|
86
|
+
*/
|
|
87
|
+
export async function verify(token, secret) {
|
|
88
|
+
const tokenParts = token.split('.');
|
|
89
|
+
if (tokenParts.length !== 3)
|
|
90
|
+
return null;
|
|
91
|
+
const { payload } = decode(token);
|
|
92
|
+
try {
|
|
93
|
+
if (payload.exp && payload.exp <= Math.floor(Date.now() / 1000))
|
|
94
|
+
return null;
|
|
95
|
+
const key = await importKey(secret, { name: 'HMAC', hash: { name: 'SHA-256' } });
|
|
96
|
+
const signatureBuffer = base64UrlToArrayBuffer(tokenParts[2]);
|
|
97
|
+
const dataBuffer = textToArrayBuffer(`${tokenParts[0]}.${tokenParts[1]}`);
|
|
98
|
+
const isValid = await crypto.subtle.verify({ name: 'HMAC', hash: { name: 'SHA-256' } }, key, signatureBuffer, dataBuffer);
|
|
99
|
+
return isValid ? payload : null;
|
|
100
|
+
}
|
|
101
|
+
catch (err) {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Verifies the integrity of the token and returns a boolean value (legacy).
|
|
107
|
+
*/
|
|
108
|
+
export async function verifyBoolean(token, secret) {
|
|
109
|
+
const payload = await verify(token, secret);
|
|
110
|
+
return payload !== null;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Returns the payload **without** verifying the integrity of the token. Please use `verify()` first to keep your application secure!
|
|
114
|
+
*/
|
|
115
|
+
export function decode(token) {
|
|
116
|
+
return {
|
|
117
|
+
header: decodePayload(token.split('.')[0].replace(/-/g, '+').replace(/_/g, '/')),
|
|
118
|
+
payload: decodePayload(token.split('.')[1].replace(/-/g, '+').replace(/_/g, '/'))
|
|
119
|
+
};
|
|
120
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { AppConfig, AdminConfig, CmsModuleConfig, NewsletterModuleConfig, ShopModuleConfig, BuilderModuleConfig } from '@hintergrund/shared';
|
|
2
|
+
/**
|
|
3
|
+
* Load application configuration from environment variables
|
|
4
|
+
* Supports both new modular env vars and legacy HG_CONFIG format
|
|
5
|
+
*/
|
|
6
|
+
export declare function loadConfig(env: Record<string, string | undefined> | any): AppConfig;
|
|
7
|
+
/**
|
|
8
|
+
* Get admin UI configuration (which modules are enabled)
|
|
9
|
+
*/
|
|
10
|
+
export declare function getAdminConfig(appConfig: AppConfig): AdminConfig;
|
|
11
|
+
/**
|
|
12
|
+
* Get CMS module configuration
|
|
13
|
+
* @throws Error if CMS module is not enabled
|
|
14
|
+
*/
|
|
15
|
+
export declare function getCmsConfig(env: Record<string, string | undefined> | any): CmsModuleConfig;
|
|
16
|
+
/**
|
|
17
|
+
* Get Newsletter module configuration
|
|
18
|
+
* @throws Error if Newsletter module is not enabled
|
|
19
|
+
*/
|
|
20
|
+
export declare function getNewsletterConfig(env: Record<string, string | undefined> | any): NewsletterModuleConfig;
|
|
21
|
+
/**
|
|
22
|
+
* Get Shop module configuration
|
|
23
|
+
* @throws Error if Shop module is not enabled
|
|
24
|
+
*/
|
|
25
|
+
export declare function getShopConfig(env: Record<string, string | undefined> | any): ShopModuleConfig;
|
|
26
|
+
/**
|
|
27
|
+
* Get Builder module configuration
|
|
28
|
+
* @throws Error if Builder module is not enabled
|
|
29
|
+
*/
|
|
30
|
+
export declare function getBuilderConfig(env: Record<string, string | undefined> | any): BuilderModuleConfig;
|
|
31
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,mBAAmB,EAAsC,MAAM,qBAAqB,CAAC;AAEtL;;;GAGG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,GAAG,GAAG,SAAS,CAOnF;AA0HD;;GAEG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,SAAS,GAAG,WAAW,CAShE;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,GAAG,GAAG,eAAe,CAQ3F;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,GAAG,GAAG,sBAAsB,CAQzG;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,GAAG,GAAG,gBAAgB,CAQ7F;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,GAAG,GAAG,mBAAmB,CAQnG"}
|