@econ-v1/domain 7.5.19 → 7.5.21
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/models/device-boot-state.d.ts +4 -0
- package/dist/models/device-boot-state.d.ts.map +1 -1
- package/dist/services/device-boot-state-service.d.ts +3 -3
- package/dist/services/device-boot-state-service.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/models/device-boot-state.js +1 -1
- package/src/services/device-boot-state-service.js +23 -3
|
@@ -8,5 +8,9 @@ export type DeviceBootState = {
|
|
|
8
8
|
readonly delegationExpiresAt: string;
|
|
9
9
|
} | {
|
|
10
10
|
readonly kind: "revoked";
|
|
11
|
+
} | {
|
|
12
|
+
readonly detectedAt?: string;
|
|
13
|
+
readonly kind: "key-unusable";
|
|
14
|
+
readonly reason?: string;
|
|
11
15
|
};
|
|
12
16
|
//# sourceMappingURL=device-boot-state.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device-boot-state.d.ts","sourceRoot":"","sources":["../../src/models/device-boot-state.js"],"names":[],"mappings":"8BACiB;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAAC,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE"}
|
|
1
|
+
{"version":3,"file":"device-boot-state.d.ts","sourceRoot":"","sources":["../../src/models/device-boot-state.js"],"names":[],"mappings":"8BACiB;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAAC,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/** @import { IdentityPort } from "@econ-v1/ports" */
|
|
1
|
+
/** @import { IdentityLifecycle, IdentityPort } from "@econ-v1/ports" */
|
|
2
2
|
/** @import { DeviceBootState } from "../models/device-boot-state.js" */
|
|
3
|
-
/** @typedef {{ readonly identity: Pick<IdentityPort, "loadDelegation" | "loadLifecycle">; readonly now: () => string; }} DeviceBootStateServiceOptions */
|
|
3
|
+
/** @typedef {{ readonly identity: Pick<IdentityPort, "loadDelegation" | "loadLifecycle" | "loadKeyInspectionFailure">; readonly now: () => string; }} DeviceBootStateServiceOptions */
|
|
4
4
|
export class DeviceBootStateService {
|
|
5
5
|
/** @param {DeviceBootStateServiceOptions} options */
|
|
6
6
|
constructor(options: DeviceBootStateServiceOptions);
|
|
@@ -9,7 +9,7 @@ export class DeviceBootStateService {
|
|
|
9
9
|
#private;
|
|
10
10
|
}
|
|
11
11
|
export type DeviceBootStateServiceOptions = {
|
|
12
|
-
readonly identity: Pick<IdentityPort, "loadDelegation" | "loadLifecycle">;
|
|
12
|
+
readonly identity: Pick<IdentityPort, "loadDelegation" | "loadLifecycle" | "loadKeyInspectionFailure">;
|
|
13
13
|
readonly now: () => string;
|
|
14
14
|
};
|
|
15
15
|
import type { DeviceBootState } from "../models/device-boot-state.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device-boot-state-service.d.ts","sourceRoot":"","sources":["../../src/services/device-boot-state-service.js"],"names":[],"mappings":"AACA,
|
|
1
|
+
{"version":3,"file":"device-boot-state-service.d.ts","sourceRoot":"","sources":["../../src/services/device-boot-state-service.js"],"names":[],"mappings":"AACA,wEAAwE;AACxE,wEAAwE;AACxE,wLAAwL;AACxL;IAKI,qDAAqD;IACrD,qBADY,6BAA6B,EAIxC;IACD,0CAA0C;IAC1C,SADc,OAAO,CAAC,eAAe,CAAC,CAiDrC;;CACJ;4CA7Dc;IAAE,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,YAAY,EAAE,gBAAgB,GAAG,eAAe,GAAG,0BAA0B,CAAC,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,MAAM,CAAC;CAAE;qCADjH,gCAAgC;kCADhB,gBAAgB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@econ-v1/domain",
|
|
3
|
-
"version": "7.5.
|
|
3
|
+
"version": "7.5.21",
|
|
4
4
|
"description": "Platform-neutral domain contracts and errors for Node clients",
|
|
5
5
|
"license": "MIT OR Apache-2.0",
|
|
6
6
|
"author": "Node contributors",
|
|
@@ -57,6 +57,6 @@
|
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@econ-v1/ports": "7.5.
|
|
60
|
+
"@econ-v1/ports": "7.5.21"
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
-
/** @typedef {| { readonly kind: "unpaired" } | { readonly kind: "paired"; readonly delegationExpiresAt: string } | { readonly kind: "paired-expired"; readonly delegationExpiresAt: string } | { readonly kind: "revoked" }} DeviceBootState */
|
|
2
|
+
/** @typedef {| { readonly kind: "unpaired" } | { readonly kind: "paired"; readonly delegationExpiresAt: string } | { readonly kind: "paired-expired"; readonly delegationExpiresAt: string } | { readonly kind: "revoked" } | { readonly detectedAt?: string; readonly kind: "key-unusable"; readonly reason?: string }} DeviceBootState */
|
|
3
3
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
-
/** @import { IdentityPort } from "@econ-v1/ports" */
|
|
2
|
+
/** @import { IdentityLifecycle, IdentityPort } from "@econ-v1/ports" */
|
|
3
3
|
/** @import { DeviceBootState } from "../models/device-boot-state.js" */
|
|
4
|
-
/** @typedef {{ readonly identity: Pick<IdentityPort, "loadDelegation" | "loadLifecycle">; readonly now: () => string; }} DeviceBootStateServiceOptions */
|
|
4
|
+
/** @typedef {{ readonly identity: Pick<IdentityPort, "loadDelegation" | "loadLifecycle" | "loadKeyInspectionFailure">; readonly now: () => string; }} DeviceBootStateServiceOptions */
|
|
5
5
|
export class DeviceBootStateService {
|
|
6
6
|
/** @type {DeviceBootStateServiceOptions["identity"]} */
|
|
7
7
|
#identity;
|
|
@@ -14,7 +14,7 @@ export class DeviceBootStateService {
|
|
|
14
14
|
}
|
|
15
15
|
/** @returns {Promise<DeviceBootState>} */
|
|
16
16
|
async state() {
|
|
17
|
-
/** @type {
|
|
17
|
+
/** @type {IdentityLifecycle | undefined} */
|
|
18
18
|
let lifecycle;
|
|
19
19
|
try {
|
|
20
20
|
lifecycle = await this.#identity.loadLifecycle?.();
|
|
@@ -26,6 +26,26 @@ export class DeviceBootStateService {
|
|
|
26
26
|
}
|
|
27
27
|
if (lifecycle === "revoked")
|
|
28
28
|
return { kind: "revoked" };
|
|
29
|
+
if (lifecycle === "unusable") {
|
|
30
|
+
// The key was quarantined (kept, never purged) on a failed inspection — see
|
|
31
|
+
// docs/superpowers/plans/2026-10-08-no-silent-device-key-purge.md. Best-effort read
|
|
32
|
+
// of WHY, mirroring the fail-toward-unpaired discipline above: a diagnostic read
|
|
33
|
+
// failure must never escalate past "no reason/time to show", since the lifecycle
|
|
34
|
+
// verdict itself already came back clean.
|
|
35
|
+
/** @type {Awaited<ReturnType<NonNullable<DeviceBootStateServiceOptions["identity"]["loadKeyInspectionFailure"]>>>} */
|
|
36
|
+
let diagnostic;
|
|
37
|
+
try {
|
|
38
|
+
diagnostic = await this.#identity.loadKeyInspectionFailure?.();
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
diagnostic = undefined;
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
kind: "key-unusable",
|
|
45
|
+
...(diagnostic?.reason === undefined ? {} : { reason: diagnostic.reason }),
|
|
46
|
+
...(diagnostic?.detectedAt === undefined ? {} : { detectedAt: diagnostic.detectedAt }),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
29
49
|
/** @type {Awaited<ReturnType<IdentityPort["loadDelegation"]>>} */
|
|
30
50
|
let delegation;
|
|
31
51
|
try {
|