@peac/cli 0.15.0 → 0.15.1
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 +3 -3
- package/dist/commands/samples.d.ts +3 -3
- package/dist/commands/samples.d.ts.map +1 -1
- package/dist/index.cjs +350 -122
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +352 -124
- package/dist/index.mjs.map +1 -1
- package/dist/lib/public-key.d.ts +21 -0
- package/dist/lib/public-key.d.ts.map +1 -0
- package/dist/lib/samples-loader.d.ts +31 -6
- package/dist/lib/samples-loader.d.ts.map +1 -1
- package/package.json +9 -9
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public verification key loader for offline `peac verify --public-key`.
|
|
3
|
+
*
|
|
4
|
+
* Accepts either a bare public Ed25519 JWK or a single-key JWKS
|
|
5
|
+
* (`{ "keys": [jwk] }`). Fails closed: rejects private key material, empty or
|
|
6
|
+
* multi-key JWKS, non-Ed25519 keys, and malformed input. Error messages are
|
|
7
|
+
* user-safe and never echo key material.
|
|
8
|
+
*
|
|
9
|
+
* Conversion and the base64url / 32-byte length check reuse the canonical
|
|
10
|
+
* `jwkToPublicKeyBytes()` from `@peac/crypto`; this module only handles file
|
|
11
|
+
* shape, container selection, and the private-key guard.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Parse the contents of a public-key file into raw Ed25519 public key bytes.
|
|
15
|
+
*
|
|
16
|
+
* @param content - UTF-8 contents of the public-key file (bare JWK or single-key JWKS).
|
|
17
|
+
* @returns The 32-byte Ed25519 public key.
|
|
18
|
+
* @throws Error with a user-safe message on any invalid / unsupported input.
|
|
19
|
+
*/
|
|
20
|
+
export declare function parsePublicKey(content: string): Uint8Array;
|
|
21
|
+
//# sourceMappingURL=public-key.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-key.d.ts","sourceRoot":"","sources":["../../src/lib/public-key.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAqD1D"}
|
|
@@ -11,26 +11,51 @@
|
|
|
11
11
|
*/
|
|
12
12
|
export type SampleCategory = 'valid' | 'invalid' | 'edge';
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Valid sample: a current PEAC signed interaction record, expressed as the
|
|
15
|
+
* inputs passed to issue(). Generation supplies privateKey and kid. Generated
|
|
16
|
+
* output passes local verification (verifyLocal).
|
|
15
17
|
*/
|
|
16
|
-
export interface
|
|
18
|
+
export interface ValidSampleDefinition {
|
|
17
19
|
id: string;
|
|
18
20
|
name: string;
|
|
19
21
|
description: string;
|
|
20
|
-
category:
|
|
22
|
+
category: 'valid';
|
|
23
|
+
format: 'issue-options';
|
|
24
|
+
/** Inputs for issue() (without privateKey/kid, which generation supplies). */
|
|
25
|
+
input: Record<string, unknown>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Invalid / edge sample: a rejection fixture expressed as raw legacy claims
|
|
29
|
+
* that are signed directly (not issued), so it can carry intentionally invalid
|
|
30
|
+
* shapes that issue() would refuse to produce.
|
|
31
|
+
*/
|
|
32
|
+
export interface LegacySampleDefinition {
|
|
33
|
+
id: string;
|
|
34
|
+
name: string;
|
|
35
|
+
description: string;
|
|
36
|
+
category: 'invalid' | 'edge';
|
|
37
|
+
format: 'legacy-claims';
|
|
21
38
|
claims: Record<string, unknown>;
|
|
22
39
|
header?: Record<string, unknown>;
|
|
23
40
|
expectedError?: string;
|
|
24
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Sample definition (discriminated by category/format).
|
|
44
|
+
*/
|
|
45
|
+
export type SampleDefinition = ValidSampleDefinition | LegacySampleDefinition;
|
|
25
46
|
/**
|
|
26
47
|
* Find samples directory
|
|
27
48
|
*/
|
|
28
49
|
export declare function findSamplesDir(customPath?: string): string | null;
|
|
29
50
|
/**
|
|
30
|
-
* Get sample definitions
|
|
51
|
+
* Get sample definitions.
|
|
31
52
|
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
53
|
+
* An explicit `customSamplesPath` is an authoritative source: it must exist,
|
|
54
|
+
* and its contents are returned as-is (even if empty after skipping malformed
|
|
55
|
+
* samples). It never falls back to embedded samples, so a malformed custom
|
|
56
|
+
* catalog is not masked. With no custom path, the repo/package samples
|
|
57
|
+
* directory is used when present; the embedded samples are a fallback only for
|
|
58
|
+
* runtime environments where that directory is unavailable.
|
|
34
59
|
*/
|
|
35
60
|
export declare function getSamples(customSamplesPath?: string): SampleDefinition[];
|
|
36
61
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"samples-loader.d.ts","sourceRoot":"","sources":["../../src/lib/samples-loader.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAE1D
|
|
1
|
+
{"version":3,"file":"samples-loader.d.ts","sourceRoot":"","sources":["../../src/lib/samples-loader.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAE1D;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,eAAe,CAAC;IACxB,8EAA8E;IAC9E,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,SAAS,GAAG,MAAM,CAAC;IAC7B,MAAM,EAAE,eAAe,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,qBAAqB,GAAG,sBAAsB,CAAC;AAiI9E;;GAEG;AACH,wBAAgB,cAAc,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA4BjE;AAqHD;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CAAC,iBAAiB,CAAC,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAezE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAG7F;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,QAAQ,CAAC,EAAE,cAAc,EAAE,iBAAiB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAI7F"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@peac/cli",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.1",
|
|
4
4
|
"description": "PEAC protocol command-line tools",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -38,18 +38,18 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"chalk": "^4.1.2",
|
|
40
40
|
"commander": "^11.0.0",
|
|
41
|
-
"@peac/
|
|
42
|
-
"@peac/
|
|
43
|
-
"@peac/
|
|
44
|
-
"@peac/
|
|
45
|
-
"@peac/
|
|
46
|
-
"@peac/protocol": "0.15.
|
|
47
|
-
"@peac/schema": "0.15.
|
|
41
|
+
"@peac/audit": "0.15.1",
|
|
42
|
+
"@peac/kernel": "0.15.1",
|
|
43
|
+
"@peac/net-node": "0.15.1",
|
|
44
|
+
"@peac/policy-kit": "0.15.1",
|
|
45
|
+
"@peac/crypto": "0.15.1",
|
|
46
|
+
"@peac/protocol": "0.15.1",
|
|
47
|
+
"@peac/schema": "0.15.1"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@types/node": "^22.19.11",
|
|
51
51
|
"typescript": "^5.3.3",
|
|
52
|
-
"vitest": "^4.
|
|
52
|
+
"vitest": "^4.1.0",
|
|
53
53
|
"tsup": "^8.0.0"
|
|
54
54
|
},
|
|
55
55
|
"keywords": [
|