@geekmidas/manifest 10.0.0-alpha.147 → 10.0.0-alpha.149

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/index.cjs CHANGED
@@ -1115,10 +1115,27 @@ var NoUrlForStage = class extends Error {
1115
1115
  * and the address is still needed — Better Auth rate-limits per client.
1116
1116
  *
1117
1117
  * Reserved: the stack's edge (Caddy, Traefik, the `gkm dev` edge) removes it
1118
- * from incoming requests, and the auth server ignores it on any request that
1119
- * is not an internal caller's, so it cannot be spoofed from outside.
1118
+ * from every request that does not carry the stack's token
1119
+ * ({@link EDGE_TOKEN_HEADER}), and the auth server ignores it on any request
1120
+ * that neither carries the token nor is an internal caller's, so it cannot be
1121
+ * spoofed from outside.
1120
1122
  */
1121
1123
  const CLIENT_IP_HEADER = "x-gkm-client-ip";
1124
+ /**
1125
+ * The token a service of a stack sends beside {@link CLIENT_IP_HEADER} when
1126
+ * it calls a sibling through the stack's edge, at its public address.
1127
+ *
1128
+ * A request carries a forwarding header once it has passed an edge, so the
1129
+ * peer alone no longer says it came from inside the stack. The token does:
1130
+ * it is derived from the stage's seed, handed to every process of the stack
1131
+ * as {@link EDGE_TOKEN_KEY}, and known to the edge. The edge keeps
1132
+ * `x-gkm-client-ip` only on a request carrying it, and strips the header from
1133
+ * every other; the auth server honours the header only from an internal
1134
+ * caller or a request carrying its own token. A browser never has it.
1135
+ */
1136
+ const EDGE_TOKEN_HEADER = "x-gkm-edge-token";
1137
+ /** Where a stack's processes read the token {@link EDGE_TOKEN_HEADER} carries. */
1138
+ const EDGE_TOKEN_KEY = "GKM_EDGE_TOKEN";
1122
1139
  //#endregion
1123
1140
  //#region src/inbox.ts
1124
1141
  /** The event type a received message is announced as on its inbox's topic. */
@@ -1379,6 +1396,8 @@ exports.DEFAULT_POSTGRES_VERSION = DEFAULT_POSTGRES_VERSION;
1379
1396
  exports.DEFAULT_STAGE_URL = DEFAULT_STAGE_URL;
1380
1397
  exports.DERIVED_PREFIX = DERIVED_PREFIX;
1381
1398
  exports.DERIVES_FROM = DERIVES_FROM;
1399
+ exports.EDGE_TOKEN_HEADER = EDGE_TOKEN_HEADER;
1400
+ exports.EDGE_TOKEN_KEY = EDGE_TOKEN_KEY;
1382
1401
  exports.INBOX_EVENT = INBOX_EVENT;
1383
1402
  exports.INBOX_MESSAGES_PREFIX = INBOX_MESSAGES_PREFIX;
1384
1403
  exports.IllegalDerivation = IllegalDerivation;