@jaypie/mcp 0.7.34 → 0.7.35

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.35#689b7398"
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.35",
4
4
  "description": "Jaypie MCP",
5
5
  "repository": {
6
6
  "type": "git",
@@ -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,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,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,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,178 @@
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
+ ### Options
45
+
46
+ | Option | Default | Description |
47
+ |--------|---------|-------------|
48
+ | `checksum` | `4` | Checksum character count (0 to omit) |
49
+ | `issuer` | (none) | Namespace segment after prefix |
50
+ | `length` | `32` | Random body length |
51
+ | `pool` | base62 (`0-9A-Za-z`) | Character pool for body |
52
+ | `prefix` | `"sk"` | Key prefix (`""` to omit) |
53
+ | `separator` | `"_"` | Delimiter between segments |
54
+
55
+ All options are optional. Zero-param call produces `sk_<32 base62>_<4 checksum>`.
56
+
57
+ ### Valid Formats
58
+
59
+ All of the following are valid key formats:
60
+
61
+ | Format | Example |
62
+ |--------|---------|
63
+ | `sk_issuer_body_checksum` | `sk_jaypie_A1b2...p6_Xq7R` |
64
+ | `sk_issuer_bodychecksum` | `sk_jaypie_A1b2...p6Xq7R` |
65
+ | `sk_body_checksum` | `sk_A1b2...p6_Xq7R` |
66
+ | `issuer_bodychecksum` | `jaypie_A1b2...p6Xq7R` |
67
+ | `body_checksum` | `A1b2...p6_Xq7R` |
68
+ | `body` | `A1b2...p6` |
69
+
70
+ Both `_` and `-` are accepted as separators in prefix matter.
71
+
72
+ ## Validate
73
+
74
+ 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:
75
+
76
+ ```typescript
77
+ import { validateJaypieKey } from "jaypie";
78
+
79
+ validateJaypieKey(key); // true
80
+ validateJaypieKey(key, { issuer: "jaypie" }); // true (if generated with issuer)
81
+ validateJaypieKey("tampered" + key); // false
82
+ validateJaypieKey(key, { issuer: "wrong" }); // false
83
+ ```
84
+
85
+ Keys without a prefix validate with default options:
86
+
87
+ ```typescript
88
+ const bare = generateJaypieKey({ prefix: "" });
89
+ validateJaypieKey(bare); // true — prefix is not required
90
+ ```
91
+
92
+ Keys without checksum validate with default options:
93
+
94
+ ```typescript
95
+ const noCheck = generateJaypieKey({ checksum: 0 });
96
+ validateJaypieKey(noCheck); // true — checksum is not required
97
+ ```
98
+
99
+ Checksum separator is also optional — `body_checksum` and `bodychecksum` both validate.
100
+
101
+ Validation does **not** check revocation or authorization — only structural validity.
102
+
103
+ ## Hash
104
+
105
+ Store hashed keys instead of plaintext. Uses HMAC-SHA256 when salted, SHA-256 otherwise:
106
+
107
+ ```typescript
108
+ import { hashJaypieKey } from "jaypie";
109
+
110
+ // With explicit salt
111
+ const hash = hashJaypieKey(key, { salt: "my-secret-salt" });
112
+
113
+ // Falls back to process.env.PROJECT_SALT
114
+ const hash = hashJaypieKey(key);
115
+ ```
116
+
117
+ Returns a 64-character hex string. Deterministic — same key and salt always produce the same hash.
118
+
119
+ ### Salt Resolution
120
+
121
+ 1. Explicit `{ salt }` parameter (highest priority)
122
+ 2. `process.env.PROJECT_SALT` environment variable
123
+ 3. No salt — plain SHA-256 (logs a warning)
124
+
125
+ ## Typical Workflow
126
+
127
+ 1. **Generate** a key and return it to the user (only time plaintext is visible)
128
+ 2. **Hash** the key and store the hash in the database
129
+ 3. On subsequent requests, **validate** the key format, then **hash** and compare against stored hash
130
+
131
+ ```typescript
132
+ import { generateJaypieKey, hashJaypieKey, validateJaypieKey } from "jaypie";
133
+
134
+ // Provisioning
135
+ const key = generateJaypieKey({ issuer: "jaypie" });
136
+ const hash = hashJaypieKey(key);
137
+ await db.storeApiKeyHash(userId, hash);
138
+ // Return key to user
139
+
140
+ // Authentication
141
+ function authenticate(presentedKey: string) {
142
+ if (!validateJaypieKey(presentedKey, { issuer: "jaypie" })) {
143
+ return false; // Malformed
144
+ }
145
+ const hash = hashJaypieKey(presentedKey);
146
+ return db.findByApiKeyHash(hash);
147
+ }
148
+ ```
149
+
150
+ ## Testing
151
+
152
+ Mocked in `@jaypie/testkit`:
153
+
154
+ ```typescript
155
+ import { generateJaypieKey, hashJaypieKey, validateJaypieKey } from "@jaypie/testkit/mock";
156
+ ```
157
+
158
+ - `generateJaypieKey` returns `"sk_MOCK00000000000000000000000000_abcd"`
159
+ - `hashJaypieKey` returns `"0".repeat(64)` (64 zeroes)
160
+ - `validateJaypieKey` returns `true`
161
+
162
+ ## Infrastructure
163
+
164
+ Use with the generated secrets pattern for `PROJECT_SALT`:
165
+
166
+ ```typescript
167
+ // CDK
168
+ new JaypieEnvSecret(this, "ProjectSalt", {
169
+ envKey: "PROJECT_SALT",
170
+ generateSecretString: {
171
+ excludePunctuation: true,
172
+ includeSpace: false,
173
+ passwordLength: 64,
174
+ },
175
+ });
176
+ ```
177
+
178
+ 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 |