@owlmeans/basic-keys 0.1.18-rc.2 → 0.1.18-rc.20
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 +2 -2
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/basic-keys/SKILL.md +43 -13
- package/package.json +4 -4
- package/build/.gitkeep +0 -0
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ ED25519 and XChaCha20 cryptographic key operations: generation, signing, verific
|
|
|
12
12
|
## Installation
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
|
-
bun add @owlmeans/basic-keys
|
|
15
|
+
bun add @owlmeans/basic-keys@^0.1.18-rc.11
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
## Usage
|
|
@@ -89,7 +89,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
|
|
|
89
89
|
your project's skill store (`.agents/skills/`):
|
|
90
90
|
|
|
91
91
|
```sh
|
|
92
|
-
npx @owlmeans/agent-skills
|
|
92
|
+
npx @owlmeans/agent-skills@^0.1.18-rc.20
|
|
93
93
|
```
|
|
94
94
|
|
|
95
95
|
The embedded files are version-matched to this package release. Do not edit them
|
package/agent-meta/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"package": "@owlmeans/basic-keys",
|
|
4
|
-
"version": "0.1.18-rc.
|
|
5
|
-
"generatedAt": "2026-
|
|
4
|
+
"version": "0.1.18-rc.20",
|
|
5
|
+
"generatedAt": "2026-09-12T14:18:54.779Z",
|
|
6
6
|
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
@@ -8,7 +8,7 @@ user-invocable: false
|
|
|
8
8
|
# @owlmeans/basic-keys
|
|
9
9
|
|
|
10
10
|
**Layer:** Core
|
|
11
|
-
**Install:** `"@owlmeans/basic-keys": "^0.1.18-rc.
|
|
11
|
+
**Install:** `"@owlmeans/basic-keys": "^0.1.18-rc.20"` in `dependencies`
|
|
12
12
|
|
|
13
13
|
## Key Exports
|
|
14
14
|
|
|
@@ -18,13 +18,18 @@ user-invocable: false
|
|
|
18
18
|
| `KeyPair` | Key pair shape: `{ privateKey, publicKey, address, type }`, keys base64 |
|
|
19
19
|
| `KeyPairModel` | `sign` / `verify` / `encrypt` / `decrypt` / `dcrpt` / `export*` |
|
|
20
20
|
| `KeyType` | `ED25519` (`'ed25519'`, signing) and `XCHACHA` (`'xchacha'`, encryption) |
|
|
21
|
-
| `fromPubKey`, `matchAddress` | Verify-only model from a public key; address check |
|
|
22
|
-
| `auth`
|
|
21
|
+
| `fromPubKey(key, type?)`, `matchAddress(address, pubKey)` | Verify-only model from a public key; address check |
|
|
22
|
+
| `packAuthCredentials(auth, extra, signer)` | Sign a credential payload into `AuthCredentials.credential` |
|
|
23
|
+
| `unpackAuthCredentials(auth, verifier?)` | Split that back into `{ unsigned, signature, extras, isValid }` |
|
|
24
|
+
| `plugins` | The key-type registry, keyed by type string |
|
|
23
25
|
|
|
24
26
|
## Subpath Exports
|
|
25
27
|
|
|
26
|
-
- `./plugins` —
|
|
27
|
-
|
|
28
|
+
- `./plugins` — the individual plugins (`ed25519Plugin`, `xChahaPlugin`), the `plugins` registry
|
|
29
|
+
again, and the **`KeyPlugin` type**. `KeyPlugin` is *not* on the root surface: the root re-exports
|
|
30
|
+
only the registry value, so a package implementing a new key type imports the type from
|
|
31
|
+
`@owlmeans/basic-keys/plugins`.
|
|
32
|
+
- `./utils` — `assertType`, `prepareKey`, `prepareData`, `toAddress`
|
|
28
33
|
|
|
29
34
|
## Usage
|
|
30
35
|
|
|
@@ -53,14 +58,31 @@ Plain `Error` with a `basic.keys:<code>` message — this package does **not** u
|
|
|
53
58
|
|
|
54
59
|
| Code | Raised when |
|
|
55
60
|
|------|-------------|
|
|
56
|
-
| `basic.keys:
|
|
57
|
-
| `basic.keys:
|
|
61
|
+
| `basic.keys:unknown-type` | the key type is absent or has no plugin (see the guard order below) |
|
|
62
|
+
| `basic.keys:missing-pk` | `sign` on a model built from a `KeyPair` **object** whose `privateKey` is null or undefined |
|
|
58
63
|
| `basic.keys:sign-data-type` | data is neither string, object, nor `Uint8Array` |
|
|
59
64
|
| `basic.keys:decrypt-not-utf8` | plaintext is not valid UTF-8 (see below) |
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
| `ed25519:encryption-support` | `encrypt` or `decrypt` on an ed25519 model |
|
|
66
|
+
| `xchacha:signing` / `xchacha:verification` | `sign` or `verify` on an xchacha model |
|
|
67
|
+
|
|
68
|
+
Not every failure comes back as one of these, so do not match on a code where the underlying
|
|
69
|
+
library throws first:
|
|
70
|
+
|
|
71
|
+
- Signing with a **verify-only** model does not raise `basic.keys:missing-pk`. `fromPubKey` stores
|
|
72
|
+
`privateKey: ''`, which passes the null guard, and `@noble/curves` rejects it as
|
|
73
|
+
`private key of length 32 expected, got 0`.
|
|
74
|
+
- A string input that is neither a key type nor valid base64 fails in the decoder
|
|
75
|
+
(`Found a character that cannot be part of a valid base64 string`), never with a `basic.keys:`
|
|
76
|
+
code.
|
|
77
|
+
- The type check is not the first thing every method does. `export`, `exportPublic` and
|
|
78
|
+
`exportAddress` run it before anything else, but `sign`, `verify` and `encrypt` convert the payload
|
|
79
|
+
first — on a model whose type has no plugin, `sign(42)` throws `basic.keys:sign-data-type` while
|
|
80
|
+
`sign('ok')` throws `basic.keys:unknown-type` — and `decrypt`/`dcrpt` base64-decode the input
|
|
81
|
+
first, so a malformed ciphertext fails in the decoder.
|
|
82
|
+
|
|
83
|
+
## `@scure/base` — strict `utf8`
|
|
84
|
+
|
|
85
|
+
This package depends on `@scure/base` `^2.3.0`, whose `utf8` coder is strict: `encode` runs
|
|
64
86
|
`TextDecoder('utf-8', { ignoreBOM: true, fatal: true })` and throws on invalid bytes instead of
|
|
65
87
|
substituting `U+FFFD`, and `decode` rejects non-well-formed strings. `decrypt` therefore wraps its
|
|
66
88
|
`utf8.encode` call and rethrows as `basic.keys:decrypt-not-utf8`. Use `dcrpt` when the plaintext is
|
|
@@ -72,7 +94,15 @@ In practice a wrong key fails earlier: xchacha20-poly1305 is authenticated, so i
|
|
|
72
94
|
Callers that tolerate undecryptable values must catch — e.g. `@owlmeans/mongo` and
|
|
73
95
|
`@owlmeans/postgres` use `key.decrypt(value).catch(() => value)` for their encrypted-field paths.
|
|
74
96
|
|
|
97
|
+
## Signed credentials
|
|
98
|
+
|
|
99
|
+
`packAuthCredentials` canonicalizes the unsigned credentials plus your extras, signs them, and
|
|
100
|
+
returns `AuthCredentials` whose `credential` holds the signature (alone, or folded into the extras).
|
|
101
|
+
`unpackAuthCredentials` reverses it and — given a verifier — reports `isValid`. Either side accepts
|
|
102
|
+
a `KeyPairModel` or a bare sign/verify function, so a caller that holds only a remote signer works
|
|
103
|
+
the same way.
|
|
104
|
+
|
|
75
105
|
## Depends On
|
|
76
106
|
|
|
77
|
-
- `@owlmeans/auth` —
|
|
78
|
-
- `@noble/curves`, `@noble/ciphers`, `@noble/hashes`, `@scure/base
|
|
107
|
+
- `@owlmeans/auth` — `AuthCredentials`, the shape the auth helpers pack and unpack
|
|
108
|
+
- `@noble/curves`, `@noble/ciphers`, `@noble/hashes`, `@scure/base`, `canonicalize`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owlmeans/basic-keys",
|
|
3
|
-
"version": "0.1.18-rc.
|
|
3
|
+
"version": "0.1.18-rc.20",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@owlmeans/dep-config": "workspace:*",
|
|
43
|
-
"@owlmeans/test-auth": "^0.1.18-rc.
|
|
44
|
-
"@types/bun": "^1.
|
|
43
|
+
"@owlmeans/test-auth": "^0.1.18-rc.21",
|
|
44
|
+
"@types/bun": "^1.4.0",
|
|
45
45
|
"nodemon": "^3.1.14",
|
|
46
46
|
"typescript": "^7.0.2"
|
|
47
47
|
},
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@noble/ciphers": "^1.2.1",
|
|
50
50
|
"@noble/curves": "^1.6.0",
|
|
51
51
|
"@noble/hashes": "^1.5.0",
|
|
52
|
-
"@owlmeans/auth": "^0.1.18-rc.
|
|
52
|
+
"@owlmeans/auth": "^0.1.18-rc.17",
|
|
53
53
|
"@scure/base": "^2.3.0",
|
|
54
54
|
"canonicalize": "^2.0.0"
|
|
55
55
|
},
|
package/build/.gitkeep
DELETED
|
File without changes
|