@lindorm/okp 0.2.0 → 0.2.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/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.2.1](https://github.com/lindorm-io/monorepo/compare/@lindorm/okp@0.2.0...@lindorm/okp@0.2.1) (2025-07-02)
7
+
8
+ **Note:** Version bump only for package @lindorm/okp
9
+
6
10
  # [0.2.0](https://github.com/lindorm-io/monorepo/compare/@lindorm/okp@0.1.8...@lindorm/okp@0.2.0) (2025-06-17)
7
11
 
8
12
  ### Bug Fixes
package/README.md CHANGED
@@ -1 +1,94 @@
1
1
  # @lindorm/okp
2
+
3
+ Simple **EdDSA / OKP (Octet-Key Pair) signing kit** built on top of Node’s `crypto` module and the
4
+ [`@lindorm/kryptos`](../kryptos) key utilities. The kit exposes a small `OkpKit` class which
5
+ implements the generic `IKeyKit` contract used throughout the Lindorm cryptography packages.
6
+
7
+ ---
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ npm install @lindorm/okp
13
+ # or
14
+ yarn add @lindorm/okp
15
+ ```
16
+
17
+ You will also need a compatible key instance:
18
+
19
+ ```ts
20
+ import { KryptosKit } from '@lindorm/kryptos';
21
+
22
+ const ED25519 = KryptosKit.generate.okp({ alg: 'Ed25519', use: 'sig' });
23
+ ```
24
+
25
+ ---
26
+
27
+ ## Example
28
+
29
+ ```ts
30
+ import { OkpKit } from '@lindorm/okp';
31
+ import { randomBytes } from 'node:crypto';
32
+
33
+ const kit = new OkpKit({ kryptos: ED25519, encoding: 'base64url' });
34
+
35
+ const data = randomBytes(32);
36
+
37
+ // Sign → Buffer
38
+ const signature = kit.sign(data);
39
+
40
+ // Verify
41
+ if (kit.verify(data, signature)) {
42
+ console.log('✔️ valid');
43
+ }
44
+
45
+ // Throw when invalid
46
+ kit.assert(data, signature);
47
+
48
+ // Convert Buffer → string
49
+ const asString = kit.format(signature);
50
+ ```
51
+
52
+ ### DSA encoding
53
+
54
+ `OkpKit` defaults to DER encoding (`dsa: 'der'`) but you can switch to IETF-style `ieee-p1363` if
55
+ required:
56
+
57
+ ```ts
58
+ const kit = new OkpKit({ kryptos: ED25519, dsa: 'ieee-p1363' });
59
+ ```
60
+
61
+ ---
62
+
63
+ ## API
64
+
65
+ ```ts
66
+ class OkpKit implements IKeyKit {
67
+ constructor(options: {
68
+ kryptos: IKryptosOkp;
69
+ dsa?: DsaEncoding; // 'der' | 'ieee-p1363' (default 'der')
70
+ encoding?: BufferEncoding; // default 'base64'
71
+ });
72
+
73
+ sign(data: KeyData): Buffer;
74
+ verify(data: KeyData, signature: KeyData): boolean;
75
+ assert(data: KeyData, signature: KeyData): void; // throws OkpError on mismatch
76
+ format(data: Buffer): string; // encode Buffer → string
77
+ }
78
+ ```
79
+
80
+ `KeyData` can be `Buffer`, `string` or `Uint8Array`.
81
+
82
+ ---
83
+
84
+ ## TypeScript
85
+
86
+ The package is written in TypeScript and ships with declaration files. Runtime dependencies are
87
+ limited to **Node.js built-ins** and other Lindorm utilities.
88
+
89
+ ---
90
+
91
+ ## License
92
+
93
+ AGPL-3.0-or-later – see the root [`LICENSE`](../../LICENSE).
94
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lindorm/okp",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "license": "AGPL-3.0-or-later",
5
5
  "author": "Jonn Nilsson",
6
6
  "repository": {
@@ -29,12 +29,12 @@
29
29
  "update:auto": "ncu -u"
30
30
  },
31
31
  "dependencies": {
32
- "@lindorm/errors": "^0.1.8",
32
+ "@lindorm/errors": "^0.1.9",
33
33
  "@lindorm/is": "^0.1.8",
34
- "@lindorm/kryptos": "^0.4.0"
34
+ "@lindorm/kryptos": "^0.4.1"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@lindorm/types": "^0.3.0"
38
38
  },
39
- "gitHead": "c1800f039a816f7ebce30379f8dce9c53ea9f5d1"
39
+ "gitHead": "e66150efb6d7a4688bcece59481ab98d54865af3"
40
40
  }