@ccmsg/protocol 1.3.0 → 1.4.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/package.json +1 -1
- package/src/common/auth.ts +24 -0
package/package.json
CHANGED
package/src/common/auth.ts
CHANGED
|
@@ -373,6 +373,30 @@ export const TokenFamily = Type.Object(
|
|
|
373
373
|
refresh: Type.Object({ value: Base64Url, expires_at: Timestamp }),
|
|
374
374
|
/** The generation before the current one, while the grace for it lasts. */
|
|
375
375
|
previous_refresh: Type.Optional(Type.Object({ value: Base64Url, expires_at: Timestamp })),
|
|
376
|
+
/** What every generation retired before that was, kept only as a digest and
|
|
377
|
+
* only until the value itself would have expired.
|
|
378
|
+
*
|
|
379
|
+
* Recognising a replay takes remembering the value, but holding it is what
|
|
380
|
+
* the family is trying to protect — these travel to every instance, and a
|
|
381
|
+
* retired token still inside its lifetime would be a live secret copied
|
|
382
|
+
* around for no purpose it could serve. A digest answers the one question
|
|
383
|
+
* asked of it, that a value presented now was once issued here and is no
|
|
384
|
+
* longer, which fails the whole family.
|
|
385
|
+
*
|
|
386
|
+
* Written by the `iss` alone, like the rest of the family, and replicated,
|
|
387
|
+
* so the memory survives that instance restarting and holds wherever the
|
|
388
|
+
* reused value is presented. */
|
|
389
|
+
retired: Type.Optional(
|
|
390
|
+
Type.Array(
|
|
391
|
+
Type.Object({
|
|
392
|
+
/** sha256 of the retired value, lowercase hex. */
|
|
393
|
+
hash: Type.String({ pattern: "^[0-9a-f]{64}$" }),
|
|
394
|
+
/** When the value would have expired, after which remembering it
|
|
395
|
+
* refuses nothing that its own expiry would not. */
|
|
396
|
+
expires_at: Timestamp,
|
|
397
|
+
}),
|
|
398
|
+
),
|
|
399
|
+
),
|
|
376
400
|
},
|
|
377
401
|
{ $id: "TokenFamily" },
|
|
378
402
|
);
|