@bendyline/gezk 1.0.6 → 1.0.7

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.
Files changed (2) hide show
  1. package/README.md +16 -4
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -18,23 +18,35 @@ ESM only, Node 24+. `zod` is the sole runtime dependency.
18
18
  signing, which need `node:crypto` / `node:fs`.
19
19
 
20
20
  ```ts
21
+ import { readFile } from 'node:fs/promises';
21
22
  import { KnowledgeCatalogManifestSchema, parseKnowledgeUri, quantizeInt8 } from '@bendyline/gezk';
22
- import { verifyManifestSignature } from '@bendyline/gezk/node';
23
+ import { type KnowledgeTrustAnchor, verifyManifestSignature } from '@bendyline/gezk/node';
23
24
 
24
25
  // Citations are a parsed grammar, not string surgery.
25
26
  parseKnowledgeUri('knowledge://bendyline/handboek/guides/intro#line=3-9');
26
27
  // → { publisherId: 'bendyline', catalogId: 'handboek', documentId: 'guides/intro',
27
28
  // fragment: { lineStart: 3, lineEnd: 9 } }
28
29
 
29
- // A manifest is only ever trusted after it parses AND verifies.
30
- const manifest = KnowledgeCatalogManifestSchema.parse(JSON.parse(rawManifestJson));
30
+ // A manifest is only ever trusted after it parses AND verifies. Trust anchors
31
+ // are the publisher keys you accept, [{ keyId, publicKeyPem }], obtained out of band.
32
+ const trustAnchors: KnowledgeTrustAnchor[] = JSON.parse(
33
+ await readFile('./trust-anchors.json', 'utf8'),
34
+ );
35
+ const manifest = KnowledgeCatalogManifestSchema.parse(
36
+ JSON.parse(await readFile('./extracted/manifest.json', 'utf8')),
37
+ );
31
38
  const verdict = verifyManifestSignature(manifest, trustAnchors);
32
39
  if (!verdict.ok) throw new Error(`untrusted catalog: ${verdict.reason}`);
33
40
 
34
41
  // Passage vectors are packed with these exact formulas, never a SQLite extension's.
35
- const packed = quantizeInt8(unitVector);
42
+ const packed = quantizeInt8([0.6, -0.8]); // Int8Array [76, -102]
36
43
  ```
37
44
 
45
+ `./extracted/manifest.json` is the manifest of an extracted `.gezk` archive.
46
+ Publishers sign it with `signManifest` from `@bendyline/gezk/node`, using a key
47
+ from `generateKnowledgeSigningKeyPair`, and publish the public half as a trust
48
+ anchor.
49
+
38
50
  The format specification, JSON Schemas, conformance fixtures and the Python
39
51
  reference reader live in [bendyline/gezk](https://github.com/bendyline/gezk).
40
52
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bendyline/gezk",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "The gezk knowledge-catalog format: manifest and registry schemas, id grammars, knowledge:// references, vector quantization, SQLite DDL, canonical JSON, and Ed25519 manifest signatures.",
5
5
  "license": "MIT",
6
6
  "keywords": [