@hardkas/artifacts 0.8.20-alpha → 0.9.1-alpha
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/README.md +44 -44
- package/dist/index.d.ts +2220 -12
- package/dist/index.js +448 -85
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
# `@hardkas/artifacts`
|
|
2
|
-
|
|
3
|
-
The
|
|
4
|
-
|
|
5
|
-
## 1. Deterministic Hashing
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
## 2.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
1.
|
|
24
|
-
2.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
1
|
+
# `@hardkas/artifacts`
|
|
2
|
+
|
|
3
|
+
The artifacts package is the persistence and verification layer for HardKas transaction plans, signed transactions, receipts, snapshots, and related local records.
|
|
4
|
+
|
|
5
|
+
## 1. Deterministic Hashing
|
|
6
|
+
|
|
7
|
+
HardKas artifacts are intended to be content-addressed and replayable. Verification recalculates canonical content and compares it with the stored metadata.
|
|
8
|
+
|
|
9
|
+
The hashing pipeline should preserve these invariants:
|
|
10
|
+
|
|
11
|
+
- Metadata such as timestamps and tool versions must not change the semantic hash.
|
|
12
|
+
- Object keys are sorted deterministically.
|
|
13
|
+
- BigInt values are serialized as decimal strings.
|
|
14
|
+
- Strings are normalized consistently.
|
|
15
|
+
- Hashing uses the canonical payload, not raw JSON formatting.
|
|
16
|
+
|
|
17
|
+
## 2. Workspace Boundaries
|
|
18
|
+
|
|
19
|
+
Artifact reads and writes should stay inside the workspace-controlled artifact area. Callers must not be able to use paths such as `../..` to escape into unrelated filesystem locations.
|
|
20
|
+
|
|
21
|
+
The expected secure flow is:
|
|
22
|
+
|
|
23
|
+
1. Resolve the requested path.
|
|
24
|
+
2. Compare it against the allowed artifact/workspace root.
|
|
25
|
+
3. Abort before reading or writing if the resolved path escapes that root.
|
|
26
|
+
|
|
27
|
+
## 3. Lineage Verification
|
|
28
|
+
|
|
29
|
+
Transaction artifacts form a chain:
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
TxPlan -> SignedTx -> Receipt
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The relationship is stored through artifact identifiers, content hashes, and lineage metadata. A strict verifier should fail if a parent artifact is missing, mutated, or inconsistent with the child that references it.
|
|
36
|
+
|
|
37
|
+
CLI checks:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
hardkas verify --deep
|
|
41
|
+
hardkas artifact verify <artifact-path> --strict
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Interactive queries can use the SQLite query store for speed, but the query store is only a projection. Deep verification should always go back to the artifact data.
|