Configuration
/**
* Sidecar Config for middleware/canon.ts
*/
module.exports = {
title: "canon.ts",
description: "Auto-generated draft",
};
---
title: "Route Flow: ssutil/src/middleware/canon.ts"
---
flowchart TD
title["Route Flow: ssutil/src/middleware/canon.ts"]
style title fill:none,stroke:none,color:#B4976A,font-size:18px
subgraph USE ["USE"]
hono_use__["USE *"]
style hono_use__ fill:#5E377B,color:#fff,stroke:#B4976A
hono_use__["USE *"]
style hono_use__ fill:#5E377B,color:#fff,stroke:#B4976A
end
subgraph GET ["GET"]
hono_get__ui["GET /ui"]
style hono_get__ui fill:#5E377B,color:#fff,stroke:#B4976A
end
subgraph POST ["POST"]
initSessionRoute["POST /init-session"]
style initSessionRoute fill:#5E377B,color:#fff,stroke:#B4976A
refreshTokenRoute["POST /refresh-token"]
style refreshTokenRoute fill:#5E377B,color:#fff,stroke:#B4976A
initPrivateRoute["POST /init-private"]
style initPrivateRoute fill:#5E377B,color:#fff,stroke:#B4976A
end
subgraph API ["API"]
openapi_initSessionRoute["API initSessionRoute"]
style openapi_initSessionRoute fill:#5E377B,color:#fff,stroke:#B4976A
openapi_refreshTokenRoute["API refreshTokenRoute"]
style openapi_refreshTokenRoute fill:#5E377B,color:#fff,stroke:#B4976A
openapi_initPrivateRoute["API initPrivateRoute"]
style openapi_initPrivateRoute fill:#5E377B,color:#fff,stroke:#B4976A
end
subgraph DOC ["DOC"]
hono_doc__doc["DOC /doc"]
style hono_doc__doc fill:#5E377B,color:#fff,stroke:#B4976A
end
canonAuthMiddleware{{"canonAuthMiddleware"}}
style canonAuthMiddleware fill:#161b22,color:#fff,stroke:#c2a35d
initSessionRoute --> openapi_initSessionRoute
refreshTokenRoute --> openapi_refreshTokenRoute
initPrivateRoute --> openapi_initPrivateRoute
linkStyle default stroke:#c2a35d,stroke-width:2px,color:#fff
classDef default color:#fff
---
title: "AST Structure: ssutil/src/middleware/canon.ts"
---
graph TD
n0["SF"]
n1["ID"]
n0 --> n1
n3["OpenAPIHono"]
n1 --> n3
n3 --> n2
style n3 stroke-dasharray:5,stroke:#B4976A
n4["createRoute"]
n1 --> n4
n4 --> n2
style n4 stroke-dasharray:5,stroke:#B4976A
n5["z"]
n1 --> n5
n5 --> n2
style n5 stroke-dasharray:5,stroke:#B4976A
n2["@hono/zod-openapi"]
style n2 fill:#ffffff10,stroke:#ffffff33,color:#a1a1a1
n6["ID"]
n0 --> n6
n8["swaggerUI"]
n6 --> n8
n8 --> n7
style n8 stroke-dasharray:5,stroke:#B4976A
n7["@hono/swagger-ui"]
style n7 fill:#ffffff10,stroke:#ffffff33,color:#a1a1a1
n9["ID"]
n0 --> n9
n11["encryptToken"]
n9 --> n11
n11 --> n10
style n11 stroke-dasharray:5,stroke:#B4976A
n12["inspectToken"]
n9 --> n12
n12 --> n10
style n12 stroke-dasharray:5,stroke:#B4976A
n10["../utils/crypto.js"]
style n10 fill:#ffffff10,stroke:#ffffff33,color:#a1a1a1
n13["ID"]
n0 --> n13
n15["protectAdminRoutes"]
n13 --> n15
n15 --> n14
style n15 stroke-dasharray:5,stroke:#B4976A
n14["./guard"]
style n14 fill:#ffffff10,stroke:#ffffff33,color:#a1a1a1
n25["VS"]
n0 --> n25
n27["VD: InitSessionSchema"]
n25 --> n27
n29["CE: z.object"]
n27 --> n29
n36["CE: z.string().openapi"]
n29 --> n36
n38["CE: z.string"]
n36 --> n38
n47["VS"]
n0 --> n47
n49["VD: TokenResponseSchema"]
n47 --> n49
n51["CE: z.object"]
n49 --> n51
n58["CE: z.string().openapi"]
n51 --> n58
n60["CE: z.string"]
n58 --> n60
n69["VS"]
n0 --> n69
n71["VD: ErrorSchema"]
n69 --> n71
n73["CE: z.object"]
n71 --> n73
n80["CE: z.string"]
n73 --> n80
n84["VS"]
n0 --> n84
n86["VD: SWAGGER_ROUTES"]
n84 --> n86
n91["FD: canonAuthMiddleware"]
n0 --> n91
n106["CE: console.log"]
n91 --> n106
n116["IS"]
n91 --> n116
n117["CE: SWAGGER_ROUTES.some"]
n116 --> n117
n121["AF"]
n117 --> n121
n125["CE: c.req.path.endsWith"]
n121 --> n125
n135["RS"]
n116 --> n135
n136["CE: next"]
n135 --> n136
n138["VS"]
n91 --> n138
n140["VD: token"]
n138 --> n140
n142["BE"]
n140 --> n142
n143["BE"]
n142 --> n143
n144["CE: c.req.header"]
n143 --> n144
n146["CE: c.req.header"]
n143 --> n146
n148["CE: c.req.header"]
n142 --> n148
n155["VS"]
n91 --> n155
n157["VD: allHeaders"]
n155 --> n157
n159["CE: Object.fromEntries"]
n157 --> n159
n163["CE: c.req.raw.headers.entries"]
n159 --> n163
n174["CE: console.log"]
n91 --> n174
n179["CE: JSON.stringify"]
n174 --> n179
n185["CE: console.log"]
n91 --> n185
n189["BE"]
n185 --> n189
n194["VS"]
n91 --> n194
n196["VD: secret"]
n194 --> n196
n203["IS"]
n91 --> n203
n204["BE"]
n203 --> n204
n211["RS"]
n203 --> n211
n212["CE: c.json"]
n211 --> n212
n221["VS"]
n91 --> n221
n223["VD: result"]
n221 --> n223
n226["CE: inspectToken"]
n223 --> n226
n230["IS"]
n91 --> n230
n231["BE"]
n230 --> n231
n238["RS"]
n230 --> n238
n239["CE: c.json"]
n238 --> n239
n250["CE: next"]
n91 --> n250
n252["VS"]
n0 --> n252
n254["VD: app"]
n252 --> n254
n256["NE"]
n254 --> n256
n264["CE: app.use"]
n0 --> n264
n269["CE: protectAdminRoutes"]
n264 --> n269
n271["VS"]
n0 --> n271
n273["VD: AUTH_ENDPOINTS"]
n271 --> n273
n280["CE: app.use"]
n0 --> n280
n285["AF"]
n280 --> n285
n293["IS"]
n285 --> n293
n294["CE: AUTH_ENDPOINTS.some"]
n293 --> n294
n298["AF"]
n294 --> n298
n302["CE: c.req.path.endsWith"]
n298 --> n302
n304["RS"]
n293 --> n304
n305["CE: next"]
n304 --> n305
n307["RS"]
n285 --> n307
n308["CE: canonAuthMiddleware"]
n307 --> n308
n312["VS"]
n0 --> n312
n314["VD: initSessionRoute"]
n312 --> n314
n316["CE: createRoute"]
n314 --> n316
n372["CE: app.openapi"]
n0 --> n372
n377["AF"]
n372 --> n377
n383["VS"]
n377 --> n383
n385["VD: { cfTurnstileResponse }"]
n383 --> n385
n389["CE: c.req.valid"]
n385 --> n389
n396["VS"]
n377 --> n396
n398["VD: tsResult"]
n396 --> n398
n401["CE: fetch"]
n398 --> n401
n410["NE"]
n401 --> n410
n411["VS"]
n377 --> n411
n413["VD: outcome"]
n411 --> n413
n417["CE: tsResult.json"]
n413 --> n417
n421["IS"]
n377 --> n421
n427["RS"]
n421 --> n427
n428["CE: c.json"]
n427 --> n428
n437["VS"]
n377 --> n437
n439["VD: expiry"]
n437 --> n439
n441["BE"]
n439 --> n441
n442["CE: Date.now"]
n441 --> n442
n445["BE"]
n441 --> n445
n446["VS"]
n377 --> n446
n448["VD: token"]
n446 --> n448
n451["CE: encryptToken"]
n448 --> n451
n453["CE: expiry.toString"]
n451 --> n453
n459["RS"]
n377 --> n459
n460["CE: c.json"]
n459 --> n460
n467["VS"]
n0 --> n467
n469["VD: refreshTokenRoute"]
n467 --> n469
n471["CE: createRoute"]
n469 --> n471
n492["CE: z.object"]
n471 --> n492
n499["CE: z.string().openapi"]
n492 --> n499
n501["CE: z.string"]
n499 --> n501
n532["CE: app.openapi"]
n0 --> n532
n537["AF"]
n532 --> n537
n543["VS"]
n537 --> n543
n545["VD: oldToken"]
n543 --> n545
n547["BE"]
n545 --> n547
n548["CE: c.req.header"]
n547 --> n548
n551["VS"]
n537 --> n551
n553["VD: result"]
n551 --> n553
n556["CE: inspectToken"]
n553 --> n556
n564["IS"]
n537 --> n564
n565["BE"]
n564 --> n565
n566["BE"]
n565 --> n566
n573["BE"]
n565 --> n573
n580["VS"]
n564 --> n580
n582["VD: newExpiry"]
n580 --> n582
n584["BE"]
n582 --> n584
n585["VS"]
n564 --> n585
n587["VD: newToken"]
n585 --> n587
n590["CE: encryptToken"]
n587 --> n590
n591["RS"]
n564 --> n591
n592["CE: c.json"]
n591 --> n592
n600["RS"]
n537 --> n600
n601["CE: c.json"]
n600 --> n601
n610["VS"]
n0 --> n610
n612["VD: initPrivateRoute"]
n610 --> n612
n614["CE: createRoute"]
n612 --> n614
n649["CE: app.openapi"]
n0 --> n649
n654["AF"]
n649 --> n654
n660["VS"]
n654 --> n660
n662["VD: expiry"]
n660 --> n662
n664["BE"]
n662 --> n664
n665["CE: Date.now"]
n664 --> n665
n668["BE"]
n664 --> n668
n669["VS"]
n654 --> n669
n671["VD: token"]
n669 --> n671
n674["CE: encryptToken"]
n671 --> n674
n676["CE: expiry.toString"]
n674 --> n676
n682["RS"]
n654 --> n682
n683["CE: c.json"]
n682 --> n683
n691["CE: app.doc"]
n0 --> n691
n723["CE: app.get"]
n0 --> n723
n728["CE: swaggerUI"]
n723 --> n728
style n0 fill:#5E377B,color:#fff,stroke:#B4976A
linkStyle default stroke:#c2a35d,stroke-width:1px,opacity:0.6
AF ArrowFunctionBE BinaryExpressionCE CallExpressionFD FunctionDeclarationIS IfStatementID ImportDeclarationNE NewExpressionRS ReturnStatementSF SourceFileVD VariableDeclarationVS VariableStatement