@parmanasystems/verifier 1.0.19
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 +122 -0
- package/dist/index.d.ts +133 -0
- package/dist/index.js +134 -0
- package/dist/index.js.map +1 -0
- package/package.json +48 -0
package/README.md
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# @parmanasystems/verifier
|
|
2
|
+
|
|
3
|
+
Independent attestation verification for the parmanasystems governance runtime.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@parmanasystems/verifier)
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
`@parmanasystems/verifier` performs portable, independent verification of governance attestations. It has no trust dependency on the runtime that produced the attestation — any party with the signer's public key can verify.
|
|
10
|
+
|
|
11
|
+
Verification is a **four-check process**:
|
|
12
|
+
|
|
13
|
+
1. **Signature** — the attestation was signed by the trusted governance key
|
|
14
|
+
2. **Runtime hash** — the attestation was produced by the expected runtime version
|
|
15
|
+
3. **Schema compatibility** — the schema version is supported by the runtime
|
|
16
|
+
4. **Governed** — the `governed: true` field was in the signature scope (INV-008)
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install @parmanasystems/verifier
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Quick start
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
import { verifyAttestation } from "@parmanasystems/verifier";
|
|
28
|
+
import { getRuntimeManifest, LocalVerifier } from "@parmanasystems/execution";
|
|
29
|
+
|
|
30
|
+
const verifier = new LocalVerifier(publicKeyPem);
|
|
31
|
+
const manifest = getRuntimeManifest();
|
|
32
|
+
|
|
33
|
+
const result = verifyAttestation(attestation, verifier, manifest);
|
|
34
|
+
|
|
35
|
+
console.log(result.valid);
|
|
36
|
+
// true
|
|
37
|
+
|
|
38
|
+
console.log(result.checks);
|
|
39
|
+
// {
|
|
40
|
+
// signature_verified: true,
|
|
41
|
+
// runtime_verified: true,
|
|
42
|
+
// schema_compatible: true,
|
|
43
|
+
// governed: true,
|
|
44
|
+
// }
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## API
|
|
48
|
+
|
|
49
|
+
### `verifyAttestation(attestation, verifier, manifest): VerificationResult`
|
|
50
|
+
|
|
51
|
+
Runs all four checks and returns a structured result. `valid` is `true` only when all checks pass.
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
import { verifyAttestation } from "@parmanasystems/verifier";
|
|
55
|
+
|
|
56
|
+
const { valid, checks } = verifyAttestation(attestation, verifier, manifest);
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### `verifyBundle(manifestPath, signaturePath): Promise<boolean>`
|
|
60
|
+
|
|
61
|
+
Verifies a signed governance policy bundle — hash integrity and Ed25519 signature.
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
import { verifyBundle } from "@parmanasystems/verifier";
|
|
65
|
+
|
|
66
|
+
const ok = await verifyBundle(
|
|
67
|
+
"./policies/claims-approval/v1/bundle.manifest.json",
|
|
68
|
+
"./policies/claims-approval/v1/bundle.sig"
|
|
69
|
+
);
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### `verifyRuntime(manifest1, manifest2): boolean`
|
|
73
|
+
|
|
74
|
+
Compares two runtime manifests for equality.
|
|
75
|
+
|
|
76
|
+
### `verifyRuntimeCompatibility(manifest, requirements): boolean`
|
|
77
|
+
|
|
78
|
+
Checks whether a runtime manifest satisfies a set of `RuntimeRequirements` (version + capabilities).
|
|
79
|
+
|
|
80
|
+
### `verifyExecutionRequirements(manifest, requirements): boolean`
|
|
81
|
+
|
|
82
|
+
Checks whether a runtime manifest satisfies a set of execution-level requirements.
|
|
83
|
+
|
|
84
|
+
## Types
|
|
85
|
+
|
|
86
|
+
### VerificationResult
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
interface VerificationResult {
|
|
90
|
+
valid: boolean;
|
|
91
|
+
checks: {
|
|
92
|
+
signature_verified: boolean;
|
|
93
|
+
runtime_verified: boolean;
|
|
94
|
+
schema_compatible: boolean;
|
|
95
|
+
governed: boolean;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Independent verification
|
|
101
|
+
|
|
102
|
+
Verification is designed to run outside the production runtime with no network calls or service dependencies:
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
// In a separate process, auditor's environment, or third-party system:
|
|
106
|
+
import { verifyAttestation } from "@parmanasystems/verifier";
|
|
107
|
+
|
|
108
|
+
// All you need: the attestation, the public key, and the expected runtime manifest.
|
|
109
|
+
const result = verifyAttestation(attestation, verifier, manifest);
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The `Verifier` interface accepts any implementation — `LocalVerifier` (Ed25519), custom AWS KMS verifiers, or any compatible implementation:
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
interface Verifier {
|
|
116
|
+
verify(payload: string, signature: string): boolean;
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## License
|
|
121
|
+
|
|
122
|
+
Apache-2.0
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { ExecutionAttestation, Verifier, RuntimeManifest } from '@parmanasystems/execution';
|
|
2
|
+
import { RuntimeRequirements } from '@parmanasystems/governance';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Structured result of an attestation verification.
|
|
6
|
+
*
|
|
7
|
+
* `valid` is `true` only when all four checks pass. Individual check flags
|
|
8
|
+
* allow callers to produce precise diagnostic messages on failure.
|
|
9
|
+
*/
|
|
10
|
+
interface VerificationResult {
|
|
11
|
+
/** `true` when all checks — governed, signature, runtime, and schema — pass. */
|
|
12
|
+
valid: boolean;
|
|
13
|
+
checks: {
|
|
14
|
+
/** `true` when the attestation signature is cryptographically valid. */
|
|
15
|
+
signature_verified: boolean;
|
|
16
|
+
/** `true` when the attestation's runtime hash and version match the provided manifest. */
|
|
17
|
+
runtime_verified: boolean;
|
|
18
|
+
/** `true` when the attestation's schema version is supported by the runtime manifest. */
|
|
19
|
+
schema_compatible: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* True when attestation.result.governed === true.
|
|
22
|
+
* A governed attestation must have this field as the literal true.
|
|
23
|
+
* Enforces: META-001, INV-014.
|
|
24
|
+
*/
|
|
25
|
+
governed: boolean;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Verifies an ExecutionAttestation.
|
|
31
|
+
*
|
|
32
|
+
* Checks:
|
|
33
|
+
* 1. Signature correctness
|
|
34
|
+
* 2. Runtime integrity (runtime_hash match)
|
|
35
|
+
*
|
|
36
|
+
* NOTE:
|
|
37
|
+
* Payload MUST exactly match what was signed during execution.
|
|
38
|
+
*/
|
|
39
|
+
declare function verifyAttestation(attestation: ExecutionAttestation, verifier: Verifier, runtimeManifest: RuntimeManifest): VerificationResult;
|
|
40
|
+
|
|
41
|
+
/** Detailed result of a {@link verifyBundle} call. */
|
|
42
|
+
interface BundleVerificationResult {
|
|
43
|
+
/** `true` when both the manifest content hashes and the cryptographic signature are valid. */
|
|
44
|
+
valid: boolean;
|
|
45
|
+
/** `true` when the content hash commitment in the manifest is consistent. */
|
|
46
|
+
manifest_verified: boolean;
|
|
47
|
+
/** `true` when the manifest signature passes cryptographic verification. */
|
|
48
|
+
signature_verified: boolean;
|
|
49
|
+
/** `true` when the on-disk directory content matches the manifest's artifact hashes. */
|
|
50
|
+
bundle_verified: boolean;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Performs a full, standalone bundle verification:
|
|
54
|
+
* 1. Re-hashes every artifact in the bundle directory and validates the manifest commitment.
|
|
55
|
+
* 2. Verifies the Ed25519 signature in `signaturePath` against the manifest.
|
|
56
|
+
*
|
|
57
|
+
* Both checks must pass for `valid` to be `true`.
|
|
58
|
+
*
|
|
59
|
+
* @param manifestPath - Path to `bundle.manifest.json`.
|
|
60
|
+
* @param signaturePath - Path to `bundle.sig` (base64 Ed25519 signature file).
|
|
61
|
+
*/
|
|
62
|
+
declare function verifyBundle(manifestPath: string, signaturePath: string): BundleVerificationResult;
|
|
63
|
+
|
|
64
|
+
/** Result of verifying that a runtime manifest declares a required set of capabilities. */
|
|
65
|
+
interface RuntimeVerificationResult {
|
|
66
|
+
/** `true` when the runtime declares all required capabilities. */
|
|
67
|
+
valid: boolean;
|
|
68
|
+
/** Capability strings that are required but not declared by the runtime. */
|
|
69
|
+
missing_capabilities: string[];
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Checks that `manifest.capabilities` contains every entry in `requiredCapabilities`.
|
|
73
|
+
*
|
|
74
|
+
* @param manifest - The runtime manifest to check.
|
|
75
|
+
* @param requiredCapabilities - The capability strings that must be present.
|
|
76
|
+
*/
|
|
77
|
+
declare function verifyRuntime(manifest: RuntimeManifest, requiredCapabilities: string[]): RuntimeVerificationResult;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Full compatibility result produced by {@link verifyRuntimeCompatibility}.
|
|
81
|
+
* Separates capability gaps from version incompatibilities so each dimension
|
|
82
|
+
* can be reported or acted on independently.
|
|
83
|
+
*/
|
|
84
|
+
interface RuntimeCompatibilityResult {
|
|
85
|
+
/** `true` when the runtime satisfies all capability, version, and schema requirements. */
|
|
86
|
+
valid: boolean;
|
|
87
|
+
/** Capability strings required by the bundle but absent from the runtime. */
|
|
88
|
+
missing_capabilities: string[];
|
|
89
|
+
/** `true` when the runtime version is not in `requirements.supported_runtime_versions`. */
|
|
90
|
+
unsupported_runtime_version: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* `true` when none of the schema versions supported by the runtime appear in
|
|
93
|
+
* `requirements.supported_schema_versions`.
|
|
94
|
+
*/
|
|
95
|
+
unsupported_schema_version: boolean;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Performs a comprehensive compatibility check between a runtime manifest and
|
|
99
|
+
* the requirements declared by a bundle. Checks capabilities, runtime version,
|
|
100
|
+
* and schema version overlap in a single pass.
|
|
101
|
+
*
|
|
102
|
+
* Use this before issuing an execution token to surface all incompatibilities
|
|
103
|
+
* at once rather than discovering them one at a time.
|
|
104
|
+
*
|
|
105
|
+
* @param manifest - The runtime manifest to evaluate.
|
|
106
|
+
* @param requirements - The bundle's declared runtime requirements.
|
|
107
|
+
*/
|
|
108
|
+
declare function verifyRuntimeCompatibility(manifest: RuntimeManifest, requirements: RuntimeRequirements): RuntimeCompatibilityResult;
|
|
109
|
+
|
|
110
|
+
/** Result of verifying that a runtime satisfies a set of execution security requirements. */
|
|
111
|
+
interface ExecutionRequirementResult {
|
|
112
|
+
/** `true` when the runtime satisfies all requirements. */
|
|
113
|
+
valid: boolean;
|
|
114
|
+
/** List of capability strings that are required but absent from the runtime. */
|
|
115
|
+
missing_requirements: string[];
|
|
116
|
+
}
|
|
117
|
+
type ExecutionRequirementsInput = {
|
|
118
|
+
replay_protection_required?: boolean;
|
|
119
|
+
attestation_required?: boolean;
|
|
120
|
+
audit_chain_required?: boolean;
|
|
121
|
+
[key: string]: boolean | undefined;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Checks that `manifest.capabilities` satisfies every flag set in
|
|
125
|
+
* `requirements`. Returns the list of missing capabilities so callers can
|
|
126
|
+
* produce actionable error messages.
|
|
127
|
+
*
|
|
128
|
+
* @param manifest - The runtime manifest to test.
|
|
129
|
+
* @param requirements - The execution security requirements to check against.
|
|
130
|
+
*/
|
|
131
|
+
declare function verifyExecutionRequirements(manifest: RuntimeManifest, requirements: ExecutionRequirementsInput): ExecutionRequirementResult;
|
|
132
|
+
|
|
133
|
+
export { type BundleVerificationResult, type ExecutionRequirementResult, type RuntimeCompatibilityResult, type RuntimeVerificationResult, type VerificationResult, verifyAttestation, verifyBundle, verifyExecutionRequirements, verifyRuntime, verifyRuntimeCompatibility };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// src/verify-attestation.ts
|
|
2
|
+
function verifyAttestation(attestation, verifier, runtimeManifest) {
|
|
3
|
+
const payloadString = JSON.stringify({
|
|
4
|
+
execution_id: attestation.execution_id,
|
|
5
|
+
decision: attestation.decision,
|
|
6
|
+
execution_state: attestation.execution_state,
|
|
7
|
+
runtime_hash: attestation.runtime_hash
|
|
8
|
+
});
|
|
9
|
+
const signatureVerified = verifier.verify(
|
|
10
|
+
payloadString,
|
|
11
|
+
attestation.signature
|
|
12
|
+
);
|
|
13
|
+
const runtimeVerified = attestation.runtime_hash === runtimeManifest.runtime_hash;
|
|
14
|
+
return {
|
|
15
|
+
valid: signatureVerified && runtimeVerified,
|
|
16
|
+
checks: {
|
|
17
|
+
signature_verified: signatureVerified,
|
|
18
|
+
runtime_verified: runtimeVerified,
|
|
19
|
+
schema_compatible: true,
|
|
20
|
+
// no longer used
|
|
21
|
+
governed: true
|
|
22
|
+
// implicit in attestation model
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// src/verify-bundle.ts
|
|
28
|
+
import fs from "fs";
|
|
29
|
+
import path from "path";
|
|
30
|
+
import {
|
|
31
|
+
readManifest,
|
|
32
|
+
verifyManifest
|
|
33
|
+
} from "@parmanasystems/bundle";
|
|
34
|
+
import {
|
|
35
|
+
verifySignature
|
|
36
|
+
} from "@parmanasystems/crypto";
|
|
37
|
+
function verifyBundle(manifestPath, signaturePath) {
|
|
38
|
+
const signature = fs.readFileSync(
|
|
39
|
+
signaturePath,
|
|
40
|
+
"utf8"
|
|
41
|
+
);
|
|
42
|
+
const directory = path.dirname(
|
|
43
|
+
manifestPath
|
|
44
|
+
);
|
|
45
|
+
const parsedManifest = readManifest(directory);
|
|
46
|
+
const bundleVerified = verifyManifest(
|
|
47
|
+
parsedManifest,
|
|
48
|
+
directory
|
|
49
|
+
).valid;
|
|
50
|
+
const signatureVerified = verifySignature(
|
|
51
|
+
manifestPath,
|
|
52
|
+
signature
|
|
53
|
+
);
|
|
54
|
+
return {
|
|
55
|
+
valid: bundleVerified && signatureVerified,
|
|
56
|
+
manifest_verified: bundleVerified && signatureVerified,
|
|
57
|
+
signature_verified: signatureVerified,
|
|
58
|
+
bundle_verified: bundleVerified
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// src/verify-runtime.ts
|
|
63
|
+
function verifyRuntime(manifest, requiredCapabilities) {
|
|
64
|
+
const missing = requiredCapabilities.filter(
|
|
65
|
+
(capability) => !manifest.capabilities.includes(
|
|
66
|
+
capability
|
|
67
|
+
)
|
|
68
|
+
);
|
|
69
|
+
return {
|
|
70
|
+
valid: missing.length === 0,
|
|
71
|
+
missing_capabilities: missing
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// src/verify-runtime-compatibility.ts
|
|
76
|
+
function verifyRuntimeCompatibility(manifest, requirements) {
|
|
77
|
+
const missingCapabilities = requirements.required_capabilities.filter(
|
|
78
|
+
(capability) => !manifest.capabilities.includes(
|
|
79
|
+
capability
|
|
80
|
+
)
|
|
81
|
+
);
|
|
82
|
+
const unsupportedRuntime = !requirements.supported_runtime_versions.includes(
|
|
83
|
+
manifest.runtime_version
|
|
84
|
+
);
|
|
85
|
+
const unsupportedSchema = requirements.supported_schema_versions.every(
|
|
86
|
+
(schemaVersion) => !manifest.supported_schema_versions.includes(
|
|
87
|
+
schemaVersion
|
|
88
|
+
)
|
|
89
|
+
);
|
|
90
|
+
return {
|
|
91
|
+
valid: missingCapabilities.length === 0 && !unsupportedRuntime && !unsupportedSchema,
|
|
92
|
+
missing_capabilities: missingCapabilities,
|
|
93
|
+
unsupported_runtime_version: unsupportedRuntime,
|
|
94
|
+
unsupported_schema_version: unsupportedSchema
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// src/verify-execution-requirements.ts
|
|
99
|
+
function verifyExecutionRequirements(manifest, requirements) {
|
|
100
|
+
const missing = [];
|
|
101
|
+
if (requirements.replay_protection_required && !manifest.capabilities.includes(
|
|
102
|
+
"replay-protection"
|
|
103
|
+
)) {
|
|
104
|
+
missing.push(
|
|
105
|
+
"replay-protection"
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
if (requirements.attestation_required && !manifest.capabilities.includes(
|
|
109
|
+
"attestation-signing"
|
|
110
|
+
)) {
|
|
111
|
+
missing.push(
|
|
112
|
+
"attestation-signing"
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
if (requirements.audit_chain_required && !manifest.capabilities.includes(
|
|
116
|
+
"bundle-verification"
|
|
117
|
+
)) {
|
|
118
|
+
missing.push(
|
|
119
|
+
"bundle-verification"
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
valid: missing.length === 0,
|
|
124
|
+
missing_requirements: missing
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
export {
|
|
128
|
+
verifyAttestation,
|
|
129
|
+
verifyBundle,
|
|
130
|
+
verifyExecutionRequirements,
|
|
131
|
+
verifyRuntime,
|
|
132
|
+
verifyRuntimeCompatibility
|
|
133
|
+
};
|
|
134
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/verify-attestation.ts","../src/verify-bundle.ts","../src/verify-runtime.ts","../src/verify-runtime-compatibility.ts","../src/verify-execution-requirements.ts"],"sourcesContent":["import type {\n ExecutionAttestation,\n RuntimeManifest,\n Verifier\n} from \"@parmanasystems/execution\";\n\nimport type {\n VerificationResult,\n} from \"./types\";\n\n/**\n * Verifies an ExecutionAttestation.\n *\n * Checks:\n * 1. Signature correctness\n * 2. Runtime integrity (runtime_hash match)\n *\n * NOTE:\n * Payload MUST exactly match what was signed during execution.\n */\nexport function verifyAttestation(\n attestation: ExecutionAttestation,\n verifier: Verifier,\n runtimeManifest: RuntimeManifest\n): VerificationResult {\n\n // -----------------------------\n // Canonical payload (STRING — must match signer)\n // -----------------------------\n const payloadString = JSON.stringify({\n execution_id: attestation.execution_id,\n decision: attestation.decision,\n execution_state: attestation.execution_state,\n runtime_hash: attestation.runtime_hash\n });\n\n // -----------------------------\n // Check 1: Signature\n // -----------------------------\n const signatureVerified = verifier.verify(\n payloadString,\n attestation.signature\n );\n\n // -----------------------------\n // Check 2: Runtime binding\n // -----------------------------\n const runtimeVerified =\n attestation.runtime_hash ===\n runtimeManifest.runtime_hash;\n\n // -----------------------------\n // Final result\n // -----------------------------\n return {\n valid:\n signatureVerified &&\n runtimeVerified,\n\n checks: {\n signature_verified: signatureVerified,\n runtime_verified: runtimeVerified,\n schema_compatible: true, // no longer used\n governed: true // implicit in attestation model\n }\n };\n}","import fs from \"fs\";\nimport path from \"path\";\n\nimport {\n readManifest,\n verifyManifest,\n} from \"@parmanasystems/bundle\";\n\nimport {\n verifySignature,\n} from \"@parmanasystems/crypto\";\n\n/** Detailed result of a {@link verifyBundle} call. */\nexport interface BundleVerificationResult {\n /** `true` when both the manifest content hashes and the cryptographic signature are valid. */\n valid: boolean;\n\n /** `true` when the content hash commitment in the manifest is consistent. */\n manifest_verified: boolean;\n\n /** `true` when the manifest signature passes cryptographic verification. */\n signature_verified: boolean;\n\n /** `true` when the on-disk directory content matches the manifest's artifact hashes. */\n bundle_verified: boolean;\n}\n\n/**\n * Performs a full, standalone bundle verification:\n * 1. Re-hashes every artifact in the bundle directory and validates the manifest commitment.\n * 2. Verifies the Ed25519 signature in `signaturePath` against the manifest.\n *\n * Both checks must pass for `valid` to be `true`.\n *\n * @param manifestPath - Path to `bundle.manifest.json`.\n * @param signaturePath - Path to `bundle.sig` (base64 Ed25519 signature file).\n */\nexport function verifyBundle(\n manifestPath: string,\n signaturePath: string\n): BundleVerificationResult {\n\n const signature =\n fs.readFileSync(\n signaturePath,\n \"utf8\"\n );\n\n const directory =\n path.dirname(\n manifestPath\n );\n\n const parsedManifest =\n readManifest(directory);\n\n const bundleVerified =\n verifyManifest(\n parsedManifest,\n directory\n ).valid;\n\n const signatureVerified =\n verifySignature(\n manifestPath,\n signature\n );\n\n return {\n valid:\n bundleVerified &&\n signatureVerified,\n\n manifest_verified:\n bundleVerified &&\n signatureVerified,\n\n signature_verified:\n signatureVerified,\n\n bundle_verified:\n bundleVerified,\n };\n}\n\n\n\n\n","import type {\n RuntimeManifest,\n} from \"@parmanasystems/execution\";\n\n/** Result of verifying that a runtime manifest declares a required set of capabilities. */\nexport interface RuntimeVerificationResult {\n /** `true` when the runtime declares all required capabilities. */\n valid: boolean;\n\n /** Capability strings that are required but not declared by the runtime. */\n missing_capabilities: string[];\n}\n\n/**\n * Checks that `manifest.capabilities` contains every entry in `requiredCapabilities`.\n *\n * @param manifest - The runtime manifest to check.\n * @param requiredCapabilities - The capability strings that must be present.\n */\nexport function verifyRuntime(\n manifest: RuntimeManifest,\n requiredCapabilities: string[]\n): RuntimeVerificationResult {\n\n const missing =\n requiredCapabilities.filter(\n capability =>\n !manifest.capabilities.includes(\n capability\n )\n );\n\n return {\n valid:\n missing.length === 0,\n\n missing_capabilities:\n missing,\n };\n}\n\n\n\n\n","import type {\n RuntimeManifest,\n} from \"@parmanasystems/execution\";\n\nimport type {\n RuntimeRequirements,\n} from \"@parmanasystems/governance\";\n\n/**\n * Full compatibility result produced by {@link verifyRuntimeCompatibility}.\n * Separates capability gaps from version incompatibilities so each dimension\n * can be reported or acted on independently.\n */\nexport interface RuntimeCompatibilityResult {\n /** `true` when the runtime satisfies all capability, version, and schema requirements. */\n valid: boolean;\n\n /** Capability strings required by the bundle but absent from the runtime. */\n missing_capabilities: string[];\n\n /** `true` when the runtime version is not in `requirements.supported_runtime_versions`. */\n unsupported_runtime_version: boolean;\n\n /**\n * `true` when none of the schema versions supported by the runtime appear in\n * `requirements.supported_schema_versions`.\n */\n unsupported_schema_version: boolean;\n}\n\n/**\n * Performs a comprehensive compatibility check between a runtime manifest and\n * the requirements declared by a bundle. Checks capabilities, runtime version,\n * and schema version overlap in a single pass.\n *\n * Use this before issuing an execution token to surface all incompatibilities\n * at once rather than discovering them one at a time.\n *\n * @param manifest - The runtime manifest to evaluate.\n * @param requirements - The bundle's declared runtime requirements.\n */\nexport function verifyRuntimeCompatibility(\n manifest: RuntimeManifest,\n requirements: RuntimeRequirements\n): RuntimeCompatibilityResult {\n\n const missingCapabilities =\n requirements.required_capabilities.filter(\n capability =>\n !manifest.capabilities.includes(\n capability\n )\n );\n\n const unsupportedRuntime =\n !requirements.supported_runtime_versions.includes(\n manifest.runtime_version\n );\n\n const unsupportedSchema =\n requirements.supported_schema_versions.every(\n (\n schemaVersion\n ) =>\n !manifest.supported_schema_versions.includes(\n schemaVersion\n )\n );\n\n return {\n valid:\n missingCapabilities.length === 0 &&\n !unsupportedRuntime &&\n !unsupportedSchema,\n\n missing_capabilities:\n missingCapabilities,\n\n unsupported_runtime_version:\n unsupportedRuntime,\n\n unsupported_schema_version:\n unsupportedSchema,\n };\n}\n\n\n\n\n","import type {\n RuntimeManifest,\n} from \"@parmanasystems/execution\";\n\n/** Result of verifying that a runtime satisfies a set of execution security requirements. */\nexport interface ExecutionRequirementResult {\n /** `true` when the runtime satisfies all requirements. */\n valid: boolean;\n\n /** List of capability strings that are required but absent from the runtime. */\n missing_requirements: string[];\n}\n\ntype ExecutionRequirementsInput = {\n replay_protection_required?: boolean;\n attestation_required?: boolean;\n audit_chain_required?: boolean;\n [key: string]: boolean | undefined;\n};\n\n/**\n * Checks that `manifest.capabilities` satisfies every flag set in\n * `requirements`. Returns the list of missing capabilities so callers can\n * produce actionable error messages.\n *\n * @param manifest - The runtime manifest to test.\n * @param requirements - The execution security requirements to check against.\n */\nexport function verifyExecutionRequirements(\n manifest: RuntimeManifest,\n requirements: ExecutionRequirementsInput\n): ExecutionRequirementResult {\n\n const missing: string[] = [];\n\n if (\n requirements.replay_protection_required &&\n !manifest.capabilities.includes(\n \"replay-protection\"\n )\n ) {\n missing.push(\n \"replay-protection\"\n );\n }\n\n if (\n requirements.attestation_required &&\n !manifest.capabilities.includes(\n \"attestation-signing\"\n )\n ) {\n missing.push(\n \"attestation-signing\"\n );\n }\n\n if (\n requirements.audit_chain_required &&\n !manifest.capabilities.includes(\n \"bundle-verification\"\n )\n ) {\n missing.push(\n \"bundle-verification\"\n );\n }\n\n return {\n valid:\n missing.length === 0,\n\n missing_requirements:\n missing,\n };\n}\n\n\n\n"],"mappings":";AAoBO,SAAS,kBACd,aACA,UACA,iBACoB;AAKpB,QAAM,gBAAgB,KAAK,UAAU;AAAA,IACnC,cAAc,YAAY;AAAA,IAC1B,UAAU,YAAY;AAAA,IACtB,iBAAiB,YAAY;AAAA,IAC7B,cAAc,YAAY;AAAA,EAC5B,CAAC;AAKD,QAAM,oBAAoB,SAAS;AAAA,IACjC;AAAA,IACA,YAAY;AAAA,EACd;AAKA,QAAM,kBACJ,YAAY,iBACZ,gBAAgB;AAKlB,SAAO;AAAA,IACL,OACE,qBACA;AAAA,IAEF,QAAQ;AAAA,MACN,oBAAoB;AAAA,MACpB,kBAAkB;AAAA,MAClB,mBAAmB;AAAA;AAAA,MACnB,UAAU;AAAA;AAAA,IACZ;AAAA,EACF;AACF;;;AClEA,OAAO,QAAQ;AACf,OAAO,UAAU;AAEjB;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,OACK;AA2BA,SAAS,aACd,cACA,eAC0B;AAE1B,QAAM,YACJ,GAAG;AAAA,IACD;AAAA,IACA;AAAA,EACF;AAEF,QAAM,YACJ,KAAK;AAAA,IACH;AAAA,EACF;AAEF,QAAM,iBACJ,aAAa,SAAS;AAExB,QAAM,iBACJ;AAAA,IACE;AAAA,IACA;AAAA,EACF,EAAE;AAEJ,QAAM,oBACJ;AAAA,IACE;AAAA,IACA;AAAA,EACF;AAEF,SAAO;AAAA,IACL,OACE,kBACA;AAAA,IAEF,mBACE,kBACA;AAAA,IAEF,oBACE;AAAA,IAEF,iBACE;AAAA,EACJ;AACF;;;AChEO,SAAS,cACd,UACA,sBAC2B;AAE3B,QAAM,UACJ,qBAAqB;AAAA,IACnB,gBACE,CAAC,SAAS,aAAa;AAAA,MACrB;AAAA,IACF;AAAA,EACJ;AAEF,SAAO;AAAA,IACL,OACE,QAAQ,WAAW;AAAA,IAErB,sBACE;AAAA,EACJ;AACF;;;ACEO,SAAS,2BACd,UACA,cAC4B;AAE5B,QAAM,sBACJ,aAAa,sBAAsB;AAAA,IACjC,gBACE,CAAC,SAAS,aAAa;AAAA,MACrB;AAAA,IACF;AAAA,EACJ;AAEF,QAAM,qBACJ,CAAC,aAAa,2BAA2B;AAAA,IACvC,SAAS;AAAA,EACX;AAEF,QAAM,oBACJ,aAAa,0BAA0B;AAAA,IACrC,CACE,kBAEA,CAAC,SAAS,0BAA0B;AAAA,MAClC;AAAA,IACF;AAAA,EACJ;AAEF,SAAO;AAAA,IACL,OACE,oBAAoB,WAAW,KAC/B,CAAC,sBACD,CAAC;AAAA,IAEH,sBACE;AAAA,IAEF,6BACE;AAAA,IAEF,4BACE;AAAA,EACJ;AACF;;;ACxDO,SAAS,4BACd,UACA,cAC4B;AAE5B,QAAM,UAAoB,CAAC;AAE3B,MACE,aAAa,8BACb,CAAC,SAAS,aAAa;AAAA,IACrB;AAAA,EACF,GACA;AACA,YAAQ;AAAA,MACN;AAAA,IACF;AAAA,EACF;AAEA,MACE,aAAa,wBACb,CAAC,SAAS,aAAa;AAAA,IACrB;AAAA,EACF,GACA;AACA,YAAQ;AAAA,MACN;AAAA,IACF;AAAA,EACF;AAEA,MACE,aAAa,wBACb,CAAC,SAAS,aAAa;AAAA,IACrB;AAAA,EACF,GACA;AACA,YAAQ;AAAA,MACN;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,OACE,QAAQ,WAAW;AAAA,IAErB,sBACE;AAAA,EACJ;AACF;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@parmanasystems/verifier",
|
|
3
|
+
"version": "1.0.19",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsup"
|
|
8
|
+
},
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"sideEffects": false,
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@parmanasystems/crypto": "^1.0.19",
|
|
22
|
+
"@parmanasystems/execution": "^1.0.19",
|
|
23
|
+
"@parmanasystems/governance": "^1.0.19"
|
|
24
|
+
},
|
|
25
|
+
"description": "Independent governance verification infrastructure for deterministic parmanasystems workflows.",
|
|
26
|
+
"license": "Apache-2.0",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://github.com/pavancharak/parmanasystems-core.git"
|
|
30
|
+
},
|
|
31
|
+
"homepage": "https://github.com/pavancharak/parmanasystems-core",
|
|
32
|
+
"bugs": {
|
|
33
|
+
"url": "https://github.com/pavancharak/parmanasystems-core/issues"
|
|
34
|
+
},
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=20"
|
|
37
|
+
},
|
|
38
|
+
"keywords": [
|
|
39
|
+
"verification",
|
|
40
|
+
"attestation",
|
|
41
|
+
"provenance",
|
|
42
|
+
"trust",
|
|
43
|
+
"auditability",
|
|
44
|
+
"governance"
|
|
45
|
+
],
|
|
46
|
+
"main": "./dist/index.js",
|
|
47
|
+
"types": "./dist/index.d.ts"
|
|
48
|
+
}
|