@plitzi/sdk-kernel 0.39.2 → 0.39.3
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/CHANGELOG.md
CHANGED
|
@@ -70,6 +70,11 @@ var claimToSpaceScope = {
|
|
|
70
70
|
[SCOPES.spaceHost]: "host"
|
|
71
71
|
};
|
|
72
72
|
var isLegacyShape = (payload) => "data" in payload || "version" in payload;
|
|
73
|
+
/** Whether a value is a JWT at all — a header and a payload that read as JSON objects — whoever signed it. */
|
|
74
|
+
var isJwt = (token) => {
|
|
75
|
+
const decoded = jwt.decode(token, { complete: true });
|
|
76
|
+
return decoded !== null && typeof decoded.payload === "object";
|
|
77
|
+
};
|
|
73
78
|
var subjectId = (payload) => {
|
|
74
79
|
if (typeof payload.sub !== "string") return;
|
|
75
80
|
const id = Number(payload.sub);
|
|
@@ -242,12 +247,18 @@ var createTokens = (config) => {
|
|
|
242
247
|
},
|
|
243
248
|
/**
|
|
244
249
|
* A token that no longer verifies for any reason the issuer can fix by re-minting — expiry, a pre-registered-
|
|
245
|
-
* claims shape,
|
|
246
|
-
* out, so a caller never has to know why.
|
|
250
|
+
* claims shape, an issuer from a deployment this one is not, or a key pair this one no longer holds. Used by the
|
|
251
|
+
* endpoints that hand tokens back out, so a caller never has to know why.
|
|
252
|
+
*
|
|
253
|
+
* A credential signed under keys rotated away from reads as `malformed` to `verify` (a `kid` it does not list, a
|
|
254
|
+
* signature it cannot check) — and so did every stored one after a deployment changed its pair, none re-minted. It
|
|
255
|
+
* is told from garbage by being a JWT at all: what never was one is not re-minted, or storing nonsense in a row would
|
|
256
|
+
* be a way to be handed a working credential.
|
|
247
257
|
*/
|
|
248
258
|
needsRotation: (token) => {
|
|
249
259
|
const result = verify(token);
|
|
250
|
-
|
|
260
|
+
if (result.ok) return false;
|
|
261
|
+
return result.reason !== "malformed" || isJwt(token);
|
|
251
262
|
},
|
|
252
263
|
/** Undefined for a credential that never expires, which is what a host should read as "no renewal needed". */
|
|
253
264
|
expiresInSeconds: (token) => {
|
package/dist/testing/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as createStoreHost, n as createFleetHub, r as createListeners, t as createFleetClient } from "../chunks/channel-DnVf7PJB.mjs";
|
|
2
2
|
import { r as selectRows, t as execute } from "../chunks/query-DGbrN3mN.mjs";
|
|
3
|
-
import { r as generateTokenKeys } from "../chunks/tokens-
|
|
3
|
+
import { r as generateTokenKeys } from "../chunks/tokens-BAV5YeT9.mjs";
|
|
4
4
|
// src/testing/certificates.ts
|
|
5
5
|
/**
|
|
6
6
|
* Self-signed certificates for tests alone — made for them, trusted by nothing, naming no real host. Kept as text so
|
package/dist/tokens/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as DEFAULT_LIFETIMES, n as createTokens, r as generateTokenKeys, i as userIdOf } from "../chunks/tokens-
|
|
1
|
+
export { t as DEFAULT_LIFETIMES, n as createTokens, r as generateTokenKeys, i as userIdOf } from "../chunks/tokens-BAV5YeT9.mjs";
|
package/dist/tokens/tokens.d.ts
CHANGED
|
@@ -177,8 +177,13 @@ export declare const createTokens: (config: TokenConfig) => {
|
|
|
177
177
|
}>;
|
|
178
178
|
/**
|
|
179
179
|
* A token that no longer verifies for any reason the issuer can fix by re-minting — expiry, a pre-registered-
|
|
180
|
-
* claims shape,
|
|
181
|
-
* out, so a caller never has to know why.
|
|
180
|
+
* claims shape, an issuer from a deployment this one is not, or a key pair this one no longer holds. Used by the
|
|
181
|
+
* endpoints that hand tokens back out, so a caller never has to know why.
|
|
182
|
+
*
|
|
183
|
+
* A credential signed under keys rotated away from reads as `malformed` to `verify` (a `kid` it does not list, a
|
|
184
|
+
* signature it cannot check) — and so did every stored one after a deployment changed its pair, none re-minted. It
|
|
185
|
+
* is told from garbage by being a JWT at all: what never was one is not re-minted, or storing nonsense in a row would
|
|
186
|
+
* be a way to be handed a working credential.
|
|
182
187
|
*/
|
|
183
188
|
needsRotation: (token: string) => boolean;
|
|
184
189
|
/** Undefined for a credential that never expires, which is what a host should read as "no renewal needed". */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/sdk-kernel",
|
|
3
|
-
"version": "0.39.
|
|
3
|
+
"version": "0.39.3",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"description": "What every Plitzi server process is built on: the HTTP pipeline, health and shutdown, the host → deployment resolution, and verifying who a request is.",
|
|
6
6
|
"files": [
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"build:prod": "vite build"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@plitzi/sdk-shared": "0.39.
|
|
40
|
+
"@plitzi/sdk-shared": "0.39.3",
|
|
41
41
|
"jsonwebtoken": "^9.0.3",
|
|
42
42
|
"undici": "^8.12.4",
|
|
43
43
|
"ws": "^8.22.2"
|