@jaypie/mcp 0.7.34 → 0.7.36

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.
@@ -9,7 +9,7 @@ import { gt } from 'semver';
9
9
  /**
10
10
  * Docs Suite - Documentation services (skill, version, release_notes)
11
11
  */
12
- const BUILD_VERSION_STRING = "@jaypie/mcp@0.7.34#4de9b6a9"
12
+ const BUILD_VERSION_STRING = "@jaypie/mcp@0.7.36#ab4034c8"
13
13
  ;
14
14
  const __filename$1 = fileURLToPath(import.meta.url);
15
15
  const __dirname$1 = path.dirname(__filename$1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jaypie/mcp",
3
- "version": "0.7.34",
3
+ "version": "0.7.36",
4
4
  "description": "Jaypie MCP",
5
5
  "repository": {
6
6
  "type": "git",
@@ -0,0 +1,11 @@
1
+ ---
2
+ version: 1.2.32
3
+ date: 2026-03-13
4
+ summary: Add removalPolicy option to JaypieEnvSecret
5
+ ---
6
+
7
+ ## Changes
8
+
9
+ - Added `removalPolicy` prop to `JaypieEnvSecret`
10
+ - Accepts `boolean` (`true` = RETAIN, `false` = DESTROY) or CDK `RemovalPolicy` enum
11
+ - Simplifies production retention: `removalPolicy: isProductionEnv()`
@@ -0,0 +1,9 @@
1
+ ---
2
+ version: 1.2.19
3
+ date: 2026-03-13
4
+ summary: Update kit dependency for flexible API key generation and validation
5
+ ---
6
+
7
+ ## Changes
8
+
9
+ - Updated `@jaypie/kit` to 1.2.3 with optional prefix/checksum in API key functions
@@ -0,0 +1,9 @@
1
+ ---
2
+ version: 1.2.20
3
+ date: 2026-03-13
4
+ summary: Bump for @jaypie/kit 1.2.4 (seed-based key generation)
5
+ ---
6
+
7
+ ## Changes
8
+
9
+ - Updated `@jaypie/kit` to 1.2.4 — `generateJaypieKey` now supports `seed` for deterministic key derivation
@@ -0,0 +1,13 @@
1
+ ---
2
+ version: 1.2.3
3
+ date: 2026-03-13
4
+ summary: Make API key prefix and checksum optional, accept both _ and - separators
5
+ ---
6
+
7
+ ## Changes
8
+
9
+ - `generateJaypieKey` now supports `prefix: ""` (omit prefix) and `checksum: 0` (omit checksum)
10
+ - `validateJaypieKey` no longer requires prefix or checksum — keys without them are valid
11
+ - Checksum separator is optional in validation — `body_checksum` and `bodychecksum` both validate
12
+ - Validator accepts both `_` and `-` as separators in prefix matter
13
+ - Changed example issuer from `jpi` to `jaypie` to encourage explicit naming
@@ -0,0 +1,12 @@
1
+ ---
2
+ version: 1.2.4
3
+ date: 2026-03-13
4
+ summary: Add seed parameter to generateJaypieKey for deterministic key derivation
5
+ ---
6
+
7
+ ## Changes
8
+
9
+ - Added `seed` option to `generateJaypieKey` for deterministic key derivation via HMAC-SHA256
10
+ - Uses the `issuer` (defaulting to `"jaypie"`) as the HMAC message
11
+ - Same seed + same issuer always produces the same key
12
+ - Useful for bootstrapping owner keys from a shared secret
@@ -0,0 +1,10 @@
1
+ ---
2
+ version: 0.7.35
3
+ date: 2026-03-13
4
+ summary: Add ~apikey skill for API key generation, validation, and hashing
5
+ ---
6
+
7
+ ## Changes
8
+
9
+ - Added `apikey` skill documenting `generateJaypieKey`, `validateJaypieKey`, and `hashJaypieKey`
10
+ - Updated development category and skill index to include `apikey`
@@ -0,0 +1,11 @@
1
+ ---
2
+ version: 0.7.36
3
+ date: 2026-03-13
4
+ summary: Update apikey skill with seed and removalPolicy documentation
5
+ ---
6
+
7
+ ## Changes
8
+
9
+ - Updated `~apikey` skill with seed-based key generation documentation
10
+ - Added `PROJECT_ADMIN_SEED` infrastructure example alongside `PROJECT_SALT`
11
+ - Documented `removalPolicy` boolean shorthand for `JaypieEnvSecret`
@@ -0,0 +1,9 @@
1
+ ---
2
+ version: 1.2.25
3
+ date: 2026-03-13
4
+ summary: Update generateJaypieKey mock to match new format with checksum separator
5
+ ---
6
+
7
+ ## Changes
8
+
9
+ - Updated `generateJaypieKey` mock return value to include separator before checksum (`sk_MOCK...000_abcd`)
package/skills/agents.md CHANGED
@@ -33,7 +33,7 @@ Complete stack styles, techniques, and traditions.
33
33
  `mcp__jaypie__skill(alias: String)`
34
34
 
35
35
  Contents: index, releasenotes
36
- Development: documentation, errors, llm, logs, mocks, monorepo, style, subpackages, tests
36
+ Development: apikey, documentation, errors, llm, logs, mocks, monorepo, style, subpackages, tests
37
37
  Infrastructure: aws, cdk, cicd, datadog, dns, dynamodb, express, lambda, secrets, streaming, variables, websockets
38
38
  Patterns: fabric, handlers, models, services, vocabulary
39
39
  Meta: issues, jaypie, skills, tools
@@ -0,0 +1,213 @@
1
+ ---
2
+ description: API key generation, validation, and hashing with Jaypie keys
3
+ related: secrets, style, tests
4
+ ---
5
+
6
+ # API Keys
7
+
8
+ Jaypie provides three functions for working with API keys: `generateJaypieKey`, `validateJaypieKey`, and `hashJaypieKey`. Available from `jaypie` or `@jaypie/kit`.
9
+
10
+ ## Generate
11
+
12
+ ```typescript
13
+ import { generateJaypieKey } from "jaypie";
14
+
15
+ const key = generateJaypieKey();
16
+ // "sk_A1b2C3d4E5f6G7h8I9j0K1l2M3n4O5p6_Xq7R"
17
+ // ^^ prefix ^^ 32-char base62 body ^^ 4-char checksum
18
+ ```
19
+
20
+ ### With Issuer
21
+
22
+ Use `issuer` to namespace keys by application or service. Prefer explicit naming:
23
+
24
+ ```typescript
25
+ const key = generateJaypieKey({ issuer: "jaypie" });
26
+ // "sk_jaypie_A1b2C3d4E5f6G7h8I9j0K1l2M3n4O5p6_Xq7R"
27
+ ```
28
+
29
+ ### Without Prefix or Checksum
30
+
31
+ Prefix and checksum are optional. Pass `prefix: ""` or `checksum: 0` to omit:
32
+
33
+ ```typescript
34
+ generateJaypieKey({ prefix: "" });
35
+ // "A1b2C3d4E5f6G7h8I9j0K1l2M3n4O5p6_Xq7R"
36
+
37
+ generateJaypieKey({ prefix: "", checksum: 0 });
38
+ // "A1b2C3d4E5f6G7h8I9j0K1l2M3n4O5p6"
39
+
40
+ generateJaypieKey({ prefix: "", issuer: "jaypie" });
41
+ // "jaypie_A1b2C3d4E5f6G7h8I9j0K1l2M3n4O5p6_Xq7R"
42
+ ```
43
+
44
+ ### With Seed
45
+
46
+ Pass `seed` to derive a deterministic key from a secret. Uses HMAC-SHA256 with the `issuer` (defaulting to `"jaypie"`) as the HMAC message:
47
+
48
+ ```typescript
49
+ const key = generateJaypieKey({ seed: process.env.PROJECT_ADMIN_SEED, issuer: "jaypie" });
50
+ // Same seed + same issuer = same key every time
51
+ ```
52
+
53
+ Different issuers produce different keys from the same seed:
54
+
55
+ ```typescript
56
+ generateJaypieKey({ seed: "my-seed", issuer: "alpha" });
57
+ generateJaypieKey({ seed: "my-seed", issuer: "beta" });
58
+ // Two different keys
59
+ ```
60
+
61
+ This is useful for bootstrapping an initial owner key from a shared secret without requiring database access.
62
+
63
+ ### Options
64
+
65
+ | Option | Default | Description |
66
+ |--------|---------|-------------|
67
+ | `checksum` | `4` | Checksum character count (0 to omit) |
68
+ | `issuer` | (none) | Namespace segment after prefix |
69
+ | `length` | `32` | Random body length |
70
+ | `pool` | base62 (`0-9A-Za-z`) | Character pool for body |
71
+ | `prefix` | `"sk"` | Key prefix (`""` to omit) |
72
+ | `seed` | (none) | Derive key deterministically via HMAC-SHA256 |
73
+ | `separator` | `"_"` | Delimiter between segments |
74
+
75
+ All options are optional. Zero-param call produces `sk_<32 base62>_<4 checksum>`.
76
+
77
+ ### Valid Formats
78
+
79
+ All of the following are valid key formats:
80
+
81
+ | Format | Example |
82
+ |--------|---------|
83
+ | `sk_issuer_body_checksum` | `sk_jaypie_A1b2...p6_Xq7R` |
84
+ | `sk_issuer_bodychecksum` | `sk_jaypie_A1b2...p6Xq7R` |
85
+ | `sk_body_checksum` | `sk_A1b2...p6_Xq7R` |
86
+ | `issuer_bodychecksum` | `jaypie_A1b2...p6Xq7R` |
87
+ | `body_checksum` | `A1b2...p6_Xq7R` |
88
+ | `body` | `A1b2...p6` |
89
+
90
+ Both `_` and `-` are accepted as separators in prefix matter.
91
+
92
+ ## Validate
93
+
94
+ Checks format, character pool, and checksum (when present). Prefix and checksum are **not required** — a key without them is still valid. Pass `issuer` when the key was generated with one:
95
+
96
+ ```typescript
97
+ import { validateJaypieKey } from "jaypie";
98
+
99
+ validateJaypieKey(key); // true
100
+ validateJaypieKey(key, { issuer: "jaypie" }); // true (if generated with issuer)
101
+ validateJaypieKey("tampered" + key); // false
102
+ validateJaypieKey(key, { issuer: "wrong" }); // false
103
+ ```
104
+
105
+ Keys without a prefix validate with default options:
106
+
107
+ ```typescript
108
+ const bare = generateJaypieKey({ prefix: "" });
109
+ validateJaypieKey(bare); // true — prefix is not required
110
+ ```
111
+
112
+ Keys without checksum validate with default options:
113
+
114
+ ```typescript
115
+ const noCheck = generateJaypieKey({ checksum: 0 });
116
+ validateJaypieKey(noCheck); // true — checksum is not required
117
+ ```
118
+
119
+ Checksum separator is also optional — `body_checksum` and `bodychecksum` both validate.
120
+
121
+ Validation does **not** check revocation or authorization — only structural validity.
122
+
123
+ ## Hash
124
+
125
+ Store hashed keys instead of plaintext. Uses HMAC-SHA256 when salted, SHA-256 otherwise:
126
+
127
+ ```typescript
128
+ import { hashJaypieKey } from "jaypie";
129
+
130
+ // With explicit salt
131
+ const hash = hashJaypieKey(key, { salt: "my-secret-salt" });
132
+
133
+ // Falls back to process.env.PROJECT_SALT
134
+ const hash = hashJaypieKey(key);
135
+ ```
136
+
137
+ Returns a 64-character hex string. Deterministic — same key and salt always produce the same hash.
138
+
139
+ ### Salt Resolution
140
+
141
+ 1. Explicit `{ salt }` parameter (highest priority)
142
+ 2. `process.env.PROJECT_SALT` environment variable
143
+ 3. No salt — plain SHA-256 (logs a warning)
144
+
145
+ ## Typical Workflow
146
+
147
+ 1. **Generate** a key and return it to the user (only time plaintext is visible)
148
+ 2. **Hash** the key and store the hash in the database
149
+ 3. On subsequent requests, **validate** the key format, then **hash** and compare against stored hash
150
+
151
+ ```typescript
152
+ import { generateJaypieKey, hashJaypieKey, validateJaypieKey } from "jaypie";
153
+
154
+ // Provisioning
155
+ const key = generateJaypieKey({ issuer: "jaypie" });
156
+ const hash = hashJaypieKey(key);
157
+ await db.storeApiKeyHash(userId, hash);
158
+ // Return key to user
159
+
160
+ // Authentication
161
+ function authenticate(presentedKey: string) {
162
+ if (!validateJaypieKey(presentedKey, { issuer: "jaypie" })) {
163
+ return false; // Malformed
164
+ }
165
+ const hash = hashJaypieKey(presentedKey);
166
+ return db.findByApiKeyHash(hash);
167
+ }
168
+ ```
169
+
170
+ ## Testing
171
+
172
+ Mocked in `@jaypie/testkit`:
173
+
174
+ ```typescript
175
+ import { generateJaypieKey, hashJaypieKey, validateJaypieKey } from "@jaypie/testkit/mock";
176
+ ```
177
+
178
+ - `generateJaypieKey` returns `"sk_MOCK00000000000000000000000000_abcd"`
179
+ - `hashJaypieKey` returns `"0".repeat(64)` (64 zeroes)
180
+ - `validateJaypieKey` returns `true`
181
+
182
+ ## Infrastructure
183
+
184
+ Use with the generated secrets pattern for `PROJECT_SALT` and `PROJECT_ADMIN_SEED`:
185
+
186
+ ```typescript
187
+ import { isProductionEnv } from "@jaypie/kit";
188
+
189
+ // PROJECT_SALT — used by hashJaypieKey to HMAC hash keys for storage.
190
+ // If this value is lost, all stored key hashes become unverifiable.
191
+ new JaypieEnvSecret(this, "ProjectSalt", {
192
+ envKey: "PROJECT_SALT",
193
+ generateSecretString: {
194
+ excludePunctuation: true,
195
+ includeSpace: false,
196
+ passwordLength: 64,
197
+ },
198
+ // Preserve this value if production stack is deleted
199
+ removalPolicy: isProductionEnv(),
200
+ });
201
+
202
+ // PROJECT_ADMIN_SEED — used by generateJaypieKey({ seed }) to derive the bootstrap owner key.
203
+ new JaypieEnvSecret(this, "ProjectAdminSeed", {
204
+ envKey: "PROJECT_ADMIN_SEED",
205
+ generateSecretString: {
206
+ excludePunctuation: true,
207
+ includeSpace: false,
208
+ passwordLength: 64,
209
+ },
210
+ });
211
+ ```
212
+
213
+ See `~secrets` for the full secrets management pattern.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: Coding standards, testing, and documentation
3
- related: documentation, errors, logs, mocks, monorepo, style, subpackage, tests
3
+ related: apikey, documentation, errors, logs, mocks, monorepo, style, subpackage, tests
4
4
  ---
5
5
 
6
6
  # Development
@@ -11,6 +11,7 @@ Coding standards and practices for Jaypie projects.
11
11
 
12
12
  | Alias | Description |
13
13
  |-------|-------------|
14
+ | `apikey` | API key generation, validation, and hashing |
14
15
  | `documentation` | Writing style and documentation |
15
16
  | `errors` | Error handling with @jaypie/errors |
16
17
  | `logs` | Logging patterns and conventions |
package/skills/skills.md CHANGED
@@ -16,7 +16,7 @@ Look up skills by alias: `mcp__jaypie__skill(alias)`
16
16
  | Category | Skills |
17
17
  |----------|--------|
18
18
  | contents | index, releasenotes |
19
- | development | documentation, errors, llm, logs, mocks, monorepo, style, subpackages, tests |
19
+ | development | apikey, documentation, errors, llm, logs, mocks, monorepo, style, subpackages, tests |
20
20
  | infrastructure | aws, cdk, cicd, datadog, dns, dynamodb, express, lambda, secrets, streaming, variables, websockets |
21
21
  | patterns | fabric, handlers, models, services, vocabulary |
22
22
  | meta | issues, jaypie, skills, tools |